UI: Breadcrumb improvements.
This commit is contained in:
parent
72134abbf9
commit
bf0d468510
@ -92,6 +92,7 @@ export enum MenuId {
|
|||||||
rule_chains = 'rule_chains',
|
rule_chains = 'rule_chains',
|
||||||
edge_management = 'edge_management',
|
edge_management = 'edge_management',
|
||||||
edges = 'edges',
|
edges = 'edges',
|
||||||
|
edge_instances = 'edge_instances',
|
||||||
rulechain_templates = 'rulechain_templates',
|
rulechain_templates = 'rulechain_templates',
|
||||||
features = 'features',
|
features = 'features',
|
||||||
otaUpdates = 'otaUpdates',
|
otaUpdates = 'otaUpdates',
|
||||||
@ -101,7 +102,7 @@ export enum MenuId {
|
|||||||
|
|
||||||
declare type MenuFilter = (authState: AuthState) => boolean;
|
declare type MenuFilter = (authState: AuthState) => boolean;
|
||||||
|
|
||||||
const menuSectionMap = new Map<MenuId, MenuSection>([
|
export const menuSectionMap = new Map<MenuId, MenuSection>([
|
||||||
[
|
[
|
||||||
MenuId.home,
|
MenuId.home,
|
||||||
{
|
{
|
||||||
@ -545,6 +546,17 @@ const menuSectionMap = new Map<MenuId, MenuSection>([
|
|||||||
icon: 'router'
|
icon: 'router'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
MenuId.edge_instances,
|
||||||
|
{
|
||||||
|
id: MenuId.edge_instances,
|
||||||
|
name: 'edge.edge-instances',
|
||||||
|
fullName: 'edge.edge-instances',
|
||||||
|
type: 'link',
|
||||||
|
path: '/edgeManagement/instances',
|
||||||
|
icon: 'router'
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
MenuId.rulechain_templates,
|
MenuId.rulechain_templates,
|
||||||
{
|
{
|
||||||
@ -756,7 +768,7 @@ const defaultUserMenuMap = new Map<Authority, MenuReference[]>([
|
|||||||
{id: MenuId.entity_views}
|
{id: MenuId.entity_views}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{id: MenuId.edges},
|
{id: MenuId.edge_instances},
|
||||||
{
|
{
|
||||||
id: MenuId.notifications_center,
|
id: MenuId.notifications_center,
|
||||||
pages: [
|
pages: [
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import { guid } from '@core/utils';
|
|||||||
import { BroadcastService } from '@core/services/broadcast.service';
|
import { BroadcastService } from '@core/services/broadcast.service';
|
||||||
import { ActiveComponentService } from '@core/services/active-component.service';
|
import { ActiveComponentService } from '@core/services/active-component.service';
|
||||||
import { UtilsService } from '@core/services/utils.service';
|
import { UtilsService } from '@core/services/utils.service';
|
||||||
import { MenuSection } from '@core/services/menu.models';
|
import { MenuSection, menuSectionMap } from '@core/services/menu.models';
|
||||||
import { MenuService } from '@core/services/menu.service';
|
import { MenuService } from '@core/services/menu.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -113,8 +113,13 @@ export class BreadcrumbComponent implements OnInit, OnDestroy {
|
|||||||
const breadcrumbConfig = route.routeConfig.data.breadcrumb as BreadCrumbConfig<any>;
|
const breadcrumbConfig = route.routeConfig.data.breadcrumb as BreadCrumbConfig<any>;
|
||||||
if (breadcrumbConfig && !breadcrumbConfig.skip) {
|
if (breadcrumbConfig && !breadcrumbConfig.skip) {
|
||||||
let labelFunction: () => string;
|
let labelFunction: () => string;
|
||||||
const section: MenuSection = breadcrumbConfig.menuId ?
|
let section: MenuSection = null;
|
||||||
availableMenuSections.find(menu => menu.id === breadcrumbConfig.menuId) : null;
|
if (breadcrumbConfig.menuId) {
|
||||||
|
section = availableMenuSections.find(menu => menu.id === breadcrumbConfig.menuId);
|
||||||
|
if (!section) {
|
||||||
|
section = menuSectionMap.get(breadcrumbConfig.menuId);
|
||||||
|
}
|
||||||
|
}
|
||||||
const label = section?.name || breadcrumbConfig.label || 'home.home';
|
const label = section?.name || breadcrumbConfig.label || 'home.home';
|
||||||
const customTranslate = section?.customTranslate || false;
|
const customTranslate = section?.customTranslate || false;
|
||||||
if (breadcrumbConfig.labelFunction) {
|
if (breadcrumbConfig.labelFunction) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user