diff --git a/frontend/app/scripts/components/organisation/OrgConfigListCmp.js b/frontend/app/scripts/components/organisation/OrgConfigListCmp.js index f96da1fade..58c4b94f29 100644 --- a/frontend/app/scripts/components/organisation/OrgConfigListCmp.js +++ b/frontend/app/scripts/components/organisation/OrgConfigListCmp.js @@ -3,7 +3,7 @@ angular.module('theHiveComponents') .component('orgConfigList', { - controller: function($scope, $q, NotificationSrv, AlertingSrv, UiSettingsSrv) { + controller: function($scope, $q, $interval, NotificationSrv, AlertingSrv, UiSettingsSrv) { var self = this; self.alertSimilarityFilters = []; @@ -66,7 +66,19 @@ self.loadSettings(this.uiConfig); self.alertSimilarityFilters = AlertingSrv.getSimilarityFilters(); + + + self.timer = $interval(function() { + self.date = new moment(); + }, 1000); + }; + + self.$onDestroy = function() { + if(self.timer) { + $interval.cancel(self.timer); + } + } }, controllerAs: '$ctrl', templateUrl: 'views/components/org/config.list.html', diff --git a/frontend/app/scripts/filters/custom-field-value.js b/frontend/app/scripts/filters/custom-field-value.js index 583749dabd..91afae1e66 100644 --- a/frontend/app/scripts/filters/custom-field-value.js +++ b/frontend/app/scripts/filters/custom-field-value.js @@ -1,14 +1,16 @@ (function() { 'use strict'; - angular.module('theHiveFilters').filter('customFieldValue', function() { + angular.module('theHiveFilters').filter('customFieldValue', function(UiSettingsSrv) { return function(customField) { if(!customField) { return ''; } + var format = UiSettingsSrv.defaultDateFormat() + switch(customField.type) { case 'date': - return moment(customField.value).format('MM/DD/YY H:mm'); + return moment(customField.value).format(format); default: return customField.value; } diff --git a/frontend/app/scripts/filters/filter-value.js b/frontend/app/scripts/filters/filter-value.js index fa7aeee565..1cd5921b23 100644 --- a/frontend/app/scripts/filters/filter-value.js +++ b/frontend/app/scripts/filters/filter-value.js @@ -1,8 +1,10 @@ (function() { 'use strict'; - angular.module('theHiveFilters').filter('filterValue', function(UtilsSrv) { + angular.module('theHiveFilters').filter('filterValue', function(UtilsSrv, UiSettingsSrv) { return function(value) { + var dateFormat = UiSettingsSrv.defaultDateFormat(); + if (angular.isArray(value)) { return _.map(value, function(item) { return item.label || item.text; @@ -33,11 +35,11 @@ } if(start !== null) { - result.push('From: ' + moment(start).hour(0).minutes(0).seconds(0).format('MM/DD/YY HH:mm')); + result.push('From: ' + moment(start).hour(0).minutes(0).seconds(0).format(dateFormat)); } if(end !== null) { - result.push('To: ' + moment(end).hour(23).minutes(59).seconds(59).format('MM/DD/YY HH:mm')); + result.push('To: ' + moment(end).hour(23).minutes(59).seconds(59).format(dateFormat)); } return result.join(', '); diff --git a/frontend/app/scripts/filters/shortDate.js b/frontend/app/scripts/filters/shortDate.js index 45af6206e1..bbad28211a 100644 --- a/frontend/app/scripts/filters/shortDate.js +++ b/frontend/app/scripts/filters/shortDate.js @@ -1,8 +1,9 @@ (function() { 'use strict'; - angular.module('theHiveFilters').filter('shortDate', function() { + angular.module('theHiveFilters').filter('shortDate', function(UiSettingsSrv) { return function(str) { - var format = 'MM/DD/YY H:mm'; + var format = UiSettingsSrv.defaultDateFormat() || 'MM/DD/YY H:mm'; + if (angular.isString(str) && str.length > 0) { return moment(str, ['YYYYMMDDTHHmmZZ', 'DD-MM-YYYY HH:mm']).format(format); } else if (angular.isNumber(str)) { diff --git a/frontend/app/scripts/services/api/UiSettingsSrv.js b/frontend/app/scripts/services/api/UiSettingsSrv.js index 4ffaabd92b..22bd5fc97d 100644 --- a/frontend/app/scripts/services/api/UiSettingsSrv.js +++ b/frontend/app/scripts/services/api/UiSettingsSrv.js @@ -9,7 +9,8 @@ this.keys = [ 'hideEmptyCaseButton', 'disallowMergeAlertInResolvedSimilarCases', - 'defaultAlertSimilarCaseFilter' + 'defaultAlertSimilarCaseFilter', + 'defaultDateFormat' ]; this.clearCache = function() { diff --git a/frontend/app/views/components/org/config.list.html b/frontend/app/views/components/org/config.list.html index 7bcbfe2df3..a6ffcc7837 100644 --- a/frontend/app/views/components/org/config.list.html +++ b/frontend/app/views/components/org/config.list.html @@ -2,8 +2,8 @@
- -
+ +
- -
+ +