ref: one codebase for hover tooltip and freezed tooltip

- rename variables for URL template, use templateSrv to render URL links
- fix visibility of tooltip items and url template help popup whe the light theme is used
- rework Tooltip settings pane, organize tooltip editor fields
- rename properties in panel config, implement migration logic for legacy configuration
- close button for the frozen tooltip
- use relative positioning for proper page scrolling
This commit is contained in:
Ivan Mikheykin
2020-07-09 13:16:09 +03:00
parent 4e281e53d5
commit 8c7279561d
44 changed files with 3967 additions and 1513 deletions
+61
View File
@@ -0,0 +1,61 @@
import { StatusHeatmapCtrl } from './module';
let emptyTooltipItem = {
urlText: '',
urlTemplate: '',
urlIcon: 'external-link',
urlToLowerCase: true,
valueDateFormat: ''
};
export class TooltipEditorCtrl {
panel: any;
panelCtrl: StatusHeatmapCtrl;
constructor($scope: any) {
$scope.editor = this;
this.panelCtrl = $scope.ctrl as StatusHeatmapCtrl;
this.panel = this.panelCtrl.panel;
}
render() {
this.panelCtrl.render();
}
onAddUrl() {
this.panel.tooltip.items.push(Object.assign({}, emptyTooltipItem));
this.render();
}
onRemoveUrl(index: number) {
this.panel.tooltip.items.splice(index, 1);
this.render();
}
onRemoveUrls() {
this.panel.tooltip.items = [];
this.render();
}
getFAIconClasses() {
return ['external-link', 'plus', 'anchor', 'ban', 'globe', 'gear', 'cloud', 'download', 'cloud-download'];
}
getValueDateFormats() {
return [
'YYYY/MM/DD/HH_mm_ss',
'YYYYMMDDHHmmss',
'YYYY-MM-DD-HH-mm-ss'
];
}
}
export function tooltipEditorCtrl() {
'use strict';
return {
restrict: 'E',
scope: true,
templateUrl: 'public/plugins/flant-statusmap-panel/partials/tooltip_editor.html',
controller: TooltipEditorCtrl,
};
}