aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/utils/menu-handler.ts
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-07-29 16:13:45 +0300
committerMichael Lando <ml636r@att.com>2018-07-29 16:20:34 +0300
commit5b593496b8f1b8e8be8d7d2dbcc223332e65a49b (patch)
tree2f9dfc45191e723da69cf74be7829784e9741b94 /catalog-ui/src/app/utils/menu-handler.ts
parent9200382f2ce7b4bb729aa287d0878004b2d2b4f9 (diff)
re base code
Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5 Issue-ID: SDC-1566 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/src/app/utils/menu-handler.ts')
-rw-r--r--catalog-ui/src/app/utils/menu-handler.ts23
1 files changed, 21 insertions, 2 deletions
diff --git a/catalog-ui/src/app/utils/menu-handler.ts b/catalog-ui/src/app/utils/menu-handler.ts
index fc6eb2081a..4c25a025da 100644
--- a/catalog-ui/src/app/utils/menu-handler.ts
+++ b/catalog-ui/src/app/utils/menu-handler.ts
@@ -65,7 +65,10 @@ export class MenuItemGroup {
}
public updateSelectedMenuItemText(newText:string) {
- this.menuItems[this.selectedIndex].text = newText;
+ const selectedMenuItem = this.menuItems[this.selectedIndex];
+ if (selectedMenuItem) {
+ this.menuItems[this.selectedIndex].text = newText;
+ }
}
}
@@ -112,7 +115,7 @@ export class MenuHandler {
// If not found search by name (name is unique).
if (selectedItemIdx === -1) {
selectedItemIdx = _.findIndex(components, (item:Component) => {
- return item.name === selected.name;
+ return item.name === selected.name && item.componentType === selected.componentType;
});
}
@@ -144,6 +147,22 @@ export class MenuHandler {
// menuItem.text = component.name;
result.menuItems.push(menuItem);
});
+
+ result.selectedIndex = this.findBreadcrumbComponentIndex(components, selected);
+
+ // if component does not exist, then add a temporary menu item for the current component
+ if (result.selectedIndex === -1) {
+ let menuItem = new MenuItem(
+ // component.name,
+ selected.getComponentSubType() + ': ' + this.$filter('resourceName')(selected.name),
+ clickItemCallback,
+ null,
+ null,
+ [selected]
+ );
+ result.menuItems.unshift(menuItem);
+ result.selectedIndex = 0;
+ }
}
return result;
};