Commit b63087d53f4157c40a982de1a11cf624132305a9
1 parent
ead9fd9e
Moved edge rule chains and edges to edge management page
Showing
5 changed files
with
137 additions
and
144 deletions
... | ... | @@ -228,26 +228,9 @@ export class MenuService { |
228 | 228 | { |
229 | 229 | id: guid(), |
230 | 230 | name: 'rulechain.rulechains', |
231 | - type: 'toggle', | |
231 | + type: 'link', | |
232 | 232 | path: '/ruleChains', |
233 | - height: '80px', | |
234 | 233 | icon: 'settings_ethernet', |
235 | - pages: [ | |
236 | - { | |
237 | - id: guid(), | |
238 | - name: 'rulechain.core-rulechains', | |
239 | - type: 'link', | |
240 | - path: '/ruleChains/core', | |
241 | - icon: 'settings_ethernet' | |
242 | - }, | |
243 | - { | |
244 | - id: guid(), | |
245 | - name: 'rulechain.edge-rulechains', | |
246 | - type: 'link', | |
247 | - path: '/ruleChains/edge', | |
248 | - icon: 'router' | |
249 | - } | |
250 | - ] | |
251 | 234 | }, |
252 | 235 | { |
253 | 236 | id: guid(), |
... | ... | @@ -287,10 +270,27 @@ export class MenuService { |
287 | 270 | }, |
288 | 271 | { |
289 | 272 | id: guid(), |
290 | - name: 'edge.edges', | |
291 | - type: 'link', | |
273 | + name: 'edge.management', | |
274 | + type: 'toggle', | |
292 | 275 | path: '/edges', |
293 | - icon: 'router' | |
276 | + height: '80px', | |
277 | + icon: 'router', | |
278 | + pages: [ | |
279 | + { | |
280 | + id: guid(), | |
281 | + name: 'edge.edges', | |
282 | + type: 'link', | |
283 | + path: '/edges', | |
284 | + icon: 'router' | |
285 | + }, | |
286 | + { | |
287 | + id: guid(), | |
288 | + name: 'rulechain.edge-rulechains', | |
289 | + type: 'link', | |
290 | + path: '/edges/ruleChains', | |
291 | + icon: 'settings_ethernet' | |
292 | + } | |
293 | + ] | |
294 | 294 | }, |
295 | 295 | { |
296 | 296 | id: guid(), |
... | ... | @@ -335,11 +335,6 @@ export class MenuService { |
335 | 335 | name: 'rulechain.rulechains', |
336 | 336 | icon: 'settings_ethernet', |
337 | 337 | path: '/ruleChains' |
338 | - }, | |
339 | - { | |
340 | - name: 'rulechain.edge-rulechains', | |
341 | - icon: 'router', | |
342 | - path: '/edgesRuleChains' | |
343 | 338 | } |
344 | 339 | ] |
345 | 340 | }, |
... | ... | @@ -396,6 +391,11 @@ export class MenuService { |
396 | 391 | name: 'edge.edges', |
397 | 392 | icon: 'router', |
398 | 393 | path: '/edges' |
394 | + }, | |
395 | + { | |
396 | + name: 'rulechain.edge-rulechains', | |
397 | + icon: 'settings_ethernet', | |
398 | + path: '/edges/ruleChains' | |
399 | 399 | } |
400 | 400 | ] |
401 | 401 | }, | ... | ... |
... | ... | @@ -27,6 +27,15 @@ import { RuleChainsTableConfigResolver } from "@home/pages/rulechain/rulechains- |
27 | 27 | import { DashboardPageComponent } from "@home/pages/dashboard/dashboard-page.component"; |
28 | 28 | import { dashboardBreadcumbLabelFunction, DashboardResolver } from "@home/pages/dashboard/dashboard-routing.module"; |
29 | 29 | import { BreadCrumbConfig } from "@shared/components/breadcrumb"; |
30 | +import {RuleChainPageComponent} from "@home/pages/rulechain/rulechain-page.component"; | |
31 | +import {ConfirmOnExitGuard} from "@core/guards/confirm-on-exit.guard"; | |
32 | +import {ruleChainType} from "@shared/models/rule-chain.models"; | |
33 | +import { | |
34 | + importRuleChainBreadcumbLabelFunction, | |
35 | + ResolvedRuleChainMetaDataResolver, | |
36 | + ruleChainBreadcumbLabelFunction, RuleChainImportGuard, | |
37 | + RuleChainResolver, RuleNodeComponentsResolver | |
38 | +} from "@home/pages/rulechain/rulechain-routing.module"; | |
30 | 39 | |
31 | 40 | const routes: Routes = [ |
32 | 41 | { |
... | ... | @@ -147,6 +156,68 @@ const routes: Routes = [ |
147 | 156 | } |
148 | 157 | ] |
149 | 158 | }, |
159 | + { | |
160 | + path: 'ruleChains', | |
161 | + data: { | |
162 | + breadcrumb: { | |
163 | + label: 'rulechain.edge-rulechains', | |
164 | + icon: 'settings_ethernet' | |
165 | + } | |
166 | + }, | |
167 | + children: [ | |
168 | + { | |
169 | + path: '', | |
170 | + component: EntitiesTableComponent, | |
171 | + data: { | |
172 | + auth: [Authority.TENANT_ADMIN], | |
173 | + title: 'rulechain.edge-rulechains', | |
174 | + ruleChainsType: 'edges' | |
175 | + }, | |
176 | + resolve: { | |
177 | + entitiesTableConfig: RuleChainsTableConfigResolver | |
178 | + } | |
179 | + }, | |
180 | + { | |
181 | + path: ':ruleChainId', | |
182 | + component: RuleChainPageComponent, | |
183 | + canDeactivate: [ConfirmOnExitGuard], | |
184 | + data: { | |
185 | + breadcrumb: { | |
186 | + labelFunction: ruleChainBreadcumbLabelFunction, | |
187 | + icon: 'settings_ethernet' | |
188 | + } as BreadCrumbConfig<RuleChainPageComponent>, | |
189 | + auth: [Authority.TENANT_ADMIN], | |
190 | + title: 'rulechain.edge-rulechain', | |
191 | + import: false, | |
192 | + ruleChainType: ruleChainType.edge | |
193 | + }, | |
194 | + resolve: { | |
195 | + ruleChain: RuleChainResolver, | |
196 | + ruleChainMetaData: ResolvedRuleChainMetaDataResolver, | |
197 | + ruleNodeComponents: RuleNodeComponentsResolver | |
198 | + } | |
199 | + }, | |
200 | + { | |
201 | + path: 'ruleChain/import', | |
202 | + component: RuleChainPageComponent, | |
203 | + canActivate: [RuleChainImportGuard], | |
204 | + canDeactivate: [ConfirmOnExitGuard], | |
205 | + data: { | |
206 | + breadcrumb: { | |
207 | + labelFunction: importRuleChainBreadcumbLabelFunction, | |
208 | + icon: 'settings_ethernet' | |
209 | + } as BreadCrumbConfig<RuleChainPageComponent>, | |
210 | + auth: [Authority.TENANT_ADMIN], | |
211 | + title: 'rulechain.edge-rulechain', | |
212 | + import: true, | |
213 | + ruleChainType: ruleChainType.edge | |
214 | + }, | |
215 | + resolve: { | |
216 | + ruleNodeComponents: RuleNodeComponentsResolver | |
217 | + } | |
218 | + } | |
219 | + ] | |
220 | + } | |
150 | 221 | ] |
151 | 222 | }] |
152 | 223 | ... | ... |
... | ... | @@ -48,7 +48,8 @@ import { |
48 | 48 | RuleChainConnectionInfo, |
49 | 49 | RuleChainImport, |
50 | 50 | RuleChainMetaData, |
51 | - ruleChainNodeComponent | |
51 | + ruleChainNodeComponent, | |
52 | + ruleChainType | |
52 | 53 | } from '@shared/models/rule-chain.models'; |
53 | 54 | import { FcItemInfo, FlowchartConstants, NgxFlowchartComponent, UserCallbacks } from 'ngx-flowchart/dist/ngx-flowchart'; |
54 | 55 | import { |
... | ... | @@ -119,6 +120,8 @@ export class RuleChainPageComponent extends PageComponent |
119 | 120 | isDirtyValue: boolean; |
120 | 121 | isInvalid = false; |
121 | 122 | |
123 | + ruleChainType: string; | |
124 | + | |
122 | 125 | errorTooltips: {[nodeId: string]: JQueryTooltipster.ITooltipsterInstance} = {}; |
123 | 126 | isFullscreen = false; |
124 | 127 | |
... | ... | @@ -288,6 +291,7 @@ export class RuleChainPageComponent extends PageComponent |
288 | 291 | private init() { |
289 | 292 | this.initHotKeys(); |
290 | 293 | this.isImport = this.route.snapshot.data.import; |
294 | + this.ruleChainType = this.route.snapshot.data.ruleChainType; | |
291 | 295 | if (this.isImport) { |
292 | 296 | const ruleChainImport: RuleChainImport = this.itembuffer.getRuleChainImport(); |
293 | 297 | this.ruleChain = ruleChainImport.ruleChain; |
... | ... | @@ -1281,7 +1285,11 @@ export class RuleChainPageComponent extends PageComponent |
1281 | 1285 | if (this.isImport) { |
1282 | 1286 | this.isDirtyValue = false; |
1283 | 1287 | this.isImport = false; |
1284 | - this.router.navigateByUrl(`ruleChains/${this.route.snapshot.data.ruleChainType.toLowerCase()}/${this.ruleChain.id.id}`); | |
1288 | + if (this.ruleChainType !== ruleChainType.edge) { | |
1289 | + this.router.navigateByUrl(`ruleChains/${this.ruleChain.id.id}`); | |
1290 | + } else { | |
1291 | + this.router.navigateByUrl(`edges/ruleChains/${this.ruleChain.id.id}`); | |
1292 | + } | |
1285 | 1293 | } else { |
1286 | 1294 | this.createRuleChainModel(); |
1287 | 1295 | } | ... | ... |
... | ... | @@ -123,140 +123,54 @@ const routes: Routes = [ |
123 | 123 | children: [ |
124 | 124 | { |
125 | 125 | path: '', |
126 | - redirectTo: '/ruleChains/core', | |
127 | - pathMatch: 'full', | |
128 | 126 | component: EntitiesTableComponent, |
129 | 127 | data: { |
130 | 128 | auth: [Authority.TENANT_ADMIN], |
131 | - title: 'rulechain.rulechains' | |
129 | + title: 'rulechain.rulechains', | |
130 | + ruleChainsType: 'tenant' | |
132 | 131 | }, |
133 | 132 | resolve: { |
134 | 133 | entitiesTableConfig: RuleChainsTableConfigResolver |
135 | 134 | } |
136 | 135 | }, |
137 | 136 | { |
138 | - path: 'core', | |
137 | + path: ':ruleChainId', | |
138 | + component: RuleChainPageComponent, | |
139 | + canDeactivate: [ConfirmOnExitGuard], | |
139 | 140 | data: { |
140 | 141 | breadcrumb: { |
141 | - label: 'rulechain.core-rulechains', | |
142 | + labelFunction: ruleChainBreadcumbLabelFunction, | |
142 | 143 | icon: 'settings_ethernet' |
143 | - } | |
144 | + } as BreadCrumbConfig<RuleChainPageComponent>, | |
145 | + auth: [Authority.TENANT_ADMIN], | |
146 | + title: 'rulechain.rulechain', | |
147 | + import: false, | |
148 | + ruleChainType: ruleChainType.core | |
144 | 149 | }, |
145 | - children: [ | |
146 | - { | |
147 | - path: '', | |
148 | - component: EntitiesTableComponent, | |
149 | - data: { | |
150 | - auth: [Authority.TENANT_ADMIN], | |
151 | - title: 'rulechain.rulechains', | |
152 | - ruleChainsType: 'tenant' | |
153 | - }, | |
154 | - resolve: { | |
155 | - entitiesTableConfig: RuleChainsTableConfigResolver | |
156 | - }, | |
157 | - }, | |
158 | - { | |
159 | - path: ':ruleChainId', | |
160 | - component: RuleChainPageComponent, | |
161 | - canDeactivate: [ConfirmOnExitGuard], | |
162 | - data: { | |
163 | - breadcrumb: { | |
164 | - labelFunction: ruleChainBreadcumbLabelFunction, | |
165 | - icon: 'settings_ethernet' | |
166 | - } as BreadCrumbConfig<RuleChainPageComponent>, | |
167 | - auth: [Authority.TENANT_ADMIN], | |
168 | - title: 'rulechain.rulechain', | |
169 | - import: false, | |
170 | - ruleChainType: ruleChainType.core | |
171 | - }, | |
172 | - resolve: { | |
173 | - ruleChain: RuleChainResolver, | |
174 | - ruleChainMetaData: ResolvedRuleChainMetaDataResolver, | |
175 | - ruleNodeComponents: RuleNodeComponentsResolver | |
176 | - } | |
177 | - }, | |
178 | - { | |
179 | - path: 'ruleChain/import', | |
180 | - component: RuleChainPageComponent, | |
181 | - canActivate: [RuleChainImportGuard], | |
182 | - canDeactivate: [ConfirmOnExitGuard], | |
183 | - data: { | |
184 | - breadcrumb: { | |
185 | - labelFunction: importRuleChainBreadcumbLabelFunction, | |
186 | - icon: 'settings_ethernet' | |
187 | - } as BreadCrumbConfig<RuleChainPageComponent>, | |
188 | - auth: [Authority.TENANT_ADMIN], | |
189 | - title: 'rulechain.rulechain', | |
190 | - import: true, | |
191 | - ruleChainType: ruleChainType.core | |
192 | - }, | |
193 | - resolve: { | |
194 | - ruleNodeComponents: RuleNodeComponentsResolver | |
195 | - } | |
196 | - } | |
197 | - ] | |
150 | + resolve: { | |
151 | + ruleChain: RuleChainResolver, | |
152 | + ruleChainMetaData: ResolvedRuleChainMetaDataResolver, | |
153 | + ruleNodeComponents: RuleNodeComponentsResolver | |
154 | + } | |
198 | 155 | }, |
199 | 156 | { |
200 | - path: 'edge', | |
157 | + path: 'ruleChain/import', | |
158 | + component: RuleChainPageComponent, | |
159 | + canActivate: [RuleChainImportGuard], | |
160 | + canDeactivate: [ConfirmOnExitGuard], | |
201 | 161 | data: { |
202 | 162 | breadcrumb: { |
203 | - label: 'rulechain.edge-rulechains', | |
163 | + labelFunction: importRuleChainBreadcumbLabelFunction, | |
204 | 164 | icon: 'settings_ethernet' |
205 | - } | |
165 | + } as BreadCrumbConfig<RuleChainPageComponent>, | |
166 | + auth: [Authority.TENANT_ADMIN], | |
167 | + title: 'rulechain.rulechain', | |
168 | + import: true, | |
169 | + ruleChainType: ruleChainType.core | |
206 | 170 | }, |
207 | - children: [ | |
208 | - { | |
209 | - path: '', | |
210 | - component: EntitiesTableComponent, | |
211 | - data: { | |
212 | - auth: [Authority.TENANT_ADMIN], | |
213 | - title: 'rulechain.edge-rulechains', | |
214 | - ruleChainsType: 'edges' | |
215 | - }, | |
216 | - resolve: { | |
217 | - entitiesTableConfig: RuleChainsTableConfigResolver | |
218 | - } | |
219 | - }, | |
220 | - { | |
221 | - path: ':ruleChainId', | |
222 | - component: RuleChainPageComponent, | |
223 | - canDeactivate: [ConfirmOnExitGuard], | |
224 | - data: { | |
225 | - breadcrumb: { | |
226 | - labelFunction: ruleChainBreadcumbLabelFunction, | |
227 | - icon: 'settings_ethernet' | |
228 | - } as BreadCrumbConfig<RuleChainPageComponent>, | |
229 | - auth: [Authority.TENANT_ADMIN], | |
230 | - title: 'rulechain.edge-rulechain', | |
231 | - import: false, | |
232 | - ruleChainType: ruleChainType.edge | |
233 | - }, | |
234 | - resolve: { | |
235 | - ruleChain: RuleChainResolver, | |
236 | - ruleChainMetaData: ResolvedRuleChainMetaDataResolver, | |
237 | - ruleNodeComponents: RuleNodeComponentsResolver | |
238 | - } | |
239 | - }, | |
240 | - { | |
241 | - path: 'ruleChain/import', | |
242 | - component: RuleChainPageComponent, | |
243 | - canActivate: [RuleChainImportGuard], | |
244 | - canDeactivate: [ConfirmOnExitGuard], | |
245 | - data: { | |
246 | - breadcrumb: { | |
247 | - labelFunction: importRuleChainBreadcumbLabelFunction, | |
248 | - icon: 'settings_ethernet' | |
249 | - } as BreadCrumbConfig<RuleChainPageComponent>, | |
250 | - auth: [Authority.TENANT_ADMIN], | |
251 | - title: 'rulechain.edge-rulechain', | |
252 | - import: true, | |
253 | - ruleChainType: ruleChainType.edge | |
254 | - }, | |
255 | - resolve: { | |
256 | - ruleNodeComponents: RuleNodeComponentsResolver | |
257 | - } | |
258 | - } | |
259 | - ] | |
171 | + resolve: { | |
172 | + ruleNodeComponents: RuleNodeComponentsResolver | |
173 | + } | |
260 | 174 | } |
261 | 175 | ] |
262 | 176 | } | ... | ... |
... | ... | @@ -169,7 +169,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
169 | 169 | |
170 | 170 | configureEntityFunctions(ruleChainScope: string): void { |
171 | 171 | if (ruleChainScope === 'tenant') { |
172 | - this.config.tableTitle = this.translate.instant('rulechain.core-rulechains'); | |
172 | + this.config.tableTitle = this.translate.instant('rulechain.rulechains'); | |
173 | 173 | this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink); |
174 | 174 | } else if (ruleChainScope === 'edges') { |
175 | 175 | this.config.tableTitle = this.translate.instant('rulechain.edge-rulechains'); | ... | ... |