Commit 9b7d10804bb2ae485b4269283ece69e684e08b10
Committed by
GitHub
Merge pull request #1664 from pgrisu/features/allow-widget-timewindow-hiding
Allow widget timewindow hiding
Showing
9 changed files
with
19 additions
and
5 deletions
... | ... | @@ -979,7 +979,7 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $ |
979 | 979 | function hasTimewindow(widget) { |
980 | 980 | if (widget.type === types.widgetType.timeseries.value || widget.type === types.widgetType.alarm.value) { |
981 | 981 | return angular.isDefined(widget.config.useDashboardTimewindow) ? |
982 | - !widget.config.useDashboardTimewindow : false; | |
982 | + (!widget.config.useDashboardTimewindow && (angular.isUndefined(widget.config.displayTimewindow) || widget.config.displayTimewindow)) : false; | |
983 | 983 | } else { |
984 | 984 | return false; |
985 | 985 | } | ... | ... |
... | ... | @@ -124,6 +124,8 @@ function WidgetConfig($compile, $templateCache, $rootScope, $translate, $timeout |
124 | 124 | scope.decimals = config.decimals; |
125 | 125 | scope.useDashboardTimewindow = angular.isDefined(config.useDashboardTimewindow) ? |
126 | 126 | config.useDashboardTimewindow : true; |
127 | + scope.displayTimewindow = angular.isDefined(config.displayTimewindow) ? | |
128 | + config.displayTimewindow : true; | |
127 | 129 | scope.timewindow = config.timewindow; |
128 | 130 | scope.showLegend = angular.isDefined(config.showLegend) ? |
129 | 131 | config.showLegend : scope.widgetType === types.widgetType.timeseries.value; |
... | ... | @@ -230,7 +232,7 @@ function WidgetConfig($compile, $templateCache, $rootScope, $translate, $timeout |
230 | 232 | }; |
231 | 233 | |
232 | 234 | scope.$watch('title + showTitle + dropShadow + enableFullscreen + backgroundColor + color + ' + |
233 | - 'padding + margin + widgetStyle + titleStyle + mobileOrder + mobileHeight + units + decimals + useDashboardTimewindow + ' + | |
235 | + 'padding + margin + widgetStyle + titleStyle + mobileOrder + mobileHeight + units + decimals + useDashboardTimewindow + displayTimewindow + ' + | |
234 | 236 | 'alarmSearchStatus + alarmsPollingInterval + showLegend', function () { |
235 | 237 | if (ngModelCtrl.$viewValue) { |
236 | 238 | var value = ngModelCtrl.$viewValue; |
... | ... | @@ -257,6 +259,7 @@ function WidgetConfig($compile, $templateCache, $rootScope, $translate, $timeout |
257 | 259 | config.units = scope.units; |
258 | 260 | config.decimals = scope.decimals; |
259 | 261 | config.useDashboardTimewindow = scope.useDashboardTimewindow; |
262 | + config.displayTimewindow = scope.displayTimewindow; | |
260 | 263 | config.alarmSearchStatus = scope.alarmSearchStatus; |
261 | 264 | config.alarmsPollingInterval = scope.alarmsPollingInterval; |
262 | 265 | config.showLegend = scope.showLegend; | ... | ... |
... | ... | @@ -26,6 +26,9 @@ |
26 | 26 | <md-checkbox flex aria-label="{{ 'widget-config.use-dashboard-timewindow' | translate }}" |
27 | 27 | ng-model="useDashboardTimewindow">{{ 'widget-config.use-dashboard-timewindow' | translate }} |
28 | 28 | </md-checkbox> |
29 | + <md-checkbox ng-disabled="useDashboardTimewindow" flex aria-label="{{ 'widget-config.display-timewindow' | translate }}" | |
30 | + ng-model="displayTimewindow">{{ 'widget-config.display-timewindow' | translate }} | |
31 | + </md-checkbox> | |
29 | 32 | <section flex layout="row" layout-align="start center" style="margin-bottom: 16px;"> |
30 | 33 | <span ng-class="{'tb-disabled-label': useDashboardTimewindow}" translate style="padding-right: 8px;">widget-config.timewindow</span> |
31 | 34 | <tb-timewindow ng-disabled="useDashboardTimewindow" as-button="true" aggregation="{{ widgetType === types.widgetType.timeseries.value }}" | ... | ... |
... | ... | @@ -287,6 +287,9 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele |
287 | 287 | options.useDashboardTimewindow = angular.isDefined(widget.config.useDashboardTimewindow) |
288 | 288 | ? widget.config.useDashboardTimewindow : true; |
289 | 289 | |
290 | + options.displayTimewindow = angular.isDefined(widget.config.displayTimewindow) | |
291 | + ? widget.config.displayTimewindow : !options.useDashboardTimewindow; | |
292 | + | |
290 | 293 | options.timeWindowConfig = options.useDashboardTimewindow ? vm.dashboardTimewindow : widget.config.timewindow; |
291 | 294 | options.legendConfig = null; |
292 | 295 | |
... | ... | @@ -909,4 +912,4 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele |
909 | 912 | |
910 | 913 | } |
911 | 914 | |
912 | -/* eslint-enable angular/angularelement */ | |
\ No newline at end of file | ||
915 | +/* eslint-enable angular/angularelement */ | ... | ... |
... | ... | @@ -1515,6 +1515,7 @@ |
1515 | 1515 | "decimals": "Anzahl der Stellen nach dem Fließkomma", |
1516 | 1516 | "timewindow": "Zeitfenster", |
1517 | 1517 | "use-dashboard-timewindow": "Dashboard-Zeitfenster verwenden", |
1518 | + "display-timewindow": "Zeitfenster anzeigen", | |
1518 | 1519 | "display-legend": "Legende anzeigen", |
1519 | 1520 | "datasources": "Datenquellen", |
1520 | 1521 | "maximum-datasources": "Maximal { count, plural, 1 {1 Datenquelle ist erlaubt} other {# Datenquellen sind erlaubt} }.", | ... | ... |
... | ... | @@ -1526,6 +1526,7 @@ |
1526 | 1526 | "decimals": "Number of digits after floating point", |
1527 | 1527 | "timewindow": "Timewindow", |
1528 | 1528 | "use-dashboard-timewindow": "Use dashboard timewindow", |
1529 | + "display-timewindow": "Display timewindow", | |
1529 | 1530 | "display-legend": "Display legend", |
1530 | 1531 | "datasources": "Datasources", |
1531 | 1532 | "maximum-datasources": "Maximum { count, plural, 1 {1 datasource is allowed.} other {# datasources are allowed} }", | ... | ... |
... | ... | @@ -1515,6 +1515,7 @@ |
1515 | 1515 | "decimals": "Número de dígitos después del punto flotante", |
1516 | 1516 | "timewindow": "Ventana de tiempo", |
1517 | 1517 | "use-dashboard-timewindow": "Utilizar ventana de tiempo del panel", |
1518 | + "display-timewindow": "Mostrar ventana de tiempo", | |
1518 | 1519 | "display-legend": "Mostrar leyenda", |
1519 | 1520 | "datasources": "Orígenes de datos", |
1520 | 1521 | "maximum-datasources": "Máximo { count, plural, 1 {1 origen de datos permitido.} other {# origenes de datos permitidos} }", |
... | ... | @@ -1640,4 +1641,4 @@ |
1640 | 1641 | "uk_UA": "Ucraniano" |
1641 | 1642 | } |
1642 | 1643 | } |
1643 | -} | |
\ No newline at end of file | ||
1644 | +} | ... | ... |
... | ... | @@ -1405,6 +1405,7 @@ |
1405 | 1405 | "delete-action": "Supprimer l'action", |
1406 | 1406 | "delete-action-text": "Etes-vous sûr de vouloir supprimer l'action du widget nommé '{{actionName}}'?", |
1407 | 1407 | "delete-action-title": "Supprimer l'action du widget", |
1408 | + "display-timewindow": "Afficher fenêtre de temps", | |
1408 | 1409 | "display-legend": "Afficher la légende", |
1409 | 1410 | "display-title": "Afficher le titre", |
1410 | 1411 | "drop-shadow": "Ombre portée", |
... | ... | @@ -1523,4 +1524,4 @@ |
1523 | 1524 | "widgets-bundle-required": "Un groupe de widgets est requis.", |
1524 | 1525 | "widgets-bundles": "Groupes de widgets" |
1525 | 1526 | } |
1526 | -} | |
\ No newline at end of file | ||
1527 | +} | ... | ... |
... | ... | @@ -1520,6 +1520,7 @@ |
1520 | 1520 | "decimals": "Numero di cifre decimali", |
1521 | 1521 | "timewindow": "Intervallo temporale", |
1522 | 1522 | "use-dashboard-timewindow": "Usa intervallo temporale dashboard", |
1523 | + "display-timewindow": "Mostra intervallo temporale", | |
1523 | 1524 | "display-legend": "Mostra legenda", |
1524 | 1525 | "datasources": "Sorgenti dei dati", |
1525 | 1526 | "maximum-datasources": "Massimo { count, plural, 1 {1 sorgente dati consentita.} other {# sorgenti dati consentite} }", | ... | ... |