Add 'Copy URL' button for number/chart URL(indicators) - dev only

This commit is contained in:
Alex Martzios 2021-12-07 16:59:13 +02:00
parent e2e43c6825
commit 04c064fa38
4 changed files with 43 additions and 9 deletions

@ -1 +1 @@
Subproject commit 2eb06717dd681898ef47da0f5da39a9005df3878
Subproject commit ca430fd89f7654bb71f52383bd52bf58e4c70e5f

View File

@ -290,11 +290,14 @@
<div class="uk-grid" uk-grid>
<div class="uk-width-1-1">
<div class="uk-grid" uk-grid>
<div class="uk-width-1-1">
<div class="uk-width-1-1 uk-flex uk-flex-between uk-flex-bottom">
<div dashboard-input [formInput]="indicatorPath.get('url')" label="Number URL"
placeholder="Write a URL">
placeholder="Write a URL" class='uk-width-1-1' id="numberURL">
<div *ngIf="urlParameterizedMessage" warning>{{urlParameterizedMessage}}</div>
</div>
<div *ngIf='properties.environment == "development"' class='uk-padding-small'>
<i class="clickable" uk-icon="copy" (click)="copyToClipboard('numberURL')" uk-tooltip="Copy URL"></i>
</div>
</div>
<div *ngIf="showCheckForSchemaEnhancements" class=" uk-width-1-1 ">
<div class="uk-alert uk-alert-warning">
@ -419,11 +422,16 @@
<div *ngIf="chartIndicatorPaths" formArrayName="indicatorPaths" class="uk-width-1-1">
<div *ngFor="let indicatorPath of chartIndicatorPaths.controls; let i=index;"
[formGroup]="indicatorPath" class="uk-grid" uk-grid>
<div dashboard-input class="uk-width-1-1"
[title]="indicatorPath.get('url').disabled?'Default chart URLs cannot change':''"
[formInput]="indicatorPath.get('url')" placeholder="Write a URL" label="Chart URL">
<div *ngIf="urlParameterizedMessage" warning>{{urlParameterizedMessage}}</div>
</div>
<div class="uk-width-1-1 uk-flex uk-flex-between uk-flex-bottom">
<div dashboard-input class="uk-width-1-1"
[title]="indicatorPath.get('url').disabled?'Default chart URLs cannot change':''"
[formInput]="indicatorPath.get('url')" placeholder="Write a URL" label="Chart URL" id="chartURL">
<div *ngIf="urlParameterizedMessage" warning>{{urlParameterizedMessage}}</div>
</div>
<div *ngIf='properties.environment == "development"' class='uk-padding-small'>
<i class="clickable" uk-icon="copy" (click)="copyToClipboard('chartURL')" uk-tooltip="Copy URL"></i>
</div>
</div>
<div *ngIf="showCheckForSchemaEnhancements" class=" uk-width-1-1 ">
<div class="uk-alert uk-alert-warning">
There are schema enchancements that can be applied in this query. <a

View File

@ -1415,4 +1415,30 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
xhr.send(formData);
});
}
copyToClipboard(val: string) {
if(val === 'numberURL') {
var inputElement = document.getElementById("numberURL").children[1].children[0].children[1].children[0] as HTMLInputElement;
}
if(val === 'chartURL') {
var inputElement = document.getElementById("chartURL").children[1].children[0].children[1].children[0] as HTMLInputElement;
}
const tempBox = document.createElement('textarea');
tempBox.style.position = 'fixed';
tempBox.style.left = '0';
tempBox.style.top = '0';
tempBox.style.opacity = '0';
tempBox.value = inputElement.value;
document.body.appendChild(tempBox);
tempBox.focus();
tempBox.select();
tempBox.setSelectionRange(0,99999);
document.execCommand('copy');
document.body.removeChild(tempBox);
UIkit.notification('Copied to clipboard', {
status: 'success',
timeout: 5000,
pos: 'bottom-right'
});
}
}

@ -1 +1 @@
Subproject commit 28db142aa54b8bea87ada52dbae2da7c7da8f458
Subproject commit 18d805e05fe839e143f9f1eeb9fd42f4dcea67d0