mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
AC-1144 fixes for inventory group edit modal dialog. Spinner issue fixed. Improved error validation. Improved scope separation. Fixed issues related to home/groups search breaking after dialog closes.
This commit is contained in:
parent
d6237dcfb0
commit
ff3ce4f7b4
@ -124,7 +124,7 @@ Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location',
|
||||
|
||||
function HomeGroups($scope, $filter, $compile, $location, $routeParams, LogViewer, HomeGroupList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||
GetBasePath, SearchInit, PaginateInit, FormatDate, GetHostsStatusMsg, GetSyncStatusMsg, ViewUpdateStatus, Stream, GroupsEdit, Wait,
|
||||
Alert, Rest, Empty, InventoryUpdate, Find, GroupsCancelUpdate) {
|
||||
Alert, Rest, Empty, InventoryUpdate, Find, GroupsCancelUpdate, Store) {
|
||||
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@ -134,7 +134,7 @@ function HomeGroups($scope, $filter, $compile, $location, $routeParams, LogViewe
|
||||
defaultUrl = GetBasePath('groups'),
|
||||
scope = $scope,
|
||||
modal_scope = $scope.$new(),
|
||||
opt;
|
||||
opt, PreviousSearchParams;
|
||||
|
||||
generator.inject(list, { mode: 'edit', scope: scope });
|
||||
|
||||
@ -173,7 +173,6 @@ function HomeGroups($scope, $filter, $compile, $location, $routeParams, LogViewe
|
||||
scope.removePostRefresh = scope.$on('PostRefresh', function () {
|
||||
var i, hosts_status, stat;
|
||||
for (i = 0; i < scope.home_groups.length; i++) {
|
||||
|
||||
scope.home_groups[i].inventory_name = scope.home_groups[i].summary_fields.inventory.name;
|
||||
|
||||
stat = GetSyncStatusMsg({
|
||||
@ -288,24 +287,30 @@ function HomeGroups($scope, $filter, $compile, $location, $routeParams, LogViewe
|
||||
});
|
||||
};
|
||||
|
||||
if (modal_scope.removeHomeGroupsRefresh) {
|
||||
modal_scope.removeHomeGroupsRefresh();
|
||||
}
|
||||
modal_scope.removeHomeGroupsRefresh = scope.$on('HomeGroupsRefresh', function() {
|
||||
scope.search(list.iterator);
|
||||
});
|
||||
|
||||
scope.editGroup = function (group_id, inventory_id) {
|
||||
PreviousSearchParams = Store('CurrentSearchParams');
|
||||
GroupsEdit({
|
||||
scope: modal_scope,
|
||||
scope: scope,
|
||||
group_id: group_id,
|
||||
inventory_id: inventory_id,
|
||||
groups_reload: false,
|
||||
mode: 'edit',
|
||||
callback: 'HomeGroupsRefresh'
|
||||
mode: 'edit'
|
||||
});
|
||||
};
|
||||
|
||||
scope.restoreSearch = function() {
|
||||
SearchInit({
|
||||
scope: scope,
|
||||
set: PreviousSearchParams.set,
|
||||
list: PreviousSearchParams.list,
|
||||
url: PreviousSearchParams.defaultUrl,
|
||||
iterator: PreviousSearchParams.iterator,
|
||||
sort_order: PreviousSearchParams.sort_order,
|
||||
setWidgets: false
|
||||
});
|
||||
scope.refresh();
|
||||
};
|
||||
|
||||
scope.viewUpdateStatus = function (id) {
|
||||
scope.groups = scope.home_groups;
|
||||
ViewUpdateStatus({
|
||||
@ -494,7 +499,7 @@ function HomeGroups($scope, $filter, $compile, $location, $routeParams, LogViewe
|
||||
|
||||
HomeGroups.$inject = ['$scope', '$filter', '$compile', '$location', '$routeParams', 'LogViewer', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
|
||||
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'GetHostsStatusMsg', 'GetSyncStatusMsg', 'ViewUpdateStatus',
|
||||
'Stream', 'GroupsEdit', 'Wait', 'Alert', 'Rest', 'Empty', 'InventoryUpdate', 'Find', 'GroupsCancelUpdate'
|
||||
'Stream', 'GroupsEdit', 'Wait', 'Alert', 'Rest', 'Empty', 'InventoryUpdate', 'Find', 'GroupsCancelUpdate', 'Store'
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -224,11 +224,20 @@ function InventoriesList($scope, $rootScope, $location, $log, $routeParams, $com
|
||||
html += "</thead>\n";
|
||||
html += "<tbody>\n";
|
||||
data.results.forEach( function(row) {
|
||||
html += "<tr>";
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob('" + row.related.last_update + "')\" aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) + ". Click for details\" aw-tip-placement=\"top\"><i class=\"fa icon-job-" + row.status + "\"></i></a></td>";
|
||||
html += "<td>" + ($filter('date')(row.last_updated,'MM/dd HH:mm:ss')).replace(/ /,'<br />') + "</td>";
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob('" + row.related.last_update + "')\">" + ellipsis(row.summary_fields.group.name) + "</a></td>";
|
||||
html += "</tr>\n";
|
||||
if (row.related.last_update) {
|
||||
html += "<tr>";
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob('" + row.related.last_update + "')\" aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) + ". Click for details\" aw-tip-placement=\"top\"><i class=\"fa icon-job-" + row.status + "\"></i></a></td>";
|
||||
html += "<td>" + ($filter('date')(row.last_updated,'MM/dd HH:mm:ss')).replace(/ /,'<br />') + "</td>";
|
||||
html += "<td><a href=\"\" ng-click=\"viewJob('" + row.related.last_update + "')\">" + ellipsis(row.summary_fields.group.name) + "</a></td>";
|
||||
html += "</tr>\n";
|
||||
}
|
||||
else {
|
||||
html += "<tr>";
|
||||
html += "<td><a href=\"\" aw-tool-tip=\"No sync data\" aw-tip-placement=\"top\"><i class=\"fa icon-job-none\"></i></a></td>";
|
||||
html += "<td>NA</td>";
|
||||
html += "<td><a href=\"\">" + ellipsis(row.summary_fields.group.name) + "</a></td>";
|
||||
html += "</tr>\n";
|
||||
}
|
||||
});
|
||||
html += "</tbody>\n";
|
||||
html += "</table>\n";
|
||||
|
||||
@ -130,14 +130,14 @@ angular.module('SourceFormDefinition', [])
|
||||
}]
|
||||
},
|
||||
update_cache_timeout: {
|
||||
label: 'Cache Timeout',
|
||||
label: "Cache Timeout <span class=\"small-text\"> (seconds)</span>",
|
||||
id: 'source-cache-timeout',
|
||||
type: 'number',
|
||||
integer: true,
|
||||
min: 0,
|
||||
ngShow: "update_on_launch",
|
||||
ngShow: "source && source.value !== '' && update_on_launch",
|
||||
spinner: true,
|
||||
"default": '0',
|
||||
"default": 0,
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
awPopOver: '<p>Time in seconds to consider an inventory sync to be current. During job runs and callbacks the task system will ' +
|
||||
|
||||
@ -273,25 +273,6 @@ angular.module('UserFormDefinition', [])
|
||||
|
||||
actions: {},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
label: 'Name'
|
||||
},
|
||||
description: {
|
||||
label: 'Description'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
projects: {
|
||||
type: 'collection',
|
||||
title: 'Projects',
|
||||
iterator: 'project',
|
||||
open: false,
|
||||
|
||||
actions: {},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
@ -302,7 +283,6 @@ angular.module('UserFormDefinition', [])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}); //UserForm
|
||||
@ -343,9 +343,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
* Add the list of schedules to the Group Edit modal
|
||||
*
|
||||
*/
|
||||
.factory('ScheduleList', ['ScheduleEdit', 'SchedulesList', 'GenerateList', 'SearchInit', 'PaginateInit', 'Rest', 'PageRangeSetup',
|
||||
.factory('GroupsScheduleList', ['GroupsScheduleEdit', 'SchedulesList', 'GenerateList', 'SearchInit', 'PaginateInit', 'Rest', 'PageRangeSetup',
|
||||
'Wait', 'ProcessErrors', 'Find', 'ToggleSchedule', 'DeleteSchedule', 'GetBasePath', 'SchedulesListInit',
|
||||
function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Rest, PageRangeSetup, Wait, ProcessErrors, Find,
|
||||
function(GroupsScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Rest, PageRangeSetup, Wait, ProcessErrors, Find,
|
||||
ToggleSchedule, DeleteSchedule, GetBasePath, SchedulesListInit) {
|
||||
return function(params) {
|
||||
var parent_scope = params.scope,
|
||||
@ -363,7 +363,7 @@ ToggleSchedule, DeleteSchedule, GetBasePath, SchedulesListInit) {
|
||||
$('.popover').each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
|
||||
// Add schedules list
|
||||
list = angular.copy(SchedulesList);
|
||||
delete list.fields.dtend;
|
||||
@ -379,9 +379,10 @@ ToggleSchedule, DeleteSchedule, GetBasePath, SchedulesListInit) {
|
||||
|
||||
$('#schedules-list').show();
|
||||
|
||||
if (schedule_scope.removePostRefresh) {
|
||||
schedule_scope.removePostRefresh();
|
||||
}
|
||||
// Removing screws up /home/groups page
|
||||
// if (schedule_scope.removePostRefresh) {
|
||||
// schedule_scope.removePostRefresh();
|
||||
//}
|
||||
schedule_scope.removePostRefresh = schedule_scope.$on('PostRefresh', function() {
|
||||
SchedulesListInit({
|
||||
scope: schedule_scope,
|
||||
@ -403,16 +404,16 @@ ToggleSchedule, DeleteSchedule, GetBasePath, SchedulesListInit) {
|
||||
});
|
||||
schedule_scope.search(list.iterator);
|
||||
|
||||
parent_scope.refreshSchedule = function() {
|
||||
schedule_scope.refreshSchedules = function() {
|
||||
schedule_scope.search(list.iterator);
|
||||
};
|
||||
|
||||
schedule_scope.editSchedule = function(id) {
|
||||
ScheduleEdit({ scope: parent_scope, mode: 'edit', url: GetBasePath('schedules') + id + '/' });
|
||||
GroupsScheduleEdit({ scope: schedule_scope, mode: 'edit', url: GetBasePath('schedules') + id + '/' });
|
||||
};
|
||||
|
||||
schedule_scope.addSchedule = function() {
|
||||
ScheduleEdit({ scope: parent_scope, mode: 'add', url: url });
|
||||
GroupsScheduleEdit({ scope: schedule_scope, mode: 'add', url: url });
|
||||
};
|
||||
|
||||
if (schedule_scope.removeSchedulesRefresh) {
|
||||
@ -462,11 +463,11 @@ ToggleSchedule, DeleteSchedule, GetBasePath, SchedulesListInit) {
|
||||
* Remove the schedule list, add the schedule widget and populate it with an rrule
|
||||
*
|
||||
*/
|
||||
.factory('ScheduleEdit', ['SchedulerInit', 'Rest', 'Wait', 'SetSchedulesInnerDialogSize', 'SchedulePost', 'ProcessErrors',
|
||||
function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, ProcessErrors) {
|
||||
.factory('GroupsScheduleEdit', ['$compile','SchedulerInit', 'Rest', 'Wait', 'SetSchedulesInnerDialogSize', 'SchedulePost', 'ProcessErrors',
|
||||
function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, ProcessErrors) {
|
||||
return function(params) {
|
||||
var parent_scope = params.scope,
|
||||
mode = params.mode, // 'create' or 'edit'
|
||||
mode = params.mode, // 'add' or 'edit'
|
||||
url = params.url,
|
||||
scope = parent_scope.$new(),
|
||||
schedule = {},
|
||||
@ -476,7 +477,8 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
list,
|
||||
detail,
|
||||
restoreList,
|
||||
container;
|
||||
container,
|
||||
elem;
|
||||
|
||||
Wait('start');
|
||||
detail = $('#schedules-detail').hide();
|
||||
@ -494,6 +496,9 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
elem = angular.element(document.getElementById('schedules-form-container'));
|
||||
$compile(elem)(scope);
|
||||
|
||||
if (scope.removeScheduleReady) {
|
||||
scope.removeScheduleReady();
|
||||
}
|
||||
@ -503,8 +508,9 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
scheduler.inject('schedules-form', false);
|
||||
scheduler.injectDetail('schedules-detail', false);
|
||||
scheduler.clear();
|
||||
scope.formShowing = true;
|
||||
scope.showRRuleDetail = false;
|
||||
parent_scope.schedulesTitle = (mode === 'edit') ? 'Edit Schedule' : 'Create Schedule';
|
||||
scope.schedulesTitle = (mode === 'edit') ? 'Edit Schedule' : 'Create Schedule';
|
||||
|
||||
// display the scheduler widget
|
||||
showForm = function() {
|
||||
@ -530,22 +536,22 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
$('#group-save-button').prop('disabled', false);
|
||||
list.show('slide', { direction: 'right' }, 500);
|
||||
$('#schedules-overlay').width($('#schedules-tab').width()).height($('#schedules-tab').height()).hide();
|
||||
parent_scope.refreshSchedule();
|
||||
parent_scope.refreshSchedules();
|
||||
};
|
||||
|
||||
parent_scope.showScheduleDetail = function() {
|
||||
if (parent_scope.formShowing) {
|
||||
scope.showScheduleDetail = function() {
|
||||
if (scope.formShowing) {
|
||||
if (scheduler.isValid()) {
|
||||
detail.width($('#schedules-form').width()).height($('#schedules-form').height());
|
||||
target.hide();
|
||||
detail.show();
|
||||
parent_scope.formShowing = false;
|
||||
scope.formShowing = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
detail.hide();
|
||||
target.show();
|
||||
parent_scope.formShowing = true;
|
||||
scope.formShowing = true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -557,7 +563,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
container.hide('slide', { direction: 'right' }, 500, restoreList);
|
||||
});
|
||||
|
||||
parent_scope.saveScheduleForm = function() {
|
||||
scope.saveScheduleForm = function() {
|
||||
if (scheduler.isValid()) {
|
||||
scope.schedulerIsValid = true;
|
||||
SchedulePost({
|
||||
@ -574,7 +580,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}
|
||||
};
|
||||
|
||||
parent_scope.cancelScheduleForm = function() {
|
||||
scope.cancelScheduleForm = function() {
|
||||
container.hide('slide', { direction: 'right' }, 500, restoreList);
|
||||
};
|
||||
|
||||
@ -603,13 +609,13 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}])
|
||||
|
||||
|
||||
.factory('GroupsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
||||
.factory('GroupsEdit', ['$rootScope', '$location', '$log', '$routeParams', '$compile', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'SetNodeName', 'ParseTypeChange', 'GetSourceTypeOptions', 'InventoryUpdate',
|
||||
'LookUpInit', 'Empty', 'Wait', 'GetChoices', 'UpdateGroup', 'SourceChange', 'Find','WatchInventoryWindowResize',
|
||||
'ParseVariableString', 'ToJSON', 'ScheduleList', 'SourceForm', 'SetSchedulesInnerDialogSize', 'BuildTree',
|
||||
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
||||
'ParseVariableString', 'ToJSON', 'GroupsScheduleList', 'SourceForm', 'SetSchedulesInnerDialogSize', 'BuildTree',
|
||||
function ($rootScope, $location, $log, $routeParams, $compile, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
||||
GetBasePath, SetNodeName, ParseTypeChange, GetSourceTypeOptions, InventoryUpdate, LookUpInit, Empty, Wait,
|
||||
GetChoices, UpdateGroup, SourceChange, Find, WatchInventoryWindowResize, ParseVariableString, ToJSON, ScheduleList,
|
||||
GetChoices, UpdateGroup, SourceChange, Find, WatchInventoryWindowResize, ParseVariableString, ToJSON, GroupsScheduleList,
|
||||
SourceForm, SetSchedulesInnerDialogSize, BuildTree) {
|
||||
return function (params) {
|
||||
|
||||
@ -619,15 +625,16 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
mode = params.mode, // 'add' or 'edit'
|
||||
inventory_id = params.inventory_id,
|
||||
groups_reload = params.groups_reload,
|
||||
callback = params.callback,
|
||||
generator = GenerateForm,
|
||||
defaultUrl,
|
||||
master = {},
|
||||
choicesReady,
|
||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||
modal_scope = parent_scope.$new(),
|
||||
properties_scope = parent_scope.$new(),
|
||||
sources_scope = parent_scope.$new(),
|
||||
x, y, ww, wh, maxrows,
|
||||
elem, x, y, ww, wh, maxrows,
|
||||
group,
|
||||
schedules_url = '';
|
||||
|
||||
if (mode === 'edit') {
|
||||
@ -637,6 +644,15 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
defaultUrl = (group_id !== null) ? GetBasePath('groups') + group_id + '/children/' :
|
||||
GetBasePath('inventory') + inventory_id + '/groups/';
|
||||
}
|
||||
|
||||
$('#properties-tab').empty();
|
||||
$('#sources-tab').empty();
|
||||
$('#schedules-list').empty();
|
||||
$('#schedules-form').empty();
|
||||
$('#schedules-detail').empty();
|
||||
|
||||
elem = document.getElementById('group-modal-dialog');
|
||||
$compile(elem)(modal_scope);
|
||||
|
||||
generator.inject(GroupForm, { mode: 'edit', id: 'properties-tab', breadCrumbs: false, related: false, scope: properties_scope });
|
||||
generator.inject(SourceForm, { mode: 'edit', id: 'sources-tab', breadCrumbs: false, related: false, scope: sources_scope });
|
||||
@ -647,6 +663,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
sources_scope.source = SourceForm.fields.source['default'];
|
||||
sources_scope.sourcePathRequired = false;
|
||||
sources_scope[SourceForm.fields.source_vars.parseTypeName] = 'yaml';
|
||||
sources_scope.update_cache_timeout = 0;
|
||||
properties_scope.parseType = 'yaml';
|
||||
|
||||
function waitStop() { Wait('stop'); }
|
||||
@ -772,11 +789,6 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}
|
||||
$('#group-modal-dialog').hide();
|
||||
$('#group-modal-dialog').dialog('destroy');
|
||||
$('#properties-tab').empty();
|
||||
$('#sources-tab').empty();
|
||||
$('#schedules-list').empty();
|
||||
$('#schedules-form').empty();
|
||||
$('#schedules-detail').empty();
|
||||
modal_scope.cancelModal();
|
||||
},
|
||||
open: function () {
|
||||
@ -799,8 +811,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}
|
||||
else if ($(e.target).text() === 'Schedule') {
|
||||
$('#schedules-overlay').hide();
|
||||
parent_scope.formShowing = true;
|
||||
ScheduleList({ scope: parent_scope, url: schedules_url });
|
||||
GroupsScheduleList({ scope: modal_scope, url: schedules_url });
|
||||
}
|
||||
});
|
||||
|
||||
@ -808,6 +819,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
modal_scope.groupVariablesLoadedRemove();
|
||||
}
|
||||
modal_scope.groupVariablesLoadedRemove = modal_scope.$on('groupVariablesLoaded', function () {
|
||||
modal_scope.showSourceTab = (mode === 'edit' && group.has_inventory_sources && Empty(group.summary_fields.inventory_source.source)) ? false : true;
|
||||
$('#group_tabs a:first').tab('show');
|
||||
Wait('start');
|
||||
$('#group-modal-dialog').dialog('open');
|
||||
@ -937,7 +949,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
key: 'value',
|
||||
val: ''
|
||||
});
|
||||
parent_scope.showSourceTab = false;
|
||||
modal_scope.showSchedulesTab = false;
|
||||
}
|
||||
});
|
||||
|
||||
@ -949,6 +961,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
Rest.setUrl(defaultUrl);
|
||||
Rest.get()
|
||||
.success(function (data) {
|
||||
group = data;
|
||||
for (var fld in GroupForm.fields) {
|
||||
if (data[fld]) {
|
||||
properties_scope[fld] = data[fld];
|
||||
@ -1011,6 +1024,14 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}
|
||||
parent_scope.removeAddTreeRefreshed = parent_scope.$on('GroupTreeRefreshed', function() {
|
||||
//Clean up
|
||||
// Change the selected group
|
||||
if (groups_reload && parent_scope.selected_tree_id !== tree_id) {
|
||||
parent_scope.showHosts(tree_id, group_id, false);
|
||||
} else {
|
||||
Wait('stop');
|
||||
}
|
||||
WatchInventoryWindowResize();
|
||||
parent_scope.removeAddTreeRefreshed();
|
||||
if (modal_scope.searchCleanUp) {
|
||||
modal_scope.searchCleanup();
|
||||
}
|
||||
@ -1020,14 +1041,6 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
catch(e) {
|
||||
// ignore
|
||||
}
|
||||
// Change the selected group
|
||||
if (groups_reload && parent_scope.selected_tree_id !== tree_id) {
|
||||
parent_scope.showHosts(tree_id, group_id, false);
|
||||
} else {
|
||||
Wait('stop');
|
||||
}
|
||||
WatchInventoryWindowResize();
|
||||
parent_scope.removeAddTreeRefreshed();
|
||||
});
|
||||
|
||||
if (modal_scope.removeSaveComplete) {
|
||||
@ -1035,7 +1048,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}
|
||||
modal_scope.removeSaveComplete = modal_scope.$on('SaveComplete', function (e, error) {
|
||||
if (!error) {
|
||||
// Update the view with any changes
|
||||
// Update the parent view with any changes
|
||||
if (groups_reload) {
|
||||
UpdateGroup({
|
||||
scope: parent_scope,
|
||||
@ -1047,15 +1060,8 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
source: (sources_scope.source && sources_scope.source.value) ? sources_scope.source.value : ''
|
||||
}
|
||||
});
|
||||
} else if (callback) {
|
||||
try {
|
||||
$('#group-modal-dialog').dialog('close');
|
||||
}
|
||||
catch(err) {
|
||||
//ignore
|
||||
}
|
||||
parent_scope.$emit(callback);
|
||||
} else {
|
||||
parent_scope.$emit('GroupTreeRefreshed');
|
||||
} else if (base === 'inventories') {
|
||||
if (mode === 'add') {
|
||||
BuildTree({
|
||||
scope: parent_scope,
|
||||
@ -1067,6 +1073,14 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
else {
|
||||
parent_scope.$emit('GroupTreeRefreshed');
|
||||
}
|
||||
} else if (base === 'home') {
|
||||
parent_scope.restoreSearch();
|
||||
try {
|
||||
$('#group-modal-dialog').dialog('close');
|
||||
}
|
||||
catch(err) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1112,7 +1126,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
modal_scope.$emit('SaveComplete', false);
|
||||
})
|
||||
.error(function (data, status) {
|
||||
modal_scope.$emit('SaveComplete', true);
|
||||
$('#group_tabs a:eq(1)').tab('show');
|
||||
ProcessErrors(sources_scope, data, status, SourceForm, { hdr: 'Error!',
|
||||
msg: 'Failed to update group inventory source. PUT status: ' + status });
|
||||
});
|
||||
@ -1129,6 +1143,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
modal_scope.$emit('formSaveSuccess');
|
||||
})
|
||||
.error(function (data, status) {
|
||||
$('#group_tabs a:eq(0)').tab('show');
|
||||
ProcessErrors(modal_scope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Failed to update group variables. PUT status: ' + status });
|
||||
});
|
||||
@ -1136,19 +1151,18 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
|
||||
// Cancel
|
||||
modal_scope.cancelModal = function () {
|
||||
Wait('stop');
|
||||
try {
|
||||
$('#group-modal-dialog').dialog('close');
|
||||
}
|
||||
catch(e) {
|
||||
//ignore
|
||||
}
|
||||
if (callback) {
|
||||
parent_scope.$emit(callback);
|
||||
}
|
||||
else {
|
||||
if (modal_scope.searchCleanup) {
|
||||
modal_scope.searchCleanup();
|
||||
}
|
||||
|
||||
//if (modal_scope.searchCleanup) {
|
||||
// modal_scope.searchCleanup();
|
||||
//}
|
||||
if (base === 'inventories') {
|
||||
WatchInventoryWindowResize();
|
||||
}
|
||||
};
|
||||
@ -1183,7 +1197,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}
|
||||
})
|
||||
.error(function (data, status) {
|
||||
Wait('stop');
|
||||
$('#group_tabs a:eq(0)').tab('show');
|
||||
ProcessErrors(properties_scope, data, status, GroupForm, { hdr: 'Error!',
|
||||
msg: 'Failed to update group: ' + group_id + '. PUT status: ' + status
|
||||
});
|
||||
@ -1192,6 +1206,8 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
else {
|
||||
Rest.post(data)
|
||||
.success(function (data) {
|
||||
mode = 'edit'; // Once the group is saved, we're in edit mode. We may end up re-saving
|
||||
// the group, if there is an error on the source
|
||||
if (properties_scope.variables) {
|
||||
sources_scope.source_url = data.related.inventory_source;
|
||||
modal_scope.$emit('updateVariables', json_data, data.related.variable_data);
|
||||
@ -1201,6 +1217,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
}
|
||||
})
|
||||
.error(function (data, status) {
|
||||
$('#group_tabs a:eq(0)').tab('show');
|
||||
ProcessErrors(properties_scope, data, status, GroupForm, { hdr: 'Error!',
|
||||
msg: 'Failed to create group: ' + group_id + '. POST status: ' + status
|
||||
});
|
||||
@ -1233,7 +1250,7 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, P
|
||||
|
||||
// Change the lookup and regions when the source changes
|
||||
sources_scope.sourceChange = function () {
|
||||
parent_scope.showSourceTab = (sources_scope.source && sources_scope.source.value) ? true : false;
|
||||
parent_scope.showSchedulesTab = (mode === 'edit' && sources_scope.source && sources_scope.source.value) ? true : false;
|
||||
SourceChange({ scope: sources_scope, form: SourceForm });
|
||||
};
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
if (calcOnly) {
|
||||
scope.$emit('searchParamsReady', url);
|
||||
}
|
||||
else {
|
||||
else if (defaultUrl) {
|
||||
Refresh({
|
||||
scope: scope,
|
||||
set: set,
|
||||
|
||||
@ -55,7 +55,7 @@ angular.module('SchedulesListDefinition', [])
|
||||
refresh: {
|
||||
mode: 'all',
|
||||
awToolTip: "Refresh the page",
|
||||
ngClick: "refreshSchedule()"
|
||||
ngClick: "refreshSchedules()"
|
||||
},
|
||||
stream: {
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -59,7 +59,7 @@ body.modal-open {
|
||||
.pad-left-sm { padding-left: 10px; }
|
||||
.pad-left-lg { padding-left: 50px; }
|
||||
.normal-weight { font-weight: normal; }
|
||||
.small-text { font-size: 12px; }
|
||||
.small-text { font-size: 12px; font-weight: normal; }
|
||||
.no-bullets { list-style: none; }
|
||||
.nowrap { white-space: nowrap; }
|
||||
.capitalize { text-transform: capitalize; }
|
||||
|
||||
@ -120,3 +120,7 @@ table.ui-datepicker-calendar {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ui-spinner a.ui-spinner-button {
|
||||
border-left: 1px solid #A6C9E2;
|
||||
}
|
||||
|
||||
@ -426,7 +426,10 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
||||
ctrl.$setValidity('max', true);
|
||||
ctrl.$dirty = true;
|
||||
ctrl.$render();
|
||||
scope.job_templates_form.$dirty = true;
|
||||
if (scope.job_templates_form) {
|
||||
// need a way to find the parent form and mark it dirty
|
||||
scope.job_templates_form.$dirty = true;
|
||||
}
|
||||
if (!scope.$$phase) {
|
||||
scope.$digest();
|
||||
}
|
||||
@ -436,6 +439,9 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
||||
opts.disabled = true;
|
||||
}
|
||||
$(elm).spinner(opts);
|
||||
$(elm).on("click", function () {
|
||||
$(elm).select();
|
||||
});
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
<ul id="group_tabs" class="nav nav-tabs">
|
||||
<li class="active"><a id="properties_link" ng-click="toggleTab($event, 'properties_link', 'group_tabs')"
|
||||
href="#properties-tab" data-toggle="tab">Properties</a></li>
|
||||
<li><a id="source_link" ng-click="toggleTab($event, 'source_link', 'group_tabs')"
|
||||
<li ng-show="showSourceTab"><a id="source_link" ng-click="toggleTab($event, 'source_link', 'group_tabs')"
|
||||
href="#sources-tab" data-toggle="tab">Source</a></li>
|
||||
<li ng-show="showSourceTab"><a id="schedules_link" ng-click="toggleTab($event, 'schedules_link', 'group_tabs')"
|
||||
<li ng-show="showSchedulesTab"><a id="schedules_link" ng-click="toggleTab($event, 'schedules_link', 'group_tabs')"
|
||||
href="#schedules-tab" data-toggle="tab">Schedule</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
<ul id="group_tabs" class="nav nav-tabs">
|
||||
<li class="active"><a id="properties_link" ng-click="toggleTab($event, 'properties_link', 'group_tabs')"
|
||||
href="#properties-tab" data-toggle="tab">Properties</a></li>
|
||||
<li><a id="source_link" ng-click="toggleTab($event, 'source_link', 'group_tabs')"
|
||||
<li ng-show="showSourceTab"><a id="source_link" ng-click="toggleTab($event, 'source_link', 'group_tabs')"
|
||||
href="#sources-tab" data-toggle="tab">Source</a></li>
|
||||
<li ng-show="showSourceTab"><a id="schedules_link" ng-click="toggleTab($event, 'schedules_link', 'group_tabs')"
|
||||
<li ng-show="showSchedulesTab"><a id="schedules_link" ng-click="toggleTab($event, 'schedules_link', 'group_tabs')"
|
||||
href="#schedules-tab" data-toggle="tab">Schedule</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user