Skip to content

Commit

Permalink
Make Edge menu great again
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-babak committed Sep 19, 2024
1 parent fca4678 commit 5f2ed2b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
55 changes: 54 additions & 1 deletion ui-ngx/src/app/core/services/menu.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export enum MenuId {
features = 'features',
otaUpdates = 'otaUpdates',
version_control = 'version_control',
api_usage = 'api_usage'
api_usage = 'api_usage',
edge = 'edge',
edge_status = 'edge_status',
cloud_events = 'cloud_events',
}

declare type MenuFilter = (authState: AuthState) => boolean;
Expand Down Expand Up @@ -640,6 +643,36 @@ export const menuSectionMap = new Map<MenuId, MenuSection>([
path: '/usage',
icon: 'insert_chart'
}
],
[
MenuId.edge,
{
id: MenuId.edge,
name: 'edge.edge',
type: 'toggle',
path: '/edge',
icon: 'router'
}
],
[
MenuId.edge_status,
{
id: MenuId.edge_status,
name: 'edge.status',
type: 'link',
path: '/edge/status',
icon: 'info'
}
],
[
MenuId.cloud_events,
{
id: MenuId.cloud_events,
name: 'edge.cloud-events',
type: 'link',
path: '/edge/cloudEvents',
icon: 'date_range'
}
]
]);

Expand All @@ -652,6 +685,19 @@ const menuFilters = new Map<MenuId, MenuFilter>([
],
[
MenuId.rulechain_templates, (authState) => authState.edgesSupportEnabled
],
// merge comment: sections below should not be visible on edge
[
MenuId.version_control, () => false
],
[
MenuId.repository_settings, () => false
],
[
MenuId.auto_commit_settings, () => false
],
[
MenuId.edge_instances, () => false
]
]);

Expand Down Expand Up @@ -718,6 +764,13 @@ const defaultUserMenuMap = new Map<Authority, MenuReference[]>([
Authority.TENANT_ADMIN,
[
{id: MenuId.home},
{
id: MenuId.edge,
pages: [
{id: MenuId.edge_status},
{id: MenuId.cloud_events}
]
},
{id: MenuId.alarms},
{id: MenuId.dashboards},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetr
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { AttributeService } from '@core/http/attribute.service';
import { MenuId } from '@core/services/menu.models';

@Injectable()
export class EdgeAttributesResolver implements Resolve<Array<AttributeData>> {
Expand Down Expand Up @@ -55,8 +56,7 @@ const routes: Routes = [
auth: [Authority.TENANT_ADMIN],
title: 'edge.edge',
breadcrumb: {
label: 'edge.edge',
icon: 'router'
menuId: MenuId.edge
}
},
children: [
Expand All @@ -75,8 +75,7 @@ const routes: Routes = [
auth: [Authority.TENANT_ADMIN],
title: 'edge.status',
breadcrumb: {
label: 'edge.status',
icon: 'info'
menuId: MenuId.edge_status
}
},
resolve: {
Expand All @@ -90,8 +89,7 @@ const routes: Routes = [
auth: [Authority.TENANT_ADMIN],
title: 'edge.cloud-events',
breadcrumb: {
label: 'edge.cloud-events',
icon: 'date_range'
menuId: MenuId.cloud_events
}
}
}
Expand Down

0 comments on commit 5f2ed2b

Please sign in to comment.