Commit 9b7d10804bb2ae485b4269283ece69e684e08b10

Authored by Igor Kulikov
Committed by GitHub
2 parents 6826ca8b 7383eee2

Merge pull request #1664 from pgrisu/features/allow-widget-timewindow-hiding

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