diff --git a/ui-ngx/src/app/modules/home/pages/device/device.component.ts b/ui-ngx/src/app/modules/home/pages/device/device.component.ts
index 833919eb78..74503bfddb 100644
--- a/ui-ngx/src/app/modules/home/pages/device/device.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/device/device.component.ts
@@ -21,10 +21,9 @@ import { EntityComponent } from '../../components/entity/entity.component';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import {
createDeviceConfiguration,
- createDeviceProfileConfiguration, createDeviceTransportConfiguration,
+ createDeviceTransportConfiguration,
DeviceData,
DeviceInfo,
- DeviceProfileData,
DeviceProfileInfo,
DeviceProfileType,
DeviceTransportType
@@ -33,8 +32,6 @@ import { EntityType } from '@shared/models/entity-type.models';
import { NULL_UUID } from '@shared/models/id/has-uuid';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { TranslateService } from '@ngx-translate/core';
-import { DeviceService } from '@core/http/device.service';
-import { ClipboardService } from 'ngx-clipboard';
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
@Component({
@@ -46,12 +43,12 @@ export class DeviceComponent extends EntityComponent
{
entityType = EntityType;
+ componentsData: any;
+
deviceScope: 'tenant' | 'customer' | 'customer_user';
constructor(protected store: Store,
protected translate: TranslateService,
- private deviceService: DeviceService,
- private clipboardService: ClipboardService,
@Inject('entity') protected entityValue: DeviceInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig,
public fb: FormBuilder) {
@@ -60,6 +57,7 @@ export class DeviceComponent extends EntityComponent {
ngOnInit() {
this.deviceScope = this.entitiesTableConfig.componentsData.deviceScope;
+ this.componentsData = this.entitiesTableConfigValue.componentsData;
super.ngOnInit();
}
@@ -114,26 +112,6 @@ export class DeviceComponent extends EntityComponent {
}));
}
- copyAccessToken($event) {
- if (this.entity.id) {
- this.deviceService.getDeviceCredentials(this.entity.id.id, true).subscribe(
- (deviceCredentials) => {
- const credentialsId = deviceCredentials.credentialsId;
- if (this.clipboardService.copyFromContent(credentialsId)) {
- this.store.dispatch(new ActionNotificationShow(
- {
- message: this.translate.instant('device.accessTokenCopiedMessage'),
- type: 'success',
- duration: 750,
- verticalPosition: 'bottom',
- horizontalPosition: 'right'
- }));
- }
- }
- );
- }
- }
-
onDeviceProfileUpdated() {
this.entitiesTableConfig.table.updateData(false);
}
diff --git a/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts
index 0aaf8e62e7..b04bf13d44 100644
--- a/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts
+++ b/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts
@@ -63,6 +63,7 @@ import { DeviceTabsComponent } from '@home/pages/device/device-tabs.component';
import { HomeDialogsService } from '@home/dialogs/home-dialogs.service';
import { DeviceWizardDialogComponent } from '@home/components/wizard/device-wizard-dialog.component';
import { BaseData, HasId } from '@shared/models/base-data';
+import { isDefinedAndNotNull } from '@core/utils';
@Injectable()
export class DevicesTableConfigResolver implements Resolve> {
@@ -115,7 +116,8 @@ export class DevicesTableConfigResolver implements Resolve {
+ if (isDefinedAndNotNull(deviceCredential)) {
+ this.config.componentsData.deviceCredential = deviceCredential;
+ this.config.table.onEntityUpdated(device);
+ }
});
}
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index 41243f885e..a8ed24f03d 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -841,8 +841,10 @@
"details": "Details",
"copyId": "Copy device Id",
"copyAccessToken": "Copy access token",
+ "copy-mqtt-authentication": "Copy MQTT authentication",
"idCopiedMessage": "Device Id has been copied to clipboard",
"accessTokenCopiedMessage": "Device access token has been copied to clipboard",
+ "mqtt-authentication-copied-message": "Device MQTT authentication has been copied to clipboard",
"assignedToCustomer": "Assigned to customer",
"unable-delete-device-alias-title": "Unable to delete device alias",
"unable-delete-device-alias-text": "Device alias '{{deviceAlias}}' can't be deleted as it used by the following widget(s):
{{widgetsList}}",