Browse Source

Moved edge rule chains and edges to edge management page

pull/3811/head
Volodymyr Babak 6 years ago
parent
commit
b63087d53f
  1. 52
      ui-ngx/src/app/core/services/menu.service.ts
  2. 71
      ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts
  3. 12
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts
  4. 144
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts
  5. 2
      ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts

52
ui-ngx/src/app/core/services/menu.service.ts

@ -228,26 +228,9 @@ export class MenuService {
{
id: guid(),
name: 'rulechain.rulechains',
type: 'toggle',
type: 'link',
path: '/ruleChains',
height: '80px',
icon: 'settings_ethernet',
pages: [
{
id: guid(),
name: 'rulechain.core-rulechains',
type: 'link',
path: '/ruleChains/core',
icon: 'settings_ethernet'
},
{
id: guid(),
name: 'rulechain.edge-rulechains',
type: 'link',
path: '/ruleChains/edge',
icon: 'router'
}
]
},
{
id: guid(),
@ -287,10 +270,27 @@ export class MenuService {
},
{
id: guid(),
name: 'edge.edges',
type: 'link',
name: 'edge.management',
type: 'toggle',
path: '/edges',
icon: 'router'
height: '80px',
icon: 'router',
pages: [
{
id: guid(),
name: 'edge.edges',
type: 'link',
path: '/edges',
icon: 'router'
},
{
id: guid(),
name: 'rulechain.edge-rulechains',
type: 'link',
path: '/edges/ruleChains',
icon: 'settings_ethernet'
}
]
},
{
id: guid(),
@ -335,11 +335,6 @@ export class MenuService {
name: 'rulechain.rulechains',
icon: 'settings_ethernet',
path: '/ruleChains'
},
{
name: 'rulechain.edge-rulechains',
icon: 'router',
path: '/edgesRuleChains'
}
]
},
@ -396,6 +391,11 @@ export class MenuService {
name: 'edge.edges',
icon: 'router',
path: '/edges'
},
{
name: 'rulechain.edge-rulechains',
icon: 'settings_ethernet',
path: '/edges/ruleChains'
}
]
},

71
ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts

@ -27,6 +27,15 @@ import { RuleChainsTableConfigResolver } from "@home/pages/rulechain/rulechains-
import { DashboardPageComponent } from "@home/pages/dashboard/dashboard-page.component";
import { dashboardBreadcumbLabelFunction, DashboardResolver } from "@home/pages/dashboard/dashboard-routing.module";
import { BreadCrumbConfig } from "@shared/components/breadcrumb";
import {RuleChainPageComponent} from "@home/pages/rulechain/rulechain-page.component";
import {ConfirmOnExitGuard} from "@core/guards/confirm-on-exit.guard";
import {ruleChainType} from "@shared/models/rule-chain.models";
import {
importRuleChainBreadcumbLabelFunction,
ResolvedRuleChainMetaDataResolver,
ruleChainBreadcumbLabelFunction, RuleChainImportGuard,
RuleChainResolver, RuleNodeComponentsResolver
} from "@home/pages/rulechain/rulechain-routing.module";
const routes: Routes = [
{
@ -147,6 +156,68 @@ const routes: Routes = [
}
]
},
{
path: 'ruleChains',
data: {
breadcrumb: {
label: 'rulechain.edge-rulechains',
icon: 'settings_ethernet'
}
},
children: [
{
path: '',
component: EntitiesTableComponent,
data: {
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechains',
ruleChainsType: 'edges'
},
resolve: {
entitiesTableConfig: RuleChainsTableConfigResolver
}
},
{
path: ':ruleChainId',
component: RuleChainPageComponent,
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
labelFunction: ruleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechain',
import: false,
ruleChainType: ruleChainType.edge
},
resolve: {
ruleChain: RuleChainResolver,
ruleChainMetaData: ResolvedRuleChainMetaDataResolver,
ruleNodeComponents: RuleNodeComponentsResolver
}
},
{
path: 'ruleChain/import',
component: RuleChainPageComponent,
canActivate: [RuleChainImportGuard],
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
labelFunction: importRuleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechain',
import: true,
ruleChainType: ruleChainType.edge
},
resolve: {
ruleNodeComponents: RuleNodeComponentsResolver
}
}
]
}
]
}]

12
ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts

@ -48,7 +48,8 @@ import {
RuleChainConnectionInfo,
RuleChainImport,
RuleChainMetaData,
ruleChainNodeComponent
ruleChainNodeComponent,
ruleChainType
} from '@shared/models/rule-chain.models';
import { FcItemInfo, FlowchartConstants, NgxFlowchartComponent, UserCallbacks } from 'ngx-flowchart/dist/ngx-flowchart';
import {
@ -119,6 +120,8 @@ export class RuleChainPageComponent extends PageComponent
isDirtyValue: boolean;
isInvalid = false;
ruleChainType: string;
errorTooltips: {[nodeId: string]: JQueryTooltipster.ITooltipsterInstance} = {};
isFullscreen = false;
@ -288,6 +291,7 @@ export class RuleChainPageComponent extends PageComponent
private init() {
this.initHotKeys();
this.isImport = this.route.snapshot.data.import;
this.ruleChainType = this.route.snapshot.data.ruleChainType;
if (this.isImport) {
const ruleChainImport: RuleChainImport = this.itembuffer.getRuleChainImport();
this.ruleChain = ruleChainImport.ruleChain;
@ -1281,7 +1285,11 @@ export class RuleChainPageComponent extends PageComponent
if (this.isImport) {
this.isDirtyValue = false;
this.isImport = false;
this.router.navigateByUrl(`ruleChains/${this.route.snapshot.data.ruleChainType.toLowerCase()}/${this.ruleChain.id.id}`);
if (this.ruleChainType !== ruleChainType.edge) {
this.router.navigateByUrl(`ruleChains/${this.ruleChain.id.id}`);
} else {
this.router.navigateByUrl(`edges/ruleChains/${this.ruleChain.id.id}`);
}
} else {
this.createRuleChainModel();
}

144
ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts

@ -123,140 +123,54 @@ const routes: Routes = [
children: [
{
path: '',
redirectTo: '/ruleChains/core',
pathMatch: 'full',
component: EntitiesTableComponent,
data: {
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.rulechains'
title: 'rulechain.rulechains',
ruleChainsType: 'tenant'
},
resolve: {
entitiesTableConfig: RuleChainsTableConfigResolver
}
},
{
path: 'core',
path: ':ruleChainId',
component: RuleChainPageComponent,
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
label: 'rulechain.core-rulechains',
labelFunction: ruleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
}
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.rulechain',
import: false,
ruleChainType: ruleChainType.core
},
children: [
{
path: '',
component: EntitiesTableComponent,
data: {
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.rulechains',
ruleChainsType: 'tenant'
},
resolve: {
entitiesTableConfig: RuleChainsTableConfigResolver
},
},
{
path: ':ruleChainId',
component: RuleChainPageComponent,
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
labelFunction: ruleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.rulechain',
import: false,
ruleChainType: ruleChainType.core
},
resolve: {
ruleChain: RuleChainResolver,
ruleChainMetaData: ResolvedRuleChainMetaDataResolver,
ruleNodeComponents: RuleNodeComponentsResolver
}
},
{
path: 'ruleChain/import',
component: RuleChainPageComponent,
canActivate: [RuleChainImportGuard],
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
labelFunction: importRuleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.rulechain',
import: true,
ruleChainType: ruleChainType.core
},
resolve: {
ruleNodeComponents: RuleNodeComponentsResolver
}
}
]
resolve: {
ruleChain: RuleChainResolver,
ruleChainMetaData: ResolvedRuleChainMetaDataResolver,
ruleNodeComponents: RuleNodeComponentsResolver
}
},
{
path: 'edge',
path: 'ruleChain/import',
component: RuleChainPageComponent,
canActivate: [RuleChainImportGuard],
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
label: 'rulechain.edge-rulechains',
labelFunction: importRuleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
}
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.rulechain',
import: true,
ruleChainType: ruleChainType.core
},
children: [
{
path: '',
component: EntitiesTableComponent,
data: {
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechains',
ruleChainsType: 'edges'
},
resolve: {
entitiesTableConfig: RuleChainsTableConfigResolver
}
},
{
path: ':ruleChainId',
component: RuleChainPageComponent,
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
labelFunction: ruleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechain',
import: false,
ruleChainType: ruleChainType.edge
},
resolve: {
ruleChain: RuleChainResolver,
ruleChainMetaData: ResolvedRuleChainMetaDataResolver,
ruleNodeComponents: RuleNodeComponentsResolver
}
},
{
path: 'ruleChain/import',
component: RuleChainPageComponent,
canActivate: [RuleChainImportGuard],
canDeactivate: [ConfirmOnExitGuard],
data: {
breadcrumb: {
labelFunction: importRuleChainBreadcumbLabelFunction,
icon: 'settings_ethernet'
} as BreadCrumbConfig<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'rulechain.edge-rulechain',
import: true,
ruleChainType: ruleChainType.edge
},
resolve: {
ruleNodeComponents: RuleNodeComponentsResolver
}
}
]
resolve: {
ruleNodeComponents: RuleNodeComponentsResolver
}
}
]
}

2
ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts

@ -169,7 +169,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
configureEntityFunctions(ruleChainScope: string): void {
if (ruleChainScope === 'tenant') {
this.config.tableTitle = this.translate.instant('rulechain.core-rulechains');
this.config.tableTitle = this.translate.instant('rulechain.rulechains');
this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink);
} else if (ruleChainScope === 'edges') {
this.config.tableTitle = this.translate.instant('rulechain.edge-rulechains');

Loading…
Cancel
Save