mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
Latest inventory group dialog changes. Finished styling schedule widget slide-in.
This commit is contained in:
parent
7ba7d3c940
commit
df696b0199
@ -544,7 +544,8 @@ function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Re
|
||||
|
||||
// Clean up
|
||||
$('#schedules-list').hide().empty();
|
||||
$('#schedules-form').hide().empty();
|
||||
$('#schedules-form-container').hide();
|
||||
$('#schedules-form').empty();
|
||||
$('.tooltip').each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
@ -556,11 +557,12 @@ function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Re
|
||||
list = angular.copy(SchedulesList);
|
||||
delete list.fields.dtend;
|
||||
delete list.actions.stream;
|
||||
list.well = false;
|
||||
scope = GenerateList.inject(list, {
|
||||
mode: 'edit',
|
||||
id: 'schedules-list',
|
||||
breadCrumbs: false,
|
||||
searchSize: 'col-lg-5 col-md-5 col-sm-6 col-xs-6'
|
||||
searchSize: 'col-lg-6 col-md-5 col-sm-5 col-xs-5'
|
||||
});
|
||||
|
||||
$('#schedules-list').show();
|
||||
@ -627,13 +629,18 @@ function(SchedulerInit, Rest, Wait) {
|
||||
scheduler,
|
||||
target,
|
||||
callback,
|
||||
restore;
|
||||
list,
|
||||
restore,
|
||||
container;
|
||||
|
||||
Wait('start');
|
||||
list = $('#schedules-list');
|
||||
target = $('#schedules-form');
|
||||
container = $('#schedules-form-container');
|
||||
|
||||
// Clean up any lingering stuff
|
||||
target.empty().hide();
|
||||
container.hide();
|
||||
target.empty();
|
||||
$('.tooltip').each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
@ -642,29 +649,31 @@ function(SchedulerInit, Rest, Wait) {
|
||||
});
|
||||
|
||||
// Insert the scheduler widget into the hidden div
|
||||
scheduler = SchedulerInit({ scope: scope });
|
||||
scheduler.inject('schedules-form', true);
|
||||
scheduler = SchedulerInit({ scope: scope, requireFutureStartTime: false });
|
||||
scheduler.inject('schedules-form', false);
|
||||
scheduler.clear();
|
||||
scope.showRRuleDetail = false;
|
||||
parent_scope.schedulesTitle = 'Edit Schedule';
|
||||
|
||||
// display the scheduler widget
|
||||
callback = function() {
|
||||
Wait('stop');
|
||||
target.show('slide', { direction: 'left' }, 500);
|
||||
container.show('slide', { direction: 'left' }, 500);
|
||||
$('#group-save-button').prop('disabled', true);
|
||||
scope.$apply(function() {
|
||||
scheduler.setRRule(schedule.rrule);
|
||||
scheduler.setName(schedule.name);
|
||||
});
|
||||
};
|
||||
$('#schedules-list').hide({ complete: callback, duration: 300 });
|
||||
list.hide({ complete: callback, duration: 300 });
|
||||
|
||||
restore = function() {
|
||||
$('#group-save-button').prop('disabled', false);
|
||||
$('#schedules-list').show('slide', { direction: 'right' }, 500);
|
||||
list.show('slide', { direction: 'right' }, 500);
|
||||
//refresh the list
|
||||
};
|
||||
|
||||
scope.saveForm = function() {
|
||||
parent_scope.saveScheduleForm = function() {
|
||||
var newSchedule,
|
||||
url = '/static/sample/data/schedules/inventory/data.json';
|
||||
if (scheduler.isValid()) {
|
||||
@ -677,11 +686,11 @@ function(SchedulerInit, Rest, Wait) {
|
||||
Rest.post(schedule)
|
||||
.success(function(){
|
||||
Wait('stop');
|
||||
target.hide('slide', { direction: 'right' }, 500, restore);
|
||||
container.hide('slide', { direction: 'right' }, 500, restore);
|
||||
})
|
||||
.error(function(){
|
||||
Wait('stop');
|
||||
target.hide('slide', { direction: 'right' }, 500, restore);
|
||||
container.hide('slide', { direction: 'right' }, 500, restore);
|
||||
});
|
||||
}
|
||||
else {
|
||||
@ -689,9 +698,8 @@ function(SchedulerInit, Rest, Wait) {
|
||||
}
|
||||
};
|
||||
|
||||
scope.resetForm = function() {
|
||||
scheduler.setRRule(schedule.rrule);
|
||||
scheduler.setName(schedule.name);
|
||||
parent_scope.cancelScheduleForm = function() {
|
||||
container.hide('slide', { direction: 'right' }, 500, restore);
|
||||
};
|
||||
};
|
||||
}])
|
||||
@ -859,7 +867,7 @@ function(SchedulerInit, Rest, Wait) {
|
||||
}
|
||||
}
|
||||
else if ($(e.target).text() === 'Schedule') {
|
||||
ScheduleList({ scope: modal_scope });
|
||||
ScheduleList({ scope: parent_scope });
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -22,15 +22,15 @@ angular.module('SchedulesHelper', ['Utilities', 'SchedulesHelper'])
|
||||
if (ww > 1199) {
|
||||
// desktop
|
||||
x = 675;
|
||||
y = (625 > wh) ? wh - 20 : 625;
|
||||
y = (675 > wh) ? wh - 20 : 675;
|
||||
maxrows = 20;
|
||||
} else if (ww <= 1199 && ww >= 768) {
|
||||
x = 550;
|
||||
y = (625 > wh) ? wh - 15 : 625;
|
||||
y = (675 > wh) ? wh - 15 : 675;
|
||||
maxrows = 15;
|
||||
} else {
|
||||
x = (ww - 20);
|
||||
y = (625 > wh) ? wh : 625;
|
||||
y = (675 > wh) ? wh : 675;
|
||||
maxrows = 10;
|
||||
}
|
||||
|
||||
@ -206,6 +206,7 @@ angular.module('SchedulesHelper', ['Utilities', 'SchedulesHelper'])
|
||||
$('#form-container').empty();
|
||||
scheduler = SchedulerInit({ scope: scope });
|
||||
scheduler.inject('form-container', false);
|
||||
scheduler.clear();
|
||||
ShowSchedulerModal({ scope: scope });
|
||||
scope.showRRuleDetail = false;
|
||||
|
||||
|
@ -15,7 +15,7 @@ angular.module('SchedulesListDefinition', [])
|
||||
iterator: 'schedule',
|
||||
selectTitle: '',
|
||||
editTitle: 'Schedules',
|
||||
well: false,
|
||||
well: true,
|
||||
index: true,
|
||||
hover: true,
|
||||
|
||||
|
@ -6,17 +6,38 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
#schedules-form -inventory group add/edit dialog
|
||||
#schedules-form-container -inventory group add/edit dialog
|
||||
*/
|
||||
|
||||
#schedules-form {
|
||||
border: 1px solid #ddd;
|
||||
#schedules-form-container {
|
||||
display: none;
|
||||
border: 1px solid #e5e5e5;
|
||||
border-radius: 4px;
|
||||
box-shadow: 3px 3px 6px 0 #666;
|
||||
padding: 8px 10px 15px 8px;
|
||||
padding: 0 10px 15px 8px;
|
||||
}
|
||||
|
||||
#scheduler-modal-dialog, #schedules-form {
|
||||
#schedules-title {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
padding-bottom: 8px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 0;
|
||||
|
||||
h4 {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
button {
|
||||
display: inline-block;
|
||||
/*margin-top: -10px;*/
|
||||
}
|
||||
}
|
||||
|
||||
#schedules-buttons {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scheduler-modal-dialog, #schedules-form-container {
|
||||
display: none;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
@ -97,8 +118,7 @@
|
||||
|
||||
.error-pull-up {
|
||||
position: relative;
|
||||
top: -15px;
|
||||
margin-bottom: 15px;
|
||||
top: -23px;
|
||||
}
|
||||
|
||||
.red-text {
|
||||
|
@ -203,7 +203,7 @@ textarea {
|
||||
left: 0;
|
||||
z-index: 1999;
|
||||
background-color: @black;
|
||||
opacity: .4;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* TB tooltip overrides */
|
||||
|
@ -35,7 +35,8 @@ angular.module('AngularScheduler', ['underscore'])
|
||||
function($log, $filter, $timezones, LoadLookupValues, SetDefaults, CreateObject, _, useTimezone, showUTCField) {
|
||||
return function(params) {
|
||||
|
||||
var scope = params.scope;
|
||||
var scope = params.scope,
|
||||
requireFutureStartTime = params.requireFutureStartTime || false;
|
||||
|
||||
scope.schedulerShowTimeZone = useTimezone;
|
||||
scope.schedulerShowUTCStartTime = showUTCField;
|
||||
@ -167,7 +168,7 @@ angular.module('AngularScheduler', ['underscore'])
|
||||
scope.setDefaults();
|
||||
}
|
||||
|
||||
return CreateObject(scope);
|
||||
return CreateObject(scope, requireFutureStartTime);
|
||||
|
||||
};
|
||||
}])
|
||||
@ -179,11 +180,12 @@ angular.module('AngularScheduler', ['underscore'])
|
||||
*/
|
||||
.factory('CreateObject', ['AngularScheduler.useTimezone', '$filter', 'GetRule', 'Inject', 'SetDefaults', '$timezones', 'SetRule',
|
||||
function(useTimezone, $filter, GetRule, Inject, SetDefaults, $timezones, SetRule) {
|
||||
return function(scope) {
|
||||
return function(scope, requireFutureST) {
|
||||
var fn = function() {
|
||||
|
||||
this.scope = scope;
|
||||
this.useTimezone = useTimezone;
|
||||
this.requireFutureStartTime = requireFutureST;
|
||||
|
||||
// Evaluate user intput and build options for passing to rrule
|
||||
this.getOptions = function() {
|
||||
@ -280,23 +282,23 @@ angular.module('AngularScheduler', ['underscore'])
|
||||
else {
|
||||
timeNow = now.getTime();
|
||||
}
|
||||
if (timeNow >= timeFuture) {
|
||||
this.scope.startDateError("Start date and time must be in the future");
|
||||
if (this.requireFutureStartTime && timeNow >= timeFuture) {
|
||||
this.scope.startDateError("Start time must be in the future");
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.scope.startDateError("Invalid start date and time");
|
||||
this.scope.startDateError("Invalid start time");
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
this.scope.startDateError("Invalid start date and time");
|
||||
this.scope.startDateError("Invalid start time");
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.scope.startDateError("Provide a valid start date and time");
|
||||
this.scope.startDateError("Provide a start time");
|
||||
validity = false;
|
||||
}
|
||||
return validity;
|
||||
@ -349,6 +351,15 @@ angular.module('AngularScheduler', ['underscore'])
|
||||
this.getUserTimezone = function() {
|
||||
return $timezones.getLocal();
|
||||
};
|
||||
|
||||
// futureStartTime setter/getter
|
||||
this.setRequireFutureStartTime = function(opt) {
|
||||
this.requireFutureStartTime = opt;
|
||||
};
|
||||
|
||||
this.getRequireFutureStartTime = function() {
|
||||
return this.requireFutureStartTime;
|
||||
};
|
||||
};
|
||||
return new fn();
|
||||
};
|
||||
|
@ -27,7 +27,20 @@
|
||||
<div class="tab-pane" id="sources-tab"></div>
|
||||
<div class="tab-pane" id="schedules-tab">
|
||||
<div id="schedules-list"></div>
|
||||
<div id="schedules-form"></div>
|
||||
<div id="schedules-form-container">
|
||||
<div id="schedules-title">
|
||||
<h4 ng-bind="schedulesTitle"></h4>
|
||||
<button type="button" class="close pull-right" ng-click="cancelScheduleForm()">×</button>
|
||||
</div>
|
||||
<div id="schedules-form"></div>
|
||||
<div id="schedules-buttons">
|
||||
<button type="button" class="btn btn-default btn-sm" id="reset-button" ng-click="cancelScheduleForm()"><i class="fa fa-times"></i> Cancel</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="save-button" ng-click="saveScheduleForm()"><i class="fa fa-check"></i> Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="schedules-detail">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user