mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 09:07:45 -02:30
@@ -738,7 +738,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
elem = document.getElementById('group-modal-dialog');
|
||||
$compile(elem)(modal_scope);
|
||||
|
||||
var form_scope =
|
||||
generator.inject(GroupForm, { mode: 'edit', id: 'properties-tab', breadCrumbs: false, related: false, scope: properties_scope });
|
||||
var source_form_scope =
|
||||
generator.inject(SourceForm, { mode: 'edit', id: 'sources-tab', breadCrumbs: false, related: false, scope: sources_scope });
|
||||
|
||||
//generator.reset();
|
||||
@@ -881,6 +883,11 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
modal_scope.cancelModal();
|
||||
},
|
||||
open: function () {
|
||||
function updateButtonStatus(isValid) {
|
||||
$('.ui-dialog[aria-describedby="group-modal-dialog"]').find('.btn-primary').prop('disabled', !isValid);
|
||||
}
|
||||
form_scope.$watch('group_form.$valid', updateButtonStatus);
|
||||
source_form_scope.$watch('source_form.$valid', updateButtonStatus);
|
||||
$('#group_name').focus();
|
||||
Wait('stop');
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('InjectHosts', ['GenerateList', 'InventoryHosts', 'HostsReload',
|
||||
.factory('InjectHosts', ['GenerateList', 'InventoryHosts', 'HostsReload',
|
||||
function(GenerateList, InventoryHosts, HostsReload) {
|
||||
return function(params) {
|
||||
|
||||
@@ -250,7 +250,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('ToggleHostEnabled', [ 'GetBasePath', 'Rest', 'Wait', 'ProcessErrors', 'Alert', 'Find', 'SetEnabledMsg',
|
||||
.factory('ToggleHostEnabled', [ 'GetBasePath', 'Rest', 'Wait', 'ProcessErrors', 'Alert', 'Find', 'SetEnabledMsg',
|
||||
function(GetBasePath, Rest, Wait, ProcessErrors, Alert, Find, SetEnabledMsg) {
|
||||
return function(params) {
|
||||
|
||||
@@ -291,7 +291,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('HostsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostList', 'GenerateList',
|
||||
.factory('HostsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostList', 'GenerateList',
|
||||
'Prompt', 'SearchInit', 'PaginateInit', 'ProcessErrors', 'GetBasePath', 'HostsAdd', 'HostsReload', 'SelectionInit',
|
||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, HostList, GenerateList, Prompt, SearchInit,
|
||||
PaginateInit, ProcessErrors, GetBasePath, HostsAdd, HostsReload, SelectionInit) {
|
||||
@@ -352,7 +352,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
}])
|
||||
|
||||
|
||||
.factory('HostsCreate', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
|
||||
.factory('HostsCreate', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
|
||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', 'ToJSON',
|
||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors,
|
||||
GetBasePath, HostsReload, ParseTypeChange, Wait, ToJSON) {
|
||||
@@ -451,7 +451,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
}])
|
||||
|
||||
|
||||
.factory('HostsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
|
||||
.factory('HostsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
|
||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', 'Find', 'SetStatus', 'ApplyEllipsis',
|
||||
'ToJSON', 'ParseVariableString', 'CreateDialog', 'TextareaResize',
|
||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors,
|
||||
@@ -471,8 +471,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
scope = parent_scope.$new(),
|
||||
master = {},
|
||||
relatedSets = {},
|
||||
buttons, url;
|
||||
buttons, url, form_scope;
|
||||
|
||||
var form_scope =
|
||||
generator.inject(HostForm, { mode: 'edit', id: 'host-modal-dialog', breadCrumbs: false, related: false, scope: scope });
|
||||
generator.reset();
|
||||
|
||||
@@ -503,6 +504,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
title: 'Host Properties',
|
||||
id: 'host-modal-dialog',
|
||||
clonseOnEscape: false,
|
||||
form: form_scope.host_form,
|
||||
onClose: function() {
|
||||
Wait('stop');
|
||||
scope.codeMirror.destroy();
|
||||
@@ -701,7 +703,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
}])
|
||||
|
||||
|
||||
.factory('HostsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'Wait',
|
||||
.factory('HostsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'Wait',
|
||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, Prompt, ProcessErrors, GetBasePath, HostsReload, Wait) {
|
||||
return function(params) {
|
||||
// Remove the selected host from the current group by disassociating
|
||||
|
||||
@@ -201,6 +201,7 @@ export default
|
||||
|
||||
form.well = false;
|
||||
|
||||
var form_scope =
|
||||
generator.inject(form, {
|
||||
mode: 'edit',
|
||||
showButtons: false,
|
||||
@@ -241,6 +242,7 @@ export default
|
||||
title: 'Inventory Properties',
|
||||
id: 'inventory-edit-modal-dialog',
|
||||
clonseOnEscape: false,
|
||||
form: form_scope.inventory_form,
|
||||
onClose: function() {
|
||||
Wait('stop');
|
||||
scope.codeMirror.destroy();
|
||||
|
||||
@@ -57,10 +57,15 @@ angular.module('ModalDialog', ['Utilities', 'ParseHelper'])
|
||||
beforeDestroy = params.beforeDestroy,
|
||||
closeOnEscape = (params.closeOnEscape === undefined) ? false : params.closeOnEscape,
|
||||
resizable = (params.resizable === undefined) ? true : params.resizable,
|
||||
forms = _.chain([params.form]).flatten().compact().value(),
|
||||
buttons,
|
||||
id = params.id,
|
||||
x, y, wh, ww;
|
||||
|
||||
function updateButtonStatus(isValid) {
|
||||
$('.ui-dialog[aria-describedby="' + id + '"]').find('.btn-primary').prop('disabled', !isValid);
|
||||
}
|
||||
|
||||
if (Empty(buttonSet)) {
|
||||
// Default button object
|
||||
buttonSet = [{
|
||||
@@ -115,6 +120,12 @@ angular.module('ModalDialog', ['Utilities', 'ParseHelper'])
|
||||
});
|
||||
}, 300);
|
||||
|
||||
if (forms.length > 0) {
|
||||
forms.map(function(form_ctrl) {
|
||||
scope.$watch(form_ctrl.$name + '.$valid', updateButtonStatus);
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
scope.$apply(function() {
|
||||
scope.$emit(callback);
|
||||
|
||||
Reference in New Issue
Block a user