mirror of
https://github.com/ansible/awx.git
synced 2026-04-14 06:29:25 -02:30
change async loading order for form
This commit is contained in:
@@ -210,8 +210,6 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.team_id = id;
|
|
||||||
|
|
||||||
// manipulate the choices from the options request to be usable
|
// manipulate the choices from the options request to be usable
|
||||||
// by the search option for permission_type, you can't inject the
|
// by the search option for permission_type, you can't inject the
|
||||||
// list until this is done!
|
// list until this is done!
|
||||||
@@ -222,8 +220,11 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
});
|
});
|
||||||
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
||||||
generator.reset();
|
generator.reset();
|
||||||
|
$scope.$emit('loadTeam');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.team_id = id;
|
||||||
|
|
||||||
$scope.PermissionAddAllowed = false;
|
$scope.PermissionAddAllowed = false;
|
||||||
|
|
||||||
// Retrieve each related set and any lookups
|
// Retrieve each related set and any lookups
|
||||||
@@ -254,59 +255,65 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Retrieve detail record and prepopulate the form
|
// Retrieve each related set and any lookups
|
||||||
Wait('start');
|
if ($scope.loadTeamRemove) {
|
||||||
Rest.setUrl(defaultUrl + ':id/');
|
$scope.loadTeamRemove();
|
||||||
Rest.get({
|
}
|
||||||
params: {
|
$scope.loadTeamRemove = $scope.$on('loadTeam', function () {
|
||||||
id: id
|
// Retrieve detail record and prepopulate the form
|
||||||
}
|
Wait('start');
|
||||||
})
|
Rest.setUrl(defaultUrl + ':id/');
|
||||||
.success(function (data) {
|
Rest.get({
|
||||||
var fld, related, set;
|
params: {
|
||||||
$scope.team_name = data.name;
|
id: id
|
||||||
for (fld in form.fields) {
|
|
||||||
if (data[fld]) {
|
|
||||||
$scope[fld] = data[fld];
|
|
||||||
master[fld] = $scope[fld];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
related = data.related;
|
|
||||||
for (set in form.related) {
|
|
||||||
if (related[set]) {
|
|
||||||
relatedSets[set] = {
|
|
||||||
url: related[set],
|
|
||||||
iterator: form.related[set].iterator
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
|
|
||||||
RelatedSearchInit({
|
|
||||||
scope: $scope,
|
|
||||||
form: form,
|
|
||||||
relatedSets: relatedSets
|
|
||||||
});
|
|
||||||
RelatedPaginateInit({
|
|
||||||
scope: $scope,
|
|
||||||
relatedSets: relatedSets
|
|
||||||
});
|
|
||||||
|
|
||||||
LookUpInit({
|
|
||||||
scope: $scope,
|
|
||||||
form: form,
|
|
||||||
current_item: data.organization,
|
|
||||||
list: OrganizationList,
|
|
||||||
field: 'organization',
|
|
||||||
input_type: 'radio'
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.organization_url = data.related.organization;
|
|
||||||
$scope.$emit('teamLoaded');
|
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.success(function (data) {
|
||||||
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to retrieve team: ' + $routeParams.team_id +
|
var fld, related, set;
|
||||||
'. GET status: ' + status });
|
$scope.team_name = data.name;
|
||||||
});
|
for (fld in form.fields) {
|
||||||
|
if (data[fld]) {
|
||||||
|
$scope[fld] = data[fld];
|
||||||
|
master[fld] = $scope[fld];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
related = data.related;
|
||||||
|
for (set in form.related) {
|
||||||
|
if (related[set]) {
|
||||||
|
relatedSets[set] = {
|
||||||
|
url: related[set],
|
||||||
|
iterator: form.related[set].iterator
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
|
||||||
|
RelatedSearchInit({
|
||||||
|
scope: $scope,
|
||||||
|
form: form,
|
||||||
|
relatedSets: relatedSets
|
||||||
|
});
|
||||||
|
RelatedPaginateInit({
|
||||||
|
scope: $scope,
|
||||||
|
relatedSets: relatedSets
|
||||||
|
});
|
||||||
|
|
||||||
|
LookUpInit({
|
||||||
|
scope: $scope,
|
||||||
|
form: form,
|
||||||
|
current_item: data.organization,
|
||||||
|
list: OrganizationList,
|
||||||
|
field: 'organization',
|
||||||
|
input_type: 'radio'
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.organization_url = data.related.organization;
|
||||||
|
$scope.$emit('teamLoaded');
|
||||||
|
})
|
||||||
|
.error(function (data, status) {
|
||||||
|
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to retrieve team: ' + $routeParams.team_id +
|
||||||
|
'. GET status: ' + status });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$scope.getPermissionText = function () {
|
$scope.getPermissionText = function () {
|
||||||
if (this.permission.permission_type !== "admin" && this.permission.run_ad_hoc_commands) {
|
if (this.permission.permission_type !== "admin" && this.permission.run_ad_hoc_commands) {
|
||||||
|
|||||||
@@ -242,22 +242,23 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// manipulate the choices from the options request to be usable
|
||||||
|
// by the search option for permission_type, you can't inject the
|
||||||
|
// list until this is done!
|
||||||
|
permissionsChoice.then(function (choices) {
|
||||||
|
form.related.permissions.fields.permission_type.searchOptions =
|
||||||
|
permissionsSearchSelect({
|
||||||
|
choices: choices
|
||||||
|
});
|
||||||
|
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
||||||
|
generator.reset();
|
||||||
|
$scope.$emit("loadForm");
|
||||||
|
});
|
||||||
|
|
||||||
if ($scope.removeFormReady) {
|
if ($scope.removeFormReady) {
|
||||||
$scope.removeFormReady();
|
$scope.removeFormReady();
|
||||||
}
|
}
|
||||||
$scope.removeFormReady = $scope.$on('formReady', function () {
|
$scope.removeFormReady = $scope.$on('formReady', function () {
|
||||||
// manipulate the choices from the options request to be usable
|
|
||||||
// by the search option for permission_type, you can't inject the
|
|
||||||
// list until this is done!
|
|
||||||
permissionsChoice.then(function (choices) {
|
|
||||||
form.related.permissions.fields.permission_type.searchOptions =
|
|
||||||
permissionsSearchSelect({
|
|
||||||
choices: choices
|
|
||||||
});
|
|
||||||
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
|
||||||
generator.reset();
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($scope.removePostRefresh) {
|
if ($scope.removePostRefresh) {
|
||||||
$scope.removePostRefresh();
|
$scope.removePostRefresh();
|
||||||
}
|
}
|
||||||
@@ -471,51 +472,57 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
// Put form back to its original state
|
// Put form back to its original state
|
||||||
ResetForm();
|
ResetForm();
|
||||||
|
|
||||||
|
if ($scope.removeLoadForm) {
|
||||||
if ($scope.removeModifyForm) {
|
$scope.removeLoadForm();
|
||||||
$scope.removeModifyForm();
|
|
||||||
}
|
}
|
||||||
$scope.removeModifyForm = $scope.$on('modifyForm', function () {
|
$scope.removeLoadForm = $scope.$on('loadForm', function () {
|
||||||
// Modify form based on LDAP settings
|
|
||||||
Rest.setUrl(GetBasePath('config'));
|
|
||||||
Rest.get()
|
if ($scope.removeModifyForm) {
|
||||||
.success(function (data) {
|
$scope.removeModifyForm();
|
||||||
var i, fld;
|
}
|
||||||
if (data.user_ldap_fields) {
|
$scope.removeModifyForm = $scope.$on('modifyForm', function () {
|
||||||
for (i = 0; i < data.user_ldap_fields.length; i++) {
|
// Modify form based on LDAP settings
|
||||||
fld = data.user_ldap_fields[i];
|
Rest.setUrl(GetBasePath('config'));
|
||||||
if (form.fields[fld]) {
|
Rest.get()
|
||||||
form.fields[fld].readonly = true;
|
.success(function (data) {
|
||||||
form.fields[fld].editRequired = false;
|
var i, fld;
|
||||||
if (form.fields[fld].awRequiredWhen) {
|
if (data.user_ldap_fields) {
|
||||||
delete form.fields[fld].awRequiredWhen;
|
for (i = 0; i < data.user_ldap_fields.length; i++) {
|
||||||
|
fld = data.user_ldap_fields[i];
|
||||||
|
if (form.fields[fld]) {
|
||||||
|
form.fields[fld].readonly = true;
|
||||||
|
form.fields[fld].editRequired = false;
|
||||||
|
if (form.fields[fld].awRequiredWhen) {
|
||||||
|
delete form.fields[fld].awRequiredWhen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$scope.$emit('formReady');
|
||||||
|
})
|
||||||
|
.error(function (data, status) {
|
||||||
|
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Failed to retrieve application config. GET status: ' + status });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Wait('start');
|
||||||
|
Rest.setUrl(defaultUrl + id + '/');
|
||||||
|
Rest.get()
|
||||||
|
.success(function (data) {
|
||||||
|
if (data.ldap_dn !== null && data.ldap_dn !== undefined && data.ldap_dn !== '') {
|
||||||
|
//this is an LDAP user
|
||||||
|
$scope.$emit('modifyForm');
|
||||||
|
} else {
|
||||||
|
$scope.$emit('formReady');
|
||||||
}
|
}
|
||||||
$scope.$emit('formReady');
|
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
|
||||||
msg: 'Failed to retrieve application config. GET status: ' + status });
|
msg: 'Failed to retrieve user: ' + id + '. GET status: ' + status });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Wait('start');
|
|
||||||
Rest.setUrl(defaultUrl + id + '/');
|
|
||||||
Rest.get()
|
|
||||||
.success(function (data) {
|
|
||||||
if (data.ldap_dn !== null && data.ldap_dn !== undefined && data.ldap_dn !== '') {
|
|
||||||
//this is an LDAP user
|
|
||||||
$scope.$emit('modifyForm');
|
|
||||||
} else {
|
|
||||||
$scope.$emit('formReady');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.error(function (data, status) {
|
|
||||||
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
|
|
||||||
msg: 'Failed to retrieve user: ' + id + '. GET status: ' + status });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UsersEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm', 'GenerateForm',
|
UsersEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm', 'GenerateForm',
|
||||||
|
|||||||
Reference in New Issue
Block a user