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(), id: guid(),
name: 'rulechain.rulechains', name: 'rulechain.rulechains',
type: 'toggle', type: 'link',
path: '/ruleChains', path: '/ruleChains',
height: '80px',
icon: 'settings_ethernet', 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(), id: guid(),
@ -287,10 +270,27 @@ export class MenuService {
}, },
{ {
id: guid(), id: guid(),
name: 'edge.edges', name: 'edge.management',
type: 'link', type: 'toggle',
path: '/edges', 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(), id: guid(),
@ -335,11 +335,6 @@ export class MenuService {
name: 'rulechain.rulechains', name: 'rulechain.rulechains',
icon: 'settings_ethernet', icon: 'settings_ethernet',
path: '/ruleChains' path: '/ruleChains'
},
{
name: 'rulechain.edge-rulechains',
icon: 'router',
path: '/edgesRuleChains'
} }
] ]
}, },
@ -396,6 +391,11 @@ export class MenuService {
name: 'edge.edges', name: 'edge.edges',
icon: 'router', icon: 'router',
path: '/edges' 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 { DashboardPageComponent } from "@home/pages/dashboard/dashboard-page.component";
import { dashboardBreadcumbLabelFunction, DashboardResolver } from "@home/pages/dashboard/dashboard-routing.module"; import { dashboardBreadcumbLabelFunction, DashboardResolver } from "@home/pages/dashboard/dashboard-routing.module";
import { BreadCrumbConfig } from "@shared/components/breadcrumb"; 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 = [ 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, RuleChainConnectionInfo,
RuleChainImport, RuleChainImport,
RuleChainMetaData, RuleChainMetaData,
ruleChainNodeComponent ruleChainNodeComponent,
ruleChainType
} from '@shared/models/rule-chain.models'; } from '@shared/models/rule-chain.models';
import { FcItemInfo, FlowchartConstants, NgxFlowchartComponent, UserCallbacks } from 'ngx-flowchart/dist/ngx-flowchart'; import { FcItemInfo, FlowchartConstants, NgxFlowchartComponent, UserCallbacks } from 'ngx-flowchart/dist/ngx-flowchart';
import { import {
@ -119,6 +120,8 @@ export class RuleChainPageComponent extends PageComponent
isDirtyValue: boolean; isDirtyValue: boolean;
isInvalid = false; isInvalid = false;
ruleChainType: string;
errorTooltips: {[nodeId: string]: JQueryTooltipster.ITooltipsterInstance} = {}; errorTooltips: {[nodeId: string]: JQueryTooltipster.ITooltipsterInstance} = {};
isFullscreen = false; isFullscreen = false;
@ -288,6 +291,7 @@ export class RuleChainPageComponent extends PageComponent
private init() { private init() {
this.initHotKeys(); this.initHotKeys();
this.isImport = this.route.snapshot.data.import; this.isImport = this.route.snapshot.data.import;
this.ruleChainType = this.route.snapshot.data.ruleChainType;
if (this.isImport) { if (this.isImport) {
const ruleChainImport: RuleChainImport = this.itembuffer.getRuleChainImport(); const ruleChainImport: RuleChainImport = this.itembuffer.getRuleChainImport();
this.ruleChain = ruleChainImport.ruleChain; this.ruleChain = ruleChainImport.ruleChain;
@ -1281,7 +1285,11 @@ export class RuleChainPageComponent extends PageComponent
if (this.isImport) { if (this.isImport) {
this.isDirtyValue = false; this.isDirtyValue = false;
this.isImport = 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 { } else {
this.createRuleChainModel(); this.createRuleChainModel();
} }

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

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

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 { configureEntityFunctions(ruleChainScope: string): void {
if (ruleChainScope === 'tenant') { 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); this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink);
} else if (ruleChainScope === 'edges') { } else if (ruleChainScope === 'edges') {
this.config.tableTitle = this.translate.instant('rulechain.edge-rulechains'); this.config.tableTitle = this.translate.instant('rulechain.edge-rulechains');

Loading…
Cancel
Save