From: Idan Amit Date: Thu, 20 Sep 2018 07:00:37 +0000 (+0300) Subject: Fix wrong selected tab in top-nav X-Git-Tag: 1.3.0~100 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=a9803eafa0afb76c0941e301798ceed98e0ed086;p=sdc.git 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 --- 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 = [