getEdgeEventContent() refactored
This commit is contained in:
parent
4981db7aeb
commit
02567a728e
@ -83,7 +83,12 @@ import {
|
|||||||
import { alarmFields } from '@shared/models/alarm.models';
|
import { alarmFields } from '@shared/models/alarm.models';
|
||||||
import { OtaPackageService } from '@core/http/ota-package.service';
|
import { OtaPackageService } from '@core/http/ota-package.service';
|
||||||
import { EdgeService } from '@core/http/edge.service';
|
import { EdgeService } from '@core/http/edge.service';
|
||||||
import { Edge, EdgeEvent, EdgeEventActionType, EdgeEventType } from '@shared/models/edge.models';
|
import {
|
||||||
|
Edge,
|
||||||
|
EdgeEvent,
|
||||||
|
EdgeEventType,
|
||||||
|
bodyContentEdgeEventActionTypes
|
||||||
|
} from '@shared/models/edge.models';
|
||||||
import { RuleChainMetaData, RuleChainType } from '@shared/models/rule-chain.models';
|
import { RuleChainMetaData, RuleChainType } from '@shared/models/rule-chain.models';
|
||||||
import { WidgetService } from '@core/http/widget.service';
|
import { WidgetService } from '@core/http/widget.service';
|
||||||
import { DeviceProfileService } from '@core/http/device-profile.service';
|
import { DeviceProfileService } from '@core/http/device-profile.service';
|
||||||
@ -1391,7 +1396,6 @@ export class EntityService {
|
|||||||
let entityObservable: Observable<BaseData<HasId> | RuleChainMetaData | string>;
|
let entityObservable: Observable<BaseData<HasId> | RuleChainMetaData | string>;
|
||||||
const entityId: string = entity.entityId;
|
const entityId: string = entity.entityId;
|
||||||
const entityType: any = entity.type;
|
const entityType: any = entity.type;
|
||||||
const entityAction: EdgeEventActionType = entity.action;
|
|
||||||
switch (entityType) {
|
switch (entityType) {
|
||||||
case EdgeEventType.DASHBOARD:
|
case EdgeEventType.DASHBOARD:
|
||||||
case EdgeEventType.ALARM:
|
case EdgeEventType.ALARM:
|
||||||
@ -1403,12 +1407,8 @@ export class EntityService {
|
|||||||
case EdgeEventType.ASSET:
|
case EdgeEventType.ASSET:
|
||||||
case EdgeEventType.DEVICE:
|
case EdgeEventType.DEVICE:
|
||||||
case EdgeEventType.ENTITY_VIEW:
|
case EdgeEventType.ENTITY_VIEW:
|
||||||
if (entityAction === EdgeEventActionType.POST_ATTRIBUTES ||
|
if (bodyContentEdgeEventActionTypes.indexOf(entity.action) > -1) {
|
||||||
entityAction === EdgeEventActionType.ATTRIBUTES_UPDATED ||
|
entityObservable = of(entity.body);
|
||||||
entityAction === EdgeEventActionType.ATTRIBUTES_DELETED ||
|
|
||||||
entityAction === EdgeEventActionType.TIMESERIES_UPDATED ||
|
|
||||||
entityAction === EdgeEventActionType.RPC_CALL) {
|
|
||||||
return of(entity.body);
|
|
||||||
} else {
|
} else {
|
||||||
entityObservable = this.getEntity(entityType, entityId, { ignoreLoading: true, ignoreErrors: true });
|
entityObservable = this.getEntity(entityType, entityId, { ignoreLoading: true, ignoreErrors: true });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,6 +137,14 @@ export const edgeEventActionTypeTranslations = new Map<EdgeEventActionType, stri
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const bodyContentEdgeEventActionTypes = [
|
||||||
|
EdgeEventActionType.POST_ATTRIBUTES,
|
||||||
|
EdgeEventActionType.ATTRIBUTES_UPDATED,
|
||||||
|
EdgeEventActionType.ATTRIBUTES_DELETED,
|
||||||
|
EdgeEventActionType.TIMESERIES_UPDATED,
|
||||||
|
EdgeEventActionType.RPC_CALL
|
||||||
|
];
|
||||||
|
|
||||||
export const edgeEventStatusColor = new Map<EdgeEventStatus, string>(
|
export const edgeEventStatusColor = new Map<EdgeEventStatus, string>(
|
||||||
[
|
[
|
||||||
[EdgeEventStatus.DEPLOYED, '#000000'],
|
[EdgeEventStatus.DEPLOYED, '#000000'],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user