mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Fixed issue with Allow Callback checkbox and host_config_key value when user unchecks Allow Callback checkbox.
This commit is contained in:
parent
9c39f13056
commit
d2c08d2848
14
awx/ui/static/js/awx-min.js
vendored
14
awx/ui/static/js/awx-min.js
vendored
@ -4,7 +4,7 @@
|
||||
*
|
||||
* awx-min.js
|
||||
*
|
||||
* master-f7ffe9a, Mon Jul 15 02:24:58 2013 -0400
|
||||
* master-f6eea06, Mon Jul 15 12:08:33 2013 -0400
|
||||
*
|
||||
*/
|
||||
var urlPrefix="/static/";
|
||||
@ -86,11 +86,11 @@ b})})}});r({scope:w,form:f,current_item:null,list:t,field:"project"});w.formSave
|
||||
b,c,e){d(w,a,b,f,{hdr:"Error!",msg:"Failed to add new job template. POST returned status: "+b})})}catch(n){a("Error","Error parsing extra variables. Parser returned: "+n)}};w.formReset=function(){e.reset();$("#forks-slider").slider("option","value",w.forks);for(var a in z)w[a]=z[a]}}JobTemplatesAdd.$inject="$scope $rootScope $compile $location $log $routeParams JobTemplateForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ReturnToCaller ClearScope GetBasePath InventoryList CredentialList ProjectList LookUpInit md5Setup ParseTypeChange".split(" ");
|
||||
function JobTemplatesEdit(k,m,h,g,c,p,f,e,l,a,d,b,y,v,A,u,C,t,r,n,B,q,w,z){function E(a){if(null!==a&&""!==a&&void 0!==a){var b=q("projects")+a+"/playbooks/";l.setUrl(b);l.get().success(function(a,b,d,c){s.playbook_options=[];for(b=0;b<a.length;b++)s.playbook_options.push(a[b])}).error(function(a,c,f,e){d(s,a,c,D,{hdr:"Error!",msg:"Failed to get playbook list for "+b+". GET returned status: "+c})})}}u("htmlTemplate");var F=q("job_templates"),D=f,s=e.inject(D,{mode:"edit",related:!0});s.parseType=
|
||||
"yaml";z(s);s.job_type_options=[{value:"run",label:"Run"},{value:"check",label:"Check"}];s.verbosity_options=[{value:"0",label:"Default"},{value:"1",label:"Verbose"},{value:"3",label:"Debug"}];s.playbook_options=null;s.playbook=null;e.reset();var K=g.path().replace(/^\//,"").split("/")[0],G={},J=p.id,H={};s.selectPlaybookUnregister&&s.selectPlaybookUnregister();s.selectPlaybookUnregister=s.$watch("project_name",function(a,b){a!==b&&(""!==b&&null!==b&&void 0!==b)&&(s.playbook=null,E(s.project))});
|
||||
s.jobTemplateLoadedRemove&&s.jobTemplateLoadedRemove();s.jobTemplateLoadedRemove=s.$on("jobTemplateLoaded",function(){for(var a in H)s.search(H[a].iterator);E(s.project);$("#forks-slider").slider("value",s.forks);w({scope:s,master:G,check_field:"allow_callbacks",default_val:s.host_config_key?"true":"false"})});l.setUrl(F+":id/");l.get({params:{id:J}}).success(function(a,d,c,f){b({path:"/job_templates/"+J,title:a.name});for(var e in D.fields){if("variables"!=e&&null!==a[e]&&void 0!==a[e]){if("select"==
|
||||
D.fields[e].type)if(s[e+"_options"]&&0<s[e+"_options"].length)for(d=0;d<s[e+"_options"].length;d++)a[e]==s[e+"_options"][d].value&&(s[e]=s[e+"_options"][d]);else s[e]=a[e];else s[e]=a[e];G[e]=s[e]}"variables"==e&&($.isEmptyObject(a.extra_vars)||"{}"==a.extra_vars||"null"==a.extra_vars?s.variables="---":(d=JSON.parse(a.extra_vars),s.variables=jsyaml.safeDump(d)),G.variables=s.variables);"lookup"==D.fields[e].type&&a.summary_fields[D.fields[e].sourceModel]&&(s[D.fields[e].sourceModel+"_"+D.fields[e].sourceField]=
|
||||
a.summary_fields[D.fields[e].sourceModel][D.fields[e].sourceField],G[D.fields[e].sourceModel+"_"+D.fields[e].sourceField]=s[D.fields[e].sourceModel+"_"+D.fields[e].sourceField])}s.url=a.url;e=a.related;for(var l in D.related)e[l]&&(H[l]={url:e[l],iterator:D.related[l].iterator});s.callback_url=a.related.callback;G.callback_url=s.callback_url;n({scope:s,form:D,current_item:a.inventory,list:C,field:"inventory"});n({scope:s,form:D,current_item:a.credential,list:t,field:"credential"});n({scope:s,form:D,
|
||||
current_item:a.project,list:r,field:"project"});y({scope:s,form:D,relatedSets:H});v({scope:s,relatedSets:H});s.$emit("jobTemplateLoaded")}).error(function(a,b,c,e){d(s,a,b,D,{hdr:"Error!",msg:"Failed to retrieve job template: "+p.id+". GET status: "+b})});s.formSave=function(){var b={};try{var c="json"==s.parseType?JSON.parse(s.variables):jsyaml.load(s.variables);if("object"!==typeof c)throw"failed to return an object!";for(var e in D.fields)"select"==D.fields[e].type&&"playbook"!=e?b[e]=s[e].value:
|
||||
"variables"!=e&&"callback_url"!=e&&(b[e]=s[e]);b.extra_vars=JSON.stringify(c,void 0,"\t");l.setUrl(F+J+"/");l.put(b).success(function(a,b,d,c){"job_templates"==g.path().replace(/^\//,"").split("/")[0]?A():A(1)}).error(function(a,b,c,e){d(s,a,b,D,{hdr:"Error!",msg:"Failed to update job template. PUT returned status: "+b})})}catch(f){a("Error","Error parsing extra variables. Parser returned: "+f)}};s.formReset=function(){e.reset();for(var a in G)s[a]=G[a];s.parseType="yaml";$("#forks-slider").slider("option",
|
||||
s.jobTemplateLoadedRemove&&s.jobTemplateLoadedRemove();s.jobTemplateLoadedRemove=s.$on("jobTemplateLoaded",function(){for(var a in H)s.search(H[a].iterator);E(s.project);$("#forks-slider").slider("value",s.forks);w({scope:s,master:G,check_field:"allow_callbacks",default_val:""===s.host_config_key||null===s.host_config_key?"false":"true"})});l.setUrl(F+":id/");l.get({params:{id:J}}).success(function(a,d,c,f){b({path:"/job_templates/"+J,title:a.name});for(var e in D.fields){if("variables"!=e&&null!==
|
||||
a[e]&&void 0!==a[e]){if("select"==D.fields[e].type)if(s[e+"_options"]&&0<s[e+"_options"].length)for(d=0;d<s[e+"_options"].length;d++)a[e]==s[e+"_options"][d].value&&(s[e]=s[e+"_options"][d]);else s[e]=a[e];else s[e]=a[e];G[e]=s[e]}"variables"==e&&($.isEmptyObject(a.extra_vars)||"{}"==a.extra_vars||"null"==a.extra_vars?s.variables="---":(d=JSON.parse(a.extra_vars),s.variables=jsyaml.safeDump(d)),G.variables=s.variables);"lookup"==D.fields[e].type&&a.summary_fields[D.fields[e].sourceModel]&&(s[D.fields[e].sourceModel+
|
||||
"_"+D.fields[e].sourceField]=a.summary_fields[D.fields[e].sourceModel][D.fields[e].sourceField],G[D.fields[e].sourceModel+"_"+D.fields[e].sourceField]=s[D.fields[e].sourceModel+"_"+D.fields[e].sourceField])}s.url=a.url;e=a.related;for(var l in D.related)e[l]&&(H[l]={url:e[l],iterator:D.related[l].iterator});s.callback_url=a.related.callback;G.callback_url=s.callback_url;n({scope:s,form:D,current_item:a.inventory,list:C,field:"inventory"});n({scope:s,form:D,current_item:a.credential,list:t,field:"credential"});
|
||||
n({scope:s,form:D,current_item:a.project,list:r,field:"project"});y({scope:s,form:D,relatedSets:H});v({scope:s,relatedSets:H});s.$emit("jobTemplateLoaded")}).error(function(a,b,c,e){d(s,a,b,D,{hdr:"Error!",msg:"Failed to retrieve job template: "+p.id+". GET status: "+b})});s.formSave=function(){var b={};try{var c="json"==s.parseType?JSON.parse(s.variables):jsyaml.load(s.variables);if("object"!==typeof c)throw"failed to return an object!";for(var e in D.fields)"select"==D.fields[e].type&&"playbook"!=
|
||||
e?b[e]=s[e].value:"variables"!=e&&"callback_url"!=e&&(b[e]=s[e]);b.extra_vars=JSON.stringify(c,void 0,"\t");l.setUrl(F+J+"/");l.put(b).success(function(a,b,d,c){"job_templates"==g.path().replace(/^\//,"").split("/")[0]?A():A(1)}).error(function(a,b,c,e){d(s,a,b,D,{hdr:"Error!",msg:"Failed to update job template. PUT returned status: "+b})})}catch(f){a("Error","Error parsing extra variables. Parser returned: "+f)}};s.formReset=function(){e.reset();for(var a in G)s[a]=G[a];s.parseType="yaml";$("#forks-slider").slider("option",
|
||||
"value",s.forks)};s.add=function(a){m.flashMessage=null;g.path("/"+K+"/"+p.id+"/"+a)};s.edit=function(a,b,d){m.flashMessage=null;g.path("/"+a+"/"+b)};s["delete"]=function(a,b,c,e){m.flashMessage=null;Prompt({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+s.name+" "+e+"?",action:function(){var c=F+J+"/"+a+"/";l.setUrl(c);l.post({id:b,disassociate:1}).success(function(b,d,c,e){$("#prompt-modal").modal("hide");s.search(D.related[a].iterator)}).error(function(a,b,e,f){$("#prompt-modal").modal("hide");
|
||||
d(s,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. POST returned status: "+b})})}})}}JobTemplatesEdit.$inject="$scope $rootScope $compile $location $log $routeParams JobTemplateForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit ReturnToCaller ClearScope InventoryList CredentialList ProjectList LookUpInit PromptPasswords GetBasePath md5Setup ParseTypeChange".split(" ");function OrganizationsList(k,m,h,g,c,p,f,e,l,a,d,b,y,v,A){y("htmlTemplate");k="organizations"==h.path().replace(/^\//,"").split("/")[0]?"edit":"select";var u=l.inject(a,{mode:k}),C=A("organizations");m.flashMessage=null;f();u.PostRefreshRemove&&u.PostRefreshRemove();u.PostRefreshRemove=u.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");u[a]=""})});d({scope:u,set:a.name,list:a,url:C});b({scope:u,list:a,url:C});u.search(a.iterator);u.addOrganization=function(){h.path(h.path()+
|
||||
"/add")};u.editOrganization=function(a){h.path(h.path()+"/"+a)};u.deleteOrganization=function(b,d){e({hdr:"Delete",body:"Are you sure you want to delete "+d+"?",action:function(){var d=C+b+"/";c.setUrl(d);c.destroy().success(function(b,d,c,e){$("#prompt-modal").modal("hide");u.search(a.iterator)}).error(function(a,b,c,e){$("#prompt-modal").modal("hide");v(u,a,b,null,{hdr:"Error!",msg:"Call to "+d+" failed. DELETE returned status: "+b})})}})};u.toggle_organization=function(b){"success"==u[a.iterator+
|
||||
@ -247,7 +247,7 @@ d})}))}).error(function(a,d,c,e){l(b,a,d,null,{hdr:"Error!",msg:"Failed to creat
|
||||
(a.credential=b.credential,d(a))}),f({scope:b,form:e,current_item:null,list:p,field:"credential",hdr:"Credential Required"}),b.lookUpCredential()):d(a)}).error(function(a,d,c,e){l(b,a,d,null,{hdr:"Error!",msg:"Failed to get job template details. GET returned status: "+d})})}}]);angular.module("LookUpHelper","RestServices Utilities SearchHelper PaginateHelper ListGenerator ApiLoader".split(" ")).factory("LookUpInit",["Alert","Rest","GenerateList","SearchInit","PaginateInit","GetBasePath",function(k,m,h,g,c,p){return function(f){var e=f.scope,l=f.form,a=f.current_item,d=f.list,b=f.field,m=f.postAction,v=d.iterator.charAt(0).toUpperCase()+d.iterator.substring(1),A="inventories"==d.name?p("inventory"):p(d.name),u=f.hdr?f.hdr:"Select "+v;$('input[name="'+l.fields[b].sourceModel+
|
||||
"_"+l.fields[b].sourceField+'"]').attr("data-url",A+"?"+l.fields[b].sourceField+"__iexact=:value");$('input[name="'+l.fields[b].sourceModel+"_"+l.fields[b].sourceField+'"]').attr("data-source",b);e["lookUp"+v]=function(){var f=h.inject(d,{mode:"lookup",hdr:u});f.selectAction=function(){for(var a=!1,c=0;c<f[d.name].length;c++)"success"==f[d.iterator+"_"+f[d.name][c].id+"_class"]&&(a=!0,e[b]=f[d.name][c].id,e[l.name+"_form"]&&(l.fields[b]&&l.fields[b].sourceModel)&&(e[l.fields[b].sourceModel+"_"+l.fields[b].sourceField]=
|
||||
f[d.name][c][l.fields[b].sourceField],e[l.name+"_form"][l.fields[b].sourceModel+"_"+l.fields[b].sourceField]&&e[l.name+"_form"][l.fields[b].sourceModel+"_"+l.fields[b].sourceField].$setValidity("awlookup",!0)),e[l.name+"_form"]&&e[l.name+"_form"].$setDirty(),h.hide());!1==a?k("Missing Selection","Oops, you failed to make a selection. Click on a row to make your selection, and then click the Select button."):m&&m()};f["toggle_"+d.iterator]=function(a){if(f[d.name])for(var b=0;b<f[d.name].length;b++)f[d.iterator+
|
||||
"_"+f[d.name][b].id+"_class"]="";null!=a&&void 0!=a&&(f[d.iterator+"_"+a+"_class"]="success")};g({scope:f,set:d.name,list:d,url:A});c({scope:f,list:d,url:A,mode:"lookup"});f.search(d.iterator);if(a)f["toggle_"+d.iterator](a)}}}]);angular.module("md5Helper",["RestServices","Utilities"]).factory("md5Setup",["Alert","Rest","GetBasePath","ProcessErrors",function(k,m,h,g){return function(c){var g=c.scope,f=c.master,e=c.check_field;c=c.default_val;g[e]=c;f[e]=c;g.genMD5=function(c){g[c]=$.md5("AnsibleWorks"+(new Date).getTime())};g.toggleCallback=function(c){"false"==g.allow_callbacks&&(g[c]=null)};g.selectAll=function(c){$('input[name="'+c+'"]').focus().select()}}}]);angular.module("PaginateHelper",["RefreshHelper","ngCookies"]).factory("PaginateInit",["Refresh","$cookieStore",function(k,m){return function(h){var g=h.scope,c=h.list,c=h.iterator?h.iterator:c.iterator,p=h.url,f=h.mode?h.mode:null,e=m.get(c+"PageSize");g[c+"Page"]=0;g[c+"PageSize"]=e&&"lookup"!=f?e:h.pageSize?h.pageSize:"lookup"==f?5:20;g.nextSet=function(c,a){g[a+"NextUrl"]&&(g[a+"Page"]++,k({scope:g,set:c,iterator:a,url:g[a+"NextUrl"]}))};g.prevSet=function(c,a){g[a+"PrevUrl"]&&(g[a+"Page"]--,
|
||||
"_"+f[d.name][b].id+"_class"]="";null!=a&&void 0!=a&&(f[d.iterator+"_"+a+"_class"]="success")};g({scope:f,set:d.name,list:d,url:A});c({scope:f,list:d,url:A,mode:"lookup"});f.search(d.iterator);if(a)f["toggle_"+d.iterator](a)}}}]);angular.module("md5Helper",["RestServices","Utilities"]).factory("md5Setup",["Alert","Rest","GetBasePath","ProcessErrors",function(k,m,h,g){return function(c){var g=c.scope,f=c.master,e=c.check_field;c=c.default_val;g[e]=c;f[e]=c;g.genMD5=function(c){g[c]=$.md5("AnsibleWorks"+(new Date).getTime())};g.toggleCallback=function(c){"false"==g.allow_callbacks&&(g[c]="")};g.selectAll=function(c){$('input[name="'+c+'"]').focus().select()}}}]);angular.module("PaginateHelper",["RefreshHelper","ngCookies"]).factory("PaginateInit",["Refresh","$cookieStore",function(k,m){return function(h){var g=h.scope,c=h.list,c=h.iterator?h.iterator:c.iterator,p=h.url,f=h.mode?h.mode:null,e=m.get(c+"PageSize");g[c+"Page"]=0;g[c+"PageSize"]=e&&"lookup"!=f?e:h.pageSize?h.pageSize:"lookup"==f?5:20;g.nextSet=function(c,a){g[a+"NextUrl"]&&(g[a+"Page"]++,k({scope:g,set:c,iterator:a,url:g[a+"NextUrl"]}))};g.prevSet=function(c,a){g[a+"PrevUrl"]&&(g[a+"Page"]--,
|
||||
k({scope:g,set:c,iterator:a,url:g[a+"PrevUrl"]}))};g.changePageSize=function(c,a){m.put(a+"PageSize",g[a+"PageSize"]);g[a+"Page"]=0;var d=p.replace(/\?page_size\=\d+/,""),b=/\/$/.test(d)?"?":"&",d=d+(g[a+"SearchParams"]?b+g[a+"SearchParams"]+"&page_size="+g[a+"PageSize"]:+b+"page_size="+g[a+"PageSize"]);k({scope:g,set:c,iterator:a,url:d})}}}]);angular.module("ParseHelper",[]).factory("ParseTypeChange",[function(){return function(k,m,h){var g=m?m:"variables";m=h?h:"parseType";k.blockParseTypeWatch=!1;k.blockVariableDataWatch=!1;k.removeParseTypeWatch&&k.removeParseTypeWatch();k.removeParseTypeWatch=k.$watch(m,function(c,h){if(c!==h)if("json"==c)if(k[g]&&!/^---$/.test(k[g]))try{var f=jsyaml.load(k[g]);k[g]=JSON.stringify(f,null," ")}catch(e){}else k[g]="{}";else if(k[g]&&!/^\{\}$/.test(k[g]))try{f=JSON.parse(k[g]),k[g]=jsyaml.safeDump(f)}catch(l){}else k[g]=
|
||||
"---"})}}]);angular.module("ProjectPathHelper",["RestServices","Utilities"]).factory("GetProjectPath",["Alert","Rest","GetBasePath","ProcessErrors",function(k,m,h,g){return function(c){var p=c.scope,f=c.master;m.setUrl(h("config"));m.get().success(function(c,l,a,d){l=[];for(a=0;a<c.project_local_paths.length;a++)l.push(c.project_local_paths[a]);p.local_path&&l.push(p.local_path);p.project_local_paths=l;p.base_dir=c.project_base_dir;f.base_dir=p.base_dir;0==l.length&&k("Missing Playbooks","<p>There are no unassigned playbook directories in the base project path ("+
|
||||
p.base_dir+"). Either the project directory is empty, or all of the contents are already assigned to other AWX projects.</p><p>To fix this, log into the AWX server and check out another playbook project from your SCM repository into "+p.base_dir+".</p>","alert-info")}).error(function(c,l,a,d){g(p,c,l,null,{hdr:"Error!",msg:"Failed to access API config. GET status: "+l})})}}]);angular.module("RefreshRelatedHelper",["RestServices","Utilities"]).factory("RefreshRelated",["Alert","Rest",function(k,m){return function(h){var g=h.scope,c=h.set,p=h.iterator;m.setUrl(h.url);m.get().success(function(f,e,l,a){g[c]=f.results;g[p+"NextUrl"]=f.next;g[p+"PrevUrl"]=f.previous;g[p+"Count"]=f.count;g[p+"PageCount"]=Math.ceil(f.count/g[p+"PageSize"]);g[p+"SearchSpin"]=!1;g[p+"Loading"]=!1}).error(function(f,e,l,a){g[p+"SearchSpin"]=!0;k("Error!","Failed to retrieve related set: "+c+". GET returned status: "+
|
||||
|
@ -377,7 +377,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
|
||||
getPlaybooks(scope.project);
|
||||
$('#forks-slider').slider('value',scope.forks); // align slider handle with value.
|
||||
|
||||
var dft = (scope['host_config_key']) ? 'true' : 'false';
|
||||
var dft = (scope['host_config_key'] === "" || scope['host_config_key'] === null) ? 'false' : 'true';
|
||||
md5Setup({
|
||||
scope: scope,
|
||||
master: master,
|
||||
|
@ -28,7 +28,7 @@ angular.module('md5Helper', ['RestServices', 'Utilities'])
|
||||
|
||||
scope.toggleCallback = function(fld) {
|
||||
if (scope.allow_callbacks == 'false') {
|
||||
scope[fld] = null;
|
||||
scope[fld] = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user