mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Filter dates with moment.js instead of built-in angular date filter
This commit is contained in:
parent
1768001881
commit
73916ade45
@ -7,11 +7,11 @@
|
||||
export default ['$filter', '$state', '$stateParams', '$http', 'Wait',
|
||||
'$scope', '$rootScope', 'CreateSelect2', 'ParseTypeChange', 'GetBasePath',
|
||||
'Rest', 'ParentObject', 'JobTemplateModel', '$q', 'Empty', 'SchedulePost',
|
||||
'ProcessErrors', 'SchedulerInit', '$location', 'PromptService', 'RRuleToAPI',
|
||||
'ProcessErrors', 'SchedulerInit', '$location', 'PromptService', 'RRuleToAPI', 'moment',
|
||||
function($filter, $state, $stateParams, $http, Wait,
|
||||
$scope, $rootScope, CreateSelect2, ParseTypeChange, GetBasePath,
|
||||
Rest, ParentObject, JobTemplate, $q, Empty, SchedulePost,
|
||||
ProcessErrors, SchedulerInit, $location, PromptService, RRuleToAPI) {
|
||||
ProcessErrors, SchedulerInit, $location, PromptService, RRuleToAPI, moment) {
|
||||
|
||||
var base = $scope.base || $location.path().replace(/^\//, '').split('/')[0],
|
||||
scheduler,
|
||||
@ -322,12 +322,12 @@ export default ['$filter', '$state', '$stateParams', '$http', 'Wait',
|
||||
|
||||
$http.post('/api/v2/schedules/preview/', {'rrule': req})
|
||||
.then(({data}) => {
|
||||
|
||||
$scope.preview_list = data;
|
||||
for (let tz in data) {
|
||||
$scope.preview_list.isEmpty = data[tz].length === 0;
|
||||
$scope.preview_list[tz] = data[tz].map(function(date) {
|
||||
return date.replace(/Z/, '');
|
||||
date = date.replace(/Z/, '');
|
||||
return moment.parseZone(date).format("MM-DD-YYYY HH:mm:ss");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
export default ['$filter', '$state', '$stateParams', 'Wait', '$scope',
|
||||
export default ['$filter', '$state', '$stateParams', 'Wait', '$scope', 'moment',
|
||||
'$rootScope', '$http', 'CreateSelect2', 'ParseTypeChange', 'ParentObject', 'ProcessErrors', 'Rest',
|
||||
'GetBasePath', 'SchedulerInit', 'SchedulePost', 'JobTemplateModel', '$q', 'Empty', 'PromptService', 'RRuleToAPI',
|
||||
function($filter, $state, $stateParams, Wait, $scope,
|
||||
function($filter, $state, $stateParams, Wait, $scope, moment,
|
||||
$rootScope, $http, CreateSelect2, ParseTypeChange, ParentObject, ProcessErrors, Rest,
|
||||
GetBasePath, SchedulerInit, SchedulePost, JobTemplate, $q, Empty, PromptService, RRuleToAPI) {
|
||||
|
||||
@ -95,7 +95,8 @@ function($filter, $state, $stateParams, Wait, $scope,
|
||||
for (let tz in data) {
|
||||
$scope.preview_list.isEmpty = data[tz].length === 0;
|
||||
$scope.preview_list[tz] = data[tz].map(function(date) {
|
||||
return date.replace(/Z/, '');
|
||||
date = date.replace(/Z/, '');
|
||||
return moment.parseZone(date).format("MM-DD-YYYY HH:mm:ss");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -630,14 +630,14 @@
|
||||
SchedulerFormDetail-occurrenceList"
|
||||
ng-show="dateChoice == 'utc'">
|
||||
<li ng-repeat="occurrence in preview_list.utc">
|
||||
{{ occurrence | date:'MM-dd-yyyy HH:mm:ss'}} UTC
|
||||
{{ occurrence }} UTC
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="occurrence-list mono-space
|
||||
SchedulerFormDetail-occurrenceList"
|
||||
ng-show="dateChoice == 'local'">
|
||||
<li ng-repeat="occurrence in preview_list.local">
|
||||
{{ occurrence | date:'MM-dd-yyyy HH:mm:ss'}}
|
||||
{{ occurrence }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user