Commit bd8a104b9f4900b2d25003a1fe681d2a7617149d

Authored by Igor Kulikov
1 parent 7ff599f7

UI: Asset and Entity View services

  1 +///
  2 +/// Copyright © 2016-2019 The Thingsboard Authors
  3 +///
  4 +/// Licensed under the Apache License, Version 2.0 (the "License");
  5 +/// you may not use this file except in compliance with the License.
  6 +/// You may obtain a copy of the License at
  7 +///
  8 +/// http://www.apache.org/licenses/LICENSE-2.0
  9 +///
  10 +/// Unless required by applicable law or agreed to in writing, software
  11 +/// distributed under the License is distributed on an "AS IS" BASIS,
  12 +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +/// See the License for the specific language governing permissions and
  14 +/// limitations under the License.
  15 +///
  16 +
  17 +import {Injectable} from '@angular/core';
  18 +import {defaultHttpOptions} from './http-utils';
  19 +import {Observable} from 'rxjs/index';
  20 +import {HttpClient} from '@angular/common/http';
  21 +import {PageLink} from '@shared/models/page/page-link';
  22 +import {PageData} from '@shared/models/page/page-data';
  23 +import {EntitySubtype} from '@app/shared/models/entity-type.models';
  24 +import {Asset, AssetInfo} from '@app/shared/models/asset.models';
  25 +
  26 +@Injectable({
  27 + providedIn: 'root'
  28 +})
  29 +export class AssetService {
  30 +
  31 + constructor(
  32 + private http: HttpClient
  33 + ) { }
  34 +
  35 + public getTenantAssetInfos(pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
  36 + ignoreLoading: boolean = false): Observable<PageData<AssetInfo>> {
  37 + return this.http.get<PageData<AssetInfo>>(`/api/tenant/assetInfos${pageLink.toQuery()}&type=${type}`,
  38 + defaultHttpOptions(ignoreLoading, ignoreErrors));
  39 + }
  40 +
  41 + public getCustomerAssetInfos(customerId: string, pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
  42 + ignoreLoading: boolean = false): Observable<PageData<AssetInfo>> {
  43 + return this.http.get<PageData<AssetInfo>>(`/api/customer/${customerId}/assetInfos${pageLink.toQuery()}&type=${type}`,
  44 + defaultHttpOptions(ignoreLoading, ignoreErrors));
  45 + }
  46 +
  47 + public getAsset(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
  48 + return this.http.get<Asset>(`/api/asset/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  49 + }
  50 +
  51 + public getAssets(assetIds: Array<string>, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Array<Asset>> {
  52 + return this.http.get<Array<Asset>>(`/api/assets?assetIds=${assetIds.join(',')}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  53 + }
  54 +
  55 + public getAssetInfo(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<AssetInfo> {
  56 + return this.http.get<AssetInfo>(`/api/asset/info/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  57 + }
  58 +
  59 + public saveAsset(asset: Asset, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
  60 + return this.http.post<Asset>('/api/asset', asset, defaultHttpOptions(ignoreLoading, ignoreErrors));
  61 + }
  62 +
  63 + public deleteAsset(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
  64 + return this.http.delete(`/api/asset/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  65 + }
  66 +
  67 + public getAssetTypes(ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Array<EntitySubtype>> {
  68 + return this.http.get<Array<EntitySubtype>>('/api/asset/types', defaultHttpOptions(ignoreLoading, ignoreErrors));
  69 + }
  70 +
  71 + public makeAssetPublic(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
  72 + return this.http.post<Asset>(`/api/customer/public/asset/${assetId}`, null, defaultHttpOptions(ignoreLoading, ignoreErrors));
  73 + }
  74 +
  75 + public assignAssetToCustomer(customerId: string, assetId: string,
  76 + ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
  77 + return this.http.post<Asset>(`/api/customer/${customerId}/asset/${assetId}`, null, defaultHttpOptions(ignoreLoading, ignoreErrors));
  78 + }
  79 +
  80 + public unassignAssetFromCustomer(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
  81 + return this.http.delete(`/api/customer/asset/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  82 + }
  83 +
  84 +}
  1 +///
  2 +/// Copyright © 2016-2019 The Thingsboard Authors
  3 +///
  4 +/// Licensed under the Apache License, Version 2.0 (the "License");
  5 +/// you may not use this file except in compliance with the License.
  6 +/// You may obtain a copy of the License at
  7 +///
  8 +/// http://www.apache.org/licenses/LICENSE-2.0
  9 +///
  10 +/// Unless required by applicable law or agreed to in writing, software
  11 +/// distributed under the License is distributed on an "AS IS" BASIS,
  12 +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +/// See the License for the specific language governing permissions and
  14 +/// limitations under the License.
  15 +///
  16 +
  17 +import {Injectable} from '@angular/core';
  18 +import {defaultHttpOptions} from './http-utils';
  19 +import {Observable} from 'rxjs/index';
  20 +import {HttpClient} from '@angular/common/http';
  21 +import {PageLink} from '@shared/models/page/page-link';
  22 +import {PageData} from '@shared/models/page/page-data';
  23 +import {EntitySubtype} from '@app/shared/models/entity-type.models';
  24 +import {EntityView, EntityViewInfo} from '@app/shared/models/entity-view.models';
  25 +
  26 +@Injectable({
  27 + providedIn: 'root'
  28 +})
  29 +export class EntityViewService {
  30 +
  31 + constructor(
  32 + private http: HttpClient
  33 + ) { }
  34 +
  35 + public getTenantEntityViewInfos(pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
  36 + ignoreLoading: boolean = false): Observable<PageData<EntityViewInfo>> {
  37 + return this.http.get<PageData<EntityViewInfo>>(`/api/tenant/entityViewInfos${pageLink.toQuery()}&type=${type}`,
  38 + defaultHttpOptions(ignoreLoading, ignoreErrors));
  39 + }
  40 +
  41 + public getCustomerEntityViewInfos(customerId: string, pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
  42 + ignoreLoading: boolean = false): Observable<PageData<EntityViewInfo>> {
  43 + return this.http.get<PageData<EntityViewInfo>>(`/api/customer/${customerId}/entityViewInfos${pageLink.toQuery()}&type=${type}`,
  44 + defaultHttpOptions(ignoreLoading, ignoreErrors));
  45 + }
  46 +
  47 + public getEntityView(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
  48 + return this.http.get<EntityView>(`/api/entityView/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  49 + }
  50 +
  51 + public getEntityViewInfo(entityViewId: string, ignoreErrors: boolean = false,
  52 + ignoreLoading: boolean = false): Observable<EntityViewInfo> {
  53 + return this.http.get<EntityViewInfo>(`/api/entityView/info/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  54 + }
  55 +
  56 + public saveEntityView(entityView: EntityView, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
  57 + return this.http.post<EntityView>('/api/entityView', entityView, defaultHttpOptions(ignoreLoading, ignoreErrors));
  58 + }
  59 +
  60 + public deleteEntityView(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
  61 + return this.http.delete(`/api/entityView/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  62 + }
  63 +
  64 + public getEntityViewTypes(ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Array<EntitySubtype>> {
  65 + return this.http.get<Array<EntitySubtype>>('/api/entityView/types', defaultHttpOptions(ignoreLoading, ignoreErrors));
  66 + }
  67 +
  68 + public makeEntityViewPublic(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
  69 + return this.http.post<EntityView>(`/api/customer/public/entityView/${entityViewId}`, null,
  70 + defaultHttpOptions(ignoreLoading, ignoreErrors));
  71 + }
  72 +
  73 + public assignEntityViewToCustomer(customerId: string, entityViewId: string,
  74 + ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
  75 + return this.http.post<EntityView>(`/api/customer/${customerId}/entityView/${entityViewId}`, null,
  76 + defaultHttpOptions(ignoreLoading, ignoreErrors));
  77 + }
  78 +
  79 + public unassignEntityViewFromCustomer(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
  80 + return this.http.delete(`/api/customer/entityView/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
  81 + }
  82 +
  83 +}
@@ -35,6 +35,8 @@ import {Authority} from '@shared/models/authority.enum'; @@ -35,6 +35,8 @@ import {Authority} from '@shared/models/authority.enum';
35 import {Tenant} from '@shared/models/tenant.model'; 35 import {Tenant} from '@shared/models/tenant.model';
36 import {concatMap, expand, map, toArray} from 'rxjs/operators'; 36 import {concatMap, expand, map, toArray} from 'rxjs/operators';
37 import {Customer} from '@app/shared/models/customer.model'; 37 import {Customer} from '@app/shared/models/customer.model';
  38 +import {AssetService} from '@core/http/asset.service';
  39 +import {EntityViewService} from '@core/http/entity-view.service';
38 40
39 @Injectable({ 41 @Injectable({
40 providedIn: 'root' 42 providedIn: 'root'
@@ -45,6 +47,8 @@ export class EntityService { @@ -45,6 +47,8 @@ export class EntityService {
45 private http: HttpClient, 47 private http: HttpClient,
46 private store: Store<AppState>, 48 private store: Store<AppState>,
47 private deviceService: DeviceService, 49 private deviceService: DeviceService,
  50 + private assetService: AssetService,
  51 + private entityViewService: EntityViewService,
48 private tenantService: TenantService, 52 private tenantService: TenantService,
49 private customerService: CustomerService, 53 private customerService: CustomerService,
50 private userService: UserService, 54 private userService: UserService,
@@ -60,10 +64,10 @@ export class EntityService { @@ -60,10 +64,10 @@ export class EntityService {
60 observable = this.deviceService.getDevice(entityId, ignoreErrors, ignoreLoading); 64 observable = this.deviceService.getDevice(entityId, ignoreErrors, ignoreLoading);
61 break; 65 break;
62 case EntityType.ASSET: 66 case EntityType.ASSET:
63 - // TODO: 67 + observable = this.assetService.getAsset(entityId, ignoreErrors, ignoreLoading);
64 break; 68 break;
65 case EntityType.ENTITY_VIEW: 69 case EntityType.ENTITY_VIEW:
66 - // TODO: 70 + observable = this.entityViewService.getEntityView(entityId, ignoreErrors, ignoreLoading);
67 break; 71 break;
68 case EntityType.TENANT: 72 case EntityType.TENANT:
69 observable = this.tenantService.getTenant(entityId, ignoreErrors, ignoreLoading); 73 observable = this.tenantService.getTenant(entityId, ignoreErrors, ignoreLoading);
@@ -127,10 +131,12 @@ export class EntityService { @@ -127,10 +131,12 @@ export class EntityService {
127 observable = this.deviceService.getDevices(entityIds, ignoreErrors, ignoreLoading); 131 observable = this.deviceService.getDevices(entityIds, ignoreErrors, ignoreLoading);
128 break; 132 break;
129 case EntityType.ASSET: 133 case EntityType.ASSET:
130 - // TODO: 134 + observable = this.assetService.getAssets(entityIds, ignoreErrors, ignoreLoading);
131 break; 135 break;
132 case EntityType.ENTITY_VIEW: 136 case EntityType.ENTITY_VIEW:
133 - // TODO: 137 + observable = this.getEntitiesByIdsObservable(
  138 + (id) => this.entityViewService.getEntityView(id, ignoreErrors, ignoreLoading),
  139 + entityIds);
134 break; 140 break;
135 case EntityType.TENANT: 141 case EntityType.TENANT:
136 observable = this.getEntitiesByIdsObservable( 142 observable = this.getEntitiesByIdsObservable(
@@ -233,17 +239,18 @@ export class EntityService { @@ -233,17 +239,18 @@ export class EntityService {
233 case EntityType.ASSET: 239 case EntityType.ASSET:
234 pageLink.sortOrder.property = 'name'; 240 pageLink.sortOrder.property = 'name';
235 if (authUser.authority === Authority.CUSTOMER_USER) { 241 if (authUser.authority === Authority.CUSTOMER_USER) {
236 - // TODO: 242 + entitiesObservable = this.assetService.getCustomerAssetInfos(customerId, pageLink, subType, ignoreErrors, ignoreLoading);
237 } else { 243 } else {
238 - // TODO: 244 + entitiesObservable = this.assetService.getTenantAssetInfos(pageLink, subType, ignoreErrors, ignoreLoading);
239 } 245 }
240 break; 246 break;
241 case EntityType.ENTITY_VIEW: 247 case EntityType.ENTITY_VIEW:
242 pageLink.sortOrder.property = 'name'; 248 pageLink.sortOrder.property = 'name';
243 if (authUser.authority === Authority.CUSTOMER_USER) { 249 if (authUser.authority === Authority.CUSTOMER_USER) {
244 - // TODO: 250 + entitiesObservable = this.entityViewService.getCustomerEntityViewInfos(customerId, pageLink,
  251 + subType, ignoreErrors, ignoreLoading);
245 } else { 252 } else {
246 - // TODO: 253 + entitiesObservable = this.entityViewService.getTenantEntityViewInfos(pageLink, subType, ignoreErrors, ignoreLoading);
247 } 254 }
248 break; 255 break;
249 case EntityType.TENANT: 256 case EntityType.TENANT:
@@ -24,6 +24,8 @@ import {DeviceService} from '@core/http/device.service'; @@ -24,6 +24,8 @@ import {DeviceService} from '@core/http/device.service';
24 import {EntityId} from '@shared/models/id/entity-id'; 24 import {EntityId} from '@shared/models/id/entity-id';
25 import {EntityType} from '@shared/models/entity-type.models'; 25 import {EntityType} from '@shared/models/entity-type.models';
26 import {forkJoin, Observable} from 'rxjs'; 26 import {forkJoin, Observable} from 'rxjs';
  27 +import {AssetService} from '@core/http/asset.service';
  28 +import {EntityViewService} from '@core/http/entity-view.service';
27 29
28 export interface AddEntitiesToCustomerDialogData { 30 export interface AddEntitiesToCustomerDialogData {
29 customerId: string; 31 customerId: string;
@@ -50,6 +52,8 @@ export class AddEntitiesToCustomerDialogComponent extends PageComponent implemen @@ -50,6 +52,8 @@ export class AddEntitiesToCustomerDialogComponent extends PageComponent implemen
50 constructor(protected store: Store<AppState>, 52 constructor(protected store: Store<AppState>,
51 @Inject(MAT_DIALOG_DATA) public data: AddEntitiesToCustomerDialogData, 53 @Inject(MAT_DIALOG_DATA) public data: AddEntitiesToCustomerDialogData,
52 private deviceService: DeviceService, 54 private deviceService: DeviceService,
  55 + private assetService: AssetService,
  56 + private entityViewService: EntityViewService,
53 @SkipSelf() private errorStateMatcher: ErrorStateMatcher, 57 @SkipSelf() private errorStateMatcher: ErrorStateMatcher,
54 public dialogRef: MatDialogRef<AddEntitiesToCustomerDialogComponent, boolean>, 58 public dialogRef: MatDialogRef<AddEntitiesToCustomerDialogComponent, boolean>,
55 public fb: FormBuilder) { 59 public fb: FormBuilder) {
@@ -107,10 +111,10 @@ export class AddEntitiesToCustomerDialogComponent extends PageComponent implemen @@ -107,10 +111,10 @@ export class AddEntitiesToCustomerDialogComponent extends PageComponent implemen
107 return this.deviceService.assignDeviceToCustomer(customerId, entityId); 111 return this.deviceService.assignDeviceToCustomer(customerId, entityId);
108 break; 112 break;
109 case EntityType.ASSET: 113 case EntityType.ASSET:
110 - // TODO: 114 + return this.assetService.assignAssetToCustomer(customerId, entityId);
111 break; 115 break;
112 case EntityType.ENTITY_VIEW: 116 case EntityType.ENTITY_VIEW:
113 - // TODO: 117 + return this.entityViewService.assignEntityViewToCustomer(customerId, entityId);
114 break; 118 break;
115 } 119 }
116 } 120 }
@@ -24,6 +24,8 @@ import {DeviceService} from '@core/http/device.service'; @@ -24,6 +24,8 @@ import {DeviceService} from '@core/http/device.service';
24 import {EntityId} from '@shared/models/id/entity-id'; 24 import {EntityId} from '@shared/models/id/entity-id';
25 import {EntityType} from '@shared/models/entity-type.models'; 25 import {EntityType} from '@shared/models/entity-type.models';
26 import {forkJoin, Observable} from 'rxjs'; 26 import {forkJoin, Observable} from 'rxjs';
  27 +import {AssetService} from '@core/http/asset.service';
  28 +import {EntityViewService} from '@core/http/entity-view.service';
27 29
28 export interface AssignToCustomerDialogData { 30 export interface AssignToCustomerDialogData {
29 entityIds: Array<EntityId>; 31 entityIds: Array<EntityId>;
@@ -50,6 +52,8 @@ export class AssignToCustomerDialogComponent extends PageComponent implements On @@ -50,6 +52,8 @@ export class AssignToCustomerDialogComponent extends PageComponent implements On
50 constructor(protected store: Store<AppState>, 52 constructor(protected store: Store<AppState>,
51 @Inject(MAT_DIALOG_DATA) public data: AssignToCustomerDialogData, 53 @Inject(MAT_DIALOG_DATA) public data: AssignToCustomerDialogData,
52 private deviceService: DeviceService, 54 private deviceService: DeviceService,
  55 + private assetService: AssetService,
  56 + private entityViewService: EntityViewService,
53 @SkipSelf() private errorStateMatcher: ErrorStateMatcher, 57 @SkipSelf() private errorStateMatcher: ErrorStateMatcher,
54 public dialogRef: MatDialogRef<AssignToCustomerDialogComponent, boolean>, 58 public dialogRef: MatDialogRef<AssignToCustomerDialogComponent, boolean>,
55 public fb: FormBuilder) { 59 public fb: FormBuilder) {
@@ -106,10 +110,10 @@ export class AssignToCustomerDialogComponent extends PageComponent implements On @@ -106,10 +110,10 @@ export class AssignToCustomerDialogComponent extends PageComponent implements On
106 return this.deviceService.assignDeviceToCustomer(customerId, entityId); 110 return this.deviceService.assignDeviceToCustomer(customerId, entityId);
107 break; 111 break;
108 case EntityType.ASSET: 112 case EntityType.ASSET:
109 - // TODO: 113 + return this.assetService.assignAssetToCustomer(customerId, entityId);
110 break; 114 break;
111 case EntityType.ENTITY_VIEW: 115 case EntityType.ENTITY_VIEW:
112 - // TODO: 116 + return this.entityViewService.assignEntityViewToCustomer(customerId, entityId);
113 break; 117 break;
114 } 118 }
115 } 119 }
@@ -33,6 +33,8 @@ import {DeviceService} from '@core/http/device.service'; @@ -33,6 +33,8 @@ import {DeviceService} from '@core/http/device.service';
33 import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models'; 33 import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models';
34 import {BroadcastService} from '@app/core/services/broadcast.service'; 34 import {BroadcastService} from '@app/core/services/broadcast.service';
35 import {coerceBooleanProperty} from '@angular/cdk/coercion'; 35 import {coerceBooleanProperty} from '@angular/cdk/coercion';
  36 +import {AssetService} from '@core/http/asset.service';
  37 +import {EntityViewService} from '@core/http/entity-view.service';
36 38
37 @Component({ 39 @Component({
38 selector: 'tb-entity-subtype-autocomplete', 40 selector: 'tb-entity-subtype-autocomplete',
@@ -85,6 +87,8 @@ export class EntitySubTypeAutocompleteComponent implements ControlValueAccessor, @@ -85,6 +87,8 @@ export class EntitySubTypeAutocompleteComponent implements ControlValueAccessor,
85 private broadcast: BroadcastService, 87 private broadcast: BroadcastService,
86 public translate: TranslateService, 88 public translate: TranslateService,
87 private deviceService: DeviceService, 89 private deviceService: DeviceService,
  90 + private assetService: AssetService,
  91 + private entityViewService: EntityViewService,
88 private fb: FormBuilder) { 92 private fb: FormBuilder) {
89 this.subTypeFormGroup = this.fb.group({ 93 this.subTypeFormGroup = this.fb.group({
90 subType: [null] 94 subType: [null]
@@ -203,13 +207,13 @@ export class EntitySubTypeAutocompleteComponent implements ControlValueAccessor, @@ -203,13 +207,13 @@ export class EntitySubTypeAutocompleteComponent implements ControlValueAccessor,
203 if (!this.subTypes) { 207 if (!this.subTypes) {
204 switch (this.entityType) { 208 switch (this.entityType) {
205 case EntityType.ASSET: 209 case EntityType.ASSET:
206 - // TODO: 210 + this.subTypes = this.assetService.getAssetTypes(false, true);
207 break; 211 break;
208 case EntityType.DEVICE: 212 case EntityType.DEVICE:
209 this.subTypes = this.deviceService.getDeviceTypes(false, true); 213 this.subTypes = this.deviceService.getDeviceTypes(false, true);
210 break; 214 break;
211 case EntityType.ENTITY_VIEW: 215 case EntityType.ENTITY_VIEW:
212 - // TODO: 216 + this.subTypes = this.entityViewService.getEntityViewTypes(false, true);
213 break; 217 break;
214 } 218 }
215 if (this.subTypes) { 219 if (this.subTypes) {
@@ -32,6 +32,8 @@ import {TranslateService} from '@ngx-translate/core'; @@ -32,6 +32,8 @@ import {TranslateService} from '@ngx-translate/core';
32 import {DeviceService} from '@core/http/device.service'; 32 import {DeviceService} from '@core/http/device.service';
33 import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models'; 33 import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models';
34 import {BroadcastService} from '@app/core/services/broadcast.service'; 34 import {BroadcastService} from '@app/core/services/broadcast.service';
  35 +import {AssetService} from '@core/http/asset.service';
  36 +import {EntityViewService} from '@core/http/entity-view.service';
35 37
36 @Component({ 38 @Component({
37 selector: 'tb-entity-subtype-select', 39 selector: 'tb-entity-subtype-select',
@@ -83,6 +85,8 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni @@ -83,6 +85,8 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni
83 private broadcast: BroadcastService, 85 private broadcast: BroadcastService,
84 public translate: TranslateService, 86 public translate: TranslateService,
85 private deviceService: DeviceService, 87 private deviceService: DeviceService,
  88 + private assetService: AssetService,
  89 + private entityViewService: EntityViewService,
86 private fb: FormBuilder) { 90 private fb: FormBuilder) {
87 this.subTypeFormGroup = this.fb.group({ 91 this.subTypeFormGroup = this.fb.group({
88 subType: [null] 92 subType: [null]
@@ -202,13 +206,13 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni @@ -202,13 +206,13 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni
202 if (!this.subTypes) { 206 if (!this.subTypes) {
203 switch (this.entityType) { 207 switch (this.entityType) {
204 case EntityType.ASSET: 208 case EntityType.ASSET:
205 - // TODO: 209 + this.subTypes = this.assetService.getAssetTypes(false, true);
206 break; 210 break;
207 case EntityType.DEVICE: 211 case EntityType.DEVICE:
208 this.subTypes = this.deviceService.getDeviceTypes(false, true); 212 this.subTypes = this.deviceService.getDeviceTypes(false, true);
209 break; 213 break;
210 case EntityType.ENTITY_VIEW: 214 case EntityType.ENTITY_VIEW:
211 - // TODO: 215 + this.subTypes = this.entityViewService.getEntityViewTypes(false, true);
212 break; 216 break;
213 } 217 }
214 if (this.subTypes) { 218 if (this.subTypes) {