update displayed timestamps in vitrage dashboard according to horizon timezone
Change-Id: I8a0acc70b875de47585d76653c5db94de8c7f504
This commit is contained in:
parent
abd94a85f6
commit
05d1518d55
@ -5,9 +5,9 @@
|
|||||||
.module('horizon.dashboard.project.vitrage')
|
.module('horizon.dashboard.project.vitrage')
|
||||||
.controller('AlarmListController', AlarmListController);
|
.controller('AlarmListController', AlarmListController);
|
||||||
|
|
||||||
AlarmListController.$inject = ['$scope', 'modalSrv', 'vitrageTopologySrv', '$interval', '$location'];
|
AlarmListController.$inject = ['$scope', 'modalSrv', 'vitrageTopologySrv', 'timeSrv', '$interval', '$location'];
|
||||||
|
|
||||||
function AlarmListController($scope, modalSrv, vitrageTopologySrv, $interval, $location) {
|
function AlarmListController($scope, modalSrv, vitrageTopologySrv, timeSrv, $interval, $location) {
|
||||||
var alarmList = this;
|
var alarmList = this;
|
||||||
var LIMIT = horizon.cookies.get('API_RESULT_PAGE_SIZE') || 20;
|
var LIMIT = horizon.cookies.get('API_RESULT_PAGE_SIZE') || 20;
|
||||||
var filterTimeout;
|
var filterTimeout;
|
||||||
@ -28,6 +28,8 @@
|
|||||||
alarmList.checkboxAutoRefresh = true;
|
alarmList.checkboxAutoRefresh = true;
|
||||||
$scope.STATIC_URL = STATIC_URL;
|
$scope.STATIC_URL = STATIC_URL;
|
||||||
alarmList.format = 'dd-MMMM-yyyy';
|
alarmList.format = 'dd-MMMM-yyyy';
|
||||||
|
alarmList.timezone = timeSrv.getHorizonTimezone();
|
||||||
|
alarmList.dateFormat = timeSrv.longDateFormat;
|
||||||
alarmList.dateOptions = {
|
alarmList.dateOptions = {
|
||||||
dateDisabled: false,
|
dateDisabled: false,
|
||||||
formatYear: 'yy',
|
formatYear: 'yy',
|
||||||
|
@ -108,11 +108,9 @@ fa-angle-double-right prev-next-btn"
|
|||||||
{$alarm.vitrage_aggregated_severity |
|
{$alarm.vitrage_aggregated_severity |
|
||||||
lowercase$}
|
lowercase$}
|
||||||
</td>
|
</td>
|
||||||
<td class="column">{$alarm.start_timestamp | date:"yyyy-MM-dd
|
<td class="column">{$alarm.start_timestamp | vitrageDate:alarmList.dateFormat:alarmList.timezone $}
|
||||||
HH:mm:ss"$}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="column">{$alarm.end_timestamp | date:"yyyy-MM-dd
|
<td class="column">{$alarm.end_timestamp | vitrageDate:alarmList.dateFormat:alarmList.timezone $}
|
||||||
HH:mm:ss"$}
|
|
||||||
</td>
|
</td>
|
||||||
<td>{$alarm.name$}</td>
|
<td>{$alarm.name$}</td>
|
||||||
<td>{$alarm.vitrage_resource_type$}</td>
|
<td>{$alarm.vitrage_resource_type$}</td>
|
||||||
|
@ -13,11 +13,13 @@ function hzAlarms() {
|
|||||||
controllerAs: 'alarmsCtrl'
|
controllerAs: 'alarmsCtrl'
|
||||||
};
|
};
|
||||||
|
|
||||||
AlarmsController.$inject = ['$scope', 'modalSrv', 'vitrageTopologySrv'];
|
AlarmsController.$inject = ['$scope', 'modalSrv', 'timeSrv', 'vitrageTopologySrv'];
|
||||||
return directive;
|
return directive;
|
||||||
|
|
||||||
function AlarmsController($scope, modalSrv, vitrageTopologySrv) {
|
function AlarmsController($scope, modalSrv, timeSrv, vitrageTopologySrv) {
|
||||||
var alarmsCtrl = this;
|
var alarmsCtrl = this;
|
||||||
|
alarmsCtrl.timezone = timeSrv.getHorizonTimezone();
|
||||||
|
alarmsCtrl.dateFormat = timeSrv.longDateFormat;
|
||||||
|
|
||||||
$scope.$watch('selected', function(newData, oldData) {
|
$scope.$watch('selected', function(newData, oldData) {
|
||||||
if (newData != oldData) {
|
if (newData != oldData) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="alarm in alarmsCtrl.computeAlarms track by $index">
|
<tr ng-repeat="alarm in alarmsCtrl.computeAlarms track by $index">
|
||||||
<td title="{$ alarm.vitrage_aggregated_state $}"><i class="fa" ng-class="{'orange fa-exclamation-triangle': alarm.vitrage_operational_severity == 'SEVERE', 'yellow fa-exclamation-triangle': alarm.vitrage_operational_severity == 'WARNING', 'red fa-exclamation-circle': alarm.vitrage_operational_severity == 'CRITICAL', 'green fa-check': alarm.vitrage_operational_severity == 'OK', 'gray fa-circle-o-notch': alarm.vitrage_operational_severity == 'N/A'}"></i></td>
|
<td title="{$ alarm.vitrage_aggregated_state $}"><i class="fa" ng-class="{'orange fa-exclamation-triangle': alarm.vitrage_operational_severity == 'SEVERE', 'yellow fa-exclamation-triangle': alarm.vitrage_operational_severity == 'WARNING', 'red fa-exclamation-circle': alarm.vitrage_operational_severity == 'CRITICAL', 'green fa-check': alarm.vitrage_operational_severity == 'OK', 'gray fa-circle-o-notch': alarm.vitrage_operational_severity == 'N/A'}"></i></td>
|
||||||
<td title="{$alarm.update_timestamp | date:'yyyy-MM-dd HH:mm:ss'$}"><i class="fa fa-clock-o"></i> {$alarm.update_timestamp | date:"yyyy-MM-dd HH:mm:ss"$} </td>
|
<td title="{$alarm.update_timestamp | vitrageDate:alarmsCtrl.dateFormat:alarmsCtrl.timezone$}"><i class="fa fa-clock-o"></i> {$alarm.update_timestamp | vitrageDate:alarmsCtrl.dateFormat:alarmsCtrl.timezone$} </td>
|
||||||
<td class="ellipsis" title="{$alarm.name$}">{$alarm.name$}</td>
|
<td class="ellipsis" title="{$alarm.name$}">{$alarm.name$}</td>
|
||||||
<td title="{$ 'Root Cause Analysis' | translate $}" ng-click="alarmsCtrl.onAlarmClick(alarm)"><i class="fa fa-sitemap"></i></td>
|
<td title="{$ 'Root Cause Analysis' | translate $}" ng-click="alarmsCtrl.onAlarmClick(alarm)"><i class="fa fa-sitemap"></i></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -2,9 +2,9 @@ angular
|
|||||||
.module('horizon.dashboard.project.vitrage')
|
.module('horizon.dashboard.project.vitrage')
|
||||||
.directive('hzRootCauseAnalysisGraph', hzRootCauseAnalysisGraph);
|
.directive('hzRootCauseAnalysisGraph', hzRootCauseAnalysisGraph);
|
||||||
|
|
||||||
hzRootCauseAnalysisGraph.$inject = ['$filter'];
|
hzRootCauseAnalysisGraph.$inject = ['$filter', 'timeSrv'];
|
||||||
|
|
||||||
function hzRootCauseAnalysisGraph($filter) {
|
function hzRootCauseAnalysisGraph($filter, timeSrv) {
|
||||||
var directive = {
|
var directive = {
|
||||||
link: link,
|
link: link,
|
||||||
templateUrl: STATIC_URL + 'dashboard/project/components/rca/rootCauseAnalysisGraph.html',
|
templateUrl: STATIC_URL + 'dashboard/project/components/rca/rootCauseAnalysisGraph.html',
|
||||||
@ -14,6 +14,8 @@ function hzRootCauseAnalysisGraph($filter) {
|
|||||||
|
|
||||||
function link(scope, element, attr, ctrl) {
|
function link(scope, element, attr, ctrl) {
|
||||||
scope.STATIC_URL = STATIC_URL;
|
scope.STATIC_URL = STATIC_URL;
|
||||||
|
scope.timezone = timeSrv.getHorizonTimezone();
|
||||||
|
scope.dateFormat = timeSrv.rcaDateFormat;
|
||||||
var lastSelectedNode = {id: "", value: ""};
|
var lastSelectedNode = {id: "", value: ""};
|
||||||
|
|
||||||
function setSelected(u) {
|
function setSelected(u) {
|
||||||
@ -114,7 +116,7 @@ function hzRootCauseAnalysisGraph($filter) {
|
|||||||
alertSeverity = key.severity, //WARNING
|
alertSeverity = key.severity, //WARNING
|
||||||
alertOperationalSeverity = key.vitrage_operational_severity ? key.vitrage_operational_severity.toUpperCase() : key.vitrage_operational_severity, //WARNING
|
alertOperationalSeverity = key.vitrage_operational_severity ? key.vitrage_operational_severity.toUpperCase() : key.vitrage_operational_severity, //WARNING
|
||||||
alertState = key.state ? key.state.toUpperCase() : key.state, //Active
|
alertState = key.state ? key.state.toUpperCase() : key.state, //Active
|
||||||
alertTimeStamp = $filter('date')(key.update_timestamp, 'MM/dd/yyyy h:mma'), //2015-12-01T12:46:41Z
|
alertTimeStamp = $filter('vitrageDate')(key.update_timestamp, scope.dateFormat, scope.timezone), //2015-12-01T12:46:41Z
|
||||||
alertType = key.vitrage_type, //nagios
|
alertType = key.vitrage_type, //nagios
|
||||||
alertVitrageId = key.vitrage_id;
|
alertVitrageId = key.vitrage_id;
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
.module('horizon.dashboard.project.vitrage')
|
.module('horizon.dashboard.project.vitrage')
|
||||||
.controller('EntitiesController', EntitiesController);
|
.controller('EntitiesController', EntitiesController);
|
||||||
|
|
||||||
EntitiesController.$inject = ['$scope', 'vitrageTopologySrv', '$interval', '$location', '$timeout'];
|
EntitiesController.$inject = ['$scope', 'vitrageTopologySrv', 'timeSrv', '$interval', '$location', '$timeout'];
|
||||||
|
|
||||||
function EntitiesController($scope, vitrageTopologySrv, $interval, $location, $timeout) {
|
function EntitiesController($scope, vitrageTopologySrv, timeSrv, $interval, $location, $timeout) {
|
||||||
this.model = {selected: {}};
|
this.model = {selected: {}};
|
||||||
|
|
||||||
var _this = this,
|
var _this = this,
|
||||||
@ -15,7 +15,9 @@
|
|||||||
errorCount = 0,
|
errorCount = 0,
|
||||||
loadInterval,
|
loadInterval,
|
||||||
initialized = false,
|
initialized = false,
|
||||||
timeoutSubscriber;
|
timeoutSubscriber,
|
||||||
|
timezone = timeSrv.getHorizonTimezone(),
|
||||||
|
dateFormat = timeSrv.longDateFormat;
|
||||||
|
|
||||||
|
|
||||||
$scope.$watch('automaticRefresh', function (newData, oldData) {
|
$scope.$watch('automaticRefresh', function (newData, oldData) {
|
||||||
@ -48,6 +50,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on('graphItemClicked', function (event, data) {
|
$scope.$on('graphItemClicked', function (event, data) {
|
||||||
|
data.timezone = timezone;
|
||||||
|
data.dateFormat = dateFormat;
|
||||||
_this.selectedItem = data;
|
_this.selectedItem = data;
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
|
@ -2,7 +2,9 @@ angular
|
|||||||
.module('horizon.dashboard.project.vitrage')
|
.module('horizon.dashboard.project.vitrage')
|
||||||
.directive('hzEntitiesInfo', hzEntitiesInfo);
|
.directive('hzEntitiesInfo', hzEntitiesInfo);
|
||||||
|
|
||||||
function hzEntitiesInfo() {
|
hzEntitiesInfo.$inject = ['$filter'];
|
||||||
|
|
||||||
|
function hzEntitiesInfo($filter) {
|
||||||
var directive = {
|
var directive = {
|
||||||
link: link,
|
link: link,
|
||||||
templateUrl: STATIC_URL + 'dashboard/project/entities/info/entities-info.html',
|
templateUrl: STATIC_URL + 'dashboard/project/entities/info/entities-info.html',
|
||||||
@ -15,7 +17,8 @@ function hzEntitiesInfo() {
|
|||||||
|
|
||||||
function link(scope, element, attrs) {
|
function link(scope, element, attrs) {
|
||||||
scope.blackList = ['is_real_vitrage_id', 'vitrage_is_deleted', 'vitrage_is_placeholder', 'index', 'graph_index',
|
scope.blackList = ['is_real_vitrage_id', 'vitrage_is_deleted', 'vitrage_is_placeholder', 'index', 'graph_index',
|
||||||
'fixed', 'weight', 'px', 'py', 'x', 'y', 'width', 'height', 'bbox', 'high', 'highDepth', 'datasource_name'];
|
'fixed', 'weight', 'px', 'py', 'x', 'y', 'width', 'height', 'bbox', 'high', 'highDepth', 'datasource_name',
|
||||||
|
'dateFormat', 'timezone'];
|
||||||
scope.parseItem = {};
|
scope.parseItem = {};
|
||||||
|
|
||||||
// TODO: Order info by this priority
|
// TODO: Order info by this priority
|
||||||
@ -34,10 +37,14 @@ function hzEntitiesInfo() {
|
|||||||
var parsedProperty = '';
|
var parsedProperty = '';
|
||||||
parsedProperty= property.split("_").join(" ");
|
parsedProperty= property.split("_").join(" ");
|
||||||
parsedProperty = parsedProperty.charAt(0).toUpperCase() + parsedProperty.substr(1).toLowerCase();
|
parsedProperty = parsedProperty.charAt(0).toUpperCase() + parsedProperty.substr(1).toLowerCase();
|
||||||
|
if (parsedProperty.includes('timestamp')) {
|
||||||
|
itemParsed[parsedProperty] = $filter('vitrageDate')(tmpItem[property], tmpItem['dateFormat'], tmpItem['timezone']);
|
||||||
|
} else {
|
||||||
itemParsed[parsedProperty] = tmpItem[property];
|
itemParsed[parsedProperty] = tmpItem[property];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scope.parseItem = itemParsed;
|
scope.parseItem = itemParsed;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
angular.module('horizon.dashboard.project.vitrage')
|
||||||
|
.filter('vitrageDate', vitrageDate);
|
||||||
|
|
||||||
|
function vitrageDate($filter, timeSrv){
|
||||||
|
return function(text, format = timeSrv.longDateFormat, timezone = ''){
|
||||||
|
var tempdate = '';
|
||||||
|
if (text) {
|
||||||
|
tempdate= new Date(text);
|
||||||
|
}
|
||||||
|
if (!timezone) {
|
||||||
|
timezone = timeSrv.getHorizonTimezone();
|
||||||
|
}
|
||||||
|
return $filter('date')(tempdate, format, timezone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vitrageDate.$inject = ['$filter', 'timeSrv'];
|
@ -0,0 +1,26 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.project.vitrage')
|
||||||
|
.service('timeSrv', TimeSrv);
|
||||||
|
|
||||||
|
function TimeSrv() {
|
||||||
|
|
||||||
|
function getHorizonTimezone() {
|
||||||
|
var timezone = horizon.cookies.get('django_timezone');
|
||||||
|
if (timezone) {
|
||||||
|
timezone = timezone.replace(/"/g,'');
|
||||||
|
} else {
|
||||||
|
timezone = 'UTC';
|
||||||
|
}
|
||||||
|
return moment.tz(timezone).format('ZZ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
getHorizonTimezone: getHorizonTimezone,
|
||||||
|
longDateFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||||
|
rcaDateFormat: 'MM/dd/yyyy h:mma'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
@ -5,9 +5,9 @@
|
|||||||
.module('horizon.dashboard.project.vitrage')
|
.module('horizon.dashboard.project.vitrage')
|
||||||
.controller('TemplateListController', TemplateListController);
|
.controller('TemplateListController', TemplateListController);
|
||||||
|
|
||||||
TemplateListController.$inject = ['$scope', '$interval', 'modalSrv', 'vitrageTopologySrv'];
|
TemplateListController.$inject = ['$scope', '$interval', 'modalSrv', 'timeSrv', 'vitrageTopologySrv'];
|
||||||
|
|
||||||
function TemplateListController($scope, $interval, modalSrv, vitrageTopologySrv)
|
function TemplateListController($scope, $interval, modalSrv, timeSrv, vitrageTopologySrv)
|
||||||
{
|
{
|
||||||
var templateList = this;
|
var templateList = this;
|
||||||
templateList.templates = [];
|
templateList.templates = [];
|
||||||
@ -17,6 +17,8 @@
|
|||||||
templateList.$interval = $interval;
|
templateList.$interval = $interval;
|
||||||
templateList.checkboxAutoRefresh = true;
|
templateList.checkboxAutoRefresh = true;
|
||||||
templateList.templateInterval;
|
templateList.templateInterval;
|
||||||
|
templateList.timezone = timeSrv.getHorizonTimezone();
|
||||||
|
templateList.dateFormat = timeSrv.longDateFormat;
|
||||||
|
|
||||||
getData();
|
getData();
|
||||||
startCollectData();
|
startCollectData();
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<td>{$template.status$}</td>
|
<td>{$template.status$}</td>
|
||||||
<td>{$template.type$}</td>
|
<td>{$template.type$}</td>
|
||||||
<td>{$template["status details"]$}</td>
|
<td>{$template["status details"]$}</td>
|
||||||
<td><i class="fa fa-clock-o"></i> {$template.date | date:"yyyy-MM-dd hh:mm:ss"$}</td>
|
<td><i class="fa fa-clock-o"></i> {$template.date | vitrageDate:templateList.dateFormat:templateList.timezone$}</td>
|
||||||
<td ng-click="templateList.onShowClick(template)"><i class="fa fa-list"></i></td>
|
<td ng-click="templateList.onShowClick(template)"><i class="fa fa-list"></i></td>
|
||||||
<td ng-click="templateList.onDeleteClick(template)"><i class="fa fa-trash"></i></td>
|
<td ng-click="templateList.onDeleteClick(template)"><i class="fa fa-trash"></i></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
4506
vitrage_dashboard/dashboard/static/vendor/moment/moment.js
vendored
Normal file
4506
vitrage_dashboard/dashboard/static/vendor/moment/moment.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user