mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
JS minification
This commit is contained in:
parent
345085a165
commit
ec9c96cef4
372
awx/ui/static/js/awx-min.js
vendored
Normal file
372
awx/ui/static/js/awx-min.js
vendored
Normal file
@ -0,0 +1,372 @@
|
||||
/*********************************************
|
||||
* Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* ansibleworks-min.js
|
||||
*
|
||||
* master-f0cf62a, Wed Jul 3 18:43:51 2013 -0400
|
||||
*
|
||||
*/
|
||||
var urlPrefix="/static/";
|
||||
angular.module("ansible","RestServices AuthService Utilities OrganizationFormDefinition UserFormDefinition FormGenerator OrganizationListDefinition UserListDefinition ListGenerator PromptDialog ApiLoader RelatedSearchHelper RelatedPaginateHelper SearchHelper PaginateHelper RefreshHelper AdminListDefinition AWDirectives InventoriesListDefinition InventoryFormDefinition InventoryHelper AWFilters HostFormDefinition HostListDefinition GroupFormDefinition GroupListDefinition TeamsListDefinition TeamFormDefinition TeamHelper CredentialsListDefinition CredentialFormDefinition LookUpHelper JobTemplatesListDefinition JobTemplateFormDefinition JobTemplateHelper ProjectsListDefinition ProjectFormDefinition PermissionFormDefinition PermissionListDefinition JobsListDefinition JobFormDefinition JobEventsListDefinition JobEventFormDefinition JobHostDefinition GroupsHelper HostsHelper ParseHelper ChildrenHelper EventsHelper ProjectPathHelper md5Helper AccessHelper".split(" ")).config(["$routeProvider",function(h){h.when("/jobs",
|
||||
{templateUrl:urlPrefix+"partials/jobs.html",controller:JobsListCtrl}).when("/jobs/:id",{templateUrl:urlPrefix+"partials/jobs.html",controller:JobsEdit}).when("/jobs/:id/job_events",{templateUrl:urlPrefix+"partials/jobs.html",controller:JobEventsList}).when("/jobs/:id/job_host_summaries",{templateUrl:urlPrefix+"partials/jobs.html",controller:JobHostSummaryList}).when("/jobs/:job_id/job_events/:event_id",{templateUrl:urlPrefix+"partials/jobs.html",controller:JobEventsEdit}).when("/job_templates",{templateUrl:urlPrefix+
|
||||
"partials/job_templates.html",controller:JobTemplatesList}).when("/job_templates/add",{templateUrl:urlPrefix+"partials/job_templates.html",controller:JobTemplatesAdd}).when("/job_templates/:id",{templateUrl:urlPrefix+"partials/job_templates.html",controller:JobTemplatesEdit}).when("/projects",{templateUrl:urlPrefix+"partials/projects.html",controller:ProjectsList}).when("/projects/add",{templateUrl:urlPrefix+"partials/projects.html",controller:ProjectsAdd}).when("/projects/:id",{templateUrl:urlPrefix+
|
||||
"partials/projects.html",controller:ProjectsEdit}).when("/inventories",{templateUrl:urlPrefix+"partials/inventories.html",controller:InventoriesList}).when("/inventories/add",{templateUrl:urlPrefix+"partials/inventories.html",controller:InventoriesAdd}).when("/inventories/:id",{templateUrl:urlPrefix+"partials/inventories.html",controller:InventoriesEdit}).when("/organizations",{templateUrl:urlPrefix+"partials/organizations.html",controller:OrganizationsList}).when("/organizations/add",{templateUrl:urlPrefix+
|
||||
"partials/organizations.html",controller:OrganizationsAdd}).when("/organizations/:organization_id",{templateUrl:urlPrefix+"partials/organizations.html",controller:OrganizationsEdit}).when("/organizations/:organization_id/admins",{templateUrl:urlPrefix+"partials/organizations.html",controller:AdminsList}).when("/organizations/:organization_id/users",{templateUrl:urlPrefix+"partials/users.html",controller:UsersList}).when("/organizations/:organization_id/users/add",{templateUrl:urlPrefix+"partials/users.html",
|
||||
controller:UsersAdd}).when("/organizations/:organization_id/users/:user_id",{templateUrl:urlPrefix+"partials/users.html",controller:UsersEdit}).when("/teams",{templateUrl:urlPrefix+"partials/teams.html",controller:TeamsList}).when("/teams/add",{templateUrl:urlPrefix+"partials/teams.html",controller:TeamsAdd}).when("/teams/:team_id",{templateUrl:urlPrefix+"partials/teams.html",controller:TeamsEdit}).when("/teams/:team_id/permissions/add",{templateUrl:urlPrefix+"partials/teams.html",controller:PermissionsAdd}).when("/teams/:team_id/permissions",
|
||||
{templateUrl:urlPrefix+"partials/teams.html",controller:PermissionsList}).when("/teams/:team_id/permissions/:permission_id",{templateUrl:urlPrefix+"partials/teams.html",controller:PermissionsEdit}).when("/teams/:team_id/users",{templateUrl:urlPrefix+"partials/teams.html",controller:UsersList}).when("/teams/:team_id/users/:user_id",{templateUrl:urlPrefix+"partials/teams.html",controller:UsersEdit}).when("/teams/:team_id/projects",{templateUrl:urlPrefix+"partials/teams.html",controller:ProjectsList}).when("/teams/:team_id/projects/add",
|
||||
{templateUrl:urlPrefix+"partials/teams.html",controller:ProjectsAdd}).when("/teams/:team_id/projects/:project_id",{templateUrl:urlPrefix+"partials/teams.html",controller:ProjectsEdit}).when("/teams/:team_id/credentials",{templateUrl:urlPrefix+"partials/teams.html",controller:CredentialsList}).when("/teams/:team_id/credentials/add",{templateUrl:urlPrefix+"partials/teams.html",controller:CredentialsAdd}).when("/teams/:team_id/credentials/:credential_id",{templateUrl:urlPrefix+"partials/teams.html",
|
||||
controller:CredentialsEdit}).when("/credentials",{templateUrl:urlPrefix+"partials/credentials.html",controller:CredentialsList}).when("/credentials/:credential_id",{templateUrl:urlPrefix+"partials/credentials.html",controller:CredentialsEdit}).when("/users",{templateUrl:urlPrefix+"partials/users.html",controller:UsersList}).when("/users/add",{templateUrl:urlPrefix+"partials/users.html",controller:UsersAdd}).when("/users/:user_id",{templateUrl:urlPrefix+"partials/users.html",controller:UsersEdit}).when("/users/:user_id/credentials",
|
||||
{templateUrl:urlPrefix+"partials/users.html",controller:CredentialsList}).when("/users/:user_id/permissions/add",{templateUrl:urlPrefix+"partials/users.html",controller:PermissionsAdd}).when("/users/:user_id/permissions",{templateUrl:urlPrefix+"partials/users.html",controller:PermissionsList}).when("/users/:user_id/permissions/:permission_id",{templateUrl:urlPrefix+"partials/users.html",controller:PermissionsEdit}).when("/users/:user_id/credentials/add",{templateUrl:urlPrefix+"partials/teams.html",
|
||||
controller:CredentialsAdd}).when("/teams/:user_id/credentials/:credential_id",{templateUrl:urlPrefix+"partials/teams.html",controller:CredentialsEdit}).when("/login",{templateUrl:urlPrefix+"partials/login-dialog.html",controller:Authenticate}).when("/logout",{templateUrl:urlPrefix+"partials/login-dialog.html",controller:Authenticate}).otherwise({redirectTo:"/"})}]).run(["$rootScope","CheckLicense","$location","Authorization","LoadBasePaths",function(h,m,k,g,c){c();h.breadcrumbs=[];h.crumbCache=[];
|
||||
h.$on("$routeChangeStart",function(c,f,e){!1==g.isTokenValid()?f.templateUrl!=urlPrefix+"partials/login.html"&&k.path("/login"):((void 0==h.current_user||null==h.current_user)&&g.restoreUserInfo(),m());c=k.path().replace(/^\//,"").split("/")[0];""==c?$('.nav-tabs a[href="#organizations"]').tab("show"):(c.replace(/\_/g," "),$('.nav-tabs a[href="#'+c+'"]').tab("show"))});g.isTokenValid()||k.path("/login");c=k.path().replace(/^\//,"").split("/")[0];""==c?(c="organizations",k.path("/organizations")):
|
||||
c.replace(/\_/g," ");$('.nav-tabs a[href="#'+c+'"]').tab("show");h.viewCurrentUser=function(){k.path("/users/"+h.current_user.id)}}]);var $AnsibleConfig={session_timeout:3600,tooltip_delay:2E3,debug_mode:!0};function AdminsList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B){h=B("organizations")+c.organization_id+"/users/";var u=l.inject(e,{mode:"select"});u.selected=[];u.PostRefreshRemove&&u.PostRefreshRemove();u.PostRefreshRemove=u.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");u[a]=""})});b({scope:u,set:"admins",list:e,url:h});z({scope:u,list:e,url:h});u.search(e.iterator);a();u.finishSelection=function(){var a=B("organizations")+c.organization_id+"/admins/";p.setUrl(a);u.queue=
|
||||
[];u.$on("callFinished",function(){if(u.queue.length==u.selected.length){$('input[type="checkbox"]').prop("checked",!1);u.selected=[];for(var a=0,b=0;b<u.queue.length;b++)"error"==u.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected users."):w(1)}});if(0<u.selected.length)for(var b=0;b<u.selected.length;b++){for(var a=null,d=0;d<u.admins.length;d++)u.admins[d].id==u.selected[b]&&(a=u.admins[d]);null!==a&&p.post(a).success(function(a,b,d,c){u.queue.push({result:"success",
|
||||
data:a,status:b});u.$emit("callFinished")}).error(function(a,b,d,c){u.queue.push({result:"error",data:a,status:b,headers:d});u.$emit("callFinished")})}else w(1)};u.toggle_admin=function(a){"success"==u[e.iterator+"_"+a+"_class"]?(u[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<u.selected.indexOf(a)&&u.selected.splice(u.selected.indexOf(a),1)):(u[e.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==u.selected.indexOf(a)&&u.selected.push(a))}}
|
||||
AdminsList.$inject="$scope $rootScope $location $log $routeParams Rest Alert AdminList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller GetBasePath".split(" ");function Authenticate(h,m,k,g,c,p){"/logout"==k.path()&&g.logout();m.userLoggedIn=!1;h.sessionExpired=g.didSessionExpire();h.sessionTimeout=($AnsibleConfig.session_timeout/60).toFixed(2);$("#login-password").bind("keypress",function(c){13==(c.keyCode?c.keyCode:c.which)&&$("#login-button").click()});$("#login-modal").modal({show:!0,keyboard:!1,backdrop:!1});h.reset=function(){$("#login-form input").each(function(c){$(this).val("")})};h.systemLogin=function(c,e){$(".api-error").empty();g.retrieveToken(c,
|
||||
e).success(function(c,a,d,b){g.setToken(c.token);h.reset();g.getUser().success(function(a,b,d,c){$("#login-modal").modal("hide");g.setUserInfo(a);g.getLicense().success(function(a,b,d,c){g.setLicense(a.license_info);k.path("/organizations")}).error(function(a,b,d,c){p("Error","Failed to access user information. GET returned status: "+b)})}).error(function(a,b,d,c){p("Error","Failed to access license information. GET returned status: "+b)})}).error(function(c,a,d,b){if(c.non_field_errors&&0==c.non_field_errors.length)for(var f in c)h[f+
|
||||
"Error"]=c[f][0];else c.non_field_errors&&0<c.non_field_errors.length?(m.alertHeader="Error!",m.alertBody=c.non_field_errors[0]):(m.alertHeader="Error!",m.alertBody="The login attempt failed with a status of: "+a),h.reset(),$("#alert-modal").modal({show:!0,keyboard:!0,backdrop:"static"})})}}Authenticate.$inject="$scope $rootScope $location Authorization ToggleClass Alert".split(" ");function CredentialsList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x){B("htmlTemplate");var t=x("credentials"),s=k.path().replace(/^\//,"").split("/")[0],n=l.inject(e,{mode:"credentials"==s?"edit":"select"});n.selected=[];n.PostRefreshRemove&&n.PostRefreshRemove();n.PostRefreshRemove=n.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");n[a]=""})});b({scope:n,set:"credentials",list:e,url:t});z({scope:n,list:e,url:t});n.search(e.iterator);a();n.addCredential=function(){k.path(k.path()+
|
||||
"/add")};n.editCredential=function(a){k.path(k.path()+"/"+a)};n.deleteCredential=function(a,b){d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:function(){var b=t+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");n.search(e.iterator)}).error(function(a,d,c,f){$("#prompt-modal").modal("hide");u(n,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+d})})}})};n.finishSelection=function(){var a=x(s),a=a+("users"==s?c.user_id+
|
||||
"/credentials/":c.team_id+"/credentials/");p.setUrl(a);n.queue=[];n.$on("callFinished",function(){if(n.queue.length==n.selected.length){$('input[type="checkbox"]').prop("checked",!1);n.selected=[];for(var a=0,b=0;b<n.queue.length;b++)"error"==n.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected Credentials."):w(1)}});if(0<n.selected.length)for(var a=null,b=0;b<n.selected.length;b++){for(var d=0;d<n.credentials.length;d++)n.credentials[d].id==n.selected[b]&&
|
||||
(a=n.credentials[d]);null!==a&&p.post(a).success(function(a,b,d,c){n.queue.push({result:"success",data:a,status:b});n.$emit("callFinished")}).error(function(a,b,d,c){n.queue.push({result:"error",data:a,status:b,headers:d});n.$emit("callFinished")})}else w()};n.toggle_credential=function(a){"success"==n[e.iterator+"_"+a+"_class"]?(n[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<n.selected.indexOf(a)&&n.selected.splice(n.selected.indexOf(a),1)):(n[e.iterator+"_"+a+
|
||||
"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==n.selected.indexOf(a)&&n.selected.push(a))}}CredentialsList.$inject="$scope $rootScope $location $log $routeParams Rest Alert CredentialList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath".split(" ");
|
||||
function CredentialsAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C){w("htmlTemplate");var q=C("credentials"),v=e.inject(f,{mode:"add",related:!1}),A=g.path().replace(/^\//,"").split("/")[0],q=C(A),q=q+("teams"==A?p.team_id+"/credentials/":p.user_id+"/credentials/");e.reset();b();v.formSave=function(){l.setUrl(q);var a={},b;for(b in f.fields)a[b]=v[b];"teams"==A?a.team=p.team_id:a.user=p.user_id;l.post(a).success(function(a,b,d,c){z(1)}).error(function(a,b,c,e){d(v,a,b,f,{hdr:"Error!",msg:"Failed to add new Credential. Post returned status: "+
|
||||
b})})};v.formReset=function(){e.reset()};v.clearPWConfirm=function(a){v[a]="";v[f.name+"_form"][a].$setValidity("awpassmatch",!1)};v.ask=function(a,b){v[a]=v[a+"_ask"]?"ASK":"";v[b]="";v[f.name+"_form"][b].$setValidity("awpassmatch",!0)};v.clear=function(a,b){v[a]="";v[b]="";v[f.name+"_form"][b].$setValidity("awpassmatch",!0)}}CredentialsAdd.$inject="$scope $rootScope $compile $location $log $routeParams CredentialForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ReturnToCaller ClearScope GenerateList SearchInit PaginateInit LookUpInit UserList TeamList GetBasePath".split(" ");
|
||||
function CredentialsEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t){function s(){for(var a in C.fields)"password"==C.fields[a].type&&C.fields[a].ask&&"ASK"==q[a]?($("#"+a+"-clear-btn").attr("disabled","disabled"),q[a+"_ask"]=!0):(q[a+"_ask"]=!1,$("#"+a+"-clear-btn").removeAttr("disabled"))}u("htmlTemplate");var n=t("credentials"),C=f,q=e.inject(C,{mode:"edit",related:!0});e.reset();var v=g.path().replace(/^\//,"").split("/")[0],n=t("credentials"),A={},E=p.credential_id,F={};q.credentialLoadedRemove&&q.credentialLoadedRemove();
|
||||
q.credentialLoadedRemove=q.$on("credentialLoaded",function(){for(var a in F)q.search(F[a].iterator)});l.setUrl(n+":id/");l.get({params:{id:E}}).success(function(a,d,c,f){b({path:"/credentials/"+E,title:a.name});for(var e in C.fields)a[e]&&(q[e]=a[e],A[e]=q[e]);q.team=a.team;q.user=a.user;s();a=a.related;for(var l in C.related)a[l]&&(F[l]={url:a[l],iterator:C.related[l].iterator});z({scope:q,form:C,relatedSets:F});w({scope:q,relatedSets:F});q.$emit("credentialLoaded")}).error(function(a,b,c,f){d(q,
|
||||
a,b,C,{hdr:"Error!",msg:"Failed to retrieve Credential: "+p.id+". GET status: "+b})});q.formSave=function(){l.setUrl(n+E+"/");var a={},b;for(b in C.fields)a[b]=q[b];a.team=q.team;a.user=q.user;l.put(a).success(function(a,b,d,c){"credentials"==g.path().replace(/^\//,"").split("/")[0]?B():B(1)}).error(function(a,b,c,f){d(q,a,b,C,{hdr:"Error!",msg:"Failed to update Credential: "+p.id+". PUT status: "+b})})};q.formReset=function(){e.reset();for(var a in A)q[a]=A[a];s()};q.add=function(a){m.flashMessage=
|
||||
null;g.path("/"+v+"/"+p.id+"/"+a+"/add")};q.edit=function(a,b,d){m.flashMessage=null;g.path("/"+v+"/"+p.id+"/"+a+"/"+b)};q["delete"]=function(a,b,c,f){m.flashMessage=null;x({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+q.name+" "+f+"?",action:function(){var c=n+E+"/"+a+"/";l.setUrl(c);l.post({id:b,disassociate:1}).success(function(b,d,c,f){$("#prompt-modal").modal("hide");q.search(C.related[a].iterator)}).error(function(a,b,f,e){$("#prompt-modal").modal("hide");d(q,a,b,null,{hdr:"Error!",
|
||||
msg:"Call to "+c+" failed. POST returned status: "+b})})}})};q.clearPWConfirm=function(a){q[a]="";q[C.name+"_form"][a].$setValidity("awpassmatch",!1)};q.ask=function(a,b){q[a+"_ask"]?($("#"+a+"-clear-btn").attr("disabled","disabled"),q[a]="ASK"):($("#"+a+"-clear-btn").removeAttr("disabled"),q[a]="");q[b]="";q[C.name+"_form"][b].$setValidity("awpassmatch",!0)};q.clear=function(a,b){q[a]="";q[b]="";q[C.name+"_form"][b].$setValidity("awpassmatch",!0)}}CredentialsEdit.$inject="$scope $rootScope $compile $location $log $routeParams CredentialForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit ReturnToCaller ClearScope Prompt GetBasePath".split(" ");function InventoriesList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x){B("htmlTemplate");var t=x("inventory");h="inventories"==k.path().replace(/^\//,"").split("/")[0]?"edit":"select";var s=l.inject(e,{mode:h});s.selected=[];m.flashMessage=null;s.PostRefreshRemove&&s.PostRefreshRemove();s.PostRefreshRemove=s.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");s[a]=""})});b({scope:s,set:"inventories",list:e,url:t});z({scope:s,list:e,url:t});s.search(e.iterator);a();s.addInventory=
|
||||
function(){k.path(k.path()+"/add")};s.editInventory=function(a){k.path(k.path()+"/"+a)};s.deleteInventory=function(a,b){d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:function(){var b=t+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");s.search(e.iterator)}).error(function(a,d,c,f){$("#prompt-modal").modal("hide");u(s,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+d})})}})};s.lookupOrganization=function(a){p.setUrl(x("organizations")+
|
||||
a+"/");p.get().success(function(a,b,d,c){return a.name})};s.finishSelection=function(){p.setUrl("/api/v1"+k.path()+"/");s.queue=[];s.$on("callFinished",function(){if(s.queue.length==s.selected.length){$('input[type="checkbox"]').prop("checked",!1);s.selected=[];for(var a=0,b=0;b<s.queue.length;b++)"error"==s.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected inventories."):w(1)}});if(0<s.selected.length)for(var a=null,b=0;b<s.selected.length;b++){for(var d=
|
||||
0;d<s.inventories.length;d++)s.inventories[d].id==s.selected[b]&&(a=s.inventories[d]);null!==a&&p.post(a).success(function(a,b,d,c){s.queue.push({result:"success",data:a,status:b});s.$emit("callFinished")}).error(function(a,b,d,c){s.queue.push({result:"error",data:a,status:b,headers:d});s.$emit("callFinished")})}else w()};s.toggle_inventory=function(a){"success"==s[e.iterator+"_"+a+"_class"]?(s[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<s.selected.indexOf(a)&&
|
||||
s.selected.splice(s.selected.indexOf(a),1)):(s[e.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==s.selected.indexOf(a)&&s.selected.push(a))};s.viewJobs=function(a){k.url("/jobs/?inventory__int="+a+"&order_by=status")}}InventoriesList.$inject="$scope $rootScope $location $log $routeParams Rest Alert InventoryList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath".split(" ");
|
||||
function InventoriesAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C){w("htmlTemplate");var q=n("inventory"),v=e.inject(f,{mode:"add",related:!1});v.parseType="yaml";e.reset();b();C(v);s({scope:v,form:f,current_item:p.organization_id?p.organization_id:null,list:u,field:"organization"});v.formSave=function(){try{if("json"==v.parseType){JSON.parse(v.variables);var b=v.variables}else b=jsyaml.load(v.variables);var c={},e;for(e in f.fields)"variables"!=e&&(f.fields[e].realName?c[f.fields[e].realName]=v[e]:
|
||||
c[e]=v[e]);l.setUrl(q);l.post(c).success(function(a,c,e,n){var h=a.id;v.variables?(l.setUrl(a.related.variable_data),l.put(b).success(function(a,b,d,c){g.path("/inventories/"+h)}).error(function(a,b,c,e){d(v,a,b,f,{hdr:"Error!",msg:"Failed to add inventory varaibles. PUT returned status: "+b})})):g.path("/inventories/"+h)}).error(function(a,b,c,e){d(v,a,b,f,{hdr:"Error!",msg:"Failed to add new inventory. Post returned status: "+b})})}catch(n){a("Error","Error parsing inventory variables. Parser returned: "+
|
||||
n)}};v.formReset=function(){e.reset()}}InventoriesAdd.$inject="$scope $rootScope $compile $location $log $routeParams InventoryForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ReturnToCaller ClearScope GenerateList OrganizationList SearchInit PaginateInit LookUpInit GetBasePath ParseTypeChange".split(" ");
|
||||
function InventoriesEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C,q,v,A,E,F,D,r,K,G,I){u("htmlTemplate");var H=C("inventory"),y=e.inject(f,{mode:"edit",related:!0});e.reset();var L=g.path().replace(/^\//,"").split("/")[0],J=p.id;I(y);y.parseType="yaml";y.inventory_id=J;y.inventoryLoadedRemove&&y.inventoryLoadedRemove();y.inventoryLoadedRemove=y.$on("inventoryLoaded",function(){y.groupTitle="All Hosts";y.createButtonShow=!1;y.search(y.relatedSets.hosts.iterator);n(y.TreeParams);x({scope:y,form:f,
|
||||
current_item:y.organization?y.organization:null,list:s,field:"organization"});y.variable_url?(l.setUrl(y.variable_url),l.get().success(function(a,b,d,c){$.isEmptyObject(a)?y.variables="---":y.variables=jsyaml.safeDump(a)}).error(function(a,b,c,e){y.variables=null;d(y,a,b,f,{hdr:"Error!",msg:"Failed to retrieve inventory variables. GET returned status: "+b})})):y.variables="---"});A({scope:y});y.filterInventory=function(){G({scope:y})};y.formSave=function(){try{if("json"==y.parseType){JSON.parse(y.variables);
|
||||
var b=y.variables}else b=jsyaml.load(y.variables);var c={},e;for(e in f.fields)"variables"!=e&&(f.fields[e].realName?c[f.fields[e].realName]=y[e]:c[e]=y[e]);l.setUrl(H+J+"/");l.put(c).success(function(a,c,e,n){y.variables?(l.setUrl(a.related.variable_data),l.put(b).success(function(a,b,d,c){g.path("/inventories")}).error(function(a,b,c,e){d(y,a,b,f,{hdr:"Error!",msg:"Failed to update inventory varaibles. PUT returned status: "+b})})):g.path("/inventories")}).error(function(a,b,c,e){d(y,a,b,f,{hdr:"Error!",
|
||||
msg:"Failed to update new inventory. Post returned status: "+b})})}catch(n){a("Error","Error parsing inventory variables. Parser returned: "+n)}};y.formReset=function(){e.reset();for(var a in y.master)y[a]=y.master[a]};y.add=function(a){m.flashMessage=null;g.path("/"+L+"/"+p.id+"/groups/"+y.group_id+"/"+a+"/add")};y.edit=function(a,b,d){m.flashMessage=null;g.path("/"+L+"/"+p.id+"/"+a+"/"+b)};y["delete"]=function(a,b,c,e){m.flashMessage=null;t({hdr:"Delete",body:"Are you sure you want to remove "+
|
||||
c+" from "+y.name+" "+e+"?",action:function(){var c=H+J+"/"+a+"/";l.setUrl(c);l.post({id:b,disassociate:1}).success(function(b,d,c,e){$("#prompt-modal").modal("hide");y.search(f.related[a].iterator)}).error(function(a,b,f,e){$("#prompt-modal").modal("hide");d(y,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. POST returned status: "+b})})}})};y.treeController=function(a){return"inventory"==$(a).attr("type")?{addGroup:{label:"Add Group",action:function(a){q({inventory_id:J,group_id:null})}}}:{addGroup:{label:"Add Group",
|
||||
action:function(a){q({inventory_id:J,group_id:$(a).attr("group_id")})}},edit:{label:"Edit Group",action:function(a){v({inventory_id:J,group_id:$(a).attr("group_id")})},separator_before:!0},"delete":{label:"Delete Group",action:function(a){E({scope:y,inventory_id:J,group_id:$(a).attr("group_id")})}}}};y.$on("NodeSelect",function(a,b){var d=$('li[id="'+b.attr.id+'"]'),c=d.attr("type"),e;y.selectedNode=d;$("#tree-view").jstree("open_node",d);"group"==c?(e=d.attr("all"),y.groupAddHide=!1,y.groupEditHide=
|
||||
!1,y.groupDeleteHide=!1,y.createButtonShow=!0,y.group_id=d.attr("group_id"),y.groupName=b.data,y.groupTitle=b.data,y.groupTitle+=d.attr("description")?" -"+d.attr("description"):""):"inventory"==c&&(e=d.attr("hosts"),y.groupAddHide=!1,y.groupEditHide=!0,y.groupDeleteHide=!0,y.createButtonShow=!1,y.groupName="All Hosts",y.groupTitle="All Hosts",y.group_id=null);y.relatedSets.hosts={url:e,iterator:"host"};z({scope:y,form:f,relatedSets:y.relatedSets});w({scope:y,relatedSets:y.relatedSets});y.search("host");
|
||||
y.$$phase||y.$digest()});y.addGroup=function(){q({inventory_id:J,group_id:y.group_id})};y.editGroup=function(){v({inventory_id:J,group_id:y.group_id})};y.deleteGroup=function(){E({scope:y,inventory_id:J,group_id:y.group_id})};y.addHost=function(){F({scope:y,inventory_id:J,group_id:y.group_id})};y.editHost=function(a,b){r({scope:y,inventory_id:J,group_id:y.group_id,host_id:a,host_name:b})};y.deleteHost=function(a,b){K({scope:y,inventory_id:J,group_id:y.group_id,host_id:a,host_name:b})};y.showEvents=
|
||||
function(a,c){l.setUrl(c);l.get().success(function(d,c,f,e){b({path:"/jobs/"+d.id,title:d.name});g.url("/jobs/"+d.id+"/job_events/?host="+escape(a))}).error(function(a,b,e,l){d(y,a,b,f,{hdr:"Error!",msg:"Failed to lookup last job: "+c+". GET status: "+b})})}}InventoriesEdit.$inject="$scope $rootScope $compile $location $log $routeParams InventoryForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit ReturnToCaller ClearScope LookUpInit Prompt OrganizationList TreeInit GetBasePath GroupsList GroupsEdit LoadInventory GroupsDelete HostsList HostsAdd HostsEdit HostsDelete RefreshTree ParseTypeChange".split(" ");function JobEventsList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C){B("htmlTemplate");e.base=k.path();h=x("jobs")+c.id+"/job_events/";k.path().replace(/^\//,"").split("/");var q=l.inject(e,{mode:"edit"});m.flashMessage=null;q.selected=[];q.expand=!0;q.parentNode="parent-event";q.childNode="child-event";q.RemovePostRefresh&&q.RemovePostRefresh();q.RemovePostRefresh=q.$on("PostRefresh",function(){for(var a=q[e.name],b,d=0;d<a.length;d++){a[d].event_display=a[d].event_display.replace(/^\u00a0*/g,"");if(3>
|
||||
a[d].event_level)a[d].ngclick="toggleChildren("+a[d].id+', "'+a[d].related.children+'")',a[d].ngicon="icon-collapse-alt",a[d]["class"]="parentNode";else{a[d]["class"]="childNode";b=a[d];var c=a[d].event_data,f="";if(c.res){var l=!1,n=void 0,n=void 0;if("string"==typeof c.res)n=(n=c.res.match(/\n/g))?n.length:1,l=!0,f+="<label>Traceback:</label>\n",f+='<textarea readonly class="input-xxlarge" rows="'+n+'">'+c.res+"</textarea>\n";else{var h=void 0;for(h in c.res)if(("msg"==h||"stdout"==h||"stderr"==
|
||||
h)&&null!==c.res[h]&&""!==c.res[h]){f+="<label>";switch(h){case "msg":case "stdout":f+="Output:";break;case "stderr":f+="Error:"}f+="</label>\n";n=(n=c.res[h].match(/\n/g))?n.length:1;f+='<textarea readonly class="input-xxlarge" rows="'+n+'">'+c.res[h]+"</textarea>\n";l=!0}}f=l?'<form class="event-detail">\n'+f+"</form>\n":""}f=""==f?null:f;b.event_detail=f}a[d].show=!0;a[d].spaces=24*a[d].event_level;q.jobevents[d].status=q.jobevents[d].failed?"error":q.jobevents[d].changed?"changed":"success";b=
|
||||
new Date(a[d].created);a[d].created=C(b)}});b({scope:q,set:"jobevents",list:e,url:h});z({scope:q,list:e,url:h});c.host&&(q[e.iterator+"SearchField"]="host",q[e.iterator+"SearchValue"]=c.host,q[e.iterator+"SearchFieldLabel"]=e.fields.host.label);q.search(e.iterator);q.toggleChildren=function(a,b){s({scope:q,list:e,id:a,children:b})};a();q.viewJobEvent=function(a){n({event_id:a})};q.refresh=function(){q.expand=!0;q.search(e.iterator)};q.jobDetails=function(){k.path("/jobs/"+c.id)};q.jobSummary=function(){k.path("/jobs/"+
|
||||
c.id+"/job_host_summaries")}}JobEventsList.$inject="$scope $rootScope $location $log $routeParams Rest Alert JobEventList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath LookUpInit ToggleChildren EventView FormatDate".split(" ");
|
||||
function JobEventsEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B){z("htmlTemplate");var u=e.inject(f,{mode:"edit",related:!0});e.reset();h=w("base")+"job_events/"+p.event_id+"/";g.path().replace(/^\//,"").split("/");l.setUrl(h);l.get().success(function(a,d,c,e){b({path:"/job_events/"+p.event_id,title:a.event});for(var l in f.fields)"status"==l?u.status=a.failed?"error":"success":"event_data"==l?u.event_data=JSON.stringify(a.event_data,void 0,"\t"):"created"==l?u.created=B(new Date(a.created)):a[l]&&(u[l]=a[l])}).error(function(a,
|
||||
b,c,e){d(u,a,b,f,{hdr:"Error!",msg:"Failed to retrieve event detail: "+p.event_id+". GET status: "+b})})}JobEventsEdit.$inject="$scope $rootScope $compile $location $log $routeParams JobEventForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ClearScope GetBasePath FormatDate".split(" ");function JobHostSummaryList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x){B("htmlTemplate");h=x("jobs")+c.id+"/job_host_summaries/";k.path().replace(/^\//,"").split("/");var t=l.inject(e,{mode:"edit"});t.selected=[];t.PostRefreshRemove&&t.PostRefreshRemove();t.PostRefershRemove=t.$on("PostRefresh",function(){for(var a=0;a<t.jobhosts.length;a++)t.jobhosts[a].host_name=t.jobhosts[a].summary_fields.host.name,t.jobhosts[a].status=t.jobhosts[a].failed?"error":"success"});b({scope:t,set:"jobhosts",list:e,url:h});
|
||||
z({scope:t,list:e,url:h});t.search(e.iterator);a();t.showEvents=function(b,d){p.setUrl(d);p.get().success(function(d,c,f,e){a({path:"/jobs/"+d.id,title:d.name});k.url("/jobs/"+d.id+"/job_events/?host="+escape(b))}).error(function(a,b,c,f){u(t,a,b,form,{hdr:"Error!",msg:"Failed to lookup last job: "+d+". GET status: "+b})})};t.refresh=function(){t.search(e.iterator)};t.jobDetails=function(){k.path("/jobs/"+c.id)};t.jobEvents=function(){k.path("/jobs/"+c.id+"/job_events")}}
|
||||
JobHostSummaryList.$inject="$scope $rootScope $location $log $routeParams Rest Alert JobHostList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath".split(" ");function JobsListCtrl(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n){B("htmlTemplate");var C=x("jobs");k.path().replace(/^\//,"").split("/");var q=l.inject(e,{mode:"edit"});m.flashMessage=null;q.selected=[];q.PostRefreshRemove&&q.PostRefreshRemove();q.PostRefreshRemove=q.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");q[a]=""});for(var a,b=0;b<q[e.name].length;b++)a=new Date(q[e.name][b].created),q[e.name][b].created=n(a)});b({scope:q,set:"jobs",list:e,url:C});z({scope:q,
|
||||
list:e,url:C});c.inventory__int&&(q[e.iterator+"SearchField"]="inventory",q[e.iterator+"SearchValue"]=c.inventory__int,q[e.iterator+"SearchFieldLabel"]="Inventory ID");q.search(e.iterator);c.order_by&&q.sort(c.order_by);a();q.refreshJob=function(){q.search(e.iterator)};q.editJob=function(b,d){a({path:"/jobs/"+b,title:d});k.path(k.path()+"/"+b)};q.viewEvents=function(b,d){a({path:"/jobs/"+b,title:d});k.path(k.path()+"/"+b+"/job_events")};q.viewSummary=function(b,d){a({path:"/jobs/"+b,title:d});k.path(k.path()+
|
||||
"/"+b+"/job_host_summaries")};q.deleteJob=function(a,b){p.setUrl(C+a+"/");p.get().success(function(b,c,f,l){var n,h;"pending"==b.status||"running"==b.status?(n=b.related.cancel,h="cancel",b="Cancel Job"):(n=C+a+"/",h="delete",b="Delete Job");d({hdr:b,body:"Are you sure you want to "+h+" job "+a+"?",action:function(){p.setUrl(n);"cancel"==h?p.post().success(function(a,b,d,c){$("#prompt-modal").modal("hide");q.search(e.iterator)}).error(function(a,b,d,c){$("#prompt-modal").modal("hide");u(q,a,b,null,
|
||||
{hdr:"Error!",msg:"Call to "+n+" failed. POST returned status: "+b})}):p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");q.search(e.iterator)}).error(function(a,b,d,c){$("#prompt-modal").modal("hide");u(q,a,b,null,{hdr:"Error!",msg:"Call to "+n+" failed. DELETE returned status: "+b})})}})}).error(function(a,b,d,c){u(q,a,b,null,{hdr:"Error!",msg:"Failed to get job details. GET returned status: "+b})})};q.submitJob=function(a,b){s({scope:q,id:a,template:b})}}
|
||||
JobsListCtrl.$inject="$scope $rootScope $location $log $routeParams Rest Alert JobList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath LookUpInit SubmitJob FormatDate".split(" ");
|
||||
function JobsEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C,q,v,A){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){r.playbook_options=[];for(b=0;b<a.length;b++)r.playbook_options.push(a[b])}).error(function(a,c,f,e){d(r,a,c,D,{hdr:"Error!",msg:"Failed to get playbook list for "+b+". GET returned status: "+c})})}}u("htmlTemplate");var F=q("jobs"),D=f,r=e.inject(D,{mode:"edit",related:!0});e.reset();var K=g.path().replace(/^\//,
|
||||
"").split("/")[0],G={},I=p.id,H={};r.statusSearchSpin=!1;r.selectPlaybookUnregister&&r.selectPlaybookUnregister();r.selectPlaybookUnregister=r.$watch("project_name",function(a,b){a!==b&&(""!==b&&null!==b&&void 0!==b)&&(r.playbook=null,E(r.project))});r.jobLoadedRemove&&r.jobLoadedRemove();r.jobLoadedRemove=r.$on("jobLoaded",function(){r[D.name+"ReadOnly"]="new"==r.status?!1:!0;for(var a in H)r.search(H[a].iterator);E(r.project);$("#forks-slider").slider("option","value",r.forks);$("#forks-slider").slider("disable");
|
||||
l.setUrl(r.template_url);l.get().success(function(a,b,d,c){b=a.host_config_key?"true":"false";r.host_config_key=a.host_config_key;v({scope:r,master:G,check_field:"allow_callbacks",default_val:b});$('input[type="checkbox"]').attr("disabled","disabled");$("#host_config_key-gen-btn").attr("disabled","disabled")}).error(function(a,b,c,f){d(r,a,b,D,{hdr:"Error!",msg:"Failed to retrieve job: "+p.id+". GET status: "+b})})});r.job_type_options=[{value:"run",label:"Run"},{value:"check",label:"Check"}];r.verbosity_options=
|
||||
[{value:"0",label:"Default"},{value:"1",label:"Verbose"},{value:"3",label:"Debug"}];r.playbook_options=null;r.playbook=null;l.setUrl(F+":id/");l.get({params:{id:I}}).success(function(a,d,c,f){b({path:"/job_templates/"+I,title:a.name});for(var e in D.fields){if(null!==a[e]&&void 0!==a[e]){if("select"==D.fields[e].type)if(r[e+"_options"]&&0<r[e+"_options"].length)for(d=0;d<r[e+"_options"].length;d++)a[e]==r[e+"_options"][d].value&&(r[e]=r[e+"_options"][d]);else r[e]=a[e];else r[e]=a[e];G[e]=r[e]}"lookup"==
|
||||
D.fields[e].type&&a.summary_fields[D.fields[e].sourceModel]&&(r[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]=r[D.fields[e].sourceModel+"_"+D.fields[e].sourceField])}for(e in D.statusFields)null!==a[e]&&void 0!==a[e]&&("created"==e?r.created=A(new Date(a.created)):r[e]=a[e]);$('form[name="jobs_form"] input[type="text"], form[name="jobs_form"] jobs_form textarea').attr("readonly",
|
||||
"readonly");$('form[name="jobs_form"] select').prop("disabled","disabled");$('form[name="jobs_form"] .lookup-btn').prop("disabled","disabled");$('form[name="jobs_form"] .buttons, form[name="jobs_form"] hr').hide();r.url=a.url;e=a.related;for(var l in D.related)e[l]&&(H[l]={url:e[l],iterator:D.related[l].iterator});n({scope:r,form:D,current_item:a.inventory,list:x,field:"inventory"});n({scope:r,form:D,current_item:a.credential,list:t,field:"credential"});n({scope:r,form:D,current_item:a.project,list:s,
|
||||
field:"project"});z({scope:r,form:D,relatedSets:H});w({scope:r,relatedSets:H});r.template_url=a.related.job_template;r.$emit("jobLoaded")}).error(function(a,b,c,e){d(r,a,b,D,{hdr:"Error!",msg:"Failed to retrieve job: "+p.id+". GET status: "+b})});r.formSave=function(){l.setUrl(F+p.id+"/");var a={},b;for(b in D.fields)a[b]="select"==D.fields[b].type&&"playbook"!=b?r[b].value:r[b];l.put(a).success(function(a,b,d,c){"job_templates"==g.path().replace(/^\//,"").split("/")[0]?B():B(1)}).error(function(a,
|
||||
b,c,e){d(r,a,b,D,{hdr:"Error!",msg:"Failed to update job "+p.id+". PUT returned status: "+b})})};r.formReset=function(){e.reset();for(var a in G)r[a]=G[a];$("#forks-slider").slider("option","value",r.forks)};r.add=function(a){m.flashMessage=null;g.path("/"+K+"/"+p.id+"/"+a)};r.edit=function(a,b,d){m.flashMessage=null;g.path("/"+K+"/"+p.id+"/"+a+"/"+b)};r["delete"]=function(a,b,c,e){m.flashMessage=null;Prompt({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+r.name+" "+e+"?",action:function(){var c=
|
||||
F+I+"/"+a+"/";l.setUrl(c);l.post({id:b,disassociate:1}).success(function(b,d,c,e){$("#prompt-modal").modal("hide");r.search(D.related[a].iterator)}).error(function(a,b,e,f){$("#prompt-modal").modal("hide");d(r,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. POST returned status: "+b})})}})};r.refresh=function(){r.statusSearchSpin=!0;l.setUrl(F+I+"/");l.get().success(function(a,b,d,c){r.status=a.status;r.result_stdout=a.result_stdout;r.result_traceback=a.result_traceback;r.statusSearchSpin=!1}).error(function(a,
|
||||
b,c,e){d(r,a,b,null,{hdr:"Error!",msg:"Attempt to load job failed. GET returned status: "+b})})};r.jobSummary=function(){g.path("/jobs/"+I+"/job_host_summaries")};r.jobEvents=function(){g.path("/jobs/"+I+"/job_events")}}JobsEdit.$inject="$scope $rootScope $compile $location $log $routeParams JobForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit ReturnToCaller ClearScope InventoryList CredentialList ProjectList LookUpInit PromptPasswords GetBasePath md5Setup FormatDate".split(" ");function JobTemplatesList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C,q){B("htmlTemplate");var v=x("job_templates");h="job_templates"==k.path().replace(/^\//,"").split("/")[0]?"edit":"select";var A=l.inject(e,{mode:h});m.flashMessage=null;A.selected=[];A.PostRefreshRemove&&A.PostRefreshRemove();A.PostRefreshRemove=A.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");A[a]=""})});b({scope:A,set:"job_templates",list:e,url:v});z({scope:A,list:e,url:v});A.search(e.iterator);
|
||||
a();A.addJobTemplate=function(){k.path(k.path()+"/add")};A.editJobTemplate=function(a){k.path(k.path()+"/"+a)};A.deleteJobTemplate=function(a,b){d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:function(){var b=v+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");A.search(e.iterator)}).error(function(a,d,c,e){$("#prompt-modal").modal("hide");u(A,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+d})})}})};A.finishSelection=
|
||||
function(){p.setUrl(v);A.queue=[];A.callFinishedRemove&&A.callFinishedRemove();A.callFinishedRemove=A.$on("callFinished",function(){if(A.queue.length==A.selected.length){$('input[type="checkbox"]').prop("checked",!1);A.selected=[];for(var a=0,b=0;b<A.queue.length;b++)"error"==A.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected templates."):w(1)}});if(0<A.selected.length)for(var a=null,b=0;b<A.selected.length;b++){for(var d=0;d<A.job_templates.length;d++)A.job_templates[d].id==
|
||||
A.selected[b]&&(a=A.job_templates[d]);null!==a&&p.post(a).success(function(a,b,d,c){A.queue.push({result:"success",data:a,status:b});A.$emit("callFinished")}).error(function(a,b,d,c){A.queue.push({result:"error",data:a,status:b,headers:d});A.$emit("callFinished")})}else w(1)};A.toggle_job_template=function(a){"success"==A[e.iterator+"_"+a+"_class"]?(A[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<A.selected.indexOf(a)&&A.selected.splice(A.selected.indexOf(a),1)):
|
||||
(A[e.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==A.selected.indexOf(a)&&A.selected.push(a))};A.submitJob=function(a){q({scope:A,id:a})}}JobTemplatesList.$inject="$scope $rootScope $location $log $routeParams Rest Alert JobTemplateList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath PromptPasswords JobTemplateForm CredentialList LookUpInit SubmitJob".split(" ");
|
||||
function JobTemplatesAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C){w("htmlTemplate");var q=B("job_templates"),v=e.inject(f,{mode:"add",related:!1}),A={};v.parseType="yaml";C(v);v.job_type_options=[{value:"run",label:"Run"},{value:"check",label:"Check"}];v.verbosity_options=[{value:"0",label:"Default"},{value:"1",label:"Verbose"},{value:"3",label:"Debug"}];v.playbook_options=[];v.allow_callbacks="false";e.reset();b();n({scope:v,master:A,check_field:"allow_callbacks",default_val:!1});s({scope:v,form:f,
|
||||
current_item:null,list:u,field:"inventory"});s({scope:v,form:f,current_item:null,list:x,field:"credential"});v.selectPlaybookUnregister&&v.selectPlaybookUnregister();v.selectPlaybookUnregister=v.$watch("project_name",function(a,b){if(a!=b&&v.project){var c=B("projects")+v.project+"/playbooks/";l.setUrl(c);l.get().success(function(a,b,d,c){b=[];for(d=0;d<a.length;d++)b.push(a[d]);v.playbook_options=b}).error(function(a,b,e,l){d(v,a,b,f,{hdr:"Error!",msg:"Failed to get playbook list for "+c+". GET returned status: "+
|
||||
b})})}});s({scope:v,form:f,current_item:null,list:t,field:"project"});v.formSave=function(){var b={};try{if("json"==v.parseType){JSON.parse(v.variables);var c=v.variables}else c=jsyaml.load(v.variables);for(var e in f.fields)"select"==f.fields[e].type&&"playbook"!=e?b[e]=v[e].value:"variables"!=e&&(b[e]=v[e]);b.extra_vars=JSON.stringify(c,void 0,"\t");l.setUrl(q);l.post(b).success(function(a,b,d,c){"job_templates"==g.path().replace(/^\//,"").split("/")[0]?z():z(1)}).error(function(a,b,c,e){d(v,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)}};v.formReset=function(){e.reset();$("#forks-slider").slider("option","value",v.forks);for(var a in A)v[a]=A[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(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n,C,q,v,A){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){r.playbook_options=[];for(b=0;b<a.length;b++)r.playbook_options.push(a[b])}).error(function(a,c,e,f){d(r,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,r=e.inject(D,{mode:"edit",related:!0});r.parseType=
|
||||
"yaml";A(r);r.job_type_options=[{value:"run",label:"Run"},{value:"check",label:"Check"}];r.verbosity_options=[{value:"0",label:"Default"},{value:"1",label:"Verbose"},{value:"3",label:"Debug"}];r.playbook_options=null;r.playbook=null;e.reset();var K=g.path().replace(/^\//,"").split("/")[0],G={},I=p.id,H={};r.selectPlaybookUnregister&&r.selectPlaybookUnregister();r.selectPlaybookUnregister=r.$watch("project_name",function(a,b){a!==b&&(""!==b&&null!==b&&void 0!==b)&&(r.playbook=null,E(r.project))});
|
||||
r.jobTemplateLoadedRemove&&r.jobTemplateLoadedRemove();r.jobTemplateLoadedRemove=r.$on("jobTemplateLoaded",function(){for(var a in H)r.search(H[a].iterator);E(r.project);$("#forks-slider").slider("value",r.forks);v({scope:r,master:G,check_field:"allow_callbacks",default_val:r.host_config_key?"true":"false"})});l.setUrl(F+":id/");l.get({params:{id:I}}).success(function(a,d,c,e){b({path:"/job_templates/"+I,title:a.name});for(var f in D.fields){if("variables"!=f&&null!==a[f]&&void 0!==a[f]){if("select"==
|
||||
D.fields[f].type)if(r[f+"_options"]&&0<r[f+"_options"].length)for(d=0;d<r[f+"_options"].length;d++)a[f]==r[f+"_options"][d].value&&(r[f]=r[f+"_options"][d]);else r[f]=a[f];else r[f]=a[f];G[f]=r[f]}"variables"==f&&($.isEmptyObject(a.extra_vars)||"{}"==a.extra_vars||"null"==a.extra_vars?r.variables="---":(d=JSON.parse(a.extra_vars),r.variables=jsyaml.safeDump(d),console.log(d)),G.variables=r.variables);"lookup"==D.fields[f].type&&a.summary_fields[D.fields[f].sourceModel]&&(r[D.fields[f].sourceModel+
|
||||
"_"+D.fields[f].sourceField]=a.summary_fields[D.fields[f].sourceModel][D.fields[f].sourceField],G[D.fields[f].sourceModel+"_"+D.fields[f].sourceField]=r[D.fields[f].sourceModel+"_"+D.fields[f].sourceField])}r.url=a.url;f=a.related;for(var l in D.related)f[l]&&(H[l]={url:f[l],iterator:D.related[l].iterator});n({scope:r,form:D,current_item:a.inventory,list:x,field:"inventory"});n({scope:r,form:D,current_item:a.credential,list:t,field:"credential"});n({scope:r,form:D,current_item:a.project,list:s,field:"project"});
|
||||
z({scope:r,form:D,relatedSets:H});w({scope:r,relatedSets:H});r.$emit("jobTemplateLoaded")}).error(function(a,b,c,f){d(r,a,b,D,{hdr:"Error!",msg:"Failed to retrieve job template: "+p.id+". GET status: "+b})});r.formSave=function(){var b={};try{var c="json"==r.parseType?JSON.parse(r.variables):jsyaml.load(r.variables),f;for(f in D.fields)"select"==D.fields[f].type&&"playbook"!=f?b[f]=r[f].value:"variables"!=f&&(b[f]=r[f]);b.extra_vars=JSON.stringify(c,void 0,"\t");l.setUrl(F+I+"/");l.put(b).success(function(a,
|
||||
b,d,c){"job_templates"==g.path().replace(/^\//,"").split("/")[0]?B():B(1)}).error(function(a,b,c,f){d(r,a,b,D,{hdr:"Error!",msg:"Failed to update job template. PUT returned status: "+b})})}catch(e){a("Error","Error parsing extra variables. Parser returned: "+e)}};r.formReset=function(){e.reset();for(var a in G)r[a]=G[a];r.parseType="yaml";$("#forks-slider").slider("option","value",r.forks)};r.add=function(a){m.flashMessage=null;g.path("/"+K+"/"+p.id+"/"+a)};r.edit=function(a,b,d){m.flashMessage=null;
|
||||
g.path("/"+a+"/"+b)};r["delete"]=function(a,b,c,f){m.flashMessage=null;Prompt({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+r.name+" "+f+"?",action:function(){var c=F+I+"/"+a+"/";l.setUrl(c);l.post({id:b,disassociate:1}).success(function(b,d,c,f){$("#prompt-modal").modal("hide");r.search(D.related[a].iterator)}).error(function(a,b,f,e){$("#prompt-modal").modal("hide");d(r,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(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B){z("htmlTemplate");h="organizations"==k.path().replace(/^\//,"").split("/")[0]?"edit":"select";var u=l.inject(a,{mode:h}),x=B("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:x});b({scope:u,list:a,url:x});u.search(a.iterator);u.addOrganization=function(){k.path(k.path()+
|
||||
"/add")};u.editOrganization=function(a){k.path(k.path()+"/"+a)};u.deleteOrganization=function(b,d){e({hdr:"Delete",body:"Are you sure you want to delete "+d+"?",action:function(){var d=x+b+"/";c.setUrl(d);c.destroy().success(function(b,d,c,f){$("#prompt-modal").modal("hide");u.search(a.iterator)}).error(function(a,b,c,f){$("#prompt-modal").modal("hide");w(u,a,b,null,{hdr:"Error!",msg:"Call to "+d+" failed. DELETE returned status: "+b})})}})};u.toggle_organization=function(b){"success"==u[a.iterator+
|
||||
"_"+b+"_class"]?(u[a.iterator+"_"+b+"_class"]="",document.getElementById("check_"+b).checked=!1,-1<u.selected.indexOf(b)&&u.selected.splice(u.selected.indexOf(b),1)):(u[a.iterator+"_"+b+"_class"]="success",document.getElementById("check_"+b).checked=!0,-1==u.selected.indexOf(b)&&u.selected.push(b))}}OrganizationsList.$inject="$scope $rootScope $location $log Rest Alert LoadBreadCrumbs Prompt GenerateList OrganizationList SearchInit PaginateInit ClearScope ProcessErrors GetBasePath".split(" ");
|
||||
function OrganizationsAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B){z("htmlTemplate");var u=e.inject(f,{mode:"add",related:!1}),x=w("organizations");e.reset();b();u.formSave=function(){l.setUrl(x);l.post({name:h.name,description:h.description}).success(function(a,b,d,c){m.flashMessage="New organization successfully created!";g.path("/organizations/"+a.id)}).error(function(a,b,c,e){d(u,a,b,f,{hdr:"Error!",msg:"Failed to add new organization. Post returned status: "+b})})};u.formReset=function(){m.flashMessage=
|
||||
null;e.reset()}}OrganizationsAdd.$inject="$scope $rootScope $compile $location $log $routeParams OrganizationForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ClearScope GetBasePath ReturnToCaller".split(" ");
|
||||
function OrganizationsEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x){u("htmlTemplate");var t=e.inject(f,{mode:"edit",related:!0});e.reset();var s=x("organizations"),n=g.path().replace(/^\//,"").split("/")[0],C={},q=p.organization_id,v={};t.organizationLoadedRemove&&t.organizationLoadedRemove();t.organizationLoadedRemove=t.$on("organizationLoaded",function(){for(var a in v)t.search(v[a].iterator)});l.setUrl(s+q+"/");l.get().success(function(a,d,c,e){b({path:"/organizations/"+q,title:a.name});for(var l in f.fields)a[l]&&
|
||||
(t[l]=a[l],C[l]=a[l]);a=a.related;for(var n in f.related)a[n]&&(v[n]={url:a[n],iterator:f.related[n].iterator});z({scope:t,form:f,relatedSets:v});w({scope:t,relatedSets:v});t.$emit("organizationLoaded")}).error(function(a,b,c,e){d(t,a,b,f,{hdr:"Error!",msg:"Failed to retrieve organization: "+p.id+". GET status: "+b})});t.formSave=function(){var a={},b;for(b in f.fields)a[b]=t[b];l.setUrl(s+q+"/");l.put(a).success(function(b,d,c,f){C=a;m.flashMessage="Your changes were successfully saved!"}).error(function(a,
|
||||
b,c,e){d(t,a,b,f,{hdr:"Error!",msg:"Failed to update organization: "+q+". PUT status: "+b})})};t.formReset=function(){m.flashMessage=null;f.reset();for(var a in C)t[a]=C[a]};t.add=function(a){m.flashMessage=null;g.path("/"+n+"/"+p.organization_id+"/"+a)};t.edit=function(a,b,d){m.flashMessage=null;g.path("/"+a+"/"+b)};t["delete"]=function(a,b,c,e){m.flashMessage=null;B({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+t.name+" "+e+"?",action:function(){var c=s+p.organization_id+"/"+
|
||||
a+"/";l.setUrl(c);l.post({id:b,disassociate:1}).success(function(b,d,c,e){$("#prompt-modal").modal("hide");t.search(f.related[a].iterator)}).error(function(a,b,f,e){$("#prompt-modal").modal("hide");d(t,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. POST returned status: "+b})})}})}}OrganizationsEdit.$inject="$scope $rootScope $compile $location $log $routeParams OrganizationForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit Prompt ClearScope GetBasePath".split(" ");function PermissionsList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t){B("htmlTemplate");h=k.path().replace(/^\//,"").split("/")[0];h=x(h);h+=void 0!==c.user_id?c.user_id:c.team_id;h+="/permissions/";var s=l.inject(e,{mode:"edit"});s.selected=[];b({scope:s,set:"permissions",list:e,url:h});z({scope:s,list:e,url:h});s.search(e.iterator);a();s.addPermission=function(){t()&&k.path(k.path()+"/add")};s.editPermission=function(a){t()&&k.path(k.path()+"/"+a)};s.deletePermission=function(a,b){var c=function(){var b=
|
||||
x("base")+"permissions/"+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");s.search(e.iterator)}).error(function(a,d,c,f){$("#prompt-modal").modal("hide");u(s,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+d})})};checkAccess()&&d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:c})}}PermissionsList.$inject="$scope $rootScope $location $log $routeParams Rest Alert PermissionList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath CheckAccess".split(" ");
|
||||
function PermissionsAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t){z("htmlTemplate");var s=void 0!==p.user_id?p.user_id:p.team_id,n=g.path().replace(/^\//,"").split("/")[0];w(n);var C=e.inject(f,{mode:"add",related:!1}),q={};e.reset();b();C.inventoryrequired=!0;C.projectrequired=!1;C.category="Inventory";q.category="Inventory";q.inventoryrequired=!0;q.projectrequired=!1;t({scope:C,form:f,current_item:null,list:u,field:"inventory"});t({scope:C,form:f,current_item:null,list:x,field:"project"});C.formSave=
|
||||
function(){var a={},b;for(b in f.fields)a[b]=C[b];b="teams"==n?w("teams")+s+"/permissions/":w("users")+s+"/permissions/";l.setUrl(b);l.post(a).success(function(a,b,d,c){B(1)}).error(function(a,b,c,e){d(C,a,b,f,{hdr:"Error!",msg:"Failed to create new permission. Post returned status: "+b})})};C.formReset=function(){m.flashMessage=null;e.reset();for(var a in q)C[a]=q[a]};C.selectCategory=function(){C.projectrequired="Inventory"==C.category?!1:!0;C.permission_type=null}}PermissionsAdd.$inject="$scope $rootScope $compile $location $log $routeParams PermissionsForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ClearScope GetBasePath ReturnToCaller InventoryList ProjectList LookUpInit".split(" ");
|
||||
function PermissionsEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s){w("htmlTemplate");var n=e.inject(f,{mode:"edit",related:!0}),C=void 0!==p.user_id?p.user_id:p.team_id;g.path().replace(/^\//,"").split("/");var q=p.permission_id,v=u("base")+"permissions/"+q+"/";e.reset();var A={};l.setUrl(v);l.get().success(function(a,d,c,e){b({path:"/users/"+C+"/permissions/"+q,title:a.name});for(var l in f.fields)a[l]&&(f.fields[l].sourceModel&&(d=f.fields[l].sourceModel,c=f.fields[l].sourceField,n[d+"_"+c]=a.summary_fields[d][c],
|
||||
A[d+"_"+c]=a.summary_fields[d][c]),n[l]=a[l],A[l]=n[l]);n.category="Deploy";"run"!=a.permission_type&&"check"!=a.permission_type?(n.category="Inventory",n.projectrequired=!1):n.projectrequired=!0;A.category=n.category;s({scope:n,form:f,current_item:a.inventory,list:x,field:"inventory"});s({scope:n,form:f,current_item:a.project,list:t,field:"project"})}).error(function(a,b,c,e){d(n,a,b,f,{hdr:"Error!",msg:"Failed to retrieve Permission: "+q+". GET status: "+b})});n.formSave=function(){var a={},b;for(b in f.fields)a[b]=
|
||||
n[b];l.setUrl(v);l.put(a).success(function(a,b,d,c){z(1)}).error(function(a,b,c,e){d(n,a,b,f,{hdr:"Error!",msg:"Failed to update Permission: "+p.id+". PUT status: "+b})})};n.formReset=function(){e.reset();for(var a in A)n[a]=A[a]};n.selectCategory=function(){n.projectrequired="Inventory"==n.category?!1:!0;n.permission_type=null}}PermissionsEdit.$inject="$scope $rootScope $compile $location $log $routeParams PermissionsForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ReturnToCaller ClearScope Prompt GetBasePath InventoryList ProjectList LookUpInit".split(" ");function ProjectsList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x){B("htmlTemplate");var t=x("projects"),s=k.path().replace(/^\//,"").split("/")[0],n=l.inject(e,{mode:"projects"==s?"edit":"select"});n.selected=[];m.flashMessage=null;n.PostRefreshRemove&&n.PostRefreshRemove();n.PostRefreshRemove=n.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");n[a]=""})});b({scope:n,set:"projects",list:e,url:t});z({scope:n,list:e,url:t});n.search(e.iterator);a();n.addProject=function(){k.path(k.path()+
|
||||
"/add")};n.editProject=function(a){k.path(k.path()+"/"+a)};n.deleteProject=function(a,b){d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:function(){var b=t+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");n.search(e.iterator)}).error(function(a,d,c,f){$("#prompt-modal").modal("hide");u(n,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+d})})}})};n.finishSelection=function(){var a="teams"==s?x("teams")+c.team_id+
|
||||
"/projects/":t;p.setUrl(a);n.queue=[];n.callFinishedRemove&&n.callFinishedRemove();n.callFinishedRemoved=n.$on("callFinished",function(){if(n.queue.length==n.selected.length){$('input[type="checkbox"]').prop("checked",!1);n.selected=[];for(var a=0,b=0;b<n.queue.length;b++)"error"==n.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected Pojects."):w(1)}});if(0<n.selected.length)for(var a=null,b=0;b<n.selected.length;b++){for(var d=0;d<n.projects.length;d++)n.projects[d].id==
|
||||
n.selected[b]&&(a=n.projects[d]);null!==a&&p.post(a).success(function(a,b,d,c){n.queue.push({result:"success",data:a,status:b});n.$emit("callFinished")}).error(function(a,b,d,c){n.queue.push({result:"error",data:a,status:b,headers:d});n.$emit("callFinished")})}else w(1)};n.toggle_project=function(a){"success"==n[e.iterator+"_"+a+"_class"]?(n[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<n.selected.indexOf(a)&&n.selected.splice(n.selected.indexOf(a),1)):(n[e.iterator+
|
||||
"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==n.selected.indexOf(a)&&n.selected.push(a))}}ProjectsList.$inject="$scope $rootScope $location $log $routeParams Rest Alert ProjectList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors GetBasePath".split(" ");
|
||||
function ProjectsAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u){z("htmlTemplate");var x=g.path().replace(/^\//,"").split("/")[0],t=w("projects"),s=e.inject(f,{mode:"add",related:!1}),n={};e.reset();b();u({scope:s,master:n});s.formSave=function(){var a={},b;for(b in f.fields)a[b]=s[b];b="teams"==x?w("teams")+p.team_id+"/projects/":t;l.setUrl(b);l.post(a).success(function(a,b,d,c){m.flashMessage="New project successfully created!";"projects"==x?B():B(1)}).error(function(a,b,c,e){d(s,a,b,f,{hdr:"Error!",msg:"Failed to create new project. Post returned status: "+
|
||||
b})})};s.formReset=function(){m.flashMessage=null;e.reset();for(var a in n)s[a]=n[a]}}ProjectsAdd.$inject="$scope $rootScope $compile $location $log $routeParams ProjectsForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ClearScope GetBasePath ReturnToCaller GetProjectPath".split(" ");
|
||||
function ProjectsEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s){u("htmlTemplate");var n=e.inject(f,{mode:"edit",related:!0});e.reset();var C=x("projects")+p.id+"/",q=g.path().replace(/^\//,"").split("/")[0],v={},A=p.id,E={};n.project_local_paths=[];n.base_dir="";n.projectLoadedRemove&&n.projectLoadedRemove();n.projectLoadedRemove=n.$on("projectLoaded",function(){for(var a in E)n.search(E[a].iterator);s({scope:n,master:v})});l.setUrl(C);l.get({params:{id:A}}).success(function(a,d,c,e){b({path:"/projects/"+
|
||||
A,title:a.name});for(var l in f.fields)a[l]&&(n[l]=a[l],v[l]=a[l]);a=a.related;for(var h in f.related)a[h]&&(E[h]={url:a[h],iterator:f.related[h].iterator});z({scope:n,form:f,relatedSets:E});w({scope:n,relatedSets:E});n.$emit("projectLoaded")}).error(function(a,b,c,e){d(n,a,b,f,{hdr:"Error!",msg:"Failed to retrieve project: "+A+". GET status: "+b})});n.formSave=function(){m.flashMessage=null;var a={},b;for(b in f.fields)a[b]=n[b];l.setUrl(C);l.put(a).success(function(a,b,d,c){t()}).error(function(a,
|
||||
b,c,e){d(n,a,b,f,{hdr:"Error!",msg:"Failed to update project: "+A+". PUT status: "+b})})};n.formReset=function(){m.flashMessage=null;e.reset();for(var a in v)n[a]=v[a]};n.add=function(a){m.flashMessage=null;g.path("/"+q+"/"+p.id+"/"+a)};n.edit=function(a,b,d){m.flashMessage=null;g.path("/"+q+"/"+p.id+"/"+a+"/"+b)};n["delete"]=function(a,b,c,e){B({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+n.name+" "+e+"?",action:function(){var c=x("projects")+A+"/"+a+"/";m.flashMessage=null;l.setUrl(c);
|
||||
l.post({id:b,disassociate:1}).success(function(b,d,c,e){$("#prompt-modal").modal("hide");n.search(f.related[a].iterator)}).error(function(a,b,f,e){$("#prompt-modal").modal("hide");d(n,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. POST returned status: "+b})})}})}}ProjectsEdit.$inject="$scope $rootScope $compile $location $log $routeParams ProjectsForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit Prompt ClearScope GetBasePath ReturnToCaller GetProjectPath".split(" ");function TeamsList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t){B("htmlTemplate");var s=t("teams");h="teams"==k.path().replace(/^\//,"").split("/")[0]?"edit":"select";var n=l.inject(e,{mode:h});n.selected=[];n.PostRefreshRemove&&n.PostRefreshRemove();n.PostRefershRemove=n.$on("PostRefresh",function(){for(var a=0;a<n.teams.length;a++)n.teams[a].organization_name=n.teams[a].summary_fields.organization.name;$("tr.success").each(function(a){a=$(this).attr("ng-class");n[a]=""})});b({scope:n,set:"teams",list:e,
|
||||
url:s});z({scope:n,list:e,url:s});n.search(e.iterator);a();n.addTeam=function(){k.path(k.path()+"/add")};n.editTeam=function(a){k.path(k.path()+"/"+a)};n.deleteTeam=function(a,b){d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:function(){var b=s+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");n.search(e.iterator)}).error(function(a,d,c,f){$("#prompt-modal").modal("hide");u(n,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+
|
||||
d})})}})};n.lookupOrganization=function(a){p.setUrl(t("organizations")+a+"/");p.get().success(function(a,b,d,c){return a.name})};n.finishSelection=function(){p.setUrl(t("base")+k.path()+"/");n.queue=[];n.$on("callFinished",function(){if(n.queue.length==n.selected.length){$('input[type="checkbox"]').prop("checked",!1);n.selected=[];for(var a=0,b=0;b<n.queue.length;b++)"error"==n.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected teams."):w(1)}});if(0<n.selected.length)for(var a=
|
||||
null,b=0;b<n.selected.length;b++){for(var d=0;d<n.teams.length;d++)n.teams[d].id==n.selected[b]&&(a=n.teams[d]);null!==a&&p.post(a).success(function(a,b,d,c){n.queue.push({result:"success",data:a,status:b});n.$emit("callFinished")}).error(function(a,b,d,c){n.queue.push({result:"error",data:a,status:b,headers:d});n.$emit("callFinished")})}else w()};n.toggle_team=function(a){"success"==n[e.iterator+"_"+a+"_class"]?(n[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<n.selected.indexOf(a)&&
|
||||
n.selected.splice(n.selected.indexOf(a),1)):(n[e.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==n.selected.indexOf(a)&&n.selected.push(a))}}TeamsList.$inject="$scope $rootScope $location $log $routeParams Rest Alert TeamList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors SetTeamListeners GetBasePath".split(" ");
|
||||
function TeamsAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n){w("htmlTemplate");var C=n("teams"),q=e.inject(f,{mode:"add",related:!1});m.flashMessage=null;e.reset();b();s({scope:q});q.formSave=function(){l.setUrl(C);var a={},b;for(b in f.fields)a[b]=q[b];l.post(a).success(function(a,b,d,c){m.flashMessage="New team successfully created!";g.path("/teams/"+a.id)}).error(function(a,b,c,e){d(q,a,b,f,{hdr:"Error!",msg:"Failed to add new inventory. Post returned status: "+b})})};q.formReset=function(){e.reset()}}
|
||||
TeamsAdd.$inject="$scope $rootScope $compile $location $log $routeParams TeamForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ReturnToCaller ClearScope GenerateList OrganizationList SearchInit PaginateInit TeamLookUpOrganizationInit GetBasePath".split(" ");
|
||||
function TeamsEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s,n){u("htmlTemplate");var C=s("teams"),q=e.inject(f,{mode:"edit",related:!0});e.reset();var v=g.path().replace(/^\//,"").split("/")[0],A={},E=p.team_id,F={};x({scope:q});q.teamLoadedRemove&&q.teamLoadedRemove();q.teamLoadedRemove=q.$on("teamLoaded",function(){l.setUrl(q.organization_url);l.get().success(function(a,b,d,c){q.organization_name=a.name;A.organization_name=a.name}).error(function(a,b,c,f){d(q,a,b,null,{hdr:"Error!",msg:"Failed to retrieve: "+
|
||||
q.orgnization_url+". GET status: "+b})});for(var a in F)q.search(F[a].iterator)});l.setUrl(C+":id/");l.get({params:{id:E}}).success(function(a,d,c,e){b({path:"/teams/"+E,title:a.name});for(var l in f.fields)a[l]&&(q[l]=a[l],A[l]=q[l]);d=a.related;for(var n in f.related)d[n]&&(F[n]={url:d[n],iterator:f.related[n].iterator});z({scope:q,form:f,relatedSets:F});w({scope:q,relatedSets:F});q.organization_url=a.related.organization;q.$emit("teamLoaded")}).error(function(a,b,c,e){d(q,a,b,f,{hdr:"Error!",msg:"Failed to retrieve team: "+
|
||||
p.id+". GET status: "+b})});q.formSave=function(){m.flashMessage=null;l.setUrl(C+p.id+"/");var a={},b;for(b in f.fields)a[b]=q[b];l.put(a).success(function(a,b,d,c){"teams"==g.path().replace(/^\//,"").split("/")[0]?B():B(1)}).error(function(a,b,c,e){d(q,a,b,f,{hdr:"Error!",msg:"Failed to update team: "+p.id+". PUT status: "+b})})};q.formReset=function(){m.flashMessage=null;e.reset();for(var a in A)q[a]=A[a]};q.add=function(a){m.flashMessage=null;"permissions"==a?n()&&g.path("/"+v+"/"+p.team_id+"/"+
|
||||
a+"/add"):g.path("/"+v+"/"+p.team_id+"/"+a)};q.edit=function(a,b,d){m.flashMessage=null;"permissions"==a?n()&&g.path("/"+v+"/"+p.team_id+"/"+a+"/"+b):g.path("/"+a+"/"+b)};q["delete"]=function(a,b,c,e){m.flashMessage=null;t({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+q.name+" "+e+"?",action:function(){var c;"permissions"==a?n()&&(c=s("base")+"permissions/"+b+"/",l.setUrl(c),l.destroy().success(function(b,d,c,e){$("#prompt-modal").modal("hide");q.search(f.related[a].iterator)}).error(function(a,
|
||||
b,f,e){$("#prompt-modal").modal("hide");d(q,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. DELETE returned status: "+b})})):(c=C+p.team_id+"/"+a+"/",l.setUrl(c),l.post({id:b,disassociate:1}).success(function(b,d,c,e){$("#prompt-modal").modal("hide");q.search(f.related[a].iterator)}).error(function(a,b,f,e){$("#prompt-modal").modal("hide");d(q,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. POST returned status: "+b})}))}})}}TeamsEdit.$inject="$scope $rootScope $compile $location $log $routeParams TeamForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit ReturnToCaller ClearScope TeamLookUpOrganizationInit Prompt GetBasePath CheckAccess".split(" ");function UsersList(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u){B("htmlTemplate");h="users"==k.path().replace(/^\//,"").split("/")[0]?"edit":"select";var x=l.inject(e,{mode:h});x.selected=[];m.flashMessage=null;b({scope:x,set:"users",list:e,url:"/api/v1/users/"});z({scope:x,list:e,url:"/api/v1/users/"});x.search(e.iterator);a();x.addUser=function(){k.path(k.path()+"/add")};x.editUser=function(a){k.path(k.path()+"/"+a)};x.deleteUser=function(a,b){d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:function(){var b=
|
||||
"/api/v1/users/"+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");x.search(e.iterator)}).error(function(a,d,c,f){$("#prompt-modal").modal("hide");u(x,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+d})})}})};x.finishSelection=function(){p.setUrl("/api/v1"+k.path()+"/");x.queue=[];x.$on("callFinished",function(){if(x.queue.length==x.selected.length){$('input[type="checkbox"]').prop("checked",!1);x.selected=[];for(var a=0,b=0;b<x.queue.length;b++)"error"==
|
||||
x.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected users."):w(1)}});if(0<x.selected.length)for(var a,b=0;b<x.selected.length;b++){a=null;for(var d=0;d<x.users.length;d++)x.users[d].id==x.selected[b]&&(a=x.users[d]);null!==a&&p.post(a).success(function(a,b,d,c){x.queue.push({result:"success",data:a,status:b});x.$emit("callFinished")}).error(function(a,b,d,c){x.queue.push({result:"error",data:a,status:b,headers:d});x.$emit("callFinished")})}else w()};x.toggle_user=
|
||||
function(a){"success"==x[e.iterator+"_"+a+"_class"]?(x[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<x.selected.indexOf(a)&&x.selected.splice(x.selected.indexOf(a),1)):(x[e.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==x.selected.indexOf(a)&&x.selected.push(a))}}UsersList.$inject="$scope $rootScope $location $log $routeParams Rest Alert UserList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller ClearScope ProcessErrors".split(" ");
|
||||
function UsersAdd(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x){w("htmlTemplate");var t=B("organizations"),s=e.inject(f,{mode:"add",related:!1});e.reset();b();u({scope:s,form:f,current_item:void 0!==p.organization_id?p.organization_id:null,list:x,field:"organization"});p.organization_id&&(s.organization=p.organization_id,l.setUrl(B("organizations")+p.organization_id+"/"),l.get().success(function(a,b,d,c){s.organization_name=a.name}).error(function(a,b,c,e){d(s,a,b,f,{hdr:"Error!",msg:"Failed to lookup Organization: "+
|
||||
a.id+". GET returned status: "+b})}));s.formSave=function(){l.setUrl(t+s.organization+"/users/");var a={},b;for(b in f.fields)a[b]=s[b];l.post(a).success(function(a,b,d,c){"users"==g.path().replace(/^\//,"").split("/")[0]?(m.flashMessage="New user successfully created!",g.path("/users/"+a.id)):z(1)}).error(function(a,b,c,e){d(s,a,b,f,{hdr:"Error!",msg:"Failed to add new user. POST returned status: "+b})})};s.formReset=function(){e.reset()};s.clearPWConfirm=function(a){s[a]="";s[f.name+"_form"][a].$setValidity("awpassmatch",
|
||||
!1)}}UsersAdd.$inject="$scope $rootScope $compile $location $log $routeParams UserForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs ReturnToCaller ClearScope GetBasePath LookUpInit OrganizationList".split(" ");
|
||||
function UsersEdit(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B,u,x,t,s){u("htmlTemplate");var n=x("users"),C=g.path().replace(/^\//,"").split("/")[0],q=e.inject(f,{mode:"edit",related:!0});e.reset();var v={},A=p.user_id,E={};q.$on("userLoaded",function(){for(var a in E)q.search(E[a].iterator)});l.setUrl(n+":id/");l.get({params:{id:A}}).success(function(a,d,c,e){b({path:"/users/"+A,title:a.username});for(var l in f.fields)a[l]&&(q[l]="is_superuser"==l?"true"==a[l]||!0==a[l]?"true":"false":a[l],v[l]=q[l]);a=a.related;
|
||||
for(var n in f.related)a[n]&&(E[n]={url:a[n],iterator:f.related[n].iterator});z({scope:q,form:f,relatedSets:E});w({scope:q,relatedSets:E});q.$emit("userLoaded")}).error(function(a,b,c,e){d(q,a,b,f,{hdr:"Error!",msg:"Failed to retrieve user: "+p.id+". GET status: "+b})});q.formSave=function(){m.flashMessage=null;l.setUrl(n+A+"/");var a={},b;for(b in f.fields)a[b]=q[b];l.put(a).success(function(a,b,d,c){"users"==g.path().replace(/^\//,"").split("/")[0]?B():B(1)}).error(function(a,b,c,e){d(q,a,b,f,{hdr:"Error!",
|
||||
msg:"Failed to update users: "+p.id+". PUT status: "+b})})};q.formReset=function(){m.flashMessage=null;e.reset();for(var a in v)q[a]=v[a]};q.clearPWConfirm=function(a){q[a]="";q[f.name+"_form"][a].$setValidity("awpassmatch",!1);m.flashMessage=null};q.add=function(a){m.flashMessage=null;"permissions"==a?s()&&g.path("/"+C+"/"+p.user_id+"/"+a+"/add"):g.path("/"+C+"/"+p.user_id+"/"+a)};q.edit=function(a,b,d){m.flashMessage=null;"permissions"==a?s()&&g.path("/users/"+p.user_id+"/permissions/"+b):g.path("/"+
|
||||
a+"/"+b)};q["delete"]=function(a,b,c,e){m.flashMessage=null;t({hdr:"Delete",body:"Are you sure you want to remove "+c+" from "+q.username+" "+e+"?",action:function(){var c;"permissions"==a?s()&&(c=x("base")+"permissions/"+b+"/",l.setUrl(c),l.destroy().success(function(b,d,c,e){$("#prompt-modal").modal("hide");q.search(f.related[a].iterator)}).error(function(a,b,e,f){$("#prompt-modal").modal("hide");d(q,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. DELETE returned status: "+b})})):(c=n+p.user_id+
|
||||
"/"+a+"/",l.setUrl(c),l.post({id:b,disassociate:1}).success(function(b,d,c,e){$("#prompt-modal").modal("hide");q.search(f.related[a].iterator)}).error(function(a,b,e,f){$("#prompt-modal").modal("hide");d(q,a,b,null,{hdr:"Error!",msg:"Call to "+c+" failed. POST returned status: "+b})}))}})}}UsersEdit.$inject="$scope $rootScope $compile $location $log $routeParams UserForm GenerateForm Rest Alert ProcessErrors LoadBreadCrumbs RelatedSearchInit RelatedPaginateInit ReturnToCaller ClearScope GetBasePath Prompt CheckAccess".split(" ");angular.module("CredentialFormDefinition",[]).value("CredentialForm",{addTitle:"Create Credential",editTitle:"{{ name }}",name:"credential",well:!0,fields:{name:{label:"Name",type:"text",addRequired:!0,editRequired:!0},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1},ssh_username:{label:"SSH Username",type:"text",addRequired:!1,editRequired:!1},ssh_password:{label:"SSH Password",type:"password",addRequired:!1,editRequired:!1,ngChange:"clearPWConfirm('ssh_password_confirm')",
|
||||
ask:!0,clear:!0,associated:"ssh_password_confirm"},ssh_password_confirm:{label:"Confirm SSH Password",type:"password",addRequired:!1,editRequired:!1,awPassMatch:!0,associated:"ssh_password"},ssh_key_data:{label:"SSH Private Key",type:"textarea",addRequired:!1,editRequired:!1,rows:10,"class":"span10"},ssh_key_unlock:{label:"Key Password",type:"password",addRequired:!1,editRequired:!1,ngChange:"clearPWConfirm('ssh_key_unlock_confirm')",associated:"ssh_key_unlock_confirm",ask:!0,clear:!0},ssh_key_unlock_confirm:{label:"Confirm Key Password",
|
||||
type:"password",addRequired:!1,editRequired:!1,awPassMatch:!0,associated:"ssh_key_unlock"},sudo_username:{label:"Sudo Username",type:"text",addRequired:!1,editRequired:!1},sudo_password:{label:"Sudo Password",type:"password",addRequired:!1,editRequired:!1,ngChange:"clearPWConfirm('sudo_password_confirm')",ask:!0,clear:!0,associated:"sudo_password_confirm"},sudo_password_confirm:{label:"Confirm Sudo Password",type:"password",addRequired:!1,editRequired:!1,awPassMatch:!0,associated:"sudo_password"}},
|
||||
buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{}});angular.module("GroupFormDefinition",[]).value("GroupForm",{addTitle:"Create Group",editTitle:"{{ name }}",name:"group",well:!1,"class":"horizontal-narrow",fields:{name:{label:"Name",type:"text",addRequired:!0,editRequired:!0},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1},variables:{label:"Variables",type:"textarea",addRequired:!1,editRequird:!1,rows:10,"class":"modal-input-xlarge","default":"---",dataTitle:"Group Variables",dataPlacement:"right",awPopOver:'<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>JSON:<br />\n<blockquote>{<br />"somevar": "somevalue",<br />"password": "magic"<br /> }</blockquote>\nYAML:<br />\n<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p><p>View YAML examples at <a href="http://www.ansibleworks.com/docs/YAMLSyntax.html" target="_blank">ansibleworks.com</a></p>',
|
||||
dataContainer:"#form-modal"}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{}});angular.module("HostFormDefinition",[]).value("HostForm",{addTitle:"Create Host",editTitle:"{{ name }}",name:"host","class":"horizontal-narrow",well:!1,fields:{name:{label:"Host Name",type:"text",addRequired:!0,editRequired:!0,awPopOver:"<p>Provide a host name, ip address, or ip address:port. Examples include:</p><blockquote>myserver.domain.com<br/>127.0.0.1<br />10.1.0.140:25<br />server.example.com:25</blockquote>",dataTitle:"Host Name",dataPlacement:"right",dataContainer:"#form-modal"},description:{label:"Description",
|
||||
type:"text",addRequired:!1,editRequired:!1},inventory:{type:"hidden",includeOnEdit:!0,includeOnAdd:!0},variables:{label:"Variables",type:"textarea",addRequired:!1,editRequird:!1,rows:10,"class":"modal-input-xlarge","default":"---",awPopOver:'<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>JSON:<br />\n<blockquote>{<br />"somevar": "somevalue",<br />"password": "magic"<br /> }</blockquote>\nYAML:<br />\n<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p><p>View YAML examples at <a href="http://www.ansibleworks.com/docs/YAMLSyntax.html" target="_blank">ansibleworks.com</a></p>',
|
||||
dataTitle:"Host Variables",dataPlacement:"right",dataContainer:"#form-modal"}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{}});angular.module("InventoryFormDefinition",[]).value("InventoryForm",{addTitle:"Create Inventory",editTitle:"{{ inventory_name }}",name:"inventory",well:!0,collapse:!0,collapseTitle:"Edit Inventory",collapseMode:"edit",twoColumns:!0,fields:{has_active_failures:{label:"Host Status",control:'<div class="job-failures-{{ has_active_failures }}"><i class="icon-exclamation-sign"></i> Failed jobs</div>',type:"custom",ngShow:"has_active_failures",readonly:!0,column:1},inventory_name:{realName:"name",label:"Name",
|
||||
type:"text",addRequired:!0,editRequired:!0,capitalize:!1,column:1},inventory_description:{realName:"description",label:"Description",type:"text",addRequired:!1,editRequired:!1,column:1},organization:{label:"Organization",type:"lookup",sourceModel:"organization",sourceField:"name",addRequired:!0,editRequired:!0,ngClick:"lookUpOrganization()",column:1},variables:{label:"Variables",type:"textarea",addRequired:!1,editRequird:!1,rows:10,"class":"modal-input-xlarge","default":"---",awPopOver:'<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p><p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p><p>View YAML examples at <a href="http://www.ansibleworks.com/docs/YAMLSyntax.html" target="_blank">ansibleworks.com</a></p>',
|
||||
dataTitle:"Inventory Variables",dataPlacement:"bottom",column:2}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{groups:{type:"tree",open:!0,actions:{}},hosts:{type:"treeview",title:"{{ groupTitle }}",iterator:"host",actions:{add:{ngClick:"addHost()",icon:"icon-plus",label:"Add Host",awToolTip:"Add a host",ngHide:"createButtonShow == false"}},fields:{name:{key:!0,
|
||||
label:"Host Name",ngClick:"editHost({{ host.id }}, '{{ host.name }}')"},has_active_failures:{label:"Failed jobs?",showValue:!1,ngClick:"showEvents('{{ host.name }}', '{{ host.related.last_job }}')",ngShow:"{{ host.has_active_failures }}",icon:"icon-exclamation-sign","class":"active-failures-{{ host.has_active_failures }}",text:"View failures",searchField:"has_active_failures",searchType:"boolean",searchOptions:[{name:"No",value:0},{name:"Yes",value:1}]}},fieldActions:{edit:{ngClick:"editHost({{ host.id }}, '{{ host.name }}')",
|
||||
icon:"icon-edit",label:"Edit","class":"btn-success",awToolTip:"Edit host"},"delete":{ngClick:"deleteHost({{ host.id }}, '{{ host.name }}')",icon:"icon-remove",label:"Delete","class":"btn-danger",awToolTip:"Remove host"}}}}});angular.module("JobEventFormDefinition",[]).value("JobEventForm",{editTitle:"{{ id }} - {{ event }}",name:"job_events","class":"horizontal-narrow",well:!1,fields:{event_display:{label:"Event",type:"text",readonly:!0},created:{label:"Created",type:"text",readonly:!0,"class":"span3"},status:{label:"Status",type:"text","class":"job-{{ event_status }}",readonly:!0},host:{label:"Host",type:"text",readonly:!0},status:{label:"Status",type:"text","class":"job-{{ event_status }}",readonly:!0},event_data:{label:"Event Data",
|
||||
type:"textarea","class":"modal-input-xlarge",rows:10,readonly:!0}},buttons:{},related:{}});angular.module("JobFormDefinition",[]).value("JobForm",{addTitle:"Create Job",editTitle:"{{ name }}",name:"jobs",well:!0,twoColumns:!0,fields:{name:{label:"Name",type:"text",addRequired:!0,editRequired:!0,column:1},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1,column:1},job_type:{label:"Job Type",type:"select",ngOptions:"type.label for type in job_type_options","default":"run",addRequired:!0,editRequired:!0,awPopOver:"<p>When this template is submitted as a job, setting the type to <em>run</em> will execute the playbook, running tasks on the selected hosts.</p> <p>Setting the type to <em>check</em> will not execute the playbook. Instead, ansible will check playbook syntax, test environment setup and report problems.</p>",
|
||||
dataTitle:"Job Type",dataPlacement:"right",column:1},inventory:{label:"Inventory",type:"lookup",sourceModel:"inventory",sourceField:"name",addRequired:!0,editRequired:!0,ngClick:"lookUpInventory()",column:1},project:{label:"Project",type:"lookup",sourceModel:"project",sourceField:"name",addRequired:!0,editRequired:!0,ngClick:"lookUpProject()",column:1},playbook:{label:"Playbook",type:"select",ngOptions:"book for book in playbook_options",id:"playbook-select",addRequired:!0,editRequired:!0,column:1},
|
||||
credential:{label:"Credential",type:"lookup",sourceModel:"credential",sourceField:"name",ngClick:"lookUpCredential()",addRequired:!1,editRequired:!1,column:2},forks:{label:"Forks",id:"forks-number",type:"number",integer:!0,min:0,max:100,slider:!0,"class":"input-mini","default":"0",addRequired:!1,editRequired:!1,column:2,awPopOver:"<p>The number of parallel or simultaneous processes to use while executing the playbook. Provide a value between 0 and 100. A value of zero will use the ansible default setting of 5 parallel processes.</p>",
|
||||
dataTitle:"Forks",dataPlacement:"left"},limit:{label:"Limit",type:"text",addRequired:!1,editRequired:!1,column:2,awPopOver:'<p>Provide a host pattern to further constrain the list of hosts that will be managed or affected by the playbook. Multiple patterns can be separated by ; : or ,</p><p>For more information and examples see the <a href="http://ansible.cc/docs/patterns.html#selecting-targets" target="_blank">Selecting Targets section</a> under Inventory and Patterns in the Ansible documentation.</p>',
|
||||
dataTitle:"Limit",dataPlacement:"left"},verbosity:{label:"Verbosity",type:"select",ngOptions:"v.label for v in verbosity_options","default":0,addRequired:!0,editRequired:!0,column:2,awPopOver:"<p>Control the level of output ansible will produce as the playbook executes.</p>",dataTitle:"Verbosity",dataPlacement:"left"},extra_vars:{label:"Extra Variables",type:"textarea",rows:6,"class":"span12",addRequired:!1,editRequired:!1,awPopOver:'<p>Pass extra command line variables to the playbook. This is the -e or --extra-vars command line parameter for ansible-playbook. Provide key=value pairs or JSON. <p><a href="http://www.ansibleworks.com/docs/playbooks2.html#passing-variables-on-the-command-line" target="_blank">Click here to view documentation and examples.</a></p>',
|
||||
column:2},allow_callbacks:{label:"Allow Callbacks",type:"checkbox",addRequired:!1,editRequird:!1,trueValue:"true",falseValue:"false",ngChange:"toggleCallback('host_config_key')","class":"span12",column:2},host_config_key:{label:"Host Config Key",type:"text",ngShow:"allow_callbacks",genMD5:!0,column:2}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},statusFields:{status:{label:'Job Status <span class="job-detail-status job-{{ status }}"><i class="icon-circle"></i> {{ status }}</span>',
|
||||
type:"text",readonly:!0,control:!1},created:{label:"Date",type:"text",readonly:!0},result_stdout:{label:"Standard Out",type:"textarea",readonly:!0,rows:20,"class":"span12"},result_traceback:{label:"Traceback",type:"textarea",readonly:!0,rows:10,"class":"span12",ngShow:"result_traceback != ''"}},statusActions:{refresh:{label:"Refresh",icon:"icon-refresh",ngClick:"refresh()","class":"btn-small btn-success",awToolTip:"Refresh job status & output",mode:"all"},summary:{label:"Hosts",icon:"icon-th-large",
|
||||
ngClick:"jobSummary()","class":"btn btn-small",awToolTip:"View host summary",mode:"all"},events:{label:"Events",icon:"icon-list-ul",ngClick:"jobEvents()","class":"btn btn-small",awToolTip:"Edit job events",mode:"all"}},related:{}});angular.module("JobTemplateFormDefinition",[]).value("JobTemplateForm",{addTitle:"Create Job Templates",editTitle:"{{ name }}",name:"job_templates",twoColumns:!0,well:!0,fields:{name:{label:"Name",type:"text",addRequired:!0,editRequired:!0,column:1},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1,column:1},job_type:{label:"Job Type",type:"select",ngOptions:"type.label for type in job_type_options","default":0,addRequired:!0,editRequired:!0,column:1,awPopOver:"<p>When this template is submitted as a job, setting the type to <em>run</em> will execute the playbook, running tasks on the selected hosts.</p> <p>Setting the type to <em>check</em> will not execute the playbook. Instead, ansible will check playbook syntax, test environment setup and report problems.</p>",
|
||||
dataTitle:"Job Type",dataPlacement:"right"},inventory:{label:"Inventory",type:"lookup",sourceModel:"inventory",sourceField:"name",addRequired:!0,editRequired:!0,ngClick:"lookUpInventory()",column:1},project:{label:"Project",type:"lookup",sourceModel:"project",sourceField:"name",addRequired:!0,editRequired:!0,ngClick:"lookUpProject()",column:1},playbook:{label:"Playbook",type:"select",ngOptions:"book for book in playbook_options",id:"playbook-select",addRequired:!0,editRequired:!0,column:1},credential:{label:"Credential",
|
||||
type:"lookup",sourceModel:"credential",sourceField:"name",ngClick:"lookUpCredential()",addRequired:!1,editRequired:!1,column:1},forks:{label:"Forks",id:"forks-number",type:"number",integer:!0,min:0,max:100,slider:!0,"class":"input-mini","default":"0",addRequired:!1,editRequired:!1,column:2,awPopOver:"<p>The number of parallel or simultaneous processes to use while executing the playbook. Provide a value between 0 and 100. A value of zero will use the ansible default setting of 5 parallel processes.</p>",
|
||||
dataTitle:"Forks",dataPlacement:"left"},limit:{label:"Limit",type:"text",addRequired:!1,editRequired:!1,column:2,awPopOver:'<p>Provide a host pattern to further constrain the list of hosts that will be managed or affected by the playbook. Multiple patterns can be separated by ; : or ,</p><p>For more information and examples see the <a href="http://ansible.cc/docs/patterns.html#selecting-targets" target="_blank">Selecting Targets section</a> under Inventory and Patterns in the Ansible documentation.</p>',
|
||||
dataTitle:"Limit",dataPlacement:"left"},verbosity:{label:"Verbosity",type:"select",ngOptions:"v.label for v in verbosity_options","default":0,addRequired:!0,editRequired:!0,column:2,awPopOver:"<p>Control the level of output ansible will produce as the playbook executes.</p>",dataTitle:"Verbosity",dataPlacement:"left"},variables:{label:"Extra Variables",type:"textarea",rows:6,"class":"span12",addRequired:!1,editRequired:!1,"default":"---",column:2,awPopOver:'<p>Pass extra command line variables to the playbook. This is the -e or --extra-vars command line parameter for ansible-playbook. Provide key/value pairs using either YAML or JSON.</p>JSON:<br />\n<blockquote>{<br />"somevar": "somevalue",<br />"password": "magic"<br /> }</blockquote>\nYAML:<br />\n<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n',
|
||||
dataTitle:"Extra Variables",dataPlacement:"left"},allow_callbacks:{label:"Allow Callbacks",type:"checkbox",addRequired:!1,editRequird:!1,trueValue:"true",falseValue:"false",ngChange:"toggleCallback('host_config_key')","class":"span12",column:2},host_config_key:{label:"Host Config Key",type:"text",ngShow:"allow_callbacks",genMD5:!0,column:2}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",
|
||||
ngDisabled:!0}},related:{jobs:{type:"collection",title:"Jobs",iterator:"job",index:!1,open:!1,actions:{},fields:{id:{label:"Job ID",key:!0,desc:!0,searchType:"int"},name:{label:"Name",link:!0},description:{label:"Description"},status:{label:"Status",icon:"icon-circle","class":"job-{{ job.status }}",searchType:"select",searchOptions:[{name:"new",value:"new"},{name:"pending",value:"pending"},{name:"running",value:"running"},{name:"successful",value:"successful"},{name:"error",value:"error"},{name:"failed",
|
||||
value:"failed"},{name:"canceled",value:"canceled"}]}},fieldActions:{edit:{label:"View",ngClick:"edit('jobs', {{ job.id }}, '{{ job.name }}')",icon:"icon-zoom-in"}}}}});angular.module("OrganizationFormDefinition",[]).value("OrganizationForm",{addTitle:"Create Organization",editTitle:"{{ name }}",name:"organization",well:!0,fields:{name:{label:"Name",type:"text",addRequired:!0,editRequired:!0,capitalize:!0},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{users:{type:"collection",
|
||||
title:"Users",iterator:"user",open:!1,actions:{add:{ngClick:"add('users')",label:"Add",icon:"icon-plus",awToolTip:"Add a new user"}},fields:{username:{key:!0,label:"Username"},first_name:{label:"First Name"},last_name:{label:"Last Name"}},fieldActions:{edit:{label:"Edit",ngClick:"edit('users', {{ user.id }}, '{{ user.username }}')",icon:"icon-edit","class":"btn-success",awToolTip:"Edit user"},"delete":{label:"Delete",ngClick:"delete('users', {{ user.id }}, '{{ user.username }}', 'users')",icon:"icon-remove",
|
||||
"class":"btn-danger",awToolTip:"Remove user"}}},admins:{type:"collection",title:"Administrators",iterator:"admin",open:!1,base:"/users",actions:{add:{ngClick:"add('admins')",icon:"icon-plus",label:"Add",awToolTip:"Add new administrator"}},fields:{username:{key:!0,label:"Username"},first_name:{label:"First Name"},last_name:{label:"Last Name"}},fieldActions:{edit:{label:"Edit",ngClick:"edit('users', {{ admin.id }}, '{{ admin.username }}')",icon:"icon-edit","class":"btn-success",awToolTip:"Edit administrator"},
|
||||
"delete":{label:"Delete",ngClick:"delete('admins', {{ admin.id }}, '{{ admin.username }}', 'administrators')",icon:"icon-remove","class":"btn-danger",awToolTip:"Remove administrator"}}}}});angular.module("PermissionFormDefinition",[]).value("PermissionsForm",{addTitle:"Add Permission",editTitle:"{{ name }}",name:"permission",well:!0,fields:{category:{label:"Permission Type",type:"radio",options:[{label:"Inventory",value:"Inventory"},{label:"Deployment",value:"Deploy"}],ngChange:"selectCategory()"},name:{label:"Name",type:"text",addRequired:!0,editRequired:!0,capitalize:!0},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1},user:{label:"User",type:"hidden"},
|
||||
team:{label:"Team",type:"hidden"},project:{label:"Project",type:"lookup",sourceModel:"project",sourceField:"name",ngShow:"category == 'Deploy'",ngClick:"lookUpProject()",awRequiredWhen:{variable:"projectrequired",init:"false"}},inventory:{label:"Inventory",type:"lookup",sourceModel:"inventory",sourceField:"name",ngClick:"lookUpInventory()",awRequiredWhen:{variable:"inventoryrequired",init:"true"}},permission_type:{label:"Permission",type:"radio",options:[{label:"Admin",value:"admin",ngShow:"category == 'Inventory'"},
|
||||
{label:"Read",value:"read",ngShow:"category == 'Inventory'"},{label:"Write",value:"write",ngShow:"category == 'Inventory'"},{label:"Run",value:"run",ngShow:"category == 'Deploy'"},{label:"Check",value:"check",ngShow:"category == 'Deploy'"}],addRequired:!0,editRequired:!0}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{}});angular.module("ProjectFormDefinition",[]).value("ProjectsForm",{addTitle:"Create Project",editTitle:"{{ name }}",name:"project",well:!0,fields:{name:{label:"Name",type:"text",addRequired:!0,editRequired:!0,capitalize:!0},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1},base_dir:{label:"Project Base Path",type:"textarea","class":"span6",showonly:!0,awPopOver:"<p>Base path used for locating playbooks. Directories found inside this path will be listed in the Project Path drop-down. Together the base path and selected project path provide the full path used to locate playbooks for this project.</p><p>Use PROJECTS_ROOT in your environment settings file to determine the base path value.</p>",
|
||||
dataTitle:"Project Base Path",dataPlacement:"right"},local_path:{label:"Project Path",type:"select",id:"local-path-select",ngOptions:"path for path in project_local_paths",addRequired:!0,editRequired:!0,awPopOver:"<p>Select from the list of directories found in the base path.Together the base path and selected project path provide the full path used to locate playbooks for this project.</p><p>Use PROJECTS_ROOT in your environment settings file to determine the base path value.</p>",dataTitle:"Project Path",
|
||||
dataPlacement:"right"}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{}});angular.module("TeamFormDefinition",[]).value("TeamForm",{addTitle:"Create Team",editTitle:"{{ name }}",name:"team",well:!0,collapse:!0,collapseTitle:"Team Settings",collapseMode:"edit",collapseOpen:!0,fields:{name:{label:"Name",type:"text",addRequired:!0,editRequired:!0,capitalize:!0},description:{label:"Description",type:"text",addRequired:!1,editRequired:!1},organization:{label:"Organization",type:"lookup",sourceModel:"organization",sourceField:"name",addRequired:!0,editRequired:!0,ngClick:"lookUpOrganization()"}},
|
||||
buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{credentials:{type:"collection",title:"Credentials",iterator:"credential",open:!1,actions:{add:{ngClick:"add('credentials')",icon:"icon-plus",label:"Add",add:"Add a new credential"}},fields:{name:{key:!0,label:"Name"},description:{label:"Description"}},fieldActions:{edit:{label:"Edit",ngClick:"edit('credentials', {{ credential.id }}, '{{ credential.name }}')",
|
||||
icon:"icon-edit","class":"btn-success",awToolTip:"Modify the credential"},"delete":{label:"Delete",ngClick:"delete('credentials', {{ credential.id }}, '{{ credential.name }}', 'credentials')",icon:"icon-remove","class":"btn-danger",awToolTip:"Remove the credential"}}},permissions:{type:"collection",title:"Permissions",iterator:"permission",open:!1,actions:{add:{ngClick:"add('permissions')",icon:"icon-plus",label:"Add",awToolTip:"Add a permission for this user"}},fields:{name:{key:!0,label:"Name",
|
||||
ngClick:"edit('permissions', {{ permission.id }}, '{{ permission.name }}')"},inventory:{label:"Inventory",sourceModel:"inventory",sourceField:"name",ngBind:"permission.summary_fields.inventory.name"},project:{label:"Project",sourceModel:"project",sourceField:"name",ngBind:"permission.summary_fields.project.name"},permission_type:{label:"Permission"}},fieldActions:{edit:{label:"Edit",ngClick:"edit('permissions', {{ permission.id }}, '{{ permission.name }}')",icon:"icon-edit","class":"btn-success",
|
||||
awToolTip:"Edit the permission"},"delete":{label:"Delete",ngClick:"delete('permissions', {{ permission.id }}, '{{ permission.name }}', 'permissions')",icon:"icon-remove","class":"btn-danger",awToolTip:"Delete the permission"}}},projects:{type:"collection",title:"Projects",iterator:"project",open:!1,actions:{add:{ngClick:"add('projects')",icon:"icon-plus",label:"Add"}},fields:{name:{key:!0,label:"Name"},description:{label:"Description"}},fieldActions:{edit:{label:"Edit",ngClick:"edit('projects', {{ project.id }}, '{{ project.name }}')",
|
||||
icon:"icon-edit","class":"btn-success",awToolTip:"Modify the project"},"delete":{label:"Delete",ngClick:"delete('projects', {{ project.id }}, '{{ project.name }}', 'projects')",icon:"icon-remove","class":"btn-danger",awToolTip:"Remove the project"}}},users:{type:"collection",title:"Users",iterator:"user",open:!1,actions:{add:{ngClick:"add('users')",icon:"icon-plus",label:"Add",awToolTip:"Add a user"}},fields:{username:{key:!0,label:"Username"},first_name:{label:"First Name"},last_name:{label:"Last Name"}},
|
||||
fieldActions:{edit:{label:"Edit",ngClick:"edit('users', {{ user.id }}, '{{ user.username }}')",icon:"icon-edit","class":"btn-success",awToolTip:"Edit user"},"delete":{label:"Delete",ngClick:"delete('users', {{ user.id }}, '{{ user.username }}', 'users')",icon:"icon-remove","class":"btn-danger",awToolTip:"Remove user"}}}}});angular.module("UserFormDefinition",[]).value("UserForm",{addTitle:"Create User",editTitle:"{{ username }}",name:"user",well:!0,collapse:!0,collapseTitle:"User Settings",collapseMode:"edit",collapseOpen:!0,fields:{username:{label:"Username",type:"text",addRequired:!0,editRequired:!0},first_name:{label:"First Name",type:"text",addRequired:!0,editRequired:!0,capitalize:!0},last_name:{label:"Last Name",type:"text",addRequired:!0,editRequired:!0,capitalize:!0},email:{label:"Email",type:"email",addRequired:!0,
|
||||
editRequired:!0},organization:{label:"Organization",type:"lookup",sourceModel:"organization",sourceField:"name",addRequired:!0,editRequired:!0,ngClick:"lookUpOrganization()",excludeMode:"edit"},password:{label:"Password",type:"password",addRequired:!0,editRequired:!1,ngChange:"clearPWConfirm('password_confirm')"},password_confirm:{label:"Confirm Password",type:"password",addRequired:!1,editRequired:!1,awPassMatch:!0,associated:"password"},is_superuser:{label:"Superuser?",type:"checkbox",trueValue:"true",
|
||||
falseValue:"false","default":"false",ngShow:"current_user['is_superuser'] == true"}},buttons:{save:{label:"Save",icon:"icon-ok","class":"btn-success",ngClick:"formSave()",ngDisabled:!0},reset:{ngClick:"formReset()",label:"Reset",icon:"icon-remove",ngDisabled:!0}},related:{credentials:{type:"collection",title:"Credentials",iterator:"credential",open:!1,actions:{add:{ngClick:"add('credentials')",icon:"icon-plus",label:"Add",awToolTip:"Add a credential for this user"}},fields:{name:{key:!0,label:"Name"},
|
||||
description:{label:"Description"}},fieldActions:{edit:{label:"Edit",ngClick:"edit('credentials', {{ credential.id }}, '{{ credential.name }}')",icon:"icon-edit","class":"btn-success",awToolTip:"Edit the credential"},"delete":{label:"Delete",ngClick:"delete('credentials', {{ credential.id }}, '{{ credential.name }}', 'credentials')",icon:"icon-remove","class":"btn-danger",awToolTip:"Delete the credential"}}},permissions:{type:"collection",title:"Permissions",iterator:"permission",open:!1,actions:{add:{ngClick:"add('permissions')",
|
||||
icon:"icon-plus",label:"Add",awToolTip:"Add a permission for this user"}},fields:{name:{key:!0,label:"Name",ngClick:"edit('permissions', {{ permission.id }}, '{{ permission.name }}')"},inventory:{label:"Inventory",sourceModel:"inventory",sourceField:"name",ngBind:"permission.summary_fields.inventory.name"},project:{label:"Project",sourceModel:"project",sourceField:"name",ngBind:"permission.summary_fields.project.name"},permission_type:{label:"Permission"}},fieldActions:{edit:{label:"Edit",ngClick:"edit('permissions', {{ permission.id }}, '{{ permission.name }}')",
|
||||
icon:"icon-edit","class":"btn-success",awToolTip:"Edit the permission"},"delete":{label:"Delete",ngClick:"delete('permissions', {{ permission.id }}, '{{ permission.name }}', 'permissions')",icon:"icon-remove","class":"btn-danger",awToolTip:"Delete the permission"}}},admin_of_organizations:{type:"collection",title:"Admin of Organizations",iterator:"adminof",open:!1,base:"/organizations",fields:{name:{key:!0,label:"Name"},description:{label:"Description"}}},organizations:{type:"collection",title:"Organizations",
|
||||
iterator:"organization",open:!1,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}}},teams:{type:"collection",title:"Teams",iterator:"team",open:!1,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}}},projects:{type:"collection",title:"Projects",iterator:"project",open:!1,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}}}}});angular.module("AccessHelper",["RestServices","Utilities","ngCookies"]).factory("CheckAccess",["$rootScope","Alert","Rest","GetBasePath","ProcessErrors",function(h,m,k,g,c){return function(g){var f=h.current_user,e=!1;f.is_superuser?e=!0:f.related.admin_of_organizations&&(k.setUrl(f.related.admin_of_organizations),k.get().success(function(c,a,d,b){0<c.results.length&&(e=!0)}).error(function(e,a,d,b){c(scope,e,a,null,{hdr:"Error!",msg:"Call to "+f.related.admin_of_organizations+" failed. DELETE returned status: "+
|
||||
a})}));e||m("Access Denied","You do not have access to this function. Please contact your system administrator.");return e}}]).factory("CheckLicense",["$rootScope","$cookieStore","Alert","$location","Authorization",function(h,m,k,g,c){return function(){var g=m.get("license");g&&!c.licenseTested()&&(g.tested=!0,m.remove("license"),m.put("license",g),h.license_tested=!0,void 0!==g.key_valid&&!1==g.key_valid?k("License Error",'Something is wrong with your /etc/awx/license file on this server. Please contact <a href="mailto:info@ansibleworks.com">info@ansibleworks.com</a> for assistance.',
|
||||
"alert-error",null,!1,!0):void 0!==g.demo&&!0==g.demo&&k("AWX Demo",'Thank you for trying AnsibleWorks AWX. You can use this edition to manage up to 5 hosts. Should you wish to acquire a license for additional servers, please visit <a href="http://ansibleworks.com/ansibleworks-awx" target="_blank"><strong>ansibleworks.com/ansibleworks-awx</strong></a>, or contact <a href="mailto:info@ansibleworks.com"><strong>info@ansibleworks.com</strong></a> for assistance.',"alert-info"),void 0!==g.date_warning&&
|
||||
!0==g.date_warning&&k("License Expired",'Your AnsibleWorks AWX License has expired and is no longer compliant. You can continue, but you will be unable to add any additional hosts. Please visit <a href="http://ansibleworks.com/ansibleworks-awx" target="_blank"><strong>ansibleworks.com/ansibleworks-awx</strong></a> for license and renewal information, or contact <a href="mailto:info@ansibleworks.com"><strong>info@ansibleworks.com</strong></a> for assistance.',"alert-info"),void 0!==g.free_instances&&
|
||||
0>=parseInt(g.free_instances)&&k("License Warning",'Your AnsibleWorks AWX License has reached capacity for the number of managed hosts allowed. You will not be able to add any additional hosts. To extend your license, please visit <a href="http://ansibleworks.com/ansibleworks-awx" target="_blank"><strong>ansibleworks.com/ansibleworks-awx.</strong></a>, or contact <a href="mailto:info@ansibleworks.com"><strong>info@ansibleworks.com</strong></a> for more information.',"alert-info",null,!0))}}]);angular.module("APIDefaults",["RestServices","Utilities"]).factory("GetAPIDefaults",["Alert","Rest","$rootScope",function(h,m,k){return function(h){function c(c){var a={};for(id in k.apiDefaults)if(id==c||id.iterator==c){a[id]=defaults[id];break}return a}function p(){if(f=={}&&5>e)e++,setTimeout(1E3,p());else if("success"==f.status)return c(h)}var f={},e=0;return null==k.apiDefaults||void 0==k.apiDefaults?(f={},m.setUrl("/api/v1"),m.get().success(function(c,a,d,b){defaults=c;for(var e in defaults)switch(e){case "organizations":dafaults[e].iterator=
|
||||
"organization";break;case "jobs":defaults[e].iterator="job";break;case "users":defaults[e].iterator="user";break;case "teams":defaults[e].iterator="team";break;case "hosts":defaults[e].iterator="host";break;case "groups":defaults[e].iterator="group";break;case "projects":defaults[e].iterator="project"}k.apiDefaults=defaults;f={status:"success"}}).error(function(c,a,d,b){f={status:"error",msg:"Call to /api/v1 failed. GET returned status: "+a}}),p()):c(h)}}]);angular.module("ChildrenHelper",["RestServices","Utilities"]).factory("ToggleChildren",["Alert","Rest","GetBasePath","ProcessErrors","FormatDate",function(h,m,k,g,c){return function(c){function f(b){a[b].ngicon="icon-collapse-alt";for(var d=b+1;d<a.length;d++)a[d].parent==a[b].id&&(a[d].show=!0)}function e(b){a[b].ngicon="icon-expand-alt";for(var d=b+1;d<a.length;d++)a[d].parent==a[b].id&&(a[d].show=!1,a[d].related.children&&e(d))}var l=c.id,a=c.scope[c.list.name],d;c=!1;for(var b=0;b<a.length&&!1==
|
||||
c;b++)a[b].id==l&&(d=b,c=!0);"icon-expand-alt"==a[d].ngicon?f(d):e(d)}}]);angular.module("EventsHelper",["RestServices","Utilities","JobEventFormDefinition"]).factory("EventView",["$rootScope","$location","$log","$routeParams","Rest","Alert","JobEventForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","FormatDate",function(h,m,k,g,c,p,f,e,l,a,d,b){return function(l){var h=l.event_id;l=d("base")+"job_events/"+h+"/";var g=e.inject(f,{mode:"edit",modal:!0,related:!1});e.reset();g.formModalAction=function(){$("#form-modal").modal("hide")};g.formModalActionLabel="OK";
|
||||
g.formModalHeader="View Event";g.formModalCancelShow=!1;$("#form-modal .btn-success").removeClass("btn-success").addClass("btn-none");c.setUrl(l);c.get().success(function(a,d,c,e){for(var l in f.fields)"status"==l?g.status=a.failed?"error":"success":"event_data"==l?g.event_data=JSON.stringify(a.event_data,void 0,"\t"):"host"==l?a.summary_fields&&a.summary_fields.host&&(g.host=a.summary_fields.host.name):"event_display"==l?g.event_display=a.event_display.replace(/^\u00a0*/g,""):"created"==l?g.created=
|
||||
b(new Date(a.created)):a[l]&&(g[l]=a[l])}).error(function(b,d,c,e){a(g,b,d,f,{hdr:"Error!",msg:"Failed to retrieve host: "+h+". GET status: "+d})});g.$$phase||g.$digest()}}]);angular.module("GroupsHelper","RestServices Utilities ListGenerator GroupListDefinition SearchHelper PaginateHelper ListGenerator AuthService GroupsHelper InventoryHelper".split(" ")).factory("GroupsList",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupList","GenerateList","Prompt","SearchInit","PaginateInit","ProcessErrors","GetBasePath","GroupsAdd","RefreshTree",function(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B){return function(b){var l=b.inventory_id,h=void 0!==b.group_id?b.group_id:
|
||||
null;b=z("inventory")+l+"/groups/";var k=e.inject(f,{id:"form-modal-body",mode:"select",breadCrumbs:!1,selectButton:!1});k.formModalActionLabel="Finished";k.formModalHeader="Add Group";k.formModalCancelShow=!0;k.formModalActionClass="btn btn-success";$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").modal();k.selected=[];k.PostRefreshRemove&&k.PostRefreshRemove();k.PostRefreshRemove=k.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");
|
||||
k[a]=""});if(g.group_id)for(var a=0;a<k.groups.length;a++)k.groups[a].id==g.group_id&&k.groups.splice(a,1)});a({scope:k,set:"groups",list:f,url:b});d({scope:k,list:f,url:b,mode:"lookup"});k.search(f.iterator);k.$$phase||k.$digest();k.formModalAction=function(){var a=h?z("groups")+h+"/children/":z("inventory")+l+"/groups/";c.setUrl(a);k.queue=[];k.callFinishedRemove&&k.callFinishedRemove();k.callFinishedRemove=k.$on("callFinished",function(){if(k.queue.length==k.selected.length){$('input[type="checkbox"]').prop("checked",
|
||||
!1);k.selected=[];for(var a=0,b=0;b<k.queue.length;b++)"error"==k.queue[b].result&&a++;0<a?p("Error","There was an error while adding one or more of the selected groups."):($("#form-modal").modal("hide"),B({scope:k}))}});if(0<k.selected.length)for(var b=0;b<k.selected.length;b++){for(var a=null,d=0;d<k.groups.length;d++)k.groups[d].id==k.selected[b]&&(a=k.groups[d]);null!==a&&c.post(a).success(function(a,b,d,c){k.queue.push({result:"success",data:a,status:b});k.$emit("callFinished")}).error(function(a,
|
||||
b,d,c){k.queue.push({result:"error",data:a,status:b,headers:d});k.$emit("callFinished")})}else $("#form-modal").modal("hide")};k.toggle_group=function(a){"success"==k[f.iterator+"_"+a+"_class"]?(k[f.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<k.selected.indexOf(a)&&k.selected.splice(k.selected.indexOf(a),1)):(k[f.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==k.selected.indexOf(a)&&k.selected.push(a))};k.createGroup=function(){$("#form-modal").modal("hide");
|
||||
w({inventory_id:l,group_id:h})}}}]).factory("GroupsAdd",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","RefreshTree","ParseTypeChange",function(h,m,k,g,c,p,f,e,l,a,d,b,z){return function(l){var h=l.inventory_id;l=void 0!==l.group_id?l.group_id:null;var k=null!==l?d("groups")+l+"/children/":d("inventory")+h+"/groups/",g=e.inject(f,{mode:"add",modal:!0,related:!1});g.formModalActionLabel="Save";g.formModalHeader="Create Group";
|
||||
g.formModalCancelShow=!0;g.parseType="yaml";z(g);$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");e.reset();g.$$phase||g.$digest();g.formModalAction=function(){try{if("json"==g.parseType){JSON.parse(g.variables);var d=g.variables}else d=jsyaml.load(g.variables);var e={},l;for(l in f.fields)"variables"!=l&&(e[l]=g[l]);h&&(e.inventory=h);c.setUrl(k);c.post(e).success(function(e,l,h,k){g.variables?(c.setUrl(e.related.variable_data),c.put(d).success(function(a,d,c,e){$("#form-modal").modal("hide");
|
||||
b({scope:g})}).error(function(b,d,c,e){a(g,b,d,f,{hdr:"Error!",msg:"Failed to add group varaibles. PUT returned status: "+d})})):($("#form-modal").modal("hide"),b({scope:g}))}).error(function(b,d,c,e){a(g,b,d,f,{hdr:"Error!",msg:"Failed to add new group. POST returned status: "+d})})}catch(m){p("Error","Error parsing group variables. Parser returned: "+m)}};g.formReset=function(){e.reset()}}}]).factory("GroupsEdit",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm",
|
||||
"Prompt","ProcessErrors","GetBasePath","RefreshTree","ParseTypeChange",function(h,m,k,g,c,p,f,e,l,a,d,b,z){return function(l){var h=l.group_id,k=g.id,m=d("groups")+h+"/",t=e.inject(f,{mode:"edit",modal:!0,related:!1});e.reset();var s={},n={};t.formModalActionLabel="Save";t.formModalHeader="Edit Group";t.formModalCancelShow=!0;t.parseType="yaml";z(t);$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");t.groupLoadedRemove&&t.groupLoadedRemove();t.groupLoadedRemove=t.$on("groupLoaded",
|
||||
function(){for(var b in n)t.search(n[b].iterator);t.variable_url?(c.setUrl(t.variable_url),c.get().success(function(a,b,d,c){$.isEmptyObject(a)?t.variables="---":t.variables=jsyaml.safeDump(a)}).error(function(b,d,c,e){t.variables=null;a(t,b,d,f,{hdr:"Error!",msg:"Failed to retrieve group variables. GET returned status: "+d})})):t.variables="---";s.variables=t.variables});c.setUrl(m);c.get().success(function(a,b,d,c){for(var e in f.fields)a[e]&&(t[e]=a[e],s[e]=t[e]);b=a.related;for(var l in f.related)b[l]&&
|
||||
(n[l]={url:b[l],iterator:f.related[l].iterator});t.variable_url=a.related.variable_data;t.$emit("groupLoaded")}).error(function(b,d,c,e){a(t,b,d,f,{hdr:"Error!",msg:"Failed to retrieve group: "+id+". GET status: "+d})});t.$$phase||t.$digest();t.formModalAction=function(){try{if("json"==t.parseType){JSON.parse(t.variables);var e=t.variables}else e=jsyaml.load(t.variables);var l={},g;for(g in f.fields)l[g]=t[g];l.inventory=k;c.setUrl(m);c.put(l).success(function(l,h,k,g){t.variables?(c.setUrl(d("groups")+
|
||||
l.id+"/variable_data/"),c.put(e).success(function(a,d,c,e){$("#form-modal").modal("hide");b({scope:t})}).error(function(b,d,c,e){a(t,b,d,f,{hdr:"Error!",msg:"Failed to update group varaibles. PUT returned status: "+d})})):($("#form-modal").modal("hide"),b({scope:t}))}).error(function(b,d,c,e){a(t,b,d,f,{hdr:"Error!",msg:"Failed to update group: "+h+". PUT status: "+d})})}catch(n){p("Error","Error parsing group variables. Parser returned: "+n)}};t.formReset=function(){e.reset();for(var a in s)t[a]=
|
||||
s[a];t.parseType="yaml"}}}]).factory("GroupsDelete",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath",function(h,m,k,g,c,p,f,e,l,a,d){return function(b){var e=b.scope,f=b.group_id;b=b.inventory_id;var l=$('#tree-view li[group_id="'+f+'"]'),h="LI"==l.parent().last().prop("tagName")?l.parent().last():l.parent().parent().last();console.log(h);var k;k="group"==h.attr("type")?d("base")+"groups/"+h.attr("group_id")+"/children/":
|
||||
d("inventory")+b+"/groups/";$("#prompt-header").text("Delete Group");$("#prompt-body").text("Are you sure you want to remove group "+$(l).attr("name")+" from "+$(h).attr("name")+"?");$("#prompt-action-btn").addClass("btn-danger");e.promptAction=function(){c.setUrl(k);c.post({id:f,disassociate:1}).success(function(a,b,d,c){$("#prompt-modal").modal("hide");$("#tree-view").jstree("delete_node",l)}).error(function(b,d,c,f){$("#prompt-modal").modal("hide");RefreshTree({scope:e});a(e,b,d,null,{hdr:"Error!",
|
||||
msg:"Call to "+k+" failed. DELETE returned status: "+d})})};$("#prompt-modal").modal({backdrop:"static",keyboard:!0,show:!0})}}]);angular.module("HostsHelper","RestServices Utilities ListGenerator HostListDefinition SearchHelper PaginateHelper ListGenerator AuthService HostsHelper InventoryHelper RelatedSearchHelper RelatedPaginateHelper InventoryFormDefinition".split(" ")).factory("HostsList",["$rootScope","$location","$log","$routeParams","Rest","Alert","HostList","GenerateList","Prompt","SearchInit","PaginateInit","ProcessErrors","GetBasePath","HostsAdd","HostsReload",function(h,m,k,g,c,p,f,e,l,a,d,b,z,w,B){return function(b){var l=
|
||||
b.inventory_id,h=b.group_id,k=z("inventory")+l+"/hosts/",g=e.inject(f,{id:"form-modal-body",mode:"select",breadCrumbs:!1,selectButton:!1});g.formModalActionLabel="Finished";g.formModalHeader="Add Host";g.formModalCancelShow=!0;$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").modal();$("#form-modal").unbind("hidden");$("#form-modal").on("hidden",function(){B(b)});g.selected=[];g.PostRefreshRemove&&g.PostRefreshRemove();g.PostRefreshRemove=g.$on("PostRefresh",
|
||||
function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");g[a]=""})});a({scope:g,set:"hosts",list:f,url:k});d({scope:g,list:f,url:k,mode:"lookup"});g.search(f.iterator);g.$$phase||g.$digest();g.formModalAction=function(){var a=z("groups")+h+"/hosts/";c.setUrl(a);g.queue=[];g.callFinishedRemove&&g.callFinishedRemove();g.callFinishedRemove=g.$on("callFinished",function(){if(g.queue.length==g.selected.length){$('input[type="checkbox"]').prop("checked",!1);g.selected=[];for(var a=0,d=0;d<
|
||||
g.queue.length;d++)"error"==g.queue[d].result&&a++;0<a?p("Error","There was an error while adding one or more of the selected hosts."):($("#form-modal").modal("hide"),B(b))}});if(0<g.selected.length)for(var d=0;d<g.selected.length;d++){for(var a=null,e=0;e<g.hosts.length;e++)g.hosts[e].id==g.selected[d]&&(a=g.hosts[e]);null!==a&&c.post(a).success(function(a,b,d,c){g.queue.push({result:"success",data:a,status:b});g.$emit("callFinished")}).error(function(a,b,d,c){g.queue.push({result:"error",data:a,
|
||||
status:b,headers:d});g.$emit("callFinished")})}else $("#form-modal").modal("hide")};g.toggle_host=function(a){"success"==g[f.iterator+"_"+a+"_class"]?(g[f.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<g.selected.indexOf(a)&&g.selected.splice(g.selected.indexOf(a),1)):(g[f.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==g.selected.indexOf(a)&&g.selected.push(a))};g.createHost=function(){$("#form-modal").modal("hide");w({scope:b.scope,
|
||||
inventory_id:l,group_id:h})}}}]).factory("HostsAdd",["$rootScope","$location","$log","$routeParams","Rest","Alert","HostForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","HostsReload","ParseTypeChange",function(h,m,k,g,c,p,f,e,l,a,d,b,z){return function(l){var g=l.inventory_id,h=void 0!==l.group_id?l.group_id:null,k=d("groups")+h+"/hosts/",m=e.inject(f,{mode:"add",modal:!0,related:!1});m.formModalActionLabel="Save";m.formModalHeader="Create Host";m.formModalCancelShow=!0;m.parseType="yaml";
|
||||
z(m);$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").unbind("hidden");$("#form-modal").on("hidden",function(){b(l)});e.reset();m.$$phase||m.$digest();m.formModalAction=function(){try{if("json"==m.parseType){JSON.parse(m.variables);var b=m.variables}else b=jsyaml.load(m.variables);var d={},e;for(e in f.fields)"variables"!=e&&(d[e]=m[e]);d.inventory=g;c.setUrl(k);c.post(d).success(function(d,e,l,g){m.variables?(c.setUrl(d.related.variable_data),c.put(b).success(function(a,
|
||||
b,d,c){$("#form-modal").modal("hide")}).error(function(b,d,c,e){a(m,b,d,f,{hdr:"Error!",msg:"Failed to add host varaibles. PUT returned status: "+d})})):$("#form-modal").modal("hide")}).error(function(b,d,c,e){a(m,b,d,f,{hdr:"Error!",msg:"Failed to add new host. POST returned status: "+d})})}catch(l){p("Error","Error parsing host variables. Parser returned: "+l)}};m.formReset=function(){e.reset()}}}]).factory("HostsEdit",["$rootScope","$location","$log","$routeParams","Rest","Alert","HostForm","GenerateForm",
|
||||
"Prompt","ProcessErrors","GetBasePath","HostsReload","ParseTypeChange",function(h,m,k,g,c,p,f,e,l,a,d,b,z){return function(l){var g=l.host_id,h=l.inventory_id,k=d("hosts")+g+"/",m=e.inject(f,{mode:"edit",modal:!0,related:!1});e.reset();var s={};m.formModalActionLabel="Save";m.formModalHeader="Edit Host";m.formModalCancelShow=!0;m.parseType="yaml";z(m);$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").unbind("hidden");$("#form-modal").on("hidden",function(){b(l)});
|
||||
m.hostLoadedRemove&&m.hostLoadedRemove();m.hostLoadedRemove=m.$on("hostLoaded",function(){m.variable_url?(c.setUrl(m.variable_url),c.get().success(function(a,b,d,c){$.isEmptyObject(a)?m.variables="---":m.variables=jsyaml.safeDump(a)}).error(function(b,d,c,e){m.variables=null;a(m,b,d,f,{hdr:"Error!",msg:"Failed to retrieve host variables. GET returned status: "+d})})):m.variables="---";s.variables=m.variables});c.setUrl(k);c.get().success(function(a,b,d,c){for(var e in f.fields)a[e]&&(m[e]=a[e],s[e]=
|
||||
m[e]);for(var l in f.related);m.variable_url=a.related.variable_data;m.$emit("hostLoaded")}).error(function(b,d,c,e){a(m,b,d,f,{hdr:"Error!",msg:"Failed to retrieve host: "+id+". GET returned status: "+d})});m.$$phase||m.$digest();m.formModalAction=function(){try{if("json"==m.parseType){JSON.parse(m.variables);var b=m.variables}else b=jsyaml.load(m.variables);var e={},l;for(l in f.fields)e[l]=m[l];e.inventory=h;c.setUrl(k);c.put(e).success(function(e,l,g,h){m.variables?(c.setUrl(d("hosts")+e.id+"/variable_data/"),
|
||||
c.put(b).success(function(a,b,d,c){$("#form-modal").modal("hide")}).error(function(b,d,c,e){a(m,b,d,f,{hdr:"Error!",msg:"Failed to update host varaibles. PUT returned status: "+d})})):$("#form-modal").modal("hide")}).error(function(b,d,c,e){a(m,b,d,f,{hdr:"Error!",msg:"Failed to update host: "+g+". PUT returned status: "+d})})}catch(z){p("Error","Error parsing host variables. Parser returned: "+z)}};m.formReset=function(){e.reset();for(var a in s)m[a]=s[a];m.parseType="yaml"}}}]).factory("HostsDelete",
|
||||
["$rootScope","$location","$log","$routeParams","Rest","Alert","Prompt","ProcessErrors","GetBasePath","HostsReload",function(h,m,k,g,c,p,f,e,l,a){return function(d){var b=d.scope,f=d.group_id,g=d.inventory_id,h=d.host_id,k=d.host_name,m=null!==f?l("groups")+f+"/hosts/":l("inventory")+g+"/hosts/";$("#prompt-header").text("Delete Host");$("#prompt-body").text("Are you sure you want to delete host "+k+"?");$("#prompt-action-btn").addClass("btn-danger");b.promptAction=function(){c.setUrl(m);c.post({id:h,
|
||||
disassociate:1}).success(function(b,c,e,f){$("#prompt-modal").modal("hide");a(d)}).error(function(c,f,l,g){$("#prompt-modal").modal("hide");a(d);e(b,c,f,null,{hdr:"Error!",msg:"Call to "+m+" failed. DELETE returned status: "+f})})};$("#prompt-modal").modal({backdrop:"static",keyboard:!0,show:!0})}}]).factory("HostsReload",["RelatedSearchInit","RelatedPaginateInit","InventoryForm","GetBasePath",function(h,m,k,g){return function(c){var p={hosts:{url:null!==c.group_id?g("groups")+c.group_id+"/hosts/":
|
||||
g("inventory")+c.inventory_id+"/hosts/",iterator:"host"}};h({scope:c.scope,form:k,relatedSets:p});m({scope:c.scope,relatedSets:p});c.scope.search("host");c.scope.$$phase||c.scope.$digest()}}]);angular.module("InventoryHelper","RestServices Utilities OrganizationListDefinition SearchHelper PaginateHelper ListGenerator AuthService InventoryHelper RelatedSearchHelper RelatedPaginateHelper InventoryFormDefinition".split(" ")).factory("LoadTreeData",["Alert","Rest","Authorization","$http",function(h,m,k,g){return function(c){var g=c.scope,f=c.inventory,e=f.related.root_groups,l=f.related.hosts,a=f.name,d=f.url,b=f.id,k=f.description,w=0,B=[];g.HostLoadedRemove&&g.HostLoadedRemove();g.HostLoadedRemove=
|
||||
g.$on("hostsLoaded",function(){m.setUrl(e+"?"+(g.inventoryFailureFilter?"has_active_failures__int=1&":"")+"order_by=name");m.get().success(function(a,b,d,c){for(b=0;b<a.results.length;b++)B[0].children.push({data:{title:a.results[b].name},attr:{id:w,group_id:a.results[b].id,type:"group",name:a.results[b].name,description:a.results[b].description,inventory:a.results[b].inventory,all:a.results[b].related.all_hosts,children:a.results[b].related.children,hosts:a.results[b].related.hosts,variable:a.results[b].related.variable_data,
|
||||
"data-failures":a.results[b].has_active_failures},state:"closed"}),w++;g.$emit("buildTree",B,w)}).error(function(a,b,d,c){h("Error","Failed to laod tree data. Url: "+e+" GET status: "+b)})});m.setUrl(l+"?order_by=name");m.get().success(function(c,e,h,m){B=[{data:{title:a},attr:{type:"inventory",id:"inventory-node",url:d,inventory_id:b,hosts:l,name:a,description:k,"data-failures":f.has_active_failures},state:"open",children:[]}];g.$emit("hostsLoaded")}).error(function(a,b,d,c){h("Error","Failed to laod tree data. Url: "+
|
||||
l+" GET status: "+b)})}}]).factory("TreeInit",["Alert","Rest","Authorization","$http","LoadTreeData",function(h,m,k,g,c){return function(g){var f=g.scope;f.buildTreeRemove&&f.buildTreeRemove();f.buildTreeRemove=f.$on("buildTree",function(c,l,a){var d=a;$("#tree-view").jstree({core:{initially_open:["inventory-node"]},plugins:["themes","json_data","ui","contextmenu"],themes:{theme:"ansible",dots:!1,icons:!0},ui:{initially_select:["inventory-node"]},json_data:{data:l,ajax:{url:function(a){f.selected_node=
|
||||
a;return $(a).attr("children")},headers:{Authorization:"Token "+k.getToken()},success:function(a){for(var c=[],e=f.inventoryFailureFilter?"has_active_failures__int=1&":"",l=0;l<a.results.length;l++)c.push({data:{title:a.results[l].name},attr:{id:d,group_id:a.results[l].id,type:"group",name:a.results[l].name,description:a.results[l].description,inventory:a.results[l].inventory,all:a.results[l].related.all_hosts,children:a.results[l].related.children+"?"+e+"order_by=name",hosts:a.results[l].related.hosts,
|
||||
variable:a.results[l].related.variable_data,"data-failures":a.results[l].has_active_failures},state:"closed"}),d++;return c}}},contextmenu:{items:f.treeController}});$("#tree-view").bind("loaded.jstree",function(){f.$emit("treeLoaded")});$("#tree-view").bind("select_node.jstree",function(a,d){f.$emit("NodeSelect",d.inst.get_json()[0])})});c(g)}}]).factory("LoadInventory",["$routeParams","Alert","Rest","Authorization","$http","ProcessErrors","RelatedSearchInit","RelatedPaginateInit","GetBasePath",
|
||||
"LoadBreadCrumbs","InventoryForm",function(h,m,k,g,c,p,f,e,l,a,d){return function(b){var c=b.scope;c.relatedSets=[];c.master={};k.setUrl(l("inventory")+h.id+"/");k.get().success(function(b,l,g,k){a({path:"/inventories/"+h.id,title:b.name});for(var m in d.fields)d.fields[m].realName?b[d.fields[m].realName]&&(c[m]=b[d.fields[m].realName],c.master[m]=c[m]):b[m]&&(c[m]=b[m],c.master[m]=c[m]),"lookup"==d.fields[m].type&&b.summary_fields[d.fields[m].sourceModel]&&(c[d.fields[m].sourceModel+"_"+d.fields[m].sourceField]=
|
||||
b.summary_fields[d.fields[m].sourceModel][d.fields[m].sourceField],c.master[d.fields[m].sourceModel+"_"+d.fields[m].sourceField]=c[d.fields[m].sourceModel+"_"+d.fields[m].sourceField]);c.TreeParams={scope:c,inventory:b};c.variable_url=b.related.variable_data;c.relatedSets.hosts={url:b.related.hosts,iterator:"host"};f({scope:c,form:d,relatedSets:c.relatedSets});e({scope:c,relatedSets:c.relatedSets});c.$emit("inventoryLoaded")}).error(function(a,b,e,f){p(c,a,b,d,{hdr:"Error!",msg:"Failed to retrieve inventory: "+
|
||||
h.id+". GET status: "+b})})}}]).factory("RefreshTree",["Alert","Rest","Authorization","$http","TreeInit","LoadInventory",function(h,m,k,g,c,p){return function(f){var e=f.scope,l=[],a;e.treeLoadedRemove&&e.treeLoadedRemove();e.treeLoadedRemove=e.$on("treeLoaded",function(){var d;0<l.length?(d=l.pop(),d=$('#tree-view li[id="'+d+'"]'),$.jstree._reference("#tree-view").open_node(d,function(){e.$emit("treeLoaded")},!0)):null!==a&&void 0!==a&&$('#tree-view li[id="'+a+'"] a').first().click()});e.inventoryLoadedRemove&&
|
||||
e.inventoryLoadedRemove();e.inventoryLoadedRemove=e.$on("inventoryLoaded",function(){function d(a){"inventory-node"!=a.attr("id")&&("LI"==a.prop("tagName")&&(a.hasClass("jstree-open")||a.find(".jstree-clicked"))&&l.push(a.attr("id")),d(a.parent()))}a=e.selectedNode.attr("id");d(e.selectedNode);$("#tree-view").jstree("destroy");c(e.TreeParams)});p({scope:e})}}]);angular.module("JobTemplateHelper","RestServices Utilities CredentialFormDefinition CredentialsListDefinition LookUpHelper JobTemplateFormDefinition".split(" ")).factory("PromptPasswords",["CredentialForm","$compile","Rest","$location","ProcessErrors","GetBasePath",function(h,m,k,g,c,p){return function(f){function e(b){!b&&"jobs"==B?a.refreshJob():g.path("/"+B)}function l(){var b=p("jobs")+a.job_id+"/";k.setUrl(b);k.destroy().success(function(a,b,d,c){e(!0)}).error(function(d,e,f,l){c(a,d,e,null,
|
||||
{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+e})})}var a=f.scope,d=f.passwords,b=f.start_url;f="";var z,w,B=g.path().replace(/^\//,"").split("/")[0];a.cancelJob=function(){$("#password-modal").modal("hide");l()};a.startJob=function(){$("#password-modal").modal("hide");var d={},f=!1;$(".password-field").each(function(a){d[$(this).attr("name")]=$(this).val();""!=$(this).val()&&null!==$(this).val()&&(f=!0)});f?(k.setUrl(b),k.post(d).success(function(a,b,d,c){e(!1)}).error(function(b,
|
||||
d,e,f){c(a,b,d,null,{hdr:"Error!",msg:"Failed to start job. POST returned status: "+d})})):a.cancelJob()};f+=f+='<form class="form-horizontal" name="password_form" novalidate>\n';for(var u=0;u<d.length;u++)z=h.fields[d[u]],w=d[u],a[w]="",f+='<div class="control-group">\n',f+='<label class="control-label" for="'+w+'">'+z.label+"</label>\n",f+='<div class="controls">\n',f+='<input type="password" ',f+='ng-model="'+w+'" ',f+='name="'+w+'" ',f+='class="password-field" ',f+="required ",f+="/>",f+="<br />\n",
|
||||
f+='<span class="error" ng-show="password_form.'+w+".$dirty && password_form."+w+'.$error.required">A value is required!</span>\n',f+='<span class="error api-error" ng-bind="'+w+'_api_error"></span>\n',f+="</div>\n",f+="</div>\n",w=z.associated,z=h.fields[z.associated],a[w]="",f+='<div class="control-group">\n',f+='<label class="control-label" for="'+w+'">'+z.label+"</label>\n",f+='<div class="controls">\n',f+='<input type="password" ',f+='ng-model="'+w+'" ',f+='name="'+w+'" ',f+="required ",f+=z.awPassMatch?
|
||||
'awpassmatch="'+z.associated+'" ':"",f+="/>",f+="<br />\n",f+='<span class="error" ng-show="password_form.'+w+".$dirty && password_form."+w+'.$error.required">A value is required!</span>\n',z.awPassMatch&&(f+='<span class="error" ng-show="password_form.'+w+'.$error.awpassmatch">Must match Password value</span>\n'),f+='<span class="error api-error" ng-bind="'+w+'_api_error"></span>\n',f+="</div>\n",f+="</div>\n";f+="</form>\n";d=angular.element(document.getElementById("password-body"));d.html(f);m(d.contents())(a);
|
||||
$("#password-modal").modal({})}}]).factory("SubmitJob",["PromptPasswords","$compile","Rest","$location","GetBasePath","CredentialList","LookUpInit","JobTemplateForm","ProcessErrors",function(h,m,k,g,c,p,f,e,l){return function(a){function d(a){b.credentialWatchRemove&&b.credentialWatchRemove();var d=(new Date).toISOString(),c=w?w:a.name;k.setUrl(a.related.jobs?a.related.jobs:a.related.job_template+"jobs/");k.post({name:c+" "+d,description:a.description,job_template:a.id,inventory:a.inventory,project:a.project,
|
||||
playbook:a.playbook,credential:a.credential,forks:a.forks,limit:a.limit,verbosity:a.verbosity,extra_vars:a.extra_vars}).success(function(a,d,c,e){b.job_id=a.id;0<a.passwords_needed_to_start.length?h({scope:b,passwords:a.passwords_needed_to_start,start_url:a.related.start}):(k.setUrl(a.related.start),k.post().success(function(a,d,c,e){"jobs"==g.path().replace(/^\//,"").split("/")[0]?b.refreshJob():g.path("/jobs")}).error(function(a,d,c,e){l(b,a,d,null,{hdr:"Error!",msg:"Failed to start job. POST returned status: "+
|
||||
d})}))}).error(function(a,d,c,e){l(b,a,d,null,{hdr:"Error!",msg:"Failed to create job. POST returned status: "+d})})}var b=a.scope,m=a.id,w=a.template?a.template:null;a=g.path().replace(/^\//,"").split("/")[0];m=c(a)+m+"/";k.setUrl(m);k.get().success(function(a,c,l,g){b.credential="";""==a.credential||null==a.credential?(b.credentialWatchRemove&&b.credentialWatchRemove(),b.credentialWatchRemove=b.$watch("credential",function(c,e){c!==e&&(""!=b.credential&&null!==b.credential&&void 0!==b.credential)&&
|
||||
(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(h,m,k,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,w=d.iterator.charAt(0).toUpperCase()+d.iterator.substring(1),B="inventories"==d.name?p("inventory"):p(d.name),u=f.hdr?f.hdr:"Select "+w;$('input[name="'+l.fields[b].sourceModel+
|
||||
"_"+l.fields[b].sourceField+'"]').attr("data-url",B+"?"+l.fields[b].sourceField+"__iexact=:value");$('input[name="'+l.fields[b].sourceModel+"_"+l.fields[b].sourceField+'"]').attr("data-source",b);e["lookUp"+w]=function(){var f=k.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(),k.hide());!1==a?h("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:B});c({scope:f,list:d,url:B,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(h,m,k,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"]).factory("PaginateInit",["Refresh",function(h){return function(m){var k=m.scope,g=m.list,g=m.iterator?m.iterator:g.iterator,c=m.url,p=m.mode?m.mode:null;k[g+"Page"]=0;k[g+"PageSize"]=m.pageSize?m.pageSize:"lookup"==p?5:20;k.nextSet=function(c,e){k[e+"NextUrl"]&&(k[e+"Page"]++,h({scope:k,set:c,iterator:e,url:k[e+"NextUrl"]}))};k.prevSet=function(c,e){k[e+"PrevUrl"]&&(k[e+"Page"]--,h({scope:k,set:c,iterator:e,url:k[e+"PrevUrl"]}))};k.changePageSize=
|
||||
function(f,e){k[e+"Page"]=0;var l=c.replace(/\?page_size\=\d+/,""),a=/\/$/.test(l)?"?":"&",l=l+(k[e+"SearchParams"]?a+k[e+"SearchParams"]+"&page_size="+k[e+"PageSize"]:+a+"page_size="+k[e+"PageSize"]);h({scope:k,set:f,iterator:e,url:l})}}}]);angular.module("ParseHelper",[]).factory("ParseTypeChange",[function(){return function(h){h.blockParseTypeWatch=!1;h.blockVariableDataWatch=!1;h.removeParseTypeWatch&&h.removeParseTypeWatch();h.removeParseTypeWatch=h.$watch("parseType",function(m,k){if(m!==k)if("json"==m)if(h.variables&&!/^---$/.test(h.variables))try{var g=jsyaml.load(h.variables);h.variables=JSON.stringify(g,null," ")}catch(c){}else h.variables="{}";else if(h.variables&&!/^\{\}$/.test(h.variables))try{g=JSON.parse(h.variables),h.variables=
|
||||
jsyaml.safeDump(g)}catch(p){}else h.variables="---"})}}]);angular.module("ProjectPathHelper",["RestServices","Utilities"]).factory("GetProjectPath",["Alert","Rest","GetBasePath","ProcessErrors",function(h,m,k,g){return function(c){var p=c.scope,f=c.master;m.setUrl(k("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&&h("Missing project path","All of the project paths have been assigned to existing projects, or there are no directories found in the base path. You will need to add a project path before creating a new project.",
|
||||
"alert-info")}).error(function(c,f,a,d){g(p,c,f,null,{hdr:"Error!",msg:"Failed to access API config. GET status: "+f})})}}]);angular.module("RefreshRelatedHelper",["RestServices","Utilities"]).factory("RefreshRelated",["Alert","Rest",function(h,m){return function(k){var g=k.scope,c=k.set,p=k.iterator;m.setUrl(k.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;h("Error!","Failed to retrieve related set: "+c+". GET returned status: "+
|
||||
e)})}}]);angular.module("RefreshHelper",["RestServices","Utilities"]).factory("Refresh",["Alert","Rest",function(h,m){return function(k){var g=k.scope,c=k.set,p=k.iterator;m.setUrl(k.url);m.get().success(function(f,e,l,a){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;g[c]=f.results;g.$emit("PostRefresh")}).error(function(f,e,l,a){g[p+"SearchSpin"]=!1;h("Error!","Failed to retrieve "+c+". GET returned status: "+
|
||||
e)})}}]);angular.module("RelatedPaginateHelper",["RefreshRelatedHelper"]).factory("RelatedPaginateInit",["RefreshRelated",function(h){return function(m){var k=m.scope,g=m.relatedSets,c;for(c in g)k[g[c].iterator+"Page"]=0,k[g[c].iterator+"PageSize"]=10;k.nextSet=function(c,f){k[f+"Page"]++;h({scope:k,set:c,iterator:f,url:k[f+"NextUrl"]})};k.prevSet=function(c,f){k[f+"Page"]--;h({scope:k,set:c,iterator:f,url:k[f+"PrevUrl"]})};k.changePageSize=function(c,f){var e;k[f+"Page"]=0;for(var l in g)if(l==c){e=g[l].url;
|
||||
break}e=e.replace(/\/\?.*$/,"/");e+=k[f+"SearchParams"]?k[f+"SearchParams"]+"&page_size="+k[f+"PageSize"]:"?page_size="+k[f+"PageSize"];h({scope:k,set:c,iterator:f,url:e})}}}]);angular.module("RelatedSearchHelper",["RestServices","Utilities","RefreshRelatedHelper"]).factory("RelatedSearchInit",["Alert","Rest","RefreshRelated",function(h,m,k){return function(g){var c=g.scope,h=g.relatedSets,f=g.form,e,l;for(l in f.related)if("tree"!=f.related[l].type){g=f.related[l].iterator;for(var a in f.related[l].fields)if(f.related[l].fields[a].key){c[g+"SearchField"]=a;c[g+"SearchFieldLabel"]=f.related[l].fields[a].label;break}c[g+"SortOrder"]=null;c[g+"SearchType"]="contains";c[g+
|
||||
"SearchTypeLabel"]="Contains";c[g+"SelectShow"]=!1;c[g+"HideSearchType"]=!1;e=c[g+"SearchField"];if(f.related[l].fields[e].searchType&&("boolean"==f.related[l].fields[e].searchType||"select"==f.related[l].fields[e].searchType))c[g+"SelectShow"]=!0,c[g+"SearchSelectOpts"]=list.fields[e].searchOptions;f.related[l].fields[e].searchType&&"int"==f.related[l].fields[e].searchType&&(c[g+"HideSearchType"]=!0);f.related[l].fields[e].searchType&&"gtzero"==f.related[l].fields[e].searchType&&(c[g+"InputHide"]=
|
||||
!0)}c.setSearchField=function(a,b,e){for(var l in f.related)if(f.related[l].iterator==a)var g=f.related[l].fields[b];c[a+"SearchFieldLabel"]=e;c[a+"SearchField"]=b;c[a+"SearchValue"]="";c[a+"SelectShow"]=!1;c[a+"HideSearchType"]=!1;c[a+"InputHide"]=!1;void 0!==g.searchType&&"gtzero"==g.searchType&&(c[a+"InputHide"]=!0);if(void 0!==g.searchType&&("boolean"==g.searchType||"select"==g.searchType))c[a+"SelectShow"]=!0,c[a+"SearchSelectOpts"]=g.searchOptions;void 0!==g.searchType&&"int"==g.searchType&&
|
||||
(c[a+"HideSearchType"]=!0);c.search(a)};c.setSearchType=function(a,b,e){c[a+"SearchTypeLabel"]=e;c[a+"SearchType"]=b;c.search(a)};c.search=function(a){c[a+"SearchSpin"]=!0;c[a+"Loading"]=!0;var b,e,l,g;for(g in h)if(h[g].iterator==a){b=g;e=h[g].url;for(var m in f.related[g].fields)f.related[g].fields[m].key&&(l=f.related[g].fields[m].desc?"-"+m:m);break}l=null==c[a+"SortOrder"]?l:c[a+"SortOrder"];g=f.related[b].fields[c[a+"SearchField"]];if(!1==c[a+"SelectShow"]&&""!=c[a+"SearchValue"]&&void 0!=c[a+
|
||||
"SearchValue"]||c[a+"SelectShow"]&&c[a+"SearchSelectValue"]||g.searchType&&"gtzero"==g.searchType){c[a+"SearchParams"]=g.sourceModel?"?"+g.sourceModel+"__"+g.sourceField+"__":g.searchField?"?"+g.searchField+"__":"?"+c[a+"SearchField"]+"__";c[a+"SearchParams"]=g.searchType&&("int"==g.searchType||"boolean"==g.searchType)?c[a+"SearchParams"]+"int=":g.searchType&&"gtzero"==g.searchType?c[a+"SearchParams"]+"gt=0":c[a+"SearchParams"]+(c[a+"SearchType"]+"=");if(g.searchType&&("boolean"==g.searchType||"select"==
|
||||
g.searchType))c[a+"SearchParams"]+=c[a+"SearchSelectValue"].value;else if(void 0==g.searchType||"gtzero"==g.searchType)c[a+"SearchParams"]+=escape(c[a+"SearchValue"]);c[a+"SearchParams"]+=l?"&order_by="+escape(l):""}else c[a+"SearchParams"]="",c[a+"SearchParams"]+=l?"?order_by="+escape(l):"";c[a+"Page"]=0;e+=c[a+"SearchParams"];e+=c[a+"PageSize"]?"&page_size="+c[a+"PageSize"]:"";k({scope:c,set:b,iterator:a,url:e})};c.sort=function(a,b){var e;$("."+a+" .list-header").each(function(c){$(this).attr("id")!=
|
||||
a+"-"+b+"-header"&&$(this).find("i").attr("class","icon-sort")});var l=$("#"+a+"-"+b+"-header i"),g="";l.hasClass("icon-sort")?(l.removeClass("icon-sort"),l.addClass("icon-sort-up")):l.hasClass("icon-sort-up")?(l.removeClass("icon-sort-up"),l.addClass("icon-sort-down"),g="-"):l.hasClass("icon-sort-down")&&(l.removeClass("icon-sort-down"),l.addClass("icon-sort-up"));for(var h in f.related)f.related[h].iterator==a&&(e=f.related[h].fields[b].sourceModel?g+f.related[h].fields[b].sourceModel+"__"+f.related[h].fields[b].sourceModel:
|
||||
g+b);c[a+"SortOrder"]=e;c.search(a)}}}]);angular.module("SearchHelper",["RestServices","Utilities","RefreshHelper"]).factory("SearchInit",["Alert","Rest","Refresh",function(h,m,k){return function(g){var c=g.scope,h=g.set,f=g.url,e=g.list;g=g.iterator?g.iterator:e.iterator;var l;for(fld in e.fields)if(e.fields[fld].key){if(e.fields[fld].sourceModel){var a=e.fields[fld].sourceModel+"__"+e.fields[fld].sourceField;l=e.fields[fld].desc?"-"+a:a}else l=e.fields[fld].desc?"-"+fld:fld;if(void 0==e.fields[fld].searchable||!0==e.fields[fld].searchable)c[g+
|
||||
"SearchField"]=fld,c[g+"SearchFieldLabel"]=e.fields[fld].label;break}if(!c[g+"SearchField"])for(fld in e.fields)if(void 0==e.fields[fld].searchable||!0==e.fields[fld].searchable){c[g+"SearchField"]=fld;c[g+"SearchFieldLabel"]=e.fields[fld].label;break}c[g+"SearchType"]="icontains";c[g+"SearchTypeLabel"]="Contains";c[g+"SearchParams"]="";c[g+"SearchValue"]="";c[g+"SelectShow"]=!1;c[g+"HideSearchType"]=!1;a=c[g+"SearchField"];if(e.fields[a].searchType&&("boolean"==e.fields[a].searchType||"select"==
|
||||
e.fields[a].searchType))c[g+"SelectShow"]=!0,c[g+"SearchSelectOpts"]=e.fields[a].searchOptions;e.fields[a].searchType&&"int"==e.fields[a].searchType&&(c[g+"HideSearchType"]=!0);e.fields[a].searchType&&"gtzero"==e.fields[a].searchType&&(c[g+"InputHide"]=!0);c.setSearchField=function(a,b,f){c[a+"SearchFieldLabel"]=f;c[a+"SearchField"]=b;c[a+"SearchValue"]="";c[a+"SelectShow"]=!1;c[a+"HideSearchType"]=!1;c[a+"InputHide"]=!1;e.fields[b].searchType&&"gtzero"==e.fields[b].searchType&&(c[a+"InputHide"]=
|
||||
!0);if(e.fields[b].searchType&&("boolean"==e.fields[b].searchType||"select"==e.fields[b].searchType))c[a+"SelectShow"]=!0,c[a+"SearchSelectOpts"]=e.fields[b].searchOptions;e.fields[b].searchType&&"int"==e.fields[b].searchType&&(c[a+"HideSearchType"]=!0);c.search(a)};c.setSearchType=function(a,b,e){c[a+"SearchTypeLabel"]=e;c[a+"SearchType"]=b;c.search(a)};c.search=function(a){c[a+"SearchSpin"]=!0;c[a+"Loading"]=!0;c[a+"SearchParms"]="";var b=f;!1==c[a+"SelectShow"]&&""!=c[a+"SearchValue"]&&void 0!=
|
||||
c[a+"SearchValue"]||c[a+"SelectShow"]&&c[a+"SearchSelectValue"]||e.fields[c[a+"SearchField"]].searchType&&"gtzero"==e.fields[c[a+"SearchField"]].searchType?(c[a+"SearchParams"]=e.fields[c[a+"SearchField"]].searchField?e.fields[c[a+"SearchField"]].searchField+"__":e.fields[c[a+"SearchField"]].sourceModel?e.fields[c[a+"SearchField"]].sourceModel+"__"+e.fields[c[a+"SearchField"]].sourceField+"__":c[a+"SearchField"]+"__",c[a+"SearchParams"]=e.fields[c[a+"SearchField"]].searchType&&("int"==e.fields[c[a+
|
||||
"SearchField"]].searchType||"boolean"==e.fields[c[a+"SearchField"]].searchType)?c[a+"SearchParams"]+"int=":e.fields[c[a+"SearchField"]].searchType&&"gtzero"==e.fields[c[a+"SearchField"]].searchType?c[a+"SearchParams"]+"gt=0":c[a+"SearchParams"]+(c[a+"SearchType"]+"="),c[a+"SearchParams"]=e.fields[c[a+"SearchField"]].searchType&&("boolean"==e.fields[c[a+"SearchField"]].searchType||"select"==e.fields[c[a+"SearchField"]].searchType)?c[a+"SearchParams"]+c[a+"SearchSelectValue"].value:c[a+"SearchParams"]+
|
||||
escape(c[a+"SearchValue"]),c[a+"SearchParams"]+=l?"&order_by="+escape(l):""):c[a+"SearchParams"]=l?"order_by="+escape(l):"";c[a+"Page"]=0;b=/\/$/.test(b)?b+("?"+c[a+"SearchParams"]):b+("&"+c[a+"SearchParams"]);b=b.replace(/\&\&/,"&");b+=c[a+"PageSize"]?"&page_size="+c[a+"PageSize"]:"";k({scope:c,set:h,iterator:a,url:b})};c.sort=function(a){$(".list-header").each(function(b){$(this).attr("id")!=a+"-header"&&$(this).find("i").attr("class","icon-sort")});var b=$("#"+a+"-header i"),f="";b.hasClass("icon-sort")?
|
||||
(b.removeClass("icon-sort"),b.addClass("icon-sort-up")):b.hasClass("icon-sort-up")?(b.removeClass("icon-sort-up"),b.addClass("icon-sort-down"),f="-"):b.hasClass("icon-sort-down")&&(b.removeClass("icon-sort-down"),b.addClass("icon-sort-up"));l=e.fields[a].searchField?f+e.fields[a].searchField:e.fields[a].sourceModel?f+e.fields[a].sourceModel+"__"+e.fields[a].sourceField:f+a;c.search(e.iterator)}}}]);angular.module("TeamHelper","RestServices Utilities OrganizationListDefinition SearchHelper PaginateHelper ListGenerator".split(" ")).factory("SetTeamListeners",["Alert","Rest",function(h,m){return function(h){var g=h.scope,c=h.set,p=h.iterator;g.$on("TeamResultFound",function(f,e,l){if(l.length==e.length){key="organization";property="organization_name";for(f=0;f<e.length;f++)for(var a=0;a<l.length;a++)e[f][key]==l[a].id&&(e[f][property]=l[a].value);g[p+"SearchSpin"]=!1;g[c]=e}});g.$on("TeamRefreshFinished",
|
||||
function(c,e){for(var l=[],a=0;a<e.length;a++)m.setUrl("/api/v1/organizations/"+e[a].organization+"/"),m.get().success(function(a,b,c,f){console.log("here!");console.log(a);l.push({id:a.id,value:a.name});g.$emit("TeamResultFound",e,l)}).error(function(a,b,c,f){l.push({id:"error"});g.$emit("TeamResultFound",e,l)})})}}]).factory("TeamLookUpOrganizationInit",["Alert","Rest","OrganizationList","GenerateList","SearchInit","PaginateInit",function(h,m,k,g,c,p){return function(f){var e=f.scope;e.lookUpOrganization=
|
||||
function(){var f=g.inject(k,{mode:"lookup",hdr:"Select Organization"});f.selectAction=function(){for(var a=!1,c=0;c<f[k.name].length;c++)"success"==f[k.iterator+"_"+f[k.name][c].id+"_class"]&&(a=!0,e.organization=f[k.name][c].id,e.organization_name=f[k.name][c].name,e.team_form.$setDirty(),g.hide());!1==a&&h("No Selection","Click on a row to select an Organization before clicking the Select button.")};f.toggle_organization=function(a){if(f[k.name])for(var c=0;c<f[k.name].length;c++)f[k.iterator+"_"+
|
||||
f[k.name][c].id+"_class"]="";null!=a&&void 0!=a&&(f[k.iterator+"_"+a+"_class"]="success")};c({scope:f,set:k.name,list:k,url:"/api/v1/organizations/"});p({scope:f,list:k,url:"/api/v1/organizations/",mode:"lookup"});e.search(k.iterator);f.toggle_organization(e.organization)}}}]);angular.module("AdminListDefinition",[]).value("AdminList",{name:"admins",iterator:"admin",selectTitle:"Add Administrators",editTitle:"Admins",selectInstructions:"Click on a row to select it. Click the Finished button when done.",base:"users",index:!0,fields:{username:{key:!0,label:"Username"},first_name:{label:"First Name"},last_name:{label:"Last Name"}},actions:{},fieldActions:{}});angular.module("CredentialsListDefinition",[]).value("CredentialList",{name:"credentials",iterator:"credential",selectTitle:"Add Credentials",editTitle:"Credentials",selectInstructions:'Check the Select checkbox next to each credential to be added, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new user.',editInstructions:"Create a new credential from either the Teams tab or the Users tab. Teams and Users each have an associated set of Credentials.",index:!0,
|
||||
hover:!0,fields:{name:{key:!0,label:"Name"},description:{label:"Description"},team:{label:"Team",ngBind:"credential.summary_fields.team.name",sourceModel:"team",sourceField:"name"},user:{label:"User",ngBind:"credential.summary_fields.user.usename",sourceModel:"user",sourceField:"username"}},actions:{add:{icon:"icon-plus",label:"Add",mode:"all",ngClick:"addCredential()",basePaths:["teams","users"],"class":"btn-success btn-small",awToolTip:"Create a new credential"}},fieldActions:{edit:{ngClick:"editCredential({{ credential.id }})",
|
||||
icon:"icon-edit",label:"Edit","class":"btn-small btn-success",awToolTip:"View/Edit credential"},"delete":{ngClick:"deleteCredential({{ credential.id }},'{{ credential.name }}')",icon:"icon-remove",label:"Delete","class":"btn-small btn-danger",awToolTip:"Delete credential"}}});angular.module("GroupListDefinition",[]).value("GroupList",{name:"groups",iterator:"group",selectTitle:"Add Group",editTitle:"Groups",selectInstructions:'Click on a row to select it, and Finished when done. Click the green <i class="icon-plus"></i> Add to create a new row.',index:!0,well:!1,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}},actions:{add:{label:"Add",icon:"icon-plus",mode:"all",ngClick:"createGroup()","class":"btn-success btn-small",awToolTip:"Create a new group"}},
|
||||
fieldActions:{edit:{label:"Edit",ngClick:"editGroup({{ group.id }})",icon:"icon-edit","class":"btn-small btn-success",awToolTip:"View/Edit group"},"delete":{label:"Delete",ngClick:"deleteGroup({{ group.id }},'{{ group.name }}')",icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete group"}}});angular.module("HostListDefinition",[]).value("HostList",{name:"hosts",iterator:"host",selectTitle:"Add Host",selectInstructions:'Click on a row to select it, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new row.',editTitle:"Hosts",index:!0,well:!0,fields:{name:{key:!0,label:"Name",linkTo:"/inventories/{{ inventory_id }}/hosts/{{ host.id }}"},description:{label:"Description"}},actions:{add:{icon:"icon-plus",label:"Add",mode:"all",ngClick:"createHost()",
|
||||
ngHide:"showAddButton == false","class":"btn-success btn-small",awToolTip:"Create a new host"}},fieldActions:{edit:{label:"Edit",ngClick:"editHost({{ host.id }})",icon:"icon-edit","class":"btn-small btn-success",awToolTip:"View/Edit host"},"delete":{label:"Delete",ngClick:"deleteHost({{ host.id }},'{{ host.name }}')",icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete host"}}});angular.module("InventoriesListDefinition",[]).value("InventoryList",{name:"inventories",iterator:"inventory",selectTitle:"Add Inventories",editTitle:"Inventories",selectInstructions:'Click on a row to select it, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new row.',index:!0,hover:!0,fields:{name:{key:!0,label:"Name"},description:{label:"Descriptions"},organization:{label:"Organization",ngBind:"inventory.summary_fields.organization.name",sourceModel:"organization",
|
||||
sourceField:"name"},has_active_failures:{label:"Failed Jobs?",showValue:!1,text:"View failures",ngShow:"{{ inventory.has_active_failures }}",icon:"icon-exclamation-sign","class":"active-failures-{{ inventory.has_active_failures }}",ngClick:"viewJobs({{ inventory.id }})",searchField:"has_active_failures",searchType:"boolean",searchOptions:[{name:"No",value:0},{name:"Yes",value:1}],excludeModal:!0}},actions:{add:{label:"Add",icon:"icon-plus",mode:"all",ngClick:"addInventory()","class":"btn-small btn-success",
|
||||
awToolTip:"Create a new row"}},fieldActions:{edit:{label:"Edit",ngClick:"editInventory({{ inventory.id }})",icon:"icon-edit","class":"btn-small btn-success",awToolTip:"View/Edit inventory"},"delete":{label:"Delete",ngClick:"deleteInventory({{ inventory.id }},'{{ inventory.name }}')",icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete inventory"}}});angular.module("JobEventsListDefinition",[]).value("JobEventList",{name:"jobevents",iterator:"jobevent",editTitle:"Job Events",index:!1,hover:!0,hasChildren:!0,filterBy:"{ show: true }",fields:{created:{label:"Date",key:!0,nosort:!0,searchable:!1,link:!1},status:{label:"Status",icon:"icon-circle","class":"job-{{ jobevent.status }}",searchField:"failed",searchType:"boolean",searchOptions:[{name:"success",value:0},{name:"error",value:1}],nosort:!0,searchable:!1},event_display:{label:"Event",hasChildren:!0,
|
||||
ngClick:"toggleChildren({{ jobevent.id }}, '{{ jobevent.related.children }}')",nosort:!0,searchable:!1,ngClass:"{{ jobevent.class }}",appendHTML:"jobevent.event_detail"},host:{label:"Host",ngBind:"jobevent.summary_fields.host.name",searchField:"hosts__name",nosort:!0,id:"job-event-host-header"}},actions:{refresh:{ngClick:"refresh()",icon:"icon-refresh",label:"Refresh",awToolTip:"Refresh the page","class":"btn-small btn-success",mode:"all"},edit:{label:"Details",ngClick:"jobDetails()",icon:"icon-zoom-in",
|
||||
"class":"btn btn-small",awToolTip:"Edit job details",mode:"all"},summary:{label:"Hosts",icon:"icon-th-large",ngClick:"jobSummary()","class":"btn btn-small",awToolTip:"View host summary",mode:"all"}},fieldActions:{edit:{label:"View",ngClick:"viewJobEvent({{ jobevent.id }})",icon:"icon-zoom-in","class":"btn-small",awToolTip:"View event details"}}});angular.module("JobHostDefinition",[]).value("JobHostList",{name:"jobhosts",iterator:"jobhost",editTitle:"Job Host Summary",index:!0,hover:!0,fields:{host:{label:"Host",key:!0,sourceModel:"host",sourceField:"name",ngBind:"jobhost.host_name",ngClick:"showEvents('{{ jobhost.summary_fields.host.name }}','{{ jobhost.related.job }}')"},status:{label:"Status",icon:"icon-circle","class":"job-{{ jobhost.status }}",searchField:"failed",searchType:"boolean",searchOptions:[{name:"success",value:0},{name:"error",
|
||||
value:1}]},ok:{label:"Success",searchable:!1},changed:{label:"Changed",searchable:!1},failures:{label:"Failure",searchType:"gtzero"},dark:{label:"Unreachable",searchable:!1},skipped:{label:"Skipped",searchable:!1}},actions:{refresh:{label:"Refresh",icon:"icon-refresh",ngClick:"refresh()","class":"btn-success btn-small",awToolTip:"Refresh the page",mode:"all"},edit:{label:"Details",icon:"icon-edit",ngClick:"jobDetails()","class":"btn btn-small",awToolTip:"Edit job details",mode:"all"},events:{label:"Events",
|
||||
icon:"icon-list-ul",ngClick:"jobEvents()","class":"btn btn-small",awToolTip:"View job events",mode:"all"}},fieldActions:{}});angular.module("JobsListDefinition",[]).value("JobList",{name:"jobs",iterator:"job",editTitle:"Jobs",index:!1,hover:!0,"class":"jobs-table",fields:{id:{label:"Job ID",key:!0,desc:!0,searchType:"int"},inventory:{label:"Inventory ID",searchType:"int",searchOnly:!0},name:{label:"Name",link:!0},created:{label:"Date",link:!0,searchable:!1},status:{label:"Status",icon:"icon-circle","class":"job-{{ job.status }}",searchType:"select",searchOptions:[{name:"new",value:"new"},{name:"pending",value:"pending"},
|
||||
{name:"running",value:"running"},{name:"successful",value:"successful"},{name:"error",value:"error"},{name:"failed",value:"failed"},{name:"canceled",value:"canceled"}]}},actions:{refresh:{label:"Refresh","class":"btn-success btn-small",ngClick:"refreshJob({{ job.id }})",icon:"icon-refresh",awToolTip:"Refresh the page",mode:"all"}},fieldActions:{summary:{label:"Hosts",icon:"icon-th-large",ngClick:"viewSummary({{ job.id }}, '{{ job.name }}')","class":"btn btn-small",awToolTip:"View host summary",ngDisabled:"job.status == 'new'"},
|
||||
events:{label:"Events",icon:"icon-list-ul",mode:"all",ngClick:"viewEvents({{ job.id }}, '{{ job.name }}')","class":"btn btn-small",awToolTip:"View events",ngDisabled:"job.status == 'new'"},edit:{label:"Details",icon:"icon-zoom-in",ngClick:"editJob({{ job.id }}, '{{ job.name }}')","class":"btn btn-small",awToolTip:"View job details"},rerun:{icon:"icon-retweet",mode:"all",ngClick:"submitJob({{ job.id }}, '{{ job.summary_fields.job_template.name }}' )","class":"btn-success btn-small",awToolTip:"Re-run this job"},
|
||||
cancel:{icon:"icon-minus-sign",mode:"all",ngClick:"deleteJob({{ job.id }})","class":"btn-danger btn-small",awToolTip:"Cancel job",ngDisabled:"job.status != 'new' && job.status != 'pending' && job.status != 'running'"}}});angular.module("JobTemplatesListDefinition",[]).value("JobTemplateList",{name:"job_templates",iterator:"job_template",selectTitle:"Add Job Template",editTitle:"Job Templates",selectInstructions:'Click on a row to select it, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new row.',index:!0,hover:!0,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}},actions:{add:{label:"Add",icon:"icon-plus",mode:"all",ngClick:"addJobTemplate()","class":"btn-success btn-small",
|
||||
basePaths:["job_templates"],awToolTip:"Create a new template"}},fieldActions:{edit:{label:"Edit",ngClick:"editJobTemplate({{ job_template.id }})",icon:"icon-edit",awToolTip:"Edit template","class":"btn-small btn-success"},submit:{label:"Launch",icon:"icon-rocket",mode:"all","class":"btn-small btn-success",ngClick:"submitJob({{ job_template.id }})",awToolTip:"Start a job using this template"},"delete":{label:"Delete",ngClick:"deleteJobTemplate({{ job_template.id }},'{{ job_template.name }}')",icon:"icon-remove",
|
||||
"class":"btn-danger btn-small",awToolTip:"Delete template"}}});angular.module("OrganizationListDefinition",[]).value("OrganizationList",{name:"organizations",iterator:"organization",selectTitle:"Add Organizations",editTitle:"Organizations",hover:!0,index:!0,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}},actions:{add:{label:"Add",icon:"icon-plus",mode:"all",ngClick:"addOrganization()","class":"btn-success btn-small",awToolTip:"Create a new row"}},fieldActions:{edit:{label:"Edit",ngClick:"editOrganization({{ organization.id }})",icon:"icon-edit",
|
||||
"class":"btn-small btn-success",awToolTip:"View/Edit organization"},"delete":{label:"Delete",ngClick:"deleteOrganization({{ organization.id }},'{{ organization.name }}')",icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete organization"}}});angular.module("PermissionListDefinition",[]).value("PermissionList",{name:"permissions",iterator:"permission",selectTitle:"Add Permission",selectInstructions:'Click on a row to select it, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new row.',editTitle:"Permissions",index:!0,well:!0,fields:{name:{key:!0,label:"Name",ngClick:"editPermission({{ permission.id }})"},inventory:{label:"Inventory",sourceModel:"inventory",sourceField:"name",ngBind:"permission.summary_fields.inventory.name"},
|
||||
project:{label:"Project",sourceModel:"project",sourceField:"name",ngBind:"permission.summary_fields.project.name"},permission_type:{label:"Permission"}},actions:{add:{icon:"icon-plus",label:"Add",mode:"all",ngClick:"addPermission()","class":"btn-success btn-small",awToolTip:"Add a new permission"}},fieldActions:{edit:{label:"Edit",ngClick:"editPermission({{ permission.id }})",icon:"icon-edit","class":"btn-small btn-success",awToolTip:"View/Edit permission"},"delete":{label:"Delete",ngClick:"deletePermission({{ permission.id }},'{{ permission.name }}')",
|
||||
icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete permission"}}});angular.module("ProjectsListDefinition",[]).value("ProjectList",{name:"projects",iterator:"project",selectTitle:"Add Project",editTitle:"{{ name }}",selectInstructions:'Click on a row to select it, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new row.',index:!0,hover:!0,fields:{name:{key:!0,label:"Name"},description:{label:"Descriptions"}},actions:{add:{label:"Add",icon:"icon-plus",mode:"all",ngClick:"addProject()","class":"btn-success btn-small",awToolTip:"Create a new project"}},
|
||||
fieldActions:{edit:{label:"Edit",ngClick:"editProject({{ project.id }})",icon:"icon-edit","class":"btn-small btn-success",awToolTip:"View/edit project"},"delete":{label:"Delete",ngClick:"deleteProject({{ project.id }},'{{ project.name }}')",icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete project"}}});angular.module("TeamsListDefinition",[]).value("TeamList",{name:"teams",iterator:"team",selectTitle:"Add Team",editTitle:"Teams",selectInstructions:'Click on a row to select it, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new row.',index:!0,hover:!0,fields:{name:{key:!0,label:"Name"},description:{label:"Descriptions"},organization:{label:"Organization",ngBind:"team.organization_name",sourceModel:"organization",sourceField:"name"}},actions:{add:{label:"Add",
|
||||
icon:"icon-plus",mode:"all",ngClick:"addTeam()","class":"btn-success btn-small",awToolTip:"Create a new team"}},fieldActions:{edit:{label:"Edit",ngClick:"editTeam({{ team.id }})",icon:"icon-edit","class":"btn-small btn-success",awToolTip:"View/Edit team"},"delete":{label:"Delete",ngClick:"deleteTeam({{ team.id }},'{{ team.name }}')",icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete team"}}});angular.module("UserListDefinition",[]).value("UserList",{name:"users",iterator:"user",selectTitle:"Add Users",editTitle:"Users",selectInstructions:'Check the Select checkbox next to each user to be added, and click Finished when done. Use the green <i class="icon-plus"></i> button to create a new user.',index:!0,hover:!0,fields:{username:{key:!0,label:"Username"},first_name:{label:"First Name"},last_name:{label:"Last Name"}},actions:{add:{label:"Add",icon:"icon-plus",mode:"all",ngClick:"addUser()",
|
||||
basePaths:["organizations","users"],"class":"btn-success btn-small",awToolTip:"Create a new user"}},fieldActions:{edit:{label:"Edit",ngClick:"editUser({{ user.id }})",icon:"icon-edit","class":"btn-small btn-success",awToolTip:"View/Edit user"},"delete":{label:"Delete",ngClick:"deleteUser({{ user.id }},'{{ user.username }}')",icon:"icon-remove","class":"btn-small btn-danger",awToolTip:"Delete user"}}});angular.module("ApiLoader",["ngCookies"]).factory("LoadBasePaths",["$http","$rootScope","$cookieStore","ProcessErrors",function(h,m,k,g){return function(){h.get("/api/").success(function(c,p,f,e){var l=c.current_version;h.get(l).success(function(a,c,b,e){a.base=l;m.defaultUrls=a;k.remove("api");k.put("api",a)}).error(function(a,c,b,e){m.defaultUrls={status:"error"};g(null,a,c,null,{hdr:"Error",msg:"Failed to read "+l+". GET status: "+c})})}).error(function(c,h,f,e){m.defaultUrls={status:"error"};
|
||||
g(null,c,h,null,{hdr:"Error",msg:"Failed to read /api. GET status: "+h})})}}]).factory("GetBasePath",["$rootScope","$cookieStore","LoadBasePaths",function(h,m,k){return function(g){null==h.defaultUrls||void 0==h.defaultUrls?(g=m.get("api")[g],k()):g=h.defaultUrls[g];return g}}]);angular.module("AuthService",["ngCookies"]).factory("Authorization",["$http","$rootScope","$location","$cookieStore",function(h,m,k,g){return{setToken:function(c){var h=new Date;h.setTime(h.getTime()+1E3*$AnsibleConfig.session_timeout);g.remove("token");g.remove("token_expire");g.put("token",c);g.put("token_expire",h.getTime());m.userLoggedIn=!0},isTokenValid:function(){var c=!1;if(g.get("token")&&g.get("token_expire")){var h=g.get("token"),f=new Date(g.get("token_expire"));new Date<f&&(this.setToken(h),
|
||||
c=!0)}return c},didSessionExpire:function(){var c=!1;g.get("token_expire")&&new Date(g.get("token_expire"))<new Date&&(c=!0);return c},getToken:function(){return this.isTokenValid()?g.get("token"):null},retrieveToken:function(c,g){return h({method:"POST",url:"/api/v1/authtoken/",data:{username:c,password:g}})},logout:function(){m.current_user={};g.remove("token");g.remove("token_expire");g.remove("current_user");m.userLoggedIn=!1},getLicense:function(){return h({method:"GET",url:"/api/v1/config/",
|
||||
headers:{Authorization:"Token "+this.getToken()}})},setLicense:function(c){c.tested=!1;g.put("license",c)},licenseTested:function(){var c;c=void 0!==m.license_test?m.license_test:(c=g.get("license"))&&void 0!==c.tested?c.tested:!1;return c},getUser:function(){return h({method:"GET",url:"/api/v1/me/",headers:{Authorization:"Token "+this.getToken()}})},setUserInfo:function(c){m.current_user=c.results[0];g.put("current_user",c.results[0])},restoreUserInfo:function(){m.current_user=g.get("current_user")},
|
||||
getUserInfo:function(c){return m.current_user[c]?m.current_user[c]:null}}}]);var INTEGER_REGEXP=/^\-?\d*$/;
|
||||
angular.module("AWDirectives",["RestServices"]).directive("awpassmatch",function(){return{require:"ngModel",link:function(h,m,k,g){g.$parsers.unshift(function(c){var h=$('input[name="'+k.awpassmatch+'"]').val();if(c==h)return g.$setValidity("awpassmatch",!0),c;g.$setValidity("awpassmatch",!1)})}}}).directive("capitalize",function(){return{require:"ngModel",link:function(h,m,k,g){g.$parsers.unshift(function(c){var h=c.split(" "),f="";for(i=0;i<h.length;i++)f+=h[i].charAt(0).toUpperCase()+h[i].substr(1)+
|
||||
" ";f=f.trim();f!=c&&(g.$setViewValue(f),g.$render());return f})}}}).directive("integer",function(){return{require:"ngModel",link:function(h,m,k,g){g.$parsers.unshift(function(c){g.$setValidity("min",!0);g.$setValidity("max",!0);if(INTEGER_REGEXP.test(c)){g.$setValidity("integer",!0);if(m.attr("min")&&(""==c||null==c||parseInt(c)<parseInt(m.attr("min")))){g.$setValidity("min",!1);return}if(m.attr("max")&&parseInt(c)>parseInt(m.attr("max"))){g.$setValidity("max",!1);return}return c}g.$setValidity("integer",
|
||||
!1)})}}}).directive("awRequiredWhen",function(){return{require:"ngModel",link:function(h,m,k,g){function c(){var c=m.val();validity=!0;h[k.awRequiredWhen]&&(null==m.attr("required")||void 0==m.attr("required"))?$(m).attr("required","required"):h[k.awRequiredWhen]||m.removeAttr("required");if(h[k.awRequiredWhen]&&(void 0==c||null==c||""==c))validity=!1;g.$setValidity("required",validity)}h[k.awRequiredWhen]=k.awrequiredInit;c();h.$watch(k.awRequiredWhen,function(){c()});h.$watch($(m).attr("name"),
|
||||
function(){c()})}}}).directive("awlookup",["Rest",function(h){return{require:"ngModel",link:function(m,k,g,c){c.$parsers.unshift(function(g){if(""!==g){var f=k.attr("data-url"),f=f.replace(/\:value/,escape(g));m[k.attr("data-source")]=null;h.setUrl(f);h.get().then(function(e){e=e.data.results;if(0<e.length)return m[k.attr("data-source")]=e[0].id,m[k.attr("name")]=e[0].name,c.$setValidity("required",!0),c.$setValidity("awlookup",!0),g;c.$setValidity("required",!0);c.$setValidity("awlookup",!1)})}else c.$setValidity("awlookup",
|
||||
!0),m[k.attr("data-source")]=null})}}}]).directive("awToolTip",function(){return function(h,m,k){h=void 0!=k.delay&&null!=k.delay?k.delay:$AnsibleConfig.tooltip_delay;var g=void 0!=k.placement&&null!=k.placement?k.placement:"left";$(m).tooltip({placement:g,delay:h,title:k.awToolTip})}}).directive("awPopOver",function(){return function(h,m,k){h=void 0!=k.placement&&null!=k.placement?k.placement:"left";var g=void 0!=k.title&&null!=k.title?k.title:"Help",c=void 0!==k.container?k.container:!1;$(m).popover({placement:h,
|
||||
delay:0,title:g,content:k.awPopOver,delay:0,trigger:"click",html:!0,container:c});$(document).bind("keydown",function(c){27===c.keyCode&&$(m).popover("hide")})}}).directive("ngSlider",[function(){return{require:"ngModel",link:function(h,m,k,g){var c=m.attr("name");$("#"+c+"-slider").slider({value:0,step:1,min:m.attr("min"),max:m.attr("max"),slide:function(c,f){g.$setViewValue(f.value);g.$setValidity("required",!0);g.$setValidity("min",!0);g.$setValidity("max",!0);g.$dirty=!0;g.$render();h.$$phase||
|
||||
h.$digest()}});$("#"+c+"-number").change(function(){$("#"+c+"-slider").slider("value",parseInt($(this).val()))})}}}]);angular.module("AWFilters",[]).filter("capitalize",function(){return function(h){h=h.replace(/\_/g," ").split(" ");var m="";for(i=0;i<h.length;i++)m+=h[i].charAt(0).toUpperCase()+h[i].substr(1)+" ";return m=m.trim()}});angular.module("FormGenerator",["GeneratorHelpers","ngCookies"]).factory("GenerateForm",["$location","$cookieStore","$compile","SearchWidget","PaginateWidget","Attr","Icon","Column",function(h,m,k,g,c,p,f,e){return{setForm:function(c){this.form=c},attr:p,icon:f,has:function(c){return this.form[c]&&null!=this.form[c]&&void 0!=this.form[c]?!0:!1},inject:function(c,a){var d;d=a.modal?angular.element(document.getElementById("form-modal-body")):angular.element(document.getElementById("htmlTemplate"));
|
||||
this.mode=a.mode;this.modal=a.modal?!0:!1;this.setForm(c);d.html(this.build(a));this.scope=d.scope();k(d)(this.scope);!a.modal&&a.related&&this.addListeners();"add"==a.mode&&this.applyDefaults();a.modal&&(this.scope.formHeader="add"==a.mode?c.addTitle:c.editTitle,$("#form-modal").modal());return this.scope},applyDefaults:function(){for(fld in this.form.fields)if(this.form.fields[fld]["default"]||0==this.form.fields[fld]["default"])this.scope[fld]="select"==this.form.fields[fld].type&&this.scope[fld+
|
||||
"_options"]?this.scope[fld+"_options"][this.form.fields[fld]["default"]]:this.form.fields[fld]["default"]},reset:function(){this.scope[this.form.name+"_form"].$setPristine();for(var c in this.form.fields)this.scope[c]="",this.scope[c+"_api_error"]="",this.form.fields[c].sourceModel&&(this.scope[this.form.fields[c].sourceModel+"_"+this.form.fields[c].sourceField]="",this.scope[this.form.fields[c].sourceModel+"_"+this.form.fields[c].sourceField+"_api_error"]=""),"lookup"==this.form.fields[c].type&&
|
||||
this.scope[this.form.name+"_form"][this.form.fields[c].sourceModel+"_"+this.form.fields[c].sourceField]&&this.scope[this.form.name+"_form"][this.form.fields[c].sourceModel+"_"+this.form.fields[c].sourceField].$setPristine(),this.scope[this.form.name+"_form"][c]&&this.scope[this.form.name+"_form"][c].$setPristine(),this.form.fields[c].awPassMatch&&this.scope[this.form.name+"_form"][c].$setValidity("awpassmatch",!0),this.form.fields[c].ask&&(this.scope[c+"_ask"]=!1);"add"==this.mode&&this.applyDefaults()},
|
||||
addListeners:function(){$(".jqui-accordion").each(function(c){c=!1;var a=m.get("accordions"),d=!1;if(a)for(var b=$(this).attr("id"),e=h.path().replace(/^\//,"").split("/")[0],f=0;f<a.length&&!1==d;f++)a[f].base==e&&a[f].id==b&&(d=!0,c=a[f].active);!1==d&&"true"==$(this).attr("data-open")&&(c=0);$(this).accordion({collapsible:!0,heightStyle:"content",active:c,activate:function(a,b){$(".jqui-accordion").each(function(a){a=$(this).accordion("option","active");var b=$(this).attr("id"),c=h.path().replace(/^\//,
|
||||
"").split("/")[0],d=m.get("accordions");if(null==d||void 0==d)d=[];for(var e=!1,f=0;f<d.length&&!1==e;f++)d[f].base==c&&d[f].id==b&&(e=!0,d[f].active=a);!1==e&&d.push({base:c,id:b,active:a});m.put("accordions",d)})}})})},genID:function(){return(new Date).getTime()},headerField:function(c,a,d){d="";a.label&&(d+="<label>"+a.label+"</label>\n");d=d+('<input type="text" name="'+c+'" ')+('ng-model="'+c+'" ');d+=a["class"]?this.attr(a,"class"):"";return d+=" readonly />\n"},buildField:function(c,a,d){var b=
|
||||
"";if("text"==a.type||"password"==a.type||"email"==a.type)if(!a.readonly||a.readonly&&"edit"==d.mode){b=b+'<div class="control-group"'+(a.ngShow?this.attr(a,"ngShow"):"");b+=a.ngHide?this.attr(a,"ngHide"):"";b+=">\n";b+='<label class="control-label';b+=a.labelClass?" "+a.labelClass:"";b+='" for="'+c+'">';a.awPopOver&&(b+='<a href="" '+this.attr(a,"awPopOver"),b+=a.dataTitle?this.attr(a,"dataTitle"):"",b+=a.dataPlacement?this.attr(a,"dataPlacement"):"",b+=a.dataContainer?this.attr(a,"dataContainer"):
|
||||
"",b+='><i class="icon-info-sign"></i></a> ');b+=a.icon?this.icon(a.icon):"";b+=a.label+"</label>\n";b+='<div class="controls">\n';b+=a.clear||a.genMD5?'<div class="input-append">\n':"";if(null===a.control||void 0===a.control||a.control){b+="<input ";b+=this.attr(a,"type");b+='ng-model="'+c+'" ';b+='name="'+c+'" ';b+=a.ngChange?this.attr(a,"ngChange"):"";b+=a.id?this.attr(a,"id"):"";b+=a["class"]?this.attr(a,"class"):"";b+=a.placeholder?this.attr(a,"placeholder"):"";b+="edit"==d.mode&&a.editRequired?
|
||||
"required ":"";b+="add"==d.mode&&a.addRequired?"required ":"";b+=a.readonly||a.showonly?"readonly ":"";b+=a.awPassMatch?'awpassmatch="'+a.associated+'" ':"";b+=a.capitalize?"capitalize ":"";b+=a.ask?'ng-disabled="'+c+'_ask" ':"";b+=a.awRequiredWhen?'data-awrequired-init="'+a.awRequiredWhen.init+'" aw-required-when="'+a.awRequiredWhen.variable+'" ':"";b+=a.associated&&this.form.fields[a.associated].ask?'ng-disabled="'+a.associated+'_ask" ':"";b+="/>";a.clear&&(b+=' \n<button class="btn" ng-click="clear(\''+
|
||||
c+"','"+a.associated+'\')" aw-tool-tip="Clear '+a.label+'" id="'+c+'-clear-btn"><i class="icon-undo"></i></button>\n',b+="</div>\n");a.genMD5&&(b+=' \n<button class="btn" ng-click="genMD5(\''+c+'\')" aw-tool-tip="Generate '+a.label+'" data-placement="top" id="'+c+'-gen-btn"><i class="icon-repeat"></i></button>\n',b+="</div>\n");a.ask&&(b+=' \n<label class="checkbox inline ask-checkbox"><input type="checkbox" ng-model="'+c+'_ask" ng-change="ask(\''+c+"','"+a.associated+"')\" /> Ask at runtime?</label>");
|
||||
b+="<br />\n";if("add"==d.mode&&a.addRequired||"edit"==d.mode&&a.editRequired||a.awRequiredWhen)b+='<span class="error" ng-show="'+this.form.name+"_form."+c+".$dirty && "+this.form.name+"_form."+c+'.$error.required">A value is required!</span>\n';"email"==a.type&&(b+='<span class="error" ng-show="'+this.form.name+"_form."+c+".$dirty && "+this.form.name+"_form."+c+'.$error.email">A valid email address is required!</span>\n');a.awPassMatch&&(b+='<span class="error" ng-show="'+this.form.name+"_form."+
|
||||
c+'.$error.awpassmatch">Must match Password value</span>\n');b+='<span class="error api-error" ng-bind="'+c+'_api_error"></span>\n'}b+="</div>\n";b+="</div>\n"}if("textarea"==a.type&&(!a.readonly||a.readonly&&"edit"==d.mode)){b+='<div class="control-group"';b+=a.ngShow?this.attr(a,"ngShow"):"";b+=">\n";b+='<label class="control-label" for="'+c+'">';a.awPopOver&&(b+='<a href="" '+this.attr(a,"awPopOver"),b+=a.dataTitle?this.attr(a,"dataTitle"):"",b+=a.dataPlacement?this.attr(a,"dataPlacement"):"",
|
||||
b+=a.dataContainer?this.attr(a,"dataContainer"):"",b+='><i class="icon-info-sign"></i></a> ');b+=a.label+"</label>\n";b+='<div class="controls">\n';if("variables"==c||"extra_vars"==c)b+='<div class="parse-selection">Parse as: <label class="radio inline"><input type="radio" ng-model="parseType" value="yaml"> YAML</label>\n<label class="radio inline"><input type="radio" ng-model="parseType" value="json"> JSON</label></div>\n';b+="<textarea ";b+=a.rows?this.attr(a,"rows"):"";b+='ng-model="'+c+'" ';b+=
|
||||
'name="'+c+'" ';b+=a["class"]?this.attr(a,"class"):"";b+=a.ngChange?this.attr(a,"ngChange"):"";b+=a.id?this.attr(a,"id"):"";b+=a.placeholder?this.attr(a,"placeholder"):"";b+="edit"==d.mode&&a.editRequired?"required ":"";b+="add"==d.mode&&a.addRequired?"required ":"";b+=a.readonly||a.showonly?"readonly ":"";b+="></textarea><br />\n";if("add"==d.mode&&a.addRequired||"edit"==d.mode&&a.editRequired)b+='<span class="error" ng-show="'+this.form.name+"_form."+c+".$dirty && "+this.form.name+"_form."+c+'.$error.required">A value is required!</span>\n';
|
||||
b+='<span class="error api-error" ng-bind="'+c+'_api_error"></span>\n';b+="</div>\n";b+="</div>\n"}if("select"==a.type&&(!a.readonly||a.readonly&&"edit"==d.mode)){b+='<div class="control-group"';b+=a.ngShow?this.attr(a,"ngShow"):"";b+=">\n";b+='<label class="control-label" for="'+c+'">';a.awPopOver&&(b+='<a href="" '+this.attr(a,"awPopOver"),b+=a.dataTitle?this.attr(a,"dataTitle"):"",b+=a.dataPlacement?this.attr(a,"dataPlacement"):"",b+='><i class="icon-info-sign"></i></a> ');b+=a.label+"</label>\n";
|
||||
b+='<div class="controls">\n';b+="<select ";b+='ng-model="'+c+'" ';b+='name="'+c+'" ';b+=this.attr(a,"ngOptions");b+=a.ngChange?this.attr(a,"ngChange"):"";b+=a.id?this.attr(a,"id"):"";b+="edit"==d.mode&&a.editRequired?"required ":"";b+="add"==d.mode&&a.addRequired?"required ":"";b+=a.readonly?"readonly ":"";b+=">\n";b+='<option value="">Choose '+a.label+"</option>\n";b+="</select><br />\n";if("add"==d.mode&&a.addRequired||"edit"==d.mode&&a.editRequired)b+='<span class="error" ng-show="'+this.form.name+
|
||||
"_form."+c+".$dirty && "+this.form.name+"_form."+c+'.$error.required">A value is required!</span>\n';b+='<span class="error api-error" ng-bind="'+c+'_api_error"></span>\n';b+="</div>\n";b+="</div>\n"}if("number"==a.type&&(!a.readonly||a.readonly&&"edit"==d.mode)){b+='<div class="control-group"';b+=a.ngShow?this.attr(a,"ngShow"):"";b+=">\n";b+='<label class="control-label" for="'+c+'">';a.awPopOver&&(b+='<a href="" '+this.attr(a,"awPopOver"),b+=a.dataTitle?this.attr(a,"dataTitle"):"",b+=a.dataPlacement?
|
||||
this.attr(a,"dataPlacement"):"",b+='><i class="icon-info-sign"></i></a> ');b+=a.label+"</label>\n";b+='<div class="controls">\n';b+=a.slider?'<div class="slider" id="'+c+'-slider"></div>\n':"";b+='<input type="text" value="'+a["default"]+'" ';b+=a["class"]?this.attr(a,"class"):"";b+=a.slider?'ng-slider="'+c+'" ':"";b+='ng-model="'+c+'" ';b+='name="'+c+'" ';b+=a.min||0==a.min?this.attr(a,"min"):"";b+=a.max?this.attr(a,"max"):"";b+=a.ngChange?this.attr(a,"ngChange"):"";b+=a.slider?'id="'+c+'-number"':
|
||||
a.id?this.attr(a,"id"):"";b+="edit"==d.mode&&a.editRequired?"required ":"";b+="add"==d.mode&&a.addRequired?"required ":"";b+=a.readonly?"readonly ":"";b+=a.integer?"integer ":"";b+="/>\n";b+="<br />\n";if("add"==d.mode&&a.addRequired||"edit"==d.mode&&a.editRequired)b+='<span class="error" ng-show="'+this.form.name+"_form."+c+".$dirty && "+this.form.name+"_form."+c+'.$error.required">A value is required!</span>\n';a.integer&&(b+='<span class="error" ng-show="'+this.form.name+"_form."+c+'.$error.integer">Must be an integer value</span>\n');
|
||||
if(a.min||a.max)b+='<span class="error" ng-show="'+this.form.name+"_form."+c+".$error.min || "+this.form.name+"_form."+c+'.$error.max">Must be in range '+a.min+" to "+a.max+"</span>\n";b+='<span class="error api-error" ng-bind="'+c+'_api_error"></span>\n';b+="</div>\n";b+="</div>\n"}if("checkbox"==a.type&&(!a.readonly||a.readonly&&"edit"==d.mode))b+='<div class="control-group" ',b+=a.ngShow?this.attr(a,"ngShow"):"",b+=">\n",b+='<div class="controls">\n',b+='<label class="checkbox">',b+="<input ",
|
||||
b+=this.attr(a,"type"),b+='ng-model="'+c+'" ',b+='name="'+c+'" ',b+=a.ngChange?this.attr(a,"ngChange"):"",b+=a.id?this.attr(a,"id"):"",b+=this.attr(a,"trueValue"),b+=this.attr(a,"falseValue"),b+=a.checked?"checked ":"",b+=a.readonly?"readonly ":"",b+=" /> "+a.label+"\n",b+="</label>\n",b+='<span class="error api-error" ng-bind="'+c+'_api_error"></span>\n',b+="</div>\n",b+="</div>\n";if("radio"==a.type&&(!a.readonly||a.readonly&&"edit"==d.mode)){b+='<div class="control-group" ';b+=a.ngShow?this.attr(a,
|
||||
"ngShow"):"";b+=">\n";b+='<label class="control-label" for="'+c+'">';a.awPopOver&&(b+='<a href="" '+this.attr(a,"awPopOver"),b+=a.dataTitle?this.attr(a,"dataTitle"):"",b+=a.dataPlacement?this.attr(a,"dataPlacement"):"",b+='><i class="icon-info-sign"></i></a> ');for(var b=b+(a.label+"</label>\n"),b=b+'<div class="controls">\n',e=0;e<a.options.length;e++)b+='<label class="radio inline" ',b+=a.options[e].ngShow?this.attr(a.options[e],"ngShow"):"",b+=">",b+='<input type="radio" ',b+='name="'+c+'" ',b+=
|
||||
'value="'+a.options[e].value+'" ',b+='ng-model="'+c+'" ',b+=a.ngChange?this.attr(a,"ngChange"):"",b+=a.readonly?"readonly ":"",b+="edit"==d.mode&&a.editRequired?"required ":"",b+="add"==d.mode&&a.addRequired?"required ":"",b+=" /> "+a.options[e].label+"\n",b+="</label>\n";if("add"==d.mode&&a.addRequired||"edit"==d.mode&&a.editRequired)b+='<p><span class="error" ng-show="'+this.form.name+"_form."+c+".$dirty && "+this.form.name+"_form."+c+'.$error.required">A value is required!</span></p>\n';b+='<p><span class="error api-error" ng-bind="'+
|
||||
c+'_api_error"></span></p>\n';b+="</div>\n";b+="</div>\n"}if("hidden"==a.type&&("edit"==d.mode&&a.includeOnEdit||"add"==d.mode&&a.includeOnAdd))b+='<input type="hidden" ng-model="'+c+'" name="'+c+'" />';if("lookup"==a.type&&(void 0==a.excludeMode||a.excludeMode!=d.mode)){b+='<div class="control-group"';b+=a.ngShow?this.attr(a,"ngShow"):"";b+=">\n";b+='<label class="control-label" for="'+c+'">';a.awPopOver&&(b+='<a href="" '+this.attr(a,"awPopOver"),b+=a.dataTitle?this.attr(a,"dataTitle"):"",b+=a.dataPlacement?
|
||||
this.attr(a,"dataPlacement"):"",b+='><i class="icon-info-sign"></i></a> ');b+=a.label+"</label>\n";b+='<div class="controls">\n';b+='<div class="input-prepend">\n';b+='<button class="lookup-btn btn" '+this.attr(a,"ngClick")+'><i class="icon-search"></i></button>\n';b+='<input class="input-medium" type="text" ';b+='ng-model="'+a.sourceModel+"_"+a.sourceField+'" ';b+='name="'+a.sourceModel+"_"+a.sourceField+'" ';b+=a.ngChange?this.attr(a,"ngChange"):"";b+=a.id?this.attr(a,"id"):"";b+=a.placeholder?
|
||||
this.attr(a,"placeholder"):"";b+="edit"==d.mode&&a.editRequired?"required ":"";b+=a.awRequiredWhen?'data-awrequired-init="'+a.awRequiredWhen.init+'" aw-required-when="'+a.awRequiredWhen.variable+'" ':"";b+=" awlookup />\n";b+="</div><br />\n";if("add"==d.mode&&a.addRequired||"edit"==d.mode&&a.editRequired||a.awRequiredWhen)b+='<span class="error" ng-show="'+this.form.name+"_form."+a.sourceModel+"_"+a.sourceField+".$dirty && "+this.form.name+"_form."+a.sourceModel+"_"+a.sourceField+'.$error.required">A value is required!</span>\n';
|
||||
b+='<span class="error" ng-show="'+this.form.name+"_form."+a.sourceModel+"_"+a.sourceField+".$dirty && "+this.form.name+"_form."+a.sourceModel+"_"+a.sourceField+'.$error.awlookup">Value not found</span>\n';b+='<span class="error api-error" ng-bind="'+a.sourceModel+"_"+a.sourceField+'_api_error"></span>\n';b+="</div>\n";b+="</div>\n"}if("custom"==a.type&&(!a.readonly||a.readonly&&"edit"==d.mode))b+='<div class="control-group"',b+=a.ngShow?this.attr(a,"ngShow"):"",b+=">\n",b+='<label class="control-label',
|
||||
b+=a.labelClass?" "+a.labelClass:"",b+='" for="'+c+'">',a.awPopOver&&(b+='<a href="" '+this.attr(a,"awPopOver"),b+=a.dataTitle?this.attr(a,"dataTitle"):"",b+=a.dataPlacement?this.attr(a,"dataPlacement"):"",b+='><i class="icon-info-sign"></i></a> '),b+=a.icon?this.icon(a.icon):"",b+=a.label+"</label>\n",b+='<div class="controls">\n',b+=a.control,b+="</div>\n",b+="</div>\n";return b},build:function(c){var a="";this.modal||(a+='<div class="nav-path">\n<ul class="breadcrumb">\n',a+='<li ng-repeat="crumb in breadcrumbs"><a href="{{ \'#\' + crumb.path }}">{{ crumb.title | capitalize }}</a> <span class="divider">/</span></li>\n',
|
||||
a+='<li class="active">',a="edit"==c.mode?a+this.form.editTitle:a+this.form.addTitle,a+="</li>\n</ul>\n</div>\n");if(!this.modal&&this.form.statusFields){a+='<div class="well">\n';if(this.form.statusActions){var a=a+'<div class="status-actions">\n',d;for(action in this.form.statusActions)d=this.form.statusActions[action],a+="<button "+this.attr(d,"ngClick")+'class="btn btn-small',a+=d["class"]?" "+d["class"]:"",a+='" ',a+=d.awToolTip?this.attr(d,"awToolTip"):"",a+=d.awToolTip?'data-placement="top" ':
|
||||
"",a+=" >"+this.icon(d.icon),a+=d.label?d.label:"",a+="</button> ";a+="</div>\n";a+='<div class="status-spin"><i class="icon-spinner icon-spin" ng-show="statusSearchSpin == true"></i></div>\n'}var a=a+'<div class="status-fields">\n',b;for(b in this.form.statusFields)d=this.form.statusFields[b],a+=this.buildField(b,d,c);a+="</div>\x3c!-- status fields --\x3e\n";a+="</div>\x3c!-- well --\x3e\n"}if(this.form.fieldsAsHeader){a+='<div class="well">\n';a+='<form class="form-inline" name="'+this.form.name+
|
||||
'_form" id="'+this.form.name+'" novalidate >\n';for(b in this.form.fields)d=this.form.fields[b],a+=this.headerField(b,d,c);a+="</form>\n";a+="</div>\n"}else{this.form.collapse&&this.form.collapseMode==c.mode&&(a+='<div id="'+this.form.name+'-collapse-0" ',a+=this.form.collapseOpen?'data-open="true" ':"",a+='class="jqui-accordion">\n',a+="<h3>"+this.form.collapseTitle+"<h3>\n",a+="<div>\n");this.has("well")&&(a+='<div class="well">\n');a+='<form class="form-horizontal';a+=this.form["class"]?" "+this.form["class"]:
|
||||
"";a+='" name="'+this.form.name+'_form" id="'+this.form.name+'" novalidate>\n';a+='<div ng-show="flashMessage != null && flashMessage != undefined" class="alert alert-info">{{ flashMessage }}</div>\n';if(this.form.twoColumns){a+='<div class="row-fluid">\n';a+='<div class="span6">\n';for(b in this.form.fields)d=this.form.fields[b],1==d.column&&(a+=this.buildField(b,d,c));a+="</div>\x3c!-- column 1 --\x3e\n";a+='<div class="span6">\n';for(b in this.form.fields)d=this.form.fields[b],2==d.column&&(a+=
|
||||
this.buildField(b,d,c));a+="</div>\x3c!-- column 2 --\x3e\n";a+="</div>\x3c!-- inner row --\x3e\n"}else for(b in this.form.fields)d=this.form.fields[b],a+=this.buildField(b,d,c);if(!this.modal){this.has("buttons")&&(a+=this.form.twoColumns?"<hr />":"",a+='<div class="control-group">\n',a+='<div class="controls buttons">\n');for(var e in this.form.buttons)d=this.form.buttons[e],a+="<button ",a+='class="btn btn-small',a+=d["class"]?" "+d["class"]:"",a+='" ',d.ngClick&&(a+=this.attr(d,"ngClick")),d.ngDisabled&&
|
||||
(a="reset"!==e?a+('ng-disabled="'+this.form.name+"_form.$pristine || "+this.form.name+"_form.$invalid"):a+('ng-disabled="'+this.form.name+"_form.$pristine"),a+=this.form.allowReadonly?" || "+this.form.name+"ReadOnly == true":"",a+='" '),a+=">",d.icon&&(a+=this.icon(d.icon)),a+=d.label+"</button>\n";this.has("buttons")&&(a+="</div>\n",a+="</div>\n");a+="</form>\n"}this.has("well")&&(a+="</div>\n");this.form.collapse&&this.form.collapseMode==c.mode&&(a+="</div>\n",a+="</div>\n")}if(!this.modal&&this.form.items)for(itm in this.form.items){a+=
|
||||
'<div class="well form-items">\n';a+=g({iterator:this.form.items[itm].iterator,template:this.form.items[itm],mini:!1,label:"Filter Events"});a+='<div class="item-count pull-right">Viewing {{ '+this.form.items[itm].iterator+"Page + 1 }} of {{ "+this.form.items[itm].iterator+"Count }}</div>\n";a+="<hr />\n";a+='<ul class="pager">\n';a+='<li ng-class="'+this.form.items[itm].iterator+'PrevUrlDisable"><a href="" ng-click="prevSet(\''+this.form.items[itm].set+"','"+this.form.items[itm].iterator+"')\">← Prev</a></li>\n";
|
||||
a+='<li ng-class="'+this.form.items[itm].iterator+'NextUrlDisable"><a href="" ng-click="nextSet(\''+this.form.items[itm].set+"','"+this.form.items[itm].iterator+"')\">→ Next</a></li>\n";a+="</ul>\n";a+='<form class="form-horizontal" name="'+this.form.name+'_items_form" id="'+this.form.name+'_items_form" novalidate>\n';for(b in this.form.items[itm].fields)d=this.form.items[itm].fields[b],a+=this.buildField(b,d,c);a+="</form>\n";a+='<ul class="pager">\n';a+='<li ng-class="'+this.form.items[itm].iterator+
|
||||
'PrevUrlDisable"><a href="" ng-click="prevSet(\''+this.form.items[itm].set+"','"+this.form.items[itm].iterator+"')\">← Prev</a></li>\n";a+='<li ng-class="'+this.form.items[itm].iterator+'NextUrlDisable"><a href="" ng-click="nextSet(\''+this.form.items[itm].set+"','"+this.form.items[itm].iterator+"')\">→ Next</a></li>\n";a+="</ul>\n";a+="</div>\x3c!-- well --\x3e\n"}"inventory"==this.form.name&&"edit"==c.mode?a+=this.buildTree(c):!this.modal&&(c.related&&this.form.related)&&(a+=this.buildCollections(c));
|
||||
return a},buildTree:function(f){var a=1,d=this.form;html='<div id="'+this.form.name+'-collapse-2" data-open="true" class="jqui-accordion">\n';html+="<h3>Inventory Content<h3>\n";html+="<div>\n";for(var b in d.related){if("tree"==d.related[b].type)html+='<div class="span5">',html+='<div class="inventory-buttons">',html+='<button ng-click="addGroup()" ng-hide="groupAddHide" id="inv-group-add" class="btn btn-mini btn-success"><i class="icon-plus"></i> Add Group</button>',html+='<button ng-click="editGroup()" ng-hide="groupEditHide" id="inv-group-edit" class="btn btn-mini btn-success"><i class="icon-edit"></i> Edit Group</button>',
|
||||
html+='<button ng-click="deleteGroup()" ng-hide="groupDeleteHide" id="inv-group-delete" class="btn btn-mini btn-danger"><i class="icon-remove"></i> Delete Group</button>',html+="</div>\n",html+='<div id="tree-view"></div>\n',html+='<div class=" inventory-filter" ng-show="has_active_failures == true"><label class="checkbox inline"><input ng-model="inventoryFailureFilter" ng-change="filterInventory()" type="checkbox" >Show only groups with failures</label></div>\n',html+="</div>\n";else{html+='<div id="group-view" class="span7">\n';
|
||||
html+='<div id="hosts-well" class="well">\n';html+='<h4 id="hosts-title">'+d.related[b].title+"</h4>\n";html+=g({iterator:d.related[b].iterator,template:d.related[b],mini:!0});html+='<div class="list-actions">\n';for(var h in d.related[b].actions)html+='<button class="btn btn-mini btn-success" ',html+=d.related[b].actions[h].id?this.attr(d.related[b].actions[h],"id"):"",html+=this.attr(d.related[b].actions[h],"ngClick"),html+=d.related[b].actions[h].awToolTip?this.attr(d.related[b].actions[h],"awToolTip"):
|
||||
"",html+=d.related[b].actions[h].awToolTip?'data-placement="top" ':"",html+=d.related[b].actions[h].ngHide?this.attr(d.related[b].actions[h],"ngHide"):"",html+='><i class="'+d.related[b].actions[h].icon+'"></i>',html+=d.related[b].actions[h].label?" "+d.related[b].actions[h].label:"",html+="</button>\n";html+="</div>\n";html+='<div class="list">\n';html+='<table class="'+d.related[b].iterator+' table table-condensed table-hover">\n';html+="<thead>\n";html+="<tr>\n";html+="<th>#</th>\n";for(var k in d.related[b].fields)html+=
|
||||
'<th class="list-header" id="'+d.related[b].iterator+"-"+k+'-header" ng-click="sort(\''+d.related[b].iterator+"', '"+k+"')\">"+d.related[b].fields[k].label,html+=' <i class="',html=d.related[b].fields[k].key?d.related[b].fields[k].desc?html+"icon-sort-down":html+"icon-sort-up":html+"icon-sort",html+='"></i></a></th>\n';html+="<th></th>\n";html+="</tr>\n";html+="</thead>";html+="<tbody>\n";html+='<tr ng-repeat="'+d.related[b].iterator+" in "+b+'" >\n';html+="<td>{{ $index + ("+d.related[b].iterator+
|
||||
"Page * "+d.related[b].iterator+"PageSize) + 1 }}.</td>\n";var m=1,p=d.related[b].base?d.related[b].base:b,p=p.replace(/^\//,"");for(k in d.related[b].fields)m++,html+=e({list:d.related[b],fld:k,options:f,base:p});html+='<td class="actions">';for(h in d.related[b].fieldActions)html+='<button class="btn btn-mini',html+=d.related[b].fieldActions[h]["class"]?" "+d.related[b].fieldActions[h]["class"]:"",html+='" ',html+=d.related[b].fieldActions[h].awToolTip?this.attr(d.related[b].fieldActions[h],"awToolTip"):
|
||||
"",html+=this.attr(d.related[b].fieldActions[h],"ngClick")+">"+this.icon(d.related[b].fieldActions[h].icon),html+=d.related[b].fieldActions[h].label?" "+d.related[b].fieldActions[h].label:"",html+="</button> ";html+="</td>";html+="</tr>\n";html+='<tr class="info" ng-show="'+d.related[b].iterator+"Loading == false && ("+b+" == null || "+b+'.length == 0)">\n';html+='<td colspan="'+m+'"><div class="alert alert-info">No records matched your search.</div></td>\n';html+="</tr>\n";html+='<tr class="info" ng-show="'+
|
||||
d.related[b].iterator+'Loading == true">\n';html+='<td colspan="'+m+'"><div class="alert alert-info">Loading...</div></td>\n';html+="</tr>\n";html+="</tbody>\n";html+="</table>\n";html+="</div>\n";html+="</div>\n";html+=c({set:b,iterator:d.related[b].iterator,mini:!0})}a++}html+="</div>\n";return html+="</div>\n"},buildCollections:function(f){var a=1,d=this.form;html='<div id="'+this.form.name+"-collapse-"+a+'" class="jqui-accordion">\n';for(var b in d.related)if("collection"==d.related[b].type){html+=
|
||||
"<h3>"+d.related[b].title+"<h3>\n";html+="<div>\n";d.related[b].instructions&&(html+='<div class="alert alert-info alert-block">\n',html+='<button type="button" class="close" data-dismiss="alert">×</button>\n',html+="<strong>Hint: </strong>"+d.related[b].instructions+"\n",html+="</div>\n");html+='<div class="well">\n';html+=g({iterator:d.related[b].iterator,template:d.related[b],mini:!1});html+='<div class="list-actions">\n';for(var h in d.related[b].actions){var k=d.related[b].actions[h];html+=
|
||||
'<button class="btn btn-small btn-success" ';html+=this.attr(k,"ngClick");html+=k.awToolTip?this.attr(k,"awToolTip"):"";html+=k.awToolTip?'data-placement="right" ':"";html+='><i class="'+k.icon+'"></i>';html+=k.label?" "+k.label:"";html+="</button>\n"}html+="</div>\n";html+='<div class="list">\n';html+='<table class="'+d.related[b].iterator+' table table-condensed table-hover">\n';html+="<thead>\n";html+="<tr>\n";html+=void 0==d.related[b].index||!1!==d.related[b].index?"<th>#</th>\n":"";for(var m in d.related[b].fields)html+=
|
||||
'<th class="list-header" id="'+d.related[b].iterator+"-"+m+'-header" ng-click="sort(\''+d.related[b].iterator+"', '"+m+"')\">"+d.related[b].fields[m].label,html+=' <i class="',html=d.related[b].fields[m].key?d.related[b].fields[m].desc?html+"icon-sort-down":html+"icon-sort-up":html+"icon-sort",html+='"></i></a></th>\n';html+="<th></th>\n";html+="</tr>\n";html+="</thead>";html+="<tbody>\n";html+='<tr ng-repeat="'+d.related[b].iterator+" in "+b+'" >\n';if(void 0==d.related[b].index||!1!==d.related[b].index)html+=
|
||||
"<td>{{ $index + ("+d.related[b].iterator+"Page * "+d.related[b].iterator+"PageSize) + 1 }}.</td>\n";var p=1,k=d.related[b].base?d.related[b].base:b,k=k.replace(/^\//,"");for(m in d.related[b].fields)p++,html+=e({list:d.related[b],fld:m,options:f,base:k});html+='<td class="actions">';for(h in d.related[b].fieldActions)k=d.related[b].fieldActions[h],html+='<button class="btn btn-small',html+=k["class"]?" "+k["class"]:"",html+='" '+this.attr(k,"ngClick"),html+=k.awToolTip?this.attr(k,"awToolTip"):"",
|
||||
html+=k.awToolTip?'data-placement="top" ':"",html+=">"+this.icon(k.icon),html+=k.label?" "+k.label:"",html+="</button> ";html+="</td>";html+="</tr>\n";html+='<tr class="info" ng-show="'+d.related[b].iterator+"Loading == false && ("+b+" == null || "+b+'.length == 0)">\n';html+='<td colspan="'+p+'"><div class="alert alert-info">No records matched your search.</div></td>\n';html+="</tr>\n";html+='<tr class="info" ng-show="'+d.related[b].iterator+'Loading == true">\n';html+='<td colspan="'+p+'"><div class="alert alert-info">Loading...</div></td>\n';
|
||||
html+="</tr>\n";html+="</tbody>\n";html+="</table>\n";html+="</div>\n";html+="</div>\n";html+=c({set:b,iterator:d.related[b].iterator,mini:!0});html+="</div>\n";a++}html+="</div>\n";return html+="</div>\n"}}}]);angular.module("GeneratorHelpers",["GeneratorHelpers"]).factory("Attr",function(){return function(h,m){var k;switch(m){case "ngClick":k='ng-click="'+h[m]+'" ';break;case "ngOptions":k='ng-options="'+h[m]+'" ';break;case "ngClass":k='ng-class="'+h[m]+'" ';break;case "ngChange":k='ng-change="'+h[m]+'" ';break;case "ngDisabled":k='ng-disabled="'+h[m]+'" ';break;case "ngShow":k='ng-show="'+h[m]+'" ';break;case "ngHide":k='ng-hide="'+h[m]+'" ';break;case "ngBind":k='ng-bind="'+h[m]+'" ';break;case "trueValue":k=
|
||||
'ng-true-value="'+h[m]+'" ';break;case "falseValue":k='ng-false-value="'+h[m]+'" ';break;case "awToolTip":k='aw-tool-tip="'+h[m]+'" ';break;case "awPopOver":k="aw-pop-over='"+h[m]+"' ";break;case "dataTitle":k='data-title="'+h[m]+'" ';break;case "dataPlacement":k='data-placement="'+h[m]+'" ';break;case "dataContainer":k='data-container="'+h[m]+'" ';break;default:k=m+'="'+h[m]+'" '}return k}}).factory("Icon",function(){return function(h){return'<i class="'+h+'"></i> '}}).factory("Column",["Attr","Icon",
|
||||
function(h,m){return function(k){var g=k.list,c=k.fld,p=k.options;k=k.base;var f=g.fields[c],e;e="<td "+('<td class="'+c+"-column");e+=f["class"]?" "+f["class"]:"";e+='" ';e+=f.ngClass?h(f,"ngClass"):"";e+=">\n";e+=f.ngShow?"<span "+h(f,"ngShow")+">":"";g.hasChildren&&f.hasChildren&&(e+='<span style="padding-left: {{ '+g.iterator+'.spaces }}px"><a href="" ng-click="{{ '+g.iterator+'.ngclick }}"> <i class="{{ '+g.iterator+'.ngicon }}" ng-show="\'{{ '+g.iterator+".related.children }}' !== ''\" ></i></a> ");
|
||||
if((f.key||f.link||f.linkTo||f.ngClick)&&"lookup"!=p.mode&&"select"!=p.mode)if(f.linkTo)e+='<a href="#'+f.linkTo+'">';else if(f.ngClick)e+='<a href=""'+h(f,"ngClick")+'">';else if(void 0==f.link||f.link)e+='<a href="#/'+k+"/{{"+g.iterator+'.id }}">';f.ngShowIcon?e+='<i ng-show="'+f.ngShowIcon+'" class="'+f.icon+'"></i> ':f.icon&&(e+=m(f.icon)+" ");if(void 0==f.showValue||!0==f.showValue)e=f.ngBind?e+("{{ "+f.ngBind+" }}"):e+("{{"+g.iterator+"."+c+"}}");f.text&&(e+=f.text);g.hasChildren&&f.hasChildren&&
|
||||
(e+="</span>");if((f.key||f.link||f.linkTo||f.ngClick)&&"lookup"!=p.mode&&"select"!=p.mode)e+="</a>";e+=f.ngShow?"</span>":"";e+=f.appendHTML?'<div ng-show="'+f.appendHTML+' !== null" ng-bind-html-unsafe="'+f.appendHTML+'" style="padding-left: {{ '+g.iterator+'.spaces + 12 }}px" ></div>\n':"";return e+"</td>\n"}}]).factory("SearchWidget",function(){return function(h){var m=h.iterator,k=h.template,g=h.mini;h=h.label?h.label:null;h='<div class="search-widget">\n'+(h?"<label>"+h+"</label>":"");h+='<div class="input-prepend input-append">\n';
|
||||
h+='<div class="btn-group">\n';h+='<button class="btn ';h+=g?"btn-mini ":"btn-small";h+='dropdown-toggle" data-toggle="dropdown">\n';h+='<span ng-bind="'+m+'SearchFieldLabel"></span>\n';h+='<span class="caret"></span>\n';h+="</button>\n";h+='<ul class="dropdown-menu" id="'+m+'SearchDropdown">\n';for(var c in k.fields)if(void 0==k.fields[c].searchable||!0==k.fields[c].searchable)h+='<li><a href="" ng-click="setSearchField(\''+m+"','",h+=c+"','"+k.fields[c].label+"')\">"+k.fields[c].label+"</a></li>\n";
|
||||
h+="</ul>\n";h+="</div>\n";h+='<select ng-show="'+m+'SelectShow" ng-model="'+m+'SearchSelectValue" ng-change="search(\''+m+"')\" ";h+='ng-options="c.name for c in '+m+'SearchSelectOpts" class="search-select';h+=g?" field-mini-height":"";h+='"></select>\n';h+='<input ng-hide="'+m+"SelectShow || "+m+'InputHide" class="input-medium';h+=g?" field-mini-height":"";h+='" ng-model="'+m+'SearchValue" ng-change="search(\''+m+'\')" placeholder="Search" type="text" >\n';h+='<div class="btn-group">\n';h+='<button ng-hide="'+
|
||||
m+"SelectShow || "+m+"HideSearchType || "+m+'InputHide" class="btn ';h+=g?"btn-mini ":"btn-small";h+='dropdown-toggle" data-toggle="dropdown">\n';h+='<span ng-bind="'+m+'SearchTypeLabel"></span>\n';h+='<span class="caret"></span>\n';h+="</button>\n";h+='<ul class="dropdown-menu">\n';h+='<li><a href="" ng-click="setSearchType(\''+m+"','iexact','Exact Match')\">Exact Match</a></li>\n";h+='<li><a href="" ng-click="setSearchType(\''+m+"','icontains','Contains')\">Contains</a></li>\n";h+="</ul>\n";h+=
|
||||
"</div>\n";h+="</div>\n";h+='<div class="spin"><i class="icon-spinner icon-spin" ng-show="'+m+'SearchSpin == true"></i></div>\n';return h+="</div>\n"}}).factory("PaginateWidget",function(){return function(h){var m=h.set,k=h.iterator,g=h.mini;h=h.mode?h.mode:null;var c="",c=("lookup"==h?c+'<div class="lookup-navigation':c+'<div class="footer-navigation')+(g?" related-footer":""),c=c+'">\n',c=c+'<form class="form-inline">\n',c=c+'<button class="previous btn',c=c+(g?' btn-mini" ':'" '),c=c+("ng-click=\"prevSet('"+
|
||||
m+"','"+k+'\')" ng-disabled="'+k+"PrevUrl == null || "+k+'PrevUrl == undefined"><i class="icon-chevron-left"></i> Prev</button>\n'),c=c+'<button class="next btn btn',c=c+(g?' btn-mini" ':'" '),c=c+(" ng-click=\"nextSet('"+m+"','"+k+'\')"ng-disabled="'+k+"NextUrl == null || "+k+'NextUrl == undefined">Next <i class="icon-chevron-right"></i></button>\n');"lookup"!=h&&(c+='<label class="page-size-label">Rows per page:</label>\n',c+='<select ng-model="'+k+'PageSize" ng-change="changePageSize(\''+m+"','"+
|
||||
k+'\')" class="input-mini',c+=g?" field-mini-height":"",c+=' page-size">\n',c+='<option value="10" selected>10</option>\n',c+='<option value="20" selected>20</option>\n',c+='<option value="40">40</option>\n',c+='<option value="60">60</option>\n',c+='<option value="80">80</option>\n',c+="</select>\n");c+='<div class="page-number-small" ng-show="'+k+'PageCount > 0" ';c+=">Page: {{ "+k+"Page + 1 }} of {{ "+k+"PageCount }}</div>\n";c+="</form>\n";return c+="</div>\n"}});angular.module("ListGenerator",["GeneratorHelpers"]).factory("GenerateList",["$location","$compile","$rootScope","SearchWidget","PaginateWidget","Attr","Icon","Column",function(h,m,k,g,c,p,f,e){return{setList:function(c){this.list=c},attr:p,icon:f,has:function(c){return this.form[c]&&null!=this.form[c]&&void 0!=this.form[c]?!0:!1},hide:function(){$("#lookup-modal").modal("hide")},inject:function(c,a){var d="lookup"==a.mode?angular.element(document.getElementById("lookup-modal-body")):a.id?angular.element(document.getElementById(a.id)):
|
||||
angular.element(document.getElementById("htmlTemplate"));this.setList(c);d.html(this.build(a));this.scope=d.scope();m(d)(this.scope);"lookup"==a.mode&&(this.scope.lookupHeader=a.hdr,$("#lookup-modal").modal());return this.scope},build:function(f){var a="",d=this.list;if("lookup"!=f.mode&&(void 0==f.breadCrumbs||!0==f.breadCrumbs))a+='<div class="nav-path">\n<ul class="breadcrumb">\n',a+='<li ng-repeat="crumb in breadcrumbs"><a href="{{ \'#\' + crumb.path }}">{{ crumb.title | capitalize }}</a> <span class="divider">/</span></li>\n',
|
||||
a+='<li class="active">',a="select"==f.mode?a+d.selectTitle:a+d.editTitle,a+="</li>\n</ul>\n</div>\n";"select"==f.mode&&d.selectInstructions?(a+='<div class="alert alert-info alert-block">\n',a+='<button type="button" class="close" data-dismiss="alert">×</button>\n',a+="<strong>Hint: </strong>"+d.selectInstructions+"\n",a+="</div>\n"):"edit"==f.mode&&d.editInstructions&&(a+='<div class="alert alert-info alert-block">\n',a+='<button type="button" class="close" data-dismiss="alert">×</button>\n',
|
||||
a+="<strong>Hint: </strong>"+d.editInstructions+"\n",a+="</div>\n");if("lookup"!=f.mode&&(void 0==d.well||"true"==d.well))a+='<div class="well">\n';a="lookup"==f.mode?a+g({iterator:d.iterator,template:d,mini:!0}):a+g({iterator:d.iterator,template:d,mini:!1});if("lookup"!=f.mode){var b=h.path().replace(/^\//,"").split("/")[0],a=a+'<div class="list-actions">\n';for(action in d.actions)if("all"==d.actions[action].mode||d.actions[action].mode==f.mode)if(void 0==d.actions[action].basePaths||d.actions[action].basePaths&&
|
||||
-1<d.actions[action].basePaths.indexOf(b))a+="<button "+this.attr(d.actions[action],"ngClick")+'class="btn',a+=d.actions[action]["class"]?" "+d.actions[action]["class"]:" btn-small",a+='" ',a+=d.actions[action].ngHide?this.attr(d.actions[action],"ngHide"):"",a+=d.actions[action].awToolTip?this.attr(d.actions[action],"awToolTip"):"",a+=d.actions[action].awToolTip?'data-placement="top" ':"",a+=" >"+this.icon(d.actions[action].icon),a+=d.actions[action].label?" "+d.actions[action].label:"",a+="</button> ";
|
||||
if("select"==f.mode&&(void 0==f.selectButton||!0==f.selectButton))a+=' <button class="btn btn-small btn-success" aw-tool-tip="Complete your selection" ng-click="finishSelection()"><i class="icon-ok"></i> Finished</button>\n';a+="</div>\n"}a+='<table class="table table-condensed';a+=d["class"]?" "+d["class"]:"";a+="lookup"==f.mode||d.hover?" table-hover":"";a+='">\n';a+="<thead>\n";a+="<tr>\n";d.index&&(a+="<th>#</th>\n");for(var k in d.fields)if((void 0==d.fields[k].searchOnly||!1==d.fields[k].searchOnly)&&
|
||||
!("lookup"==f.mode&&void 0!==d.fields[k].excludeModal&&!0==d.fields[k].excludeModal)){a+='<th class="list-header" id="';a+=d.fields[k].id?d.fields[k].id:k+"-header";a+='"';a+=void 0===d.fields[k].nosort||!0!==d.fields[k].nosort?"ng-click=\"sort('"+k+"')\"":"";a+=">"+d.fields[k].label;if(void 0===d.fields[k].nosort||!0!==d.fields[k].nosort)a+=' <i class="',a=d.fields[k].key?d.fields[k].desc?a+"icon-sort-down":a+"icon-sort-up":a+"icon-sort",a+='"></i></a>';a+="</th>\n"}"select"==f.mode?a+="<th>Select</th>":
|
||||
"edit"==f.mode&&(a+="<th></th>\n");a+="</tr>\n";a+="</thead>\n";a+="<tbody>\n";a+="<tr ";a+="lookup"==f.mode||"select"==f.mode?'ng-class="'+d.iterator+"_{{ "+d.iterator+'.id }}_class" ':"";a+='class="'+d.iterator+'_class" ng-repeat="'+d.iterator+" in "+d.name;a+=d.orderBy?" | orderBy:'"+d.orderBy+"'":"";a+=d.filterBy?" | filter: "+d.filterBy:"";a+='"';a+="lookup"==f.mode||"select"==f.mode?' ng-click="toggle_'+d.iterator+"({{ "+d.iterator+'.id }})"':"";a+=">\n";d.index&&(a+='<td class="index-column">{{ $index + ('+
|
||||
d.iterator+"Page * "+d.iterator+"PageSize) + 1 }}.</td>\n");var m=2,b=d.base?d.base:d.name,b=b.replace(/^\//,"");for(k in d.fields)if(m++,(void 0==d.fields[k].searchOnly||!1==d.fields[k].searchOnly)&&!("lookup"==f.mode&&void 0!==d.fields[k].excludeModal&&!0==d.fields[k].excludeModal))a+=e({list:d,fld:k,options:f,base:b});if("select"==f.mode)a+='<td><input type="checkbox" name="check_{{'+d.iterator+'.id}}" id="check_{{'+d.iterator+'.id}}" /></td>';else if("edit"==f.mode){a+='<td class="actions">';
|
||||
for(action in d.fieldActions)a+='<button class="btn',a+=d.fieldActions[action]["class"]?" "+d.fieldActions[action]["class"]:" btn-small",a+='" '+this.attr(d.fieldActions[action],"ngClick"),a+=d.fieldActions[action].ngShow?this.attr(d.fieldActions[action],"ngShow"):"",a+=d.fieldActions[action].awToolTip?this.attr(d.fieldActions[action],"awToolTip"):"",a+=d.fieldActions[action].ngDisabled?this.attr(d.fieldActions[action],"ngDisabled"):"",a+=">",a+=d.fieldActions[action].icon?this.icon(d.fieldActions[action].icon):
|
||||
"",a+=d.fieldActions[action].label?" "+d.fieldActions[action].label:"",a+="</button> ";a+="</td>"}a+="</tr>\n";a+='<tr class="info" ng-show="'+d.iterator+"Loading == false && ("+d.name+" == null || "+d.name+'.length == 0)">\n';a+='<td colspan="'+m+'"><div class="alert alert-info">No records matched your search.</div></td>\n';a+="</tr>\n";a+='<tr class="info" ng-show="'+d.iterator+'Loading == true">\n';a+='<td colspan="'+m+'"><div class="alert alert-info">Loading...</div></td>\n';a+="</tr>\n";a+="</tbody>\n";
|
||||
a+="</table>\n";if("lookup"!=f.mode&&(void 0==d.well||"true"==d.well))a+="</div>\n";return a="lookup"==f.mode||f.id&&"form-modal-body"==f.id?a+c({set:d.name,iterator:d.iterator,mini:!0,mode:"lookup"}):a+c({set:d.name,iterator:d.iterator,mini:!0})}}}]);angular.module("PromptDialog",["Utilities"]).factory("Prompt",["Alert",function(h){return function(h){var k=angular.element(document.getElementById("prompt-modal")),g=k.scope();g.promptHeader=h.hdr;g.promptBody=h.body;var c=null==h["class"]||void 0==h["class"]?"btn-danger":h["class"];$("#prompt-action-btn").addClass(c);g.promptAction=h.action;$(k).modal({backdrop:"static",keyboard:!0,show:!0})}}]);angular.module("RestServices",["ngCookies","AuthService"]).factory("Rest",["$http","$rootScope","$cookieStore","Authorization",function(h,m,k,g){return{setUrl:function(c){this.url=c},auth:{Authorization:"Token "+g.getToken()},pReplace:function(){var c,g;for(c in this.params)g=RegExp("\\:"+c,"gm"),g.test(this.url)&&(this.url=this.url.replace(g,this.params[c]),delete this.params[c])},get:function(c){c=c?c:{};this.params=c.params?c.params:null;this.pReplace();return h({method:"GET",url:this.url,headers:this.auth,
|
||||
params:this.params})},post:function(c){return h({method:"POST",url:this.url,headers:this.auth,data:c})},put:function(c){return h({method:"PUT",url:this.url,headers:this.auth,data:c})},destroy:function(c){return h({method:"DELETE",url:this.url,headers:this.auth,data:c})}}}]);angular.module("Utilities",[]).factory("ClearScope",function(){return function(h){h=document.getElementById(h);angular.element(h).scope().$destroy()}}).factory("ToggleClass",function(){return function(h,m){$(h)&&$(h).hasClass(m)?$(h).removeClass(m):$(h)&&$(h).addClass(m)}}).factory("Alert",["$rootScope","$location",function(h,m){return function(k,g,c,m,f,e){if(f){if(h.alertHeader2=k,h.alertBody2=g,h.alertClass2=c?c:"alert-error",$("#alert-modal2").modal({show:!0,keyboard:!0,backdrop:"static"}),h.disableButtons2=
|
||||
e?!0:!1,m)$("#alert-modal2").on("hidden",function(){m()})}else if(h.alertHeader=k,h.alertBody=g,h.alertClass=c?c:"alert-error",$("#alert-modal").modal({show:!0,keyboard:!0,backdrop:"static"}),h.disableButtons=e?!0:!1,m)$("#alert-modal").on("hidden",function(){m()})}}]).factory("ProcessErrors",["$log","Alert",function(h,m){return function(h,g,c,p,f){if(403==c)m("Access Denied","The API responded with a 403 Access Denied error. You do not have permission to perform the requested action. Please contact a system administrator.");
|
||||
else if(g.non_field_errors)m("Error!",g.non_field_errors);else if(g.detail)m(f.hdr,f.msg+" "+g.detail);else if(g.__all__)m("Error!",g.__all__);else if(p){c=!1;for(var e in p.fields)p.fields[e].realName&&g[p.fields[e].realName]&&(h[e+"_api_error"]=g[p.fields[e]][0],c=!0),p.fields[e].sourceModel?g[e]&&(h[p.fields[e].sourceModel+"_"+p.fields[e].sourceField+"_api_error"]=g[e][0],c=!0):g[e]&&(h[e+"_api_error"]=g[e][0],c=!0);!c&&f&&m(f.hdr,f.msg)}else m(f.hdr,f.msg)}}]).factory("LoadBreadCrumbs",["$rootScope",
|
||||
"$routeParams","$location",function(h,m,k,g){return function(c){if(null!==c&&void 0!==c){for(var g=!1,f=0;f<h.crumbCache.length;f++)if(h.crumbCache[f].path==c.path){g=!0;h.crumbCache[f]=c;break}!1==g&&h.crumbCache.push(c)}c=k.path().replace(/^\//,"").split("/");g="";h.breadcrumbs=[];if(1<c.length)for(var e,l,f=0;f<c.length-1;f++){if(0<f&&c[f].match(/\d+/)){e=c[f-1];l="inventories"==e?"inventory":e.substring(0,e.length-1);for(var a=0;a<h.crumbCache.length;a++)if(h.crumbCache[a].path=="/"+e+"/"+c[f]){l=
|
||||
h.crumbCache[a].title;break}h.breadcrumbs.push({title:l,path:g+"/"+c[f]})}else h.breadcrumbs.push({title:c[f],path:g+"/"+c[f]});g+="/"+c[f]}}}]).factory("ReturnToCaller",["$location",function(h){return function(m){var k=h.path().replace(/^\//,"").split("/"),g="";m=null==m||void 0==m?k.length-1:m+1;for(var c=0;c<m;c++)g+="/"+k[c];h.path(g)}}]).factory("FormatDate",[function(){return function(h){var m=h.getFullYear()+"-",m=m+(("0"+(h.getMonth()+1)).slice(-2)+"-"),m=m+(("0"+h.getDate()).slice(-2)+" "),
|
||||
m=m+(("0"+h.getHours()).slice(-2)+":"),m=m+(("0"+h.getMinutes()).slice(-2)+":"),m=m+(("0"+h.getSeconds()).slice(-2)+":");return m+=("000"+h.getMilliseconds()).slice(-3)}}]);
|
@ -130,13 +130,13 @@ angular.module('TeamFormDefinition', [])
|
||||
label: 'Inventory',
|
||||
sourceModel: 'inventory',
|
||||
sourceField: 'name',
|
||||
ngBind: 'permission.summary_fields.inventory.name',
|
||||
ngBind: 'permission.summary_fields.inventory.name'
|
||||
},
|
||||
project: {
|
||||
label: 'Project',
|
||||
sourceModel: 'project',
|
||||
sourceField: 'name',
|
||||
ngBind: 'permission.summary_fields.project.name',
|
||||
ngBind: 'permission.summary_fields.project.name'
|
||||
},
|
||||
permission_type: {
|
||||
label: 'Permission'
|
||||
|
@ -167,13 +167,13 @@ angular.module('UserFormDefinition', [])
|
||||
label: 'Inventory',
|
||||
sourceModel: 'inventory',
|
||||
sourceField: 'name',
|
||||
ngBind: 'permission.summary_fields.inventory.name',
|
||||
ngBind: 'permission.summary_fields.inventory.name'
|
||||
},
|
||||
project: {
|
||||
label: 'Project',
|
||||
sourceModel: 'project',
|
||||
sourceField: 'name',
|
||||
ngBind: 'permission.summary_fields.project.name',
|
||||
ngBind: 'permission.summary_fields.project.name'
|
||||
},
|
||||
permission_type: {
|
||||
label: 'Permission'
|
||||
|
@ -10,8 +10,8 @@
|
||||
*/
|
||||
|
||||
angular.module('ProjectPathHelper', ['RestServices', 'Utilities'])
|
||||
.factory('GetProjectPath', ['Alert', 'Rest', 'GetBasePath','ProcessErrors', 'Alert',
|
||||
function(Alert, Rest, GetBasePath, ProcessErrors, Alert) {
|
||||
.factory('GetProjectPath', ['Alert', 'Rest', 'GetBasePath','ProcessErrors',
|
||||
function(Alert, Rest, GetBasePath, ProcessErrors) {
|
||||
return function(params) {
|
||||
|
||||
var scope = params.scope;
|
||||
|
@ -34,7 +34,7 @@ angular.module('JobEventsListDefinition', [])
|
||||
searchType: 'boolean',
|
||||
searchOptions: [{ name: "success", value: 0 }, { name: "error", value: 1 }],
|
||||
nosort: true,
|
||||
searchable: false,
|
||||
searchable: false
|
||||
},
|
||||
event_display: {
|
||||
label: 'Event',
|
||||
|
@ -635,7 +635,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
}
|
||||
|
||||
html += "<form class=\"form-horizontal";
|
||||
html += (this.form['class']) ? ' ' + this.form.class : '';
|
||||
html += (this.form['class']) ? ' ' + this.form['class'] : '';
|
||||
html += "\" name=\"" + this.form.name + '_form" id="' + this.form.name + '" novalidate>' + "\n";
|
||||
html += "<div ng-show=\"flashMessage != null && flashMessage != undefined\" class=\"alert alert-info\">{{ flashMessage }}</div>\n";
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
* }
|
||||
*/
|
||||
|
||||
angular.module('PromptDialog', [])
|
||||
.factory('Prompt', function(Alert) {
|
||||
angular.module('PromptDialog', ['Utilities'])
|
||||
.factory('Prompt', ['Alert', function(Alert) {
|
||||
return function(params) {
|
||||
//
|
||||
|
||||
@ -35,7 +35,7 @@ angular.module('PromptDialog', [])
|
||||
show: true
|
||||
});
|
||||
}
|
||||
});
|
||||
}]);
|
||||
|
||||
|
||||
|
||||
|
@ -26,6 +26,9 @@
|
||||
<script src="{{ STATIC_URL }}lib/ansible/list-generator.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/prompt-dialog.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/generator-helpers.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/directives.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/filters.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/api-loader.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Authentication.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Organizations.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Users.js"></script>
|
||||
@ -83,9 +86,6 @@
|
||||
<script src="{{ STATIC_URL }}js/helpers/ProjectPath.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/helpers/md5.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/helpers/Access.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/directives.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/filters.js"></script>
|
||||
<script src="{{ STATIC_URL }}lib/ansible/api-loader.js"></script>
|
||||
{% endif %}
|
||||
<!-- <script src="{{ STATIC_URL }}lib/angular/http-auth-interceptor.js"></script> -->
|
||||
</head>
|
||||
|
Loading…
Reference in New Issue
Block a user