From a9803eafa0afb76c0941e301798ceed98e0ed086 Mon Sep 17 00:00:00 2001 From: Idan Amit Date: Thu, 20 Sep 2018 10:00:37 +0300 Subject: Fix wrong selected tab in top-nav Fixed a bug with wrong selected tabs in the top-nav Change-Id: I0a4fdb2d62154207b60fee641bf28b7f971d2456 Issue-ID: SDC-1583 Signed-off-by: Idan Amit --- .../src/app/ng2/components/layout/top-nav/top-nav.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts b/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts index 881a91613d..a253b3a933 100644 --- a/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts +++ b/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts @@ -50,6 +50,7 @@ export class TopNavComponent { public topLvlMenu:MenuItemGroup; public user:IUserProperties; + private topNavPlugins: Array; constructor(private translateService:TranslateService, @Inject('$state') private $state:ng.ui.IStateService, @@ -69,7 +70,7 @@ export class TopNavComponent { this.topLvlMenu.menuItems.every((item:MenuItem, index:number)=> { if (item.state === this.$state.current.name) { if (this.$state.current.name === 'plugins') { - const pluginIdx = _.findIndex(PluginsConfiguration.plugins, (plugin: Plugin) => plugin.pluginStateUrl === this.$state.params.path); + const pluginIdx = _.findIndex(this.topNavPlugins, (plugin: Plugin) => plugin.pluginStateUrl === this.$state.params.path); if (pluginIdx !== -1) { result = index + pluginIdx; return false; @@ -112,6 +113,9 @@ export class TopNavComponent { ngOnInit() { console.log('Nav is init!', this.menuModel); this.user = this.userService.getLoggedinUser(); + this.topNavPlugins = _.filter(PluginsConfiguration.plugins, (plugin: Plugin) => { + return plugin.pluginDisplayOptions["tab"] !== undefined; + }); this.translateService.languageChangedObservable.subscribe((lang) => { let tmpArray: Array = [ -- cgit 1.2.3-korg