Commit b1c4c30317b1fd6c6aedee7d5df0a6d9902a55ae

Authored by Artem Babak
1 parent acfb6de8

Fixed fetchEdgeRuleChains. Added Downlink

... ... @@ -293,16 +293,11 @@ export class RuleChainService {
293 293 );
294 294 }
295 295
296   - public getEdgeRuleChains(edgeId: string, pageLink: PageLink,
297   - config?:RequestConfig): Observable<PageData<RuleChain>> {
  296 + public getEdgeRuleChains(edgeId: string, pageLink: PageLink, config?:RequestConfig): Observable<PageData<RuleChain>> {
298 297 return this.http.get<PageData<RuleChain>>(`/api/edge/${edgeId}/ruleChains${pageLink.toQuery()}`,
299 298 defaultHttpOptionsFromConfig(config) )
300 299 }
301 300
302   - public getEdgesRuleChains(pageLink: PageLink, config?: RequestConfig): Observable<PageData<RuleChain>> {
303   - return this.getRuleChains(pageLink, ruleChainType.edge, config);
304   - }
305   -
306 301 public assignRuleChainToEdge(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable<RuleChain> {
307 302 return this.http.post<RuleChain>(`/api/edge/${edgeId}/ruleChain/${ruleChainId}`, null,
308 303 defaultHttpOptionsFromConfig(config));
... ...
... ... @@ -179,10 +179,10 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
179 179 configureEntityFunctions(ruleChainScope: string): void {
180 180 if (ruleChainScope === 'tenant') {
181 181 this.config.tableTitle = this.translate.instant('rulechain.core-rulechains');
182   - this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.core, ruleChainScope);
  182 + this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.core);
183 183 } else if (ruleChainScope === 'edges') {
184 184 this.config.tableTitle = this.translate.instant('rulechain.edge-rulechains');
185   - this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.edge, ruleChainScope);
  185 + this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.edge);
186 186 } else if (ruleChainScope === 'edge') {
187 187 if (this.edgeId) {
188 188 this.edgeService.getEdge(this.edgeId)
... ... @@ -481,13 +481,8 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
481 481 return (isDefined(ruleChain)) && !ruleChain.root && !ruleChain.isDefault;
482 482 }
483 483
484   - fetchRuleChains(pageLink: PageLink, type: string, ruleChainScope: string) {
485   - if (ruleChainScope === 'tenant') {
  484 + fetchRuleChains(pageLink: PageLink, type: string) {
486 485 return this.ruleChainService.getRuleChains(pageLink, type);
487   - }
488   - else if (ruleChainScope === 'edges') {
489   - this.ruleChainService.getRuleChains(pageLink, type)
490   - }
491 486 }
492 487
493 488 }
... ...
... ... @@ -23,7 +23,8 @@ import { ContentType } from '@shared/models/constants';
23 23 export enum EventType {
24 24 ERROR = 'ERROR',
25 25 LC_EVENT = 'LC_EVENT',
26   - STATS = 'STATS'
  26 + STATS = 'STATS',
  27 + EDGE_EVENT = 'EDGE_EVENT'
27 28 }
28 29
29 30 export enum DebugEventType {
... ... @@ -36,6 +37,7 @@ export const eventTypeTranslations = new Map<EventType | DebugEventType, string>
36 37 [EventType.ERROR, 'event.type-error'],
37 38 [EventType.LC_EVENT, 'event.type-lc-event'],
38 39 [EventType.STATS, 'event.type-stats'],
  40 + [EventType.EDGE_EVENT, 'event.type-edge-event'],
39 41 [DebugEventType.DEBUG_RULE_NODE, 'event.type-debug-rule-node'],
40 42 [DebugEventType.DEBUG_RULE_CHAIN, 'event.type-debug-rule-chain'],
41 43 ]
... ... @@ -61,6 +63,11 @@ export interface StatsEventBody extends BaseEventBody {
61 63 errorsOccurred: number;
62 64 }
63 65
  66 +export interface EdgeEventBody extends BaseEventBody {
  67 + messagesProcessed: number;
  68 + errorsOccurred: number;
  69 +}
  70 +
64 71 export interface DebugRuleNodeEventBody extends BaseEventBody {
65 72 type: string;
66 73 entityId: string;
... ...
... ... @@ -1226,6 +1226,7 @@
1226 1226 "type-stats": "Statistics",
1227 1227 "type-debug-rule-node": "Debug",
1228 1228 "type-debug-rule-chain": "Debug",
  1229 + "type-edge-event": "Downlink",
1229 1230 "no-events-prompt": "No events found",
1230 1231 "error": "Error",
1231 1232 "alarm": "Alarm",
... ...