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