Browse Source

Minor getEdgeEventContentByEntityType refactoring

pull/3811/head
deaflynx 6 years ago
parent
commit
f2ac0f6913
  1. 14
      ui-ngx/src/app/core/http/entity.service.ts

14
ui-ngx/src/app/core/http/entity.service.ts

@ -1323,7 +1323,9 @@ export class EntityService {
public getEdgeEventContentByEntityType(entity: any): Observable<any> {
let entityObservable: Observable<any>;
switch (entity.type) {
const entityId = entity.entityId;
const entityType = entity.type;
switch (entityType) {
case EdgeEventType.DASHBOARD:
case EdgeEventType.ALARM:
case EdgeEventType.RULE_CHAIN:
@ -1334,19 +1336,19 @@ export class EntityService {
case EdgeEventType.ASSET:
case EdgeEventType.DEVICE:
case EdgeEventType.ENTITY_VIEW:
entityObservable = this.getEntity(entity.type, entity.entityId, { ignoreLoading: true, ignoreErrors: true });
entityObservable = this.getEntity(entityType, entityId, { ignoreLoading: true, ignoreErrors: true });
break;
case EdgeEventType.RULE_CHAIN_METADATA:
entityObservable = this.ruleChainService.getRuleChainMetadata(entity.entityId);
entityObservable = this.ruleChainService.getRuleChainMetadata(entityId);
break;
case EdgeEventType.WIDGET_TYPE:
entityObservable = this.widgetService.getWidgetTypeById(entity.entityId);
entityObservable = this.widgetService.getWidgetTypeById(entityId);
break;
case EdgeEventType.WIDGETS_BUNDLE:
entityObservable = this.widgetService.getWidgetsBundle(entity.entityId);
entityObservable = this.widgetService.getWidgetsBundle(entityId);
break;
case EdgeEventType.DEVICE_PROFILE:
entityObservable = this.deviceProfileService.getDeviceProfile(entity.entityId);
entityObservable = this.deviceProfileService.getDeviceProfile(entityId);
break;
case EdgeEventType.RELATION:
entityObservable = of(entity.body);

Loading…
Cancel
Save