UI: Asset and Entity View services
This commit is contained in:
parent
7ff599f7c4
commit
bd8a104b9f
84
ui-ngx/src/app/core/http/asset.service.ts
Normal file
84
ui-ngx/src/app/core/http/asset.service.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
///
|
||||||
|
/// Copyright © 2016-2019 The Thingsboard Authors
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
|
||||||
|
import {Injectable} from '@angular/core';
|
||||||
|
import {defaultHttpOptions} from './http-utils';
|
||||||
|
import {Observable} from 'rxjs/index';
|
||||||
|
import {HttpClient} from '@angular/common/http';
|
||||||
|
import {PageLink} from '@shared/models/page/page-link';
|
||||||
|
import {PageData} from '@shared/models/page/page-data';
|
||||||
|
import {EntitySubtype} from '@app/shared/models/entity-type.models';
|
||||||
|
import {Asset, AssetInfo} from '@app/shared/models/asset.models';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class AssetService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private http: HttpClient
|
||||||
|
) { }
|
||||||
|
|
||||||
|
public getTenantAssetInfos(pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
|
||||||
|
ignoreLoading: boolean = false): Observable<PageData<AssetInfo>> {
|
||||||
|
return this.http.get<PageData<AssetInfo>>(`/api/tenant/assetInfos${pageLink.toQuery()}&type=${type}`,
|
||||||
|
defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getCustomerAssetInfos(customerId: string, pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
|
||||||
|
ignoreLoading: boolean = false): Observable<PageData<AssetInfo>> {
|
||||||
|
return this.http.get<PageData<AssetInfo>>(`/api/customer/${customerId}/assetInfos${pageLink.toQuery()}&type=${type}`,
|
||||||
|
defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getAsset(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
|
||||||
|
return this.http.get<Asset>(`/api/asset/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getAssets(assetIds: Array<string>, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Array<Asset>> {
|
||||||
|
return this.http.get<Array<Asset>>(`/api/assets?assetIds=${assetIds.join(',')}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getAssetInfo(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<AssetInfo> {
|
||||||
|
return this.http.get<AssetInfo>(`/api/asset/info/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public saveAsset(asset: Asset, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
|
||||||
|
return this.http.post<Asset>('/api/asset', asset, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteAsset(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
|
||||||
|
return this.http.delete(`/api/asset/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getAssetTypes(ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Array<EntitySubtype>> {
|
||||||
|
return this.http.get<Array<EntitySubtype>>('/api/asset/types', defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public makeAssetPublic(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
|
||||||
|
return this.http.post<Asset>(`/api/customer/public/asset/${assetId}`, null, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public assignAssetToCustomer(customerId: string, assetId: string,
|
||||||
|
ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Asset> {
|
||||||
|
return this.http.post<Asset>(`/api/customer/${customerId}/asset/${assetId}`, null, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public unassignAssetFromCustomer(assetId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
|
||||||
|
return this.http.delete(`/api/customer/asset/${assetId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
83
ui-ngx/src/app/core/http/entity-view.service.ts
Normal file
83
ui-ngx/src/app/core/http/entity-view.service.ts
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
///
|
||||||
|
/// Copyright © 2016-2019 The Thingsboard Authors
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
|
||||||
|
import {Injectable} from '@angular/core';
|
||||||
|
import {defaultHttpOptions} from './http-utils';
|
||||||
|
import {Observable} from 'rxjs/index';
|
||||||
|
import {HttpClient} from '@angular/common/http';
|
||||||
|
import {PageLink} from '@shared/models/page/page-link';
|
||||||
|
import {PageData} from '@shared/models/page/page-data';
|
||||||
|
import {EntitySubtype} from '@app/shared/models/entity-type.models';
|
||||||
|
import {EntityView, EntityViewInfo} from '@app/shared/models/entity-view.models';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class EntityViewService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private http: HttpClient
|
||||||
|
) { }
|
||||||
|
|
||||||
|
public getTenantEntityViewInfos(pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
|
||||||
|
ignoreLoading: boolean = false): Observable<PageData<EntityViewInfo>> {
|
||||||
|
return this.http.get<PageData<EntityViewInfo>>(`/api/tenant/entityViewInfos${pageLink.toQuery()}&type=${type}`,
|
||||||
|
defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getCustomerEntityViewInfos(customerId: string, pageLink: PageLink, type: string = '', ignoreErrors: boolean = false,
|
||||||
|
ignoreLoading: boolean = false): Observable<PageData<EntityViewInfo>> {
|
||||||
|
return this.http.get<PageData<EntityViewInfo>>(`/api/customer/${customerId}/entityViewInfos${pageLink.toQuery()}&type=${type}`,
|
||||||
|
defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getEntityView(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
|
||||||
|
return this.http.get<EntityView>(`/api/entityView/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getEntityViewInfo(entityViewId: string, ignoreErrors: boolean = false,
|
||||||
|
ignoreLoading: boolean = false): Observable<EntityViewInfo> {
|
||||||
|
return this.http.get<EntityViewInfo>(`/api/entityView/info/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public saveEntityView(entityView: EntityView, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
|
||||||
|
return this.http.post<EntityView>('/api/entityView', entityView, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteEntityView(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
|
||||||
|
return this.http.delete(`/api/entityView/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getEntityViewTypes(ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<Array<EntitySubtype>> {
|
||||||
|
return this.http.get<Array<EntitySubtype>>('/api/entityView/types', defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public makeEntityViewPublic(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
|
||||||
|
return this.http.post<EntityView>(`/api/customer/public/entityView/${entityViewId}`, null,
|
||||||
|
defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public assignEntityViewToCustomer(customerId: string, entityViewId: string,
|
||||||
|
ignoreErrors: boolean = false, ignoreLoading: boolean = false): Observable<EntityView> {
|
||||||
|
return this.http.post<EntityView>(`/api/customer/${customerId}/entityView/${entityViewId}`, null,
|
||||||
|
defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public unassignEntityViewFromCustomer(entityViewId: string, ignoreErrors: boolean = false, ignoreLoading: boolean = false) {
|
||||||
|
return this.http.delete(`/api/customer/entityView/${entityViewId}`, defaultHttpOptions(ignoreLoading, ignoreErrors));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -35,6 +35,8 @@ import {Authority} from '@shared/models/authority.enum';
|
|||||||
import {Tenant} from '@shared/models/tenant.model';
|
import {Tenant} from '@shared/models/tenant.model';
|
||||||
import {concatMap, expand, map, toArray} from 'rxjs/operators';
|
import {concatMap, expand, map, toArray} from 'rxjs/operators';
|
||||||
import {Customer} from '@app/shared/models/customer.model';
|
import {Customer} from '@app/shared/models/customer.model';
|
||||||
|
import {AssetService} from '@core/http/asset.service';
|
||||||
|
import {EntityViewService} from '@core/http/entity-view.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -45,6 +47,8 @@ export class EntityService {
|
|||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private store: Store<AppState>,
|
private store: Store<AppState>,
|
||||||
private deviceService: DeviceService,
|
private deviceService: DeviceService,
|
||||||
|
private assetService: AssetService,
|
||||||
|
private entityViewService: EntityViewService,
|
||||||
private tenantService: TenantService,
|
private tenantService: TenantService,
|
||||||
private customerService: CustomerService,
|
private customerService: CustomerService,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
@ -60,10 +64,10 @@ export class EntityService {
|
|||||||
observable = this.deviceService.getDevice(entityId, ignoreErrors, ignoreLoading);
|
observable = this.deviceService.getDevice(entityId, ignoreErrors, ignoreLoading);
|
||||||
break;
|
break;
|
||||||
case EntityType.ASSET:
|
case EntityType.ASSET:
|
||||||
// TODO:
|
observable = this.assetService.getAsset(entityId, ignoreErrors, ignoreLoading);
|
||||||
break;
|
break;
|
||||||
case EntityType.ENTITY_VIEW:
|
case EntityType.ENTITY_VIEW:
|
||||||
// TODO:
|
observable = this.entityViewService.getEntityView(entityId, ignoreErrors, ignoreLoading);
|
||||||
break;
|
break;
|
||||||
case EntityType.TENANT:
|
case EntityType.TENANT:
|
||||||
observable = this.tenantService.getTenant(entityId, ignoreErrors, ignoreLoading);
|
observable = this.tenantService.getTenant(entityId, ignoreErrors, ignoreLoading);
|
||||||
@ -127,10 +131,12 @@ export class EntityService {
|
|||||||
observable = this.deviceService.getDevices(entityIds, ignoreErrors, ignoreLoading);
|
observable = this.deviceService.getDevices(entityIds, ignoreErrors, ignoreLoading);
|
||||||
break;
|
break;
|
||||||
case EntityType.ASSET:
|
case EntityType.ASSET:
|
||||||
// TODO:
|
observable = this.assetService.getAssets(entityIds, ignoreErrors, ignoreLoading);
|
||||||
break;
|
break;
|
||||||
case EntityType.ENTITY_VIEW:
|
case EntityType.ENTITY_VIEW:
|
||||||
// TODO:
|
observable = this.getEntitiesByIdsObservable(
|
||||||
|
(id) => this.entityViewService.getEntityView(id, ignoreErrors, ignoreLoading),
|
||||||
|
entityIds);
|
||||||
break;
|
break;
|
||||||
case EntityType.TENANT:
|
case EntityType.TENANT:
|
||||||
observable = this.getEntitiesByIdsObservable(
|
observable = this.getEntitiesByIdsObservable(
|
||||||
@ -233,17 +239,18 @@ export class EntityService {
|
|||||||
case EntityType.ASSET:
|
case EntityType.ASSET:
|
||||||
pageLink.sortOrder.property = 'name';
|
pageLink.sortOrder.property = 'name';
|
||||||
if (authUser.authority === Authority.CUSTOMER_USER) {
|
if (authUser.authority === Authority.CUSTOMER_USER) {
|
||||||
// TODO:
|
entitiesObservable = this.assetService.getCustomerAssetInfos(customerId, pageLink, subType, ignoreErrors, ignoreLoading);
|
||||||
} else {
|
} else {
|
||||||
// TODO:
|
entitiesObservable = this.assetService.getTenantAssetInfos(pageLink, subType, ignoreErrors, ignoreLoading);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EntityType.ENTITY_VIEW:
|
case EntityType.ENTITY_VIEW:
|
||||||
pageLink.sortOrder.property = 'name';
|
pageLink.sortOrder.property = 'name';
|
||||||
if (authUser.authority === Authority.CUSTOMER_USER) {
|
if (authUser.authority === Authority.CUSTOMER_USER) {
|
||||||
// TODO:
|
entitiesObservable = this.entityViewService.getCustomerEntityViewInfos(customerId, pageLink,
|
||||||
|
subType, ignoreErrors, ignoreLoading);
|
||||||
} else {
|
} else {
|
||||||
// TODO:
|
entitiesObservable = this.entityViewService.getTenantEntityViewInfos(pageLink, subType, ignoreErrors, ignoreLoading);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EntityType.TENANT:
|
case EntityType.TENANT:
|
||||||
|
|||||||
@ -24,6 +24,8 @@ import {DeviceService} from '@core/http/device.service';
|
|||||||
import {EntityId} from '@shared/models/id/entity-id';
|
import {EntityId} from '@shared/models/id/entity-id';
|
||||||
import {EntityType} from '@shared/models/entity-type.models';
|
import {EntityType} from '@shared/models/entity-type.models';
|
||||||
import {forkJoin, Observable} from 'rxjs';
|
import {forkJoin, Observable} from 'rxjs';
|
||||||
|
import {AssetService} from '@core/http/asset.service';
|
||||||
|
import {EntityViewService} from '@core/http/entity-view.service';
|
||||||
|
|
||||||
export interface AddEntitiesToCustomerDialogData {
|
export interface AddEntitiesToCustomerDialogData {
|
||||||
customerId: string;
|
customerId: string;
|
||||||
@ -50,6 +52,8 @@ export class AddEntitiesToCustomerDialogComponent extends PageComponent implemen
|
|||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: AddEntitiesToCustomerDialogData,
|
@Inject(MAT_DIALOG_DATA) public data: AddEntitiesToCustomerDialogData,
|
||||||
private deviceService: DeviceService,
|
private deviceService: DeviceService,
|
||||||
|
private assetService: AssetService,
|
||||||
|
private entityViewService: EntityViewService,
|
||||||
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
|
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
|
||||||
public dialogRef: MatDialogRef<AddEntitiesToCustomerDialogComponent, boolean>,
|
public dialogRef: MatDialogRef<AddEntitiesToCustomerDialogComponent, boolean>,
|
||||||
public fb: FormBuilder) {
|
public fb: FormBuilder) {
|
||||||
@ -107,10 +111,10 @@ export class AddEntitiesToCustomerDialogComponent extends PageComponent implemen
|
|||||||
return this.deviceService.assignDeviceToCustomer(customerId, entityId);
|
return this.deviceService.assignDeviceToCustomer(customerId, entityId);
|
||||||
break;
|
break;
|
||||||
case EntityType.ASSET:
|
case EntityType.ASSET:
|
||||||
// TODO:
|
return this.assetService.assignAssetToCustomer(customerId, entityId);
|
||||||
break;
|
break;
|
||||||
case EntityType.ENTITY_VIEW:
|
case EntityType.ENTITY_VIEW:
|
||||||
// TODO:
|
return this.entityViewService.assignEntityViewToCustomer(customerId, entityId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,8 @@ import {DeviceService} from '@core/http/device.service';
|
|||||||
import {EntityId} from '@shared/models/id/entity-id';
|
import {EntityId} from '@shared/models/id/entity-id';
|
||||||
import {EntityType} from '@shared/models/entity-type.models';
|
import {EntityType} from '@shared/models/entity-type.models';
|
||||||
import {forkJoin, Observable} from 'rxjs';
|
import {forkJoin, Observable} from 'rxjs';
|
||||||
|
import {AssetService} from '@core/http/asset.service';
|
||||||
|
import {EntityViewService} from '@core/http/entity-view.service';
|
||||||
|
|
||||||
export interface AssignToCustomerDialogData {
|
export interface AssignToCustomerDialogData {
|
||||||
entityIds: Array<EntityId>;
|
entityIds: Array<EntityId>;
|
||||||
@ -50,6 +52,8 @@ export class AssignToCustomerDialogComponent extends PageComponent implements On
|
|||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: AssignToCustomerDialogData,
|
@Inject(MAT_DIALOG_DATA) public data: AssignToCustomerDialogData,
|
||||||
private deviceService: DeviceService,
|
private deviceService: DeviceService,
|
||||||
|
private assetService: AssetService,
|
||||||
|
private entityViewService: EntityViewService,
|
||||||
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
|
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
|
||||||
public dialogRef: MatDialogRef<AssignToCustomerDialogComponent, boolean>,
|
public dialogRef: MatDialogRef<AssignToCustomerDialogComponent, boolean>,
|
||||||
public fb: FormBuilder) {
|
public fb: FormBuilder) {
|
||||||
@ -106,10 +110,10 @@ export class AssignToCustomerDialogComponent extends PageComponent implements On
|
|||||||
return this.deviceService.assignDeviceToCustomer(customerId, entityId);
|
return this.deviceService.assignDeviceToCustomer(customerId, entityId);
|
||||||
break;
|
break;
|
||||||
case EntityType.ASSET:
|
case EntityType.ASSET:
|
||||||
// TODO:
|
return this.assetService.assignAssetToCustomer(customerId, entityId);
|
||||||
break;
|
break;
|
||||||
case EntityType.ENTITY_VIEW:
|
case EntityType.ENTITY_VIEW:
|
||||||
// TODO:
|
return this.entityViewService.assignEntityViewToCustomer(customerId, entityId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,8 @@ import {DeviceService} from '@core/http/device.service';
|
|||||||
import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models';
|
import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models';
|
||||||
import {BroadcastService} from '@app/core/services/broadcast.service';
|
import {BroadcastService} from '@app/core/services/broadcast.service';
|
||||||
import {coerceBooleanProperty} from '@angular/cdk/coercion';
|
import {coerceBooleanProperty} from '@angular/cdk/coercion';
|
||||||
|
import {AssetService} from '@core/http/asset.service';
|
||||||
|
import {EntityViewService} from '@core/http/entity-view.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-entity-subtype-autocomplete',
|
selector: 'tb-entity-subtype-autocomplete',
|
||||||
@ -85,6 +87,8 @@ export class EntitySubTypeAutocompleteComponent implements ControlValueAccessor,
|
|||||||
private broadcast: BroadcastService,
|
private broadcast: BroadcastService,
|
||||||
public translate: TranslateService,
|
public translate: TranslateService,
|
||||||
private deviceService: DeviceService,
|
private deviceService: DeviceService,
|
||||||
|
private assetService: AssetService,
|
||||||
|
private entityViewService: EntityViewService,
|
||||||
private fb: FormBuilder) {
|
private fb: FormBuilder) {
|
||||||
this.subTypeFormGroup = this.fb.group({
|
this.subTypeFormGroup = this.fb.group({
|
||||||
subType: [null]
|
subType: [null]
|
||||||
@ -203,13 +207,13 @@ export class EntitySubTypeAutocompleteComponent implements ControlValueAccessor,
|
|||||||
if (!this.subTypes) {
|
if (!this.subTypes) {
|
||||||
switch (this.entityType) {
|
switch (this.entityType) {
|
||||||
case EntityType.ASSET:
|
case EntityType.ASSET:
|
||||||
// TODO:
|
this.subTypes = this.assetService.getAssetTypes(false, true);
|
||||||
break;
|
break;
|
||||||
case EntityType.DEVICE:
|
case EntityType.DEVICE:
|
||||||
this.subTypes = this.deviceService.getDeviceTypes(false, true);
|
this.subTypes = this.deviceService.getDeviceTypes(false, true);
|
||||||
break;
|
break;
|
||||||
case EntityType.ENTITY_VIEW:
|
case EntityType.ENTITY_VIEW:
|
||||||
// TODO:
|
this.subTypes = this.entityViewService.getEntityViewTypes(false, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.subTypes) {
|
if (this.subTypes) {
|
||||||
|
|||||||
@ -32,6 +32,8 @@ import {TranslateService} from '@ngx-translate/core';
|
|||||||
import {DeviceService} from '@core/http/device.service';
|
import {DeviceService} from '@core/http/device.service';
|
||||||
import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models';
|
import {EntitySubtype, EntityType} from '@app/shared/models/entity-type.models';
|
||||||
import {BroadcastService} from '@app/core/services/broadcast.service';
|
import {BroadcastService} from '@app/core/services/broadcast.service';
|
||||||
|
import {AssetService} from '@core/http/asset.service';
|
||||||
|
import {EntityViewService} from '@core/http/entity-view.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-entity-subtype-select',
|
selector: 'tb-entity-subtype-select',
|
||||||
@ -83,6 +85,8 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni
|
|||||||
private broadcast: BroadcastService,
|
private broadcast: BroadcastService,
|
||||||
public translate: TranslateService,
|
public translate: TranslateService,
|
||||||
private deviceService: DeviceService,
|
private deviceService: DeviceService,
|
||||||
|
private assetService: AssetService,
|
||||||
|
private entityViewService: EntityViewService,
|
||||||
private fb: FormBuilder) {
|
private fb: FormBuilder) {
|
||||||
this.subTypeFormGroup = this.fb.group({
|
this.subTypeFormGroup = this.fb.group({
|
||||||
subType: [null]
|
subType: [null]
|
||||||
@ -202,13 +206,13 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni
|
|||||||
if (!this.subTypes) {
|
if (!this.subTypes) {
|
||||||
switch (this.entityType) {
|
switch (this.entityType) {
|
||||||
case EntityType.ASSET:
|
case EntityType.ASSET:
|
||||||
// TODO:
|
this.subTypes = this.assetService.getAssetTypes(false, true);
|
||||||
break;
|
break;
|
||||||
case EntityType.DEVICE:
|
case EntityType.DEVICE:
|
||||||
this.subTypes = this.deviceService.getDeviceTypes(false, true);
|
this.subTypes = this.deviceService.getDeviceTypes(false, true);
|
||||||
break;
|
break;
|
||||||
case EntityType.ENTITY_VIEW:
|
case EntityType.ENTITY_VIEW:
|
||||||
// TODO:
|
this.subTypes = this.entityViewService.getEntityViewTypes(false, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.subTypes) {
|
if (this.subTypes) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user