Browse Source

Fixed fetchEdgeRuleChains. Added Downlink

pull/3811/head
Artem Babak 6 years ago
parent
commit
b1c4c30317
  1. 7
      ui-ngx/src/app/core/http/rule-chain.service.ts
  2. 11
      ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts
  3. 9
      ui-ngx/src/app/shared/models/event.models.ts
  4. 1
      ui-ngx/src/assets/locale/locale.constant-en_US.json

7
ui-ngx/src/app/core/http/rule-chain.service.ts

@ -293,16 +293,11 @@ export class RuleChainService {
);
}
public getEdgeRuleChains(edgeId: string, pageLink: PageLink,
config?:RequestConfig): Observable<PageData<RuleChain>> {
public getEdgeRuleChains(edgeId: string, pageLink: PageLink, config?:RequestConfig): Observable<PageData<RuleChain>> {
return this.http.get<PageData<RuleChain>>(`/api/edge/${edgeId}/ruleChains${pageLink.toQuery()}`,
defaultHttpOptionsFromConfig(config) )
}
public getEdgesRuleChains(pageLink: PageLink, config?: RequestConfig): Observable<PageData<RuleChain>> {
return this.getRuleChains(pageLink, ruleChainType.edge, config);
}
public assignRuleChainToEdge(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable<RuleChain> {
return this.http.post<RuleChain>(`/api/edge/${edgeId}/ruleChain/${ruleChainId}`, null,
defaultHttpOptionsFromConfig(config));

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

@ -179,10 +179,10 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
configureEntityFunctions(ruleChainScope: string): void {
if (ruleChainScope === 'tenant') {
this.config.tableTitle = this.translate.instant('rulechain.core-rulechains');
this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.core, ruleChainScope);
this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.core);
} else if (ruleChainScope === 'edges') {
this.config.tableTitle = this.translate.instant('rulechain.edge-rulechains');
this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.edge, ruleChainScope);
this.config.entitiesFetchFunction = pageLink => this.fetchRuleChains(pageLink, ruleChainType.edge);
} else if (ruleChainScope === 'edge') {
if (this.edgeId) {
this.edgeService.getEdge(this.edgeId)
@ -481,13 +481,8 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
return (isDefined(ruleChain)) && !ruleChain.root && !ruleChain.isDefault;
}
fetchRuleChains(pageLink: PageLink, type: string, ruleChainScope: string) {
if (ruleChainScope === 'tenant') {
fetchRuleChains(pageLink: PageLink, type: string) {
return this.ruleChainService.getRuleChains(pageLink, type);
}
else if (ruleChainScope === 'edges') {
this.ruleChainService.getRuleChains(pageLink, type)
}
}
}

9
ui-ngx/src/app/shared/models/event.models.ts

@ -23,7 +23,8 @@ import { ContentType } from '@shared/models/constants';
export enum EventType {
ERROR = 'ERROR',
LC_EVENT = 'LC_EVENT',
STATS = 'STATS'
STATS = 'STATS',
EDGE_EVENT = 'EDGE_EVENT'
}
export enum DebugEventType {
@ -36,6 +37,7 @@ export const eventTypeTranslations = new Map<EventType | DebugEventType, string>
[EventType.ERROR, 'event.type-error'],
[EventType.LC_EVENT, 'event.type-lc-event'],
[EventType.STATS, 'event.type-stats'],
[EventType.EDGE_EVENT, 'event.type-edge-event'],
[DebugEventType.DEBUG_RULE_NODE, 'event.type-debug-rule-node'],
[DebugEventType.DEBUG_RULE_CHAIN, 'event.type-debug-rule-chain'],
]
@ -61,6 +63,11 @@ export interface StatsEventBody extends BaseEventBody {
errorsOccurred: number;
}
export interface EdgeEventBody extends BaseEventBody {
messagesProcessed: number;
errorsOccurred: number;
}
export interface DebugRuleNodeEventBody extends BaseEventBody {
type: string;
entityId: string;

1
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -1226,6 +1226,7 @@
"type-stats": "Statistics",
"type-debug-rule-node": "Debug",
"type-debug-rule-chain": "Debug",
"type-edge-event": "Downlink",
"no-events-prompt": "No events found",
"error": "Error",
"alarm": "Alarm",

Loading…
Cancel
Save