mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Fixes for AC-715 'adding cloud credentials to job_template' and AC-721 'this.scope not defined'
This commit is contained in:
@@ -14,6 +14,7 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
||||||
ClearScope, ProcessErrors, GetBasePath, SelectionInit, GetChoices, Wait, Stream)
|
ClearScope, ProcessErrors, GetBasePath, SelectionInit, GetChoices, Wait, Stream)
|
||||||
{
|
{
|
||||||
|
ClearScope('tree-form');
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
var list = CredentialList;
|
var list = CredentialList;
|
||||||
@@ -61,7 +62,7 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
if (scope.removeChoicesReady) {
|
if (scope.removeChoicesReady) {
|
||||||
scope.removeChoicesReady();
|
scope.removeChoicesReady();
|
||||||
}
|
}
|
||||||
scope.removeChoicesReady = scope.$on('choicesReady', function() {
|
scope.removeChoicesReady = scope.$on('choicesReadyCredential', function() {
|
||||||
SearchInit({ scope: scope, set: 'credentials', list: list, url: defaultUrl });
|
SearchInit({ scope: scope, set: 'credentials', list: list, url: defaultUrl });
|
||||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
@@ -73,7 +74,7 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
url: defaultUrl,
|
url: defaultUrl,
|
||||||
field: 'kind',
|
field: 'kind',
|
||||||
variable: 'credential_kind_options',
|
variable: 'credential_kind_options',
|
||||||
callback: 'choicesReady'
|
callback: 'choicesReadyCredential'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -124,6 +125,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
|
|||||||
GenerateList, SearchInit, PaginateInit, LookUpInit, UserList, TeamList, GetBasePath,
|
GenerateList, SearchInit, PaginateInit, LookUpInit, UserList, TeamList, GetBasePath,
|
||||||
GetChoices, Empty, KindChange, OwnerChange, FormSave, DebugForm)
|
GetChoices, Empty, KindChange, OwnerChange, FormSave, DebugForm)
|
||||||
{
|
{
|
||||||
|
ClearScope('tree-form');
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
|
|
||||||
@@ -256,6 +258,7 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
KindChange, UserList, TeamList, LookUpInit, Empty, OwnerChange, FormSave, Stream
|
KindChange, UserList, TeamList, LookUpInit, Empty, OwnerChange, FormSave, Stream
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
ClearScope('tree-form');
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
|
|
||||||
@@ -324,7 +327,7 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
if (scope.removeChoicesReady) {
|
if (scope.removeChoicesReady) {
|
||||||
scope.removeChoicesReady();
|
scope.removeChoicesReady();
|
||||||
}
|
}
|
||||||
scope.removeChoicesReady = scope.$on('choicesReady', function() {
|
scope.removeChoicesReady = scope.$on('choicesReadyCredential', function() {
|
||||||
// Retrieve detail record and prepopulate the form
|
// Retrieve detail record and prepopulate the form
|
||||||
Rest.setUrl(defaultUrl + ':id/');
|
Rest.setUrl(defaultUrl + ':id/');
|
||||||
Rest.get({ params: {id: id} })
|
Rest.get({ params: {id: id} })
|
||||||
@@ -392,7 +395,7 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
url: defaultUrl,
|
url: defaultUrl,
|
||||||
field: 'kind',
|
field: 'kind',
|
||||||
variable: 'credential_kind_options',
|
variable: 'credential_kind_options',
|
||||||
callback: 'choicesReady'
|
callback: 'choicesReadyCredential'
|
||||||
});
|
});
|
||||||
|
|
||||||
scope.showActivity = function() { Stream(); }
|
scope.showActivity = function() { Stream(); }
|
||||||
|
|||||||
@@ -483,6 +483,10 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
|
|||||||
{ hdr: 'Error!', msg: 'Failed to related cloud credential. GET returned status: ' + status });
|
{ hdr: 'Error!', msg: 'Failed to related cloud credential. GET returned status: ' + status });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// No existing cloud credential
|
||||||
|
scope.$emit('cloudCredentialReady', null);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Retrieve detail record and prepopulate the form
|
// Retrieve detail record and prepopulate the form
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
ClearScope, ProcessErrors, GetBasePath, SelectionInit, ProjectUpdate, ProjectStatus,
|
ClearScope, ProcessErrors, GetBasePath, SelectionInit, ProjectUpdate, ProjectStatus,
|
||||||
FormatDate, Refresh, Wait, Stream, GetChoices)
|
FormatDate, Refresh, Wait, Stream, GetChoices)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('tree-form');
|
||||||
//scope.
|
ClearScope('htmlTemplate');
|
||||||
|
|
||||||
var list = ProjectList;
|
var list = ProjectList;
|
||||||
var defaultUrl = GetBasePath('projects');
|
var defaultUrl = GetBasePath('projects');
|
||||||
@@ -84,7 +84,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
if (scope.removeChoicesHere) {
|
if (scope.removeChoicesHere) {
|
||||||
scope.removeChoicesHere();
|
scope.removeChoicesHere();
|
||||||
}
|
}
|
||||||
scope.removeChoicesHere = scope.$on('choicesHere', function() {
|
scope.removeChoicesHere = scope.$on('choicesCompleteProject', function() {
|
||||||
|
|
||||||
list.fields.scm_type.searchOptions = scope.project_scm_type_options;
|
list.fields.scm_type.searchOptions = scope.project_scm_type_options;
|
||||||
list.fields.status.searchOptions = scope.project_status_options;
|
list.fields.status.searchOptions = scope.project_status_options;
|
||||||
@@ -130,10 +130,10 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
if (scope.removeChoicesReady) {
|
if (scope.removeChoicesReady) {
|
||||||
scope.removeChoicesReady();
|
scope.removeChoicesReady();
|
||||||
}
|
}
|
||||||
scope.removeChoicesReady = scope.$on('choicesReady', function() {
|
scope.removeChoicesReady = scope.$on('choicesReadyProject', function() {
|
||||||
choiceCount++;
|
choiceCount++;
|
||||||
if (choiceCount == 2) {
|
if (choiceCount == 2) {
|
||||||
scope.$emit('choicesHere');
|
scope.$emit('choicesCompleteProject');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
url: defaultUrl,
|
url: defaultUrl,
|
||||||
field: 'status',
|
field: 'status',
|
||||||
variable: 'project_status_options',
|
variable: 'project_status_options',
|
||||||
callback: 'choicesReady'
|
callback: 'choicesReadyProject'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load the list of options for Kind
|
// Load the list of options for Kind
|
||||||
@@ -152,7 +152,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
url: defaultUrl,
|
url: defaultUrl,
|
||||||
field: 'scm_type',
|
field: 'scm_type',
|
||||||
variable: 'project_scm_type_options',
|
variable: 'project_scm_type_options',
|
||||||
callback: 'choicesReady'
|
callback: 'choicesReadyProject'
|
||||||
});
|
});
|
||||||
|
|
||||||
LoadBreadCrumbs();
|
LoadBreadCrumbs();
|
||||||
@@ -329,8 +329,8 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
|
|||||||
GetBasePath, ReturnToCaller, GetProjectPath, LookUpInit, OrganizationList,
|
GetBasePath, ReturnToCaller, GetProjectPath, LookUpInit, OrganizationList,
|
||||||
CredentialList, GetChoices, DebugForm, Wait)
|
CredentialList, GetChoices, DebugForm, Wait)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('tree-form');
|
||||||
//scope.
|
ClearScope('htmlTemplate');
|
||||||
|
|
||||||
// Inject dynamic view
|
// Inject dynamic view
|
||||||
var form = ProjectsForm;
|
var form = ProjectsForm;
|
||||||
@@ -466,8 +466,8 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
|
|||||||
RelatedPaginateInit, Prompt, ClearScope, GetBasePath, ReturnToCaller, GetProjectPath,
|
RelatedPaginateInit, Prompt, ClearScope, GetBasePath, ReturnToCaller, GetProjectPath,
|
||||||
Authorization, CredentialList, LookUpInit, GetChoices, Empty, DebugForm, Wait, Stream)
|
Authorization, CredentialList, LookUpInit, GetChoices, Empty, DebugForm, Wait, Stream)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('tree-form');
|
||||||
//scope.
|
ClearScope('htmlTemplate');
|
||||||
|
|
||||||
// Inject dynamic view
|
// Inject dynamic view
|
||||||
var form = ProjectsForm;
|
var form = ProjectsForm;
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ angular.module('JobTemplateFormDefinition', [])
|
|||||||
sourceModel: 'credential',
|
sourceModel: 'credential',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
ngClick: 'lookUpCredential()',
|
ngClick: 'lookUpCredential()',
|
||||||
addRequired: true,
|
addRequired: false,
|
||||||
editRequired: true,
|
editRequired: false,
|
||||||
column: 1,
|
column: 1,
|
||||||
awPopOver: "<p>Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " +
|
awPopOver: "<p>Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " +
|
||||||
" the username and SSH key or password that Ansbile will need to log into the remote hosts.</p>",
|
" the username and SSH key or password that Ansbile will need to log into the remote hosts.</p>",
|
||||||
|
|||||||
@@ -719,18 +719,18 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
LookUpInit, CredentialList, Empty, Wait, GetChoices) {
|
LookUpInit, CredentialList, Empty, Wait, GetChoices) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
|
$('#tree-form').hide().empty();
|
||||||
|
|
||||||
var group_id = params.group_id;
|
var group_id = params.group_id;
|
||||||
var inventory_id = params.inventory_id;
|
var inventory_id = params.inventory_id;
|
||||||
var generator = GenerateForm;
|
var generator = GenerateForm;
|
||||||
var form = GroupForm;
|
var form = GroupForm;
|
||||||
var defaultUrl = GetBasePath('groups') + group_id + '/';
|
var defaultUrl = GetBasePath('groups') + group_id + '/';
|
||||||
|
|
||||||
$('#tree-form').hide().empty();
|
|
||||||
|
|
||||||
var element = angular.element(document.getElementById('tree-form'));
|
var scope = generator.inject(form,
|
||||||
var scope = element.scope();
|
{ mode: 'edit', modal: false, related: false, id: 'tree-form', breadCrumbs: false });
|
||||||
|
generator.reset();
|
||||||
|
|
||||||
//var scope = generator.inject(form, { mode: 'edit', modal: false, related: false, id: 'tree-form', breadCrumbs: false });
|
|
||||||
var master = {};
|
var master = {};
|
||||||
var relatedSets = {};
|
var relatedSets = {};
|
||||||
|
|
||||||
@@ -892,12 +892,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
if (scope.removeChoicesComplete) {
|
if (scope.removeChoicesComplete) {
|
||||||
scope.removeChoicesComplete();
|
scope.removeChoicesComplete();
|
||||||
}
|
}
|
||||||
scope.removeChoicesComplete = scope.$on('choicesComplete', function() {
|
scope.removeChoicesComplete = scope.$on('choicesCompleteGroup', function() {
|
||||||
|
|
||||||
generator.inject(form, { mode: 'edit', modal: false, related: false, id: 'tree-form',
|
|
||||||
breadCrumbs: false, scope: scope });
|
|
||||||
generator.reset();
|
|
||||||
|
|
||||||
// Retrieve detail record and prepopulate the form
|
// Retrieve detail record and prepopulate the form
|
||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -929,10 +924,10 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
if (scope.removeChoicesReady) {
|
if (scope.removeChoicesReady) {
|
||||||
scope.removeChoicesReady();
|
scope.removeChoicesReady();
|
||||||
}
|
}
|
||||||
scope.removeChoicesReady = scope.$on('choicesReady', function() {
|
scope.removeChoicesReady = scope.$on('choicesReadyGroup', function() {
|
||||||
choicesReady++;
|
choicesReady++;
|
||||||
if (choicesReady == 2) {
|
if (choicesReady == 2) {
|
||||||
scope.$emit('choicesComplete');
|
scope.$emit('choicesCompleteGroup');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -943,7 +938,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
field: 'source_regions',
|
field: 'source_regions',
|
||||||
variable: 'rax_regions',
|
variable: 'rax_regions',
|
||||||
choice_name: 'rax_region_choices',
|
choice_name: 'rax_region_choices',
|
||||||
callback: 'choicesReady'
|
callback: 'choicesReadyGroup'
|
||||||
});
|
});
|
||||||
|
|
||||||
GetChoices({
|
GetChoices({
|
||||||
@@ -952,7 +947,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
field: 'source_regions',
|
field: 'source_regions',
|
||||||
variable: 'ec2_regions',
|
variable: 'ec2_regions',
|
||||||
choice_name: 'ec2_region_choices',
|
choice_name: 'ec2_region_choices',
|
||||||
callback: 'choicesReady'
|
callback: 'choicesReadyGroup'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!scope.$$phase) {
|
if (!scope.$$phase) {
|
||||||
|
|||||||
@@ -9,9 +9,12 @@ angular.module('Utilities',['RestServices', 'Utilities'])
|
|||||||
|
|
||||||
.factory('ClearScope', [ function() {
|
.factory('ClearScope', [ function() {
|
||||||
return function(id) {
|
return function(id) {
|
||||||
|
|
||||||
var element = document.getElementById(id);
|
var element = document.getElementById(id);
|
||||||
var scope = angular.element(element).scope();
|
if (element) {
|
||||||
scope.$destroy();
|
var scope = angular.element(element).scope();
|
||||||
|
scope.$destroy();
|
||||||
|
}
|
||||||
|
|
||||||
$('.tooltip').each( function(index) {
|
$('.tooltip').each( function(index) {
|
||||||
// Remove any lingering tooltip and popover <div> elements
|
// Remove any lingering tooltip and popover <div> elements
|
||||||
@@ -378,7 +381,7 @@ angular.module('Utilities',['RestServices', 'Utilities'])
|
|||||||
}).fadeIn(400);
|
}).fadeIn(400);
|
||||||
}
|
}
|
||||||
else if (directive == 'stop' && $rootScope.waiting){
|
else if (directive == 'stop' && $rootScope.waiting){
|
||||||
$('.spinny, .overlay').fadeOut(800, function(){ $rootScope.waiting = false; });
|
$('.spinny, .overlay').fadeOut(400, function(){ $rootScope.waiting = false; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities'])
|
|||||||
|
|
||||||
accordion_count: 0,
|
accordion_count: 0,
|
||||||
|
|
||||||
|
scope: null,
|
||||||
|
|
||||||
has: function(key) {
|
has: function(key) {
|
||||||
return (this.form[key] && this.form[key] != null && this.form[key] != undefined) ? true : false;
|
return (this.form[key] && this.form[key] != null && this.form[key] != undefined) ? true : false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
|
|||||||
html += "<div class=\"input-group-btn dropdown\">\n";
|
html += "<div class=\"input-group-btn dropdown\">\n";
|
||||||
html += "<button type=\"button\" ";
|
html += "<button type=\"button\" ";
|
||||||
html += "id=\"search_field_ddown\" ";
|
html += "id=\"search_field_ddown\" ";
|
||||||
html += "class=\"btn ";
|
html += "class=\"btn btn-default ";
|
||||||
html += "dropdown-toggle\" data-toggle=\"dropdown\"";
|
html += "dropdown-toggle\" data-toggle=\"dropdown\"";
|
||||||
html += ">\n";
|
html += ">\n";
|
||||||
html += "<span ng-bind=\"" + iterator + "SearchFieldLabel" + modifier + "\"></span>\n";
|
html += "<span ng-bind=\"" + iterator + "SearchFieldLabel" + modifier + "\"></span>\n";
|
||||||
|
|||||||
@@ -9,13 +9,14 @@
|
|||||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/font-awesome.min.css" />
|
<link rel="stylesheet" href="{{ STATIC_URL }}css/font-awesome.min.css" />
|
||||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/select2.css" />
|
<link rel="stylesheet" href="{{ STATIC_URL }}css/select2.css" />
|
||||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/select2-bootstrap.css" />
|
<link rel="stylesheet" href="{{ STATIC_URL }}css/select2-bootstrap.css" />
|
||||||
|
|
||||||
|
|
||||||
{% if settings.USE_MINIFIED_JS %}
|
{% if settings.USE_MINIFIED_JS %}
|
||||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/awx.min.css" />
|
<link rel="stylesheet" href="{{ STATIC_URL }}css/awx.min.css" />
|
||||||
{% else %}
|
{% else %}
|
||||||
<link rel="stylesheet/less" type="text/css" href="{{ STATIC_URL }}less/ansible-ui.less" />
|
<link rel="stylesheet/less" type="text/css" href="{{ STATIC_URL }}less/ansible-ui.less" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<link rel="shortcut icon" href="{{ STATIC_URL }}img/favicon.ico" />
|
<link rel="shortcut icon" href="{{ STATIC_URL }}img/favicon.ico" />
|
||||||
<script>
|
<script>
|
||||||
var $basePath = "{{ STATIC_URL }}";
|
var $basePath = "{{ STATIC_URL }}";
|
||||||
|
|||||||
Reference in New Issue
Block a user