diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts index da5aedf53b..c2eff33a11 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts @@ -58,21 +58,6 @@ const routes: Routes = [ entitiesTableConfig: EdgesTableConfigResolver } }, - { - path: ':edgeId/ruleChains', - component: EntitiesTableComponent, - data: { - auth: [Authority.TENANT_ADMIN], - ruleChainsType: 'edge', - breadcrumb: { - label: 'edge.edge-rulechains', - icon: 'settings_ethernet' - }, - }, - resolve: { - entitiesTableConfig: RuleChainsTableConfigResolver - } - }, { path: ':edgeId/assets', component: EntitiesTableComponent, @@ -156,6 +141,50 @@ const routes: Routes = [ } ] }, + { + path: ':edgeId/ruleChains', + data: { + breadcrumb: { + label: 'edge.edge-rulechains', + icon: 'settings_ethernet' + } + }, + children: [ + { + path: '', + component: EntitiesTableComponent, + data: { + auth: [Authority.TENANT_ADMIN], + title: 'edge.rulechains', + ruleChainsType: 'edge' + }, + resolve: { + entitiesTableConfig: RuleChainsTableConfigResolver + } + }, + { + path: ':ruleChainId', + component: RuleChainPageComponent, + canDeactivate: [ConfirmOnExitGuard], + data: { + breadcrumb: { + labelFunction: ruleChainBreadcumbLabelFunction, + icon: 'settings_ethernet' + } as BreadCrumbConfig, + auth: [Authority.TENANT_ADMIN], + title: 'rulechain.edge-rulechain', + import: false, + ruleChainType: RuleChainType.EDGE + }, + resolve: { + ruleChain: RuleChainResolver, + ruleChainMetaData: ResolvedRuleChainMetaDataResolver, + ruleNodeComponents: RuleNodeComponentsResolver, + tooltipster: TooltipsterResolver + } + } + ] + }, { path: 'ruleChains', data: { diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html index 5eda2edf34..66d5d6d74c 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html @@ -19,19 +19,19 @@ -
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts index 2b9572b7fa..b27fc2e997 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts @@ -211,53 +211,51 @@ export class RuleChainsTableConfigResolver implements Resolve> { const actions: Array> = []; - if (ruleChainScope === 'tenant' || ruleChainScope === 'edges') { + actions.push( + { + name: this.translate.instant('rulechain.open-rulechain'), + icon: 'settings_ethernet', + isEnabled: () => true, + onAction: ($event, entity) => this.openRuleChain($event, entity) + }, + { + name: this.translate.instant('rulechain.export'), + icon: 'file_download', + isEnabled: () => true, + onAction: ($event, entity) => this.exportRuleChain($event, entity) + } + ); + if (ruleChainScope === 'tenant') { actions.push( { - name: this.translate.instant('rulechain.open-rulechain'), - icon: 'settings_ethernet', - isEnabled: () => true, - onAction: ($event, entity) => this.openRuleChain($event, entity) + name: this.translate.instant('rulechain.set-root'), + icon: 'flag', + isEnabled: (entity) => this.isNonRootRuleChain(entity), + onAction: ($event, entity) => this.setRootRuleChain($event, entity) + } + ); + } + if (ruleChainScope === 'edges') { + actions.push( + { + name: this.translate.instant('rulechain.set-edge-template-root-rulechain'), + icon: 'flag', + isEnabled: (entity) => this.isNonRootRuleChain(entity), + onAction: ($event, entity) => this.setEdgeTemplateRootRuleChain($event, entity) }, { - name: this.translate.instant('rulechain.export'), - icon: 'file_download', - isEnabled: () => true, - onAction: ($event, entity) => this.exportRuleChain($event, entity) + name: this.translate.instant('rulechain.set-auto-assign-to-edge'), + icon: 'bookmark_outline', + isEnabled: (entity) => this.isNotAutoAssignToEdgeRuleChain(entity), + onAction: ($event, entity) => this.setAutoAssignToEdgeRuleChain($event, entity) + }, + { + name: this.translate.instant('rulechain.unset-auto-assign-to-edge'), + icon: 'bookmark', + isEnabled: (entity) => this.isAutoAssignToEdgeRuleChain(entity), + onAction: ($event, entity) => this.unsetAutoAssignToEdgeRuleChain($event, entity) } ); - if (ruleChainScope === 'tenant') { - actions.push( - { - name: this.translate.instant('rulechain.set-root'), - icon: 'flag', - isEnabled: (entity) => this.isNonRootRuleChain(entity), - onAction: ($event, entity) => this.setRootRuleChain($event, entity) - } - ); - } - if (ruleChainScope === 'edges') { - actions.push( - { - name: this.translate.instant('rulechain.set-edge-template-root-rulechain'), - icon: 'flag', - isEnabled: (entity) => this.isNonRootRuleChain(entity), - onAction: ($event, entity) => this.setEdgeTemplateRootRuleChain($event, entity) - }, - { - name: this.translate.instant('rulechain.set-auto-assign-to-edge'), - icon: 'bookmark_outline', - isEnabled: (entity) => this.isNotAutoAssignToEdgeRuleChain(entity), - onAction: ($event, entity) => this.setAutoAssignToEdgeRuleChain($event, entity) - }, - { - name: this.translate.instant('rulechain.unset-auto-assign-to-edge'), - icon: 'bookmark', - isEnabled: (entity) => this.isAutoAssignToEdgeRuleChain(entity), - onAction: ($event, entity) => this.unsetAutoAssignToEdgeRuleChain($event, entity) - } - ); - } } if (ruleChainScope === 'edge') { actions.push( @@ -301,6 +299,8 @@ export class RuleChainsTableConfigResolver implements Resolve