thingsboard/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.ts

64 lines
2.0 KiB
TypeScript
Raw Normal View History

2020-09-02 18:32:57 +03:00
///
2025-02-25 09:39:16 +02:00
/// Copyright © 2016-2025 The Thingsboard Authors
2020-09-02 18:32:57 +03:00
///
/// 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 { Component, DestroyRef, OnInit } from '@angular/core';
2020-09-02 18:32:57 +03:00
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityTabsComponent } from '../../components/entity/entity-tabs.component';
2020-10-09 18:06:22 +03:00
import {
DeviceProfile,
DeviceTransportType,
deviceTransportTypeHintMap,
deviceTransportTypeTranslationMap
} from '@shared/models/device.models';
2024-12-19 11:38:26 +02:00
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
2020-09-02 18:32:57 +03:00
@Component({
selector: 'tb-device-profile-tabs',
templateUrl: './device-profile-tabs.component.html',
styleUrls: []
})
export class DeviceProfileTabsComponent extends EntityTabsComponent<DeviceProfile> implements OnInit {
2020-09-02 18:32:57 +03:00
deviceTransportTypes = Object.values(DeviceTransportType);
2020-10-09 18:06:22 +03:00
deviceTransportTypeTranslations = deviceTransportTypeTranslationMap;
2020-10-09 18:06:22 +03:00
deviceTransportTypeHints = deviceTransportTypeHintMap;
isTransportTypeChanged = false;
2024-12-19 11:38:26 +02:00
constructor(protected store: Store<AppState>,
private destroyRef: DestroyRef) {
2020-09-02 18:32:57 +03:00
super(store);
}
ngOnInit() {
super.ngOnInit();
2024-12-19 11:38:26 +02:00
this.detailsForm.get('transportType').valueChanges.pipe(
takeUntilDestroyed(this.destroyRef)
).subscribe(() => {
this.isTransportTypeChanged = true;
});
2020-09-02 18:32:57 +03:00
}
protected setEntity(entity: DeviceProfile) {
this.isTransportTypeChanged = false;
super.setEntity(entity);
}
2020-09-02 18:32:57 +03:00
}