From 540df6c6a84f134aad1377a6ae750dbaf2ef06aa Mon Sep 17 00:00:00 2001 From: Braun Patrik Date: Mon, 16 May 2016 19:36:04 +0200 Subject: [PATCH] disabling search at photos --- backend/middlewares/GalleryMWs.ts | 1 - backend/routes/GalleryRouter.ts | 8 ++++---- frontend/app/gallery/gallery.service.ts | 4 ++-- .../grid/photo/photo.grid.gallery.component.html | 15 ++++++++++----- .../grid/photo/photo.grid.gallery.component.ts | 3 +++ .../app/gallery/search/autocomplete.service.ts | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/backend/middlewares/GalleryMWs.ts b/backend/middlewares/GalleryMWs.ts index ad4ee213..cf91c504 100644 --- a/backend/middlewares/GalleryMWs.ts +++ b/backend/middlewares/GalleryMWs.ts @@ -72,7 +72,6 @@ export class GalleryMWs { } let type:SearchTypes; - console.log() if (req.query.type) { type = parseInt(req.query.type); } diff --git a/backend/routes/GalleryRouter.ts b/backend/routes/GalleryRouter.ts index 5aa578d6..97f09042 100644 --- a/backend/routes/GalleryRouter.ts +++ b/backend/routes/GalleryRouter.ts @@ -44,15 +44,15 @@ export class GalleryRouter { }; private addSearch() { - this.app.get("/api/gallery/search/:text", - // AuthenticationMWs.authenticate, + this.app.get("/api/search/:text", + AuthenticationMWs.authenticate, GalleryMWs.search, RenderingMWs.renderResult ); }; private addInstantSearch() { - this.app.get("/api/gallery/instant-search/:text", + this.app.get("/api/instant-search/:text", AuthenticationMWs.authenticate, GalleryMWs.instantSearch, RenderingMWs.renderResult @@ -60,7 +60,7 @@ export class GalleryRouter { }; private addAutoComplete() { - this.app.get("/api/gallery/autocomplete/:text", + this.app.get("/api/autocomplete/:text", AuthenticationMWs.authenticate, GalleryMWs.autocomplete, RenderingMWs.renderResult diff --git a/frontend/app/gallery/gallery.service.ts b/frontend/app/gallery/gallery.service.ts index 7c546b6a..c6bf4747 100644 --- a/frontend/app/gallery/gallery.service.ts +++ b/frontend/app/gallery/gallery.service.ts @@ -40,7 +40,7 @@ export class GalleryService { return Promise.resolve(new Message(null, null)); } - let queryString = "/gallery/search/" + text; + let queryString = "/search/" + text; if (type) { queryString += "?type=" + type; } @@ -72,7 +72,7 @@ export class GalleryService { this.searchId = null; }, 3000); //TODO: set timeout to config - return this._networkService.getJson("/gallery/instant-search/" + text).then( + return this._networkService.getJson("/instant-search/" + text).then( (message:Message) => { if (!message.error && message.result) { this.content = message.result; diff --git a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html index 570120f1..b65f5f0e 100644 --- a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html +++ b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html @@ -5,16 +5,21 @@
diff --git a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts index 53b8e428..ea3c77d2 100644 --- a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts +++ b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.ts @@ -5,6 +5,7 @@ import {IRenderable, Dimension} from "../../../model/IRenderable"; import {GridPhoto} from "../GridPhoto"; import {SearchTypes} from "../../../../../common/entities/AutoCompleteItem"; import {RouterLink} from "@angular/router-deprecated"; +import {Config} from "../../../config/Config"; @Component({ selector: 'gallery-grid-photo', @@ -22,9 +23,11 @@ export class GalleryPhotoComponent implements IRenderable { background: "" }; SearchTypes:any = []; + searchEnabled:boolean = true; constructor() { this.SearchTypes = SearchTypes; + this.searchEnabled = Config.Client.Search.searchEnabled; } getPositionText():string { diff --git a/frontend/app/gallery/search/autocomplete.service.ts b/frontend/app/gallery/search/autocomplete.service.ts index 0ba34b7d..b2ce3300 100644 --- a/frontend/app/gallery/search/autocomplete.service.ts +++ b/frontend/app/gallery/search/autocomplete.service.ts @@ -13,7 +13,7 @@ export class AutoCompleteService { } public autoComplete(text:string):Promise >> { - return this._networkService.getJson("/gallery/autocomplete/" + text); + return this._networkService.getJson("/autocomplete/" + text); }