Browse Source

Merge pull request #8447 from ArtemDzhereleiko/AD/imp/attribute-copy-button

Copy button for attribute table
pull/8469/head
Igor Kulikov 3 years ago
committed by GitHub
parent
commit
e777c1db39
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html
  2. 17
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.scss
  3. 4
      ui-ngx/src/assets/locale/locale.constant-en_US.json

34
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html

@ -160,17 +160,41 @@
</ng-container>
<ng-container matColumnDef="key">
<mat-header-cell *matHeaderCellDef mat-sort-header style="width: 40%"> {{ 'attribute.key' | translate }} </mat-header-cell>
<mat-cell *matCellDef="let attribute">
{{ attribute.key }}
<mat-cell *matCellDef="let attribute" class="attribute">
<div fxLayout="row" style="align-items: center">
<span class="ellipsis">{{ attribute.key }}</span>
<tb-copy-button
class="attribute-copy"
[disabled]="isLoading$ | async"
[copyText]="attribute.key"
tooltipText="{{ 'attribute.copy-key' | translate }}"
tooltipPosition="above"
icon="content_copy"
[style]="{padding: '4px', 'font-size': '16px', color: 'rgba(0,0,0,.87)'}"
>
</tb-copy-button>
</div>
</mat-cell>
</ng-container>
<ng-container matColumnDef="value">
<mat-header-cell *matHeaderCellDef style="width: 60%"> {{ 'attribute.value' | translate }} </mat-header-cell>
<mat-cell *matCellDef="let attribute"
class="tb-value-cell"
class="tb-value-cell attribute"
(click)="editAttribute($event, attribute)">
<div fxLayout="row" style="align-items: center">
<span style="overflow: hidden;text-overflow: ellipsis;" fxFlex>{{attribute.value | tbJson}}</span>
<div fxFlex fxLayout="row" style="align-items: center">
<div fxFlex fxLayout="row" style="overflow: hidden; align-items: center;">
<span class="ellipsis">{{attribute.value | tbJson}}</span>
<tb-copy-button
class="attribute-copy"
[disabled]="isLoading$ | async"
[copyText]="attribute.value | tbJson"
tooltipText="{{ 'attribute.copy-value' | translate }}"
tooltipPosition="above"
icon="content_copy"
[style]="{padding: '4px', 'font-size': '16px', color: 'rgba(0,0,0,.87)'}"
>
</tb-copy-button>
</div>
<span [fxShow]="!isClientSideTelemetryTypeMap.get(attributeScope)">
<mat-icon>edit</mat-icon>
</span>

17
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.scss

@ -51,6 +51,7 @@
overflow: auto;
.mat-mdc-table {
table-layout: fixed;
min-width: 450px;
}
}
@ -65,6 +66,22 @@
overflow: hidden;
text-overflow: ellipsis;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
}
.attribute-copy {
visibility: hidden;
transition: visibility 0.1s;
}
.attribute:hover {
.attribute-copy {
visibility: visible;
}
}
}
}

4
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -691,7 +691,9 @@
"selected-attributes": "{ count, plural, =1 {1 attribute} other {# attributes} } selected",
"selected-telemetry": "{ count, plural, =1 {1 telemetry unit} other {# telemetry units} } selected",
"no-attributes-text": "No attributes found",
"no-telemetry-text": "No telemetry found"
"no-telemetry-text": "No telemetry found",
"copy-key": "Copy key",
"copy-value": "Copy value"
},
"api-usage": {
"api-features": "API features",

Loading…
Cancel
Save