mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Fixed problem with lingering help pop-overs. Issue was user would open help pop-over on a modal dialog and then close the dialog without first closing the help pop-over. Next time a dialog was presented, the lingering help pop-over would re-appear. This is now fixed.
This commit is contained in:
parent
44f7ce42cc
commit
dc6536bf90
@ -126,7 +126,7 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.help-link {
|
||||
.help-link, .help-link:active, .help-link:visited {
|
||||
color: #49afcd;
|
||||
}
|
||||
|
||||
|
82
awx/ui/static/js/awx-min.js
vendored
82
awx/ui/static/js/awx-min.js
vendored
@ -4,7 +4,7 @@
|
||||
*
|
||||
* awx-min.js
|
||||
*
|
||||
* master-6495420, Fri Jul 12 17:08:30 2013 -0400
|
||||
* master-bf73e20, Sat Jul 13 05:56:49 2013 -0400
|
||||
*
|
||||
*/
|
||||
var urlPrefix="/static/";
|
||||
@ -198,22 +198,22 @@ a})}));e||m("Access Denied","You do not have access to this function. Please con
|
||||
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(k,m,h,g,c,p,f,e,l,a,d,b){return function(l){var g=l.event_id;l=d("base")+"job_events/"+g+"/";var k=e.inject(f,{mode:"edit",modal:!0,related:!1});e.reset();k.formModalAction=function(){$("#form-modal").modal("hide")};k.formModalActionLabel="OK";
|
||||
k.formModalHeader="View Event";k.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?k.status=a.failed?"error":"success":"event_data"==l?k.event_data=JSON.stringify(a.event_data,void 0,"\t"):"host"==l?a.summary_fields&&a.summary_fields.host&&(k.host=a.summary_fields.host.name):"event_display"==l?k.event_display=a.event_display.replace(/^\u00a0*/g,""):"created"==l?k.created=
|
||||
b(new Date(a.created)):a[l]&&(k[l]=a[l])}).error(function(b,d,c,e){a(k,b,d,f,{hdr:"Error!",msg:"Failed to retrieve host: "+g+". GET status: "+d})});k.$$phase||k.$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(k,m,h,g,c,p,f,e,l,a,d,b,y,v,A){return function(b){var l=b.inventory_id,k=void 0!==b.group_id?b.group_id:
|
||||
null;b=y("inventory")+l+"/groups/";var h=e.inject(f,{id:"form-modal-body",mode:"select",breadCrumbs:!1,selectButton:!1});h.formModalActionLabel="Select";h.formModalHeader="Add Groups";h.formModalCancelShow=!0;h.formModalActionClass="btn btn-success";$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").modal({backdrop:"static",keyboard:!1});h.selected=[];h.PostRefreshRemove&&h.PostRefreshRemove();h.PostRefreshRemove=h.$on("PostRefresh",function(){$("tr.success").each(function(a){a=
|
||||
$(this).attr("ng-class");h[a]=""});if(g.group_id)for(var a=0;a<h.groups.length;a++)h.groups[a].id==g.group_id&&h.groups.splice(a,1)});a({scope:h,set:"groups",list:f,url:b});d({scope:h,list:f,url:b,mode:"lookup"});h.search(f.iterator);h.$$phase||h.$digest();h.formModalAction=function(){var a=k?y("groups")+k+"/children/":y("inventory")+l+"/groups/";c.setUrl(a);h.queue=[];h.callFinishedRemove&&h.callFinishedRemove();h.callFinishedRemove=h.$on("callFinished",function(){if(h.queue.length==h.selected.length){$('input[type="checkbox"]').prop("checked",
|
||||
!1);h.selected=[];for(var a=0,b=0;b<h.queue.length;b++)"error"==h.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"),A({scope:h}))}});if(0<h.selected.length)for(var b=0;b<h.selected.length;b++){for(var a=null,d=0;d<h.groups.length;d++)h.groups[d].id==h.selected[b]&&(a=h.groups[d]);null!==a&&c.post(a).success(function(a,b,d,c){h.queue.push({result:"success",data:a,status:b});h.$emit("callFinished")}).error(function(a,
|
||||
b,d,c){h.queue.push({result:"error",data:a,status:b,headers:d});h.$emit("callFinished")})}else $("#form-modal").modal("hide")};h.toggle_group=function(a){"success"==h[f.iterator+"_"+a+"_class"]?(h[f.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<h.selected.indexOf(a)&&h.selected.splice(h.selected.indexOf(a),1)):(h[f.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==h.selected.indexOf(a)&&h.selected.push(a))};h.createGroup=function(){$("#form-modal").modal("hide");
|
||||
v({inventory_id:l,group_id:k})}}}]).factory("GroupsAdd",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","RefreshTree","ParseTypeChange",function(k,m,h,g,c,p,f,e,l,a,d,b,y){return function(l){var g=l.inventory_id;l=void 0!==l.group_id?l.group_id:null;var h=null!==l?d("groups")+l+"/children/":d("inventory")+g+"/groups/",k=e.inject(f,{mode:"add",modal:!0,related:!1});k.formModalActionLabel="Save";k.formModalHeader="Create Group";
|
||||
k.formModalCancelShow=!0;k.parseType="yaml";y(k);$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");e.reset();k.$$phase||k.$digest();k.formModalAction=function(){try{var d="json"==k.parseType?JSON.parse(k.variables):jsyaml.load(k.variables);if("object"!==typeof d)throw"failed to return an object!";var e={},l;for(l in f.fields)"variables"!=l&&(e[l]=k[l]);g&&(e.inventory=g);c.setUrl(h);c.post(e).success(function(e,l,n,g){k.variables?(c.setUrl(e.related.variable_data),c.put(d).success(function(a,
|
||||
d,c,e){$("#form-modal").modal("hide");b({scope:k})}).error(function(b,d,c,e){a(k,b,d,f,{hdr:"Error!",msg:"Failed to add group varaibles. PUT returned status: "+d})})):($("#form-modal").modal("hide"),b({scope:k}))}).error(function(b,d,c,e){a(k,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)}};k.formReset=function(){e.reset()}}}]).factory("GroupsEdit",["$rootScope","$location","$log","$routeParams",
|
||||
"Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","RefreshTree","ParseTypeChange",function(k,m,h,g,c,p,f,e,l,a,d,b,y){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 r={},n={};t.formModalActionLabel="Save";t.formModalHeader="Edit Group";t.formModalCancelShow=!0;t.parseType="yaml";y(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="---";r.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],r[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{var e="json"==t.parseType?JSON.parse(t.variables):jsyaml.load(t.variables);if("object"!==typeof e)throw"failed to return an object!";var l={},n;for(n in f.fields)l[n]=t[n];l.inventory=
|
||||
k;c.setUrl(m);c.put(l).success(function(l,n,g,h){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(g){p("Error","Error parsing group variables. Parser returned: "+
|
||||
g)}};t.formReset=function(){e.reset();for(var a in r)t[a]=r[a];t.parseType="yaml"}}}]).factory("GroupsDelete",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath",function(k,m,h,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+'"]'),g="LI"==l.parent().last().prop("tagName")?l.parent().last():l.parent().parent().last(),h;h="group"==g.attr("type")?d("base")+
|
||||
"groups/"+g.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 "+$(g).attr("name")+"?");$("#prompt-action-btn").addClass("btn-danger");e.promptAction=function(){c.setUrl(h);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,l){$("#prompt-modal").modal("hide");RefreshTree({scope:e});
|
||||
a(e,b,d,null,{hdr:"Error!",msg:"Call to "+h+" 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(k,m,h,g,c,p,f,e,l,a,d,b,y,v,A){return function(b){var l=
|
||||
b.inventory_id,g=b.group_id;f.iterator="subhost";f.name="subhosts";var h=y("inventory")+l+"/hosts/",n=e.inject(f,{id:"form-modal-body",mode:"select",breadCrumbs:!1,selectButton:!1});n.formModalActionLabel="Select";n.formModalHeader="Select Hosts";n.formModalCancelShow=!0;n.removeHostsReload&&n.removeHostsReload();n.removeHostsReload=n.$on("hostsReload",function(){A(b)});$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").modal({backdrop:"static",keyboard:!1});
|
||||
n.selected=[];n.PostRefreshRemove&&n.PostRefreshRemove();n.PostRefreshRemove=n.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");n[a]=""})});a({scope:n,set:"subhosts",list:f,url:h});d({scope:n,list:f,url:h,mode:"lookup"});n.search(f.iterator);n.$$phase||n.$digest();n.formModalAction=function(){var a=y("groups")+g+"/hosts/";c.setUrl(a);n.queue=[];n.callFinishedRemove&&n.callFinishedRemove();n.callFinishedRemove=n.$on("callFinished",function(){if(n.queue.length==
|
||||
null;b=y("inventory")+l+"/groups/";var h=e.inject(f,{id:"form-modal-body",mode:"select",breadCrumbs:!1,selectButton:!1});h.formModalActionLabel="Select";h.formModalHeader="Add Groups";h.formModalCancelShow=!0;h.formModalActionClass="btn btn-success";$(".popover").remove();$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").modal({backdrop:"static",keyboard:!1});h.selected=[];h.PostRefreshRemove&&h.PostRefreshRemove();h.PostRefreshRemove=h.$on("PostRefresh",
|
||||
function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");h[a]=""});if(g.group_id)for(var a=0;a<h.groups.length;a++)h.groups[a].id==g.group_id&&h.groups.splice(a,1)});a({scope:h,set:"groups",list:f,url:b});d({scope:h,list:f,url:b,mode:"lookup"});h.search(f.iterator);h.$$phase||h.$digest();h.formModalAction=function(){var a=k?y("groups")+k+"/children/":y("inventory")+l+"/groups/";c.setUrl(a);h.queue=[];h.callFinishedRemove&&h.callFinishedRemove();h.callFinishedRemove=h.$on("callFinished",
|
||||
function(){if(h.queue.length==h.selected.length){$('input[type="checkbox"]').prop("checked",!1);h.selected=[];for(var a=0,b=0;b<h.queue.length;b++)"error"==h.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"),A({scope:h}))}});if(0<h.selected.length)for(var b=0;b<h.selected.length;b++){for(var a=null,d=0;d<h.groups.length;d++)h.groups[d].id==h.selected[b]&&(a=h.groups[d]);null!==a&&c.post(a).success(function(a,b,
|
||||
d,c){h.queue.push({result:"success",data:a,status:b});h.$emit("callFinished")}).error(function(a,b,d,c){h.queue.push({result:"error",data:a,status:b,headers:d});h.$emit("callFinished")})}else $("#form-modal").modal("hide")};h.toggle_group=function(a){"success"==h[f.iterator+"_"+a+"_class"]?(h[f.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<h.selected.indexOf(a)&&h.selected.splice(h.selected.indexOf(a),1)):(h[f.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+
|
||||
a).checked=!0,-1==h.selected.indexOf(a)&&h.selected.push(a))};h.createGroup=function(){$("#form-modal").modal("hide");v({inventory_id:l,group_id:k})}}}]).factory("GroupsAdd",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","RefreshTree","ParseTypeChange",function(k,m,h,g,c,p,f,e,l,a,d,b,y){return function(l){var g=l.inventory_id;l=void 0!==l.group_id?l.group_id:null;var h=null!==l?d("groups")+l+"/children/":d("inventory")+
|
||||
g+"/groups/",k=e.inject(f,{mode:"add",modal:!0,related:!1});k.formModalActionLabel="Save";k.formModalHeader="Create Group";k.formModalCancelShow=!0;k.parseType="yaml";y(k);$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");e.reset();k.$$phase||k.$digest();k.formModalAction=function(){try{var d="json"==k.parseType?JSON.parse(k.variables):jsyaml.load(k.variables);if("object"!==typeof d)throw"failed to return an object!";var e={},l;for(l in f.fields)"variables"!=l&&(e[l]=k[l]);
|
||||
g&&(e.inventory=g);c.setUrl(h);c.post(e).success(function(e,l,n,g){k.variables?(c.setUrl(e.related.variable_data),c.put(d).success(function(a,d,c,e){$("#form-modal").modal("hide");b({scope:k})}).error(function(b,d,c,e){a(k,b,d,f,{hdr:"Error!",msg:"Failed to add group varaibles. PUT returned status: "+d})})):($("#form-modal").modal("hide"),b({scope:k}))}).error(function(b,d,c,e){a(k,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)}};k.formReset=function(){e.reset()}}}]).factory("GroupsEdit",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","RefreshTree","ParseTypeChange",function(k,m,h,g,c,p,f,e,l,a,d,b,y){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 r={},n={};t.formModalActionLabel="Save";t.formModalHeader="Edit Group";t.formModalCancelShow=!0;t.parseType="yaml";
|
||||
y(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=
|
||||
"---";r.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],r[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{var e="json"==t.parseType?JSON.parse(t.variables):jsyaml.load(t.variables);
|
||||
if("object"!==typeof e)throw"failed to return an object!";var l={},n;for(n in f.fields)l[n]=t[n];l.inventory=k;c.setUrl(m);c.put(l).success(function(l,n,g,h){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(g){p("Error","Error parsing group variables. Parser returned: "+g)}};t.formReset=function(){e.reset();for(var a in r)t[a]=r[a];t.parseType="yaml"}}}]).factory("GroupsDelete",["$rootScope","$location","$log","$routeParams","Rest","Alert","GroupForm","GenerateForm","Prompt","ProcessErrors","GetBasePath",function(k,m,h,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+'"]'),
|
||||
g="LI"==l.parent().last().prop("tagName")?l.parent().last():l.parent().parent().last(),h;h="group"==g.attr("type")?d("base")+"groups/"+g.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 "+$(g).attr("name")+"?");$("#prompt-action-btn").addClass("btn-danger");e.promptAction=function(){c.setUrl(h);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,l){$("#prompt-modal").modal("hide");RefreshTree({scope:e});a(e,b,d,null,{hdr:"Error!",msg:"Call to "+h+" 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(k,m,h,g,c,p,f,e,l,a,d,b,y,v,A){return function(b){var l=
|
||||
b.inventory_id,g=b.group_id;f.iterator="subhost";f.name="subhosts";var h=y("inventory")+l+"/hosts/",n=e.inject(f,{id:"form-modal-body",mode:"select",breadCrumbs:!1,selectButton:!1});n.formModalActionLabel="Select";n.formModalHeader="Select Hosts";n.formModalCancelShow=!0;n.removeHostsReload&&n.removeHostsReload();n.removeHostsReload=n.$on("hostsReload",function(){A(b)});$(".popover").remove();$("#form-modal .btn-none").removeClass("btn-none").addClass("btn-success");$("#form-modal").modal({backdrop:"static",
|
||||
keyboard:!1});n.selected=[];n.PostRefreshRemove&&n.PostRefreshRemove();n.PostRefreshRemove=n.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");n[a]=""})});a({scope:n,set:"subhosts",list:f,url:h});d({scope:n,list:f,url:h,mode:"lookup"});n.search(f.iterator);n.$$phase||n.$digest();n.formModalAction=function(){var a=y("groups")+g+"/hosts/";c.setUrl(a);n.queue=[];n.callFinishedRemove&&n.callFinishedRemove();n.callFinishedRemove=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&&p("Error","There was an error while adding one or more of the selected hosts.");$("#form-modal").modal("hide");n.$emit("hostsReload")}});if(0<n.selected.length)for(var b=0;b<n.selected.length;b++){for(var a=null,d=0;d<n.subhosts.length;d++)n.subhosts[d].id==n.selected[b]&&(a=n.subhosts[d]);null!==a&&c.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 $("#form-modal").modal("hide"),n.$emit("hostsReload")};n.toggle_subhost=function(a){"success"==n[f.iterator+"_"+a+"_class"]?(n[f.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<n.selected.indexOf(a)&&n.selected.splice(n.selected.indexOf(a),1)):(n[f.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+
|
||||
a).checked=!0,-1==n.selected.indexOf(a)&&n.selected.push(a))};n.createHost=function(){$("#form-modal").modal("hide");v({scope:b.scope,inventory_id:l,group_id:g})}}}]).factory("HostsAdd",["$rootScope","$location","$log","$routeParams","Rest","Alert","HostForm","GenerateForm","Prompt","ProcessErrors","GetBasePath","HostsReload","ParseTypeChange",function(k,m,h,g,c,p,f,e,l,a,d,b,y){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",
|
||||
@ -303,29 +303,29 @@ function(){c()})}}}).directive("awlookup",["Rest",function(k){return{require:"ng
|
||||
!0),m[h.attr("data-source")]=null})}}}]).directive("awToolTip",function(){return function(k,m,h){k=void 0!=h.delay&&null!=h.delay?h.delay:$AnsibleConfig.tooltip_delay;var g=void 0!=h.placement&&null!=h.placement?h.placement:"left";$(m).tooltip({placement:g,delay:k,title:h.awToolTip})}}).directive("awPopOver",function(){return function(k,m,h){k=void 0!=h.placement&&null!=h.placement?h.placement:"left";var g=void 0!=h.title&&null!=h.title?h.title:"Help",c=void 0!==h.container?h.container:!1;$(m).popover({placement:k,
|
||||
delay:0,title:g,content:h.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(k,m,h,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();k.$$phase||
|
||||
k.$digest()}});$("#"+c+"-number").change(function(){$("#"+c+"-slider").slider("value",parseInt($(this).val()))})}}}]);angular.module("AWFilters",[]).filter("capitalize",function(){return function(k){k=k.replace(/\_/g," ").split(" ");var m="";for(i=0;i<k.length;i++)m+=k[i].charAt(0).toUpperCase()+k[i].substr(1)+" ";return m=m.trim()}});angular.module("FormGenerator",["GeneratorHelpers","ngCookies"]).factory("GenerateForm",["$location","$cookieStore","$compile","SearchWidget","PaginateWidget","Attr","Icon","Column",function(k,m,h,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();h(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({backdrop:"static",keyboard:!1}));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=k.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=k.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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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+=void 0!==a.autocomplete?this.attr(a,"autocomplete"):"";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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";b+=a.label+"</label>\n";b+='<div class="controls">\n';if("variables"==c||"extra_vars"==c||"inventory_variables"==c)b+='<div class="parse-selection">Parse as: <label class="radio inline"><input type="radio" ng-model="',b+=this.form.parseTypeName?this.form.parseTypeName:
|
||||
"parseType",b+='" value="yaml"> YAML</label>\n',b+='<label class="radio inline"><input type="radio" ng-model="',b+=this.form.parseTypeName?this.form.parseTypeName:"parseType",b+='" 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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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+=a.awPopOver?this.attr(a,"awPopOver"):"",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)){for(var b=b+'<div class="control-group" ',b=b+(a.ngShow?this.attr(a,"ngShow"):""),b=b+">\n",b=b+('<label class="control-label" for="'+c+'">'),b=b+(a.awPopOver?this.attr(a,"awPopOver"):""),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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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="'+
|
||||
this.mode=a.mode;this.modal=a.modal?!0:!1;this.setForm(c);d.html(this.build(a));this.scope=d.scope();h(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,$(".popover").remove(),$("#form-modal").modal({backdrop:"static",keyboard:!1}));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=k.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=k.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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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+=void 0!==a.autocomplete?this.attr(a,"autocomplete"):"";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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";b+=a.label+"</label>\n";b+='<div class="controls">\n';if("variables"==c||"extra_vars"==c||"inventory_variables"==c)b+='<div class="parse-selection">Parse as: <label class="radio inline"><input type="radio" ng-model="',b+=this.form.parseTypeName?
|
||||
this.form.parseTypeName:"parseType",b+='" value="yaml"> YAML</label>\n',b+='<label class="radio inline"><input type="radio" ng-model="',b+=this.form.parseTypeName?this.form.parseTypeName:"parseType",b+='" 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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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+=a.awPopOver?this.attr(a,"awPopOver"):"",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)){for(var b=b+'<div class="control-group" ',b=b+(a.ngShow?this.attr(a,"ngShow"):""),b=b+">\n",b=b+('<label class="control-label" for="'+c+'">'),b=b+(a.awPopOver?this.attr(a,"awPopOver"):""),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+'">';b+=a.awPopOver?this.attr(a,"awPopOver"):"";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+'">',b+=a.awPopOver?this.attr(a,"awPopOver"):"",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';
|
||||
@ -363,7 +363,7 @@ k+='<div class="btn-group">\n';k+='<button ng-hide="'+m+"SelectShow || "+m+"Hide
|
||||
k+="</ul>\n";k+="</div>\n";k+="</div>\n";k+='<div class="spin"><i class="icon-spinner icon-spin" ng-show="'+m+'SearchSpin == true"></i></div>\n';return k+="</div>\n"}}).factory("PaginateWidget",function(){return function(k){var m=k.set,h=k.iterator,g=k.mini;k=k.mode?k.mode:null;var c="",c=("lookup"==k?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+"','"+h+'\')" ng-disabled="'+h+"PrevUrl == null || "+h+'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+"','"+h+'\')"ng-disabled="'+h+"NextUrl == null || "+h+'NextUrl == undefined">Next <i class="icon-chevron-right"></i></button>\n');"lookup"!=k&&(c+='<label class="page-size-label">Rows per page:</label>\n',c+='<select ng-model="'+h+'PageSize" ng-change="changePageSize(\''+
|
||||
m+"','"+h+'\')" 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="'+h+'PageCount > 0" ';c+=">Page: {{ "+h+"Page + 1 }} of {{ "+h+"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(k,m,h,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({backdrop:"static",keyboard:!1}));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',
|
||||
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,$(".popover").remove(),$("#lookup-modal").modal({backdrop:"static",keyboard:!1}));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||void 0!=f.id?a+g({iterator:d.iterator,template:d,mini:!0}):a+g({iterator:d.iterator,template:d,mini:!1});if("lookup"!=f.mode){var b=k.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&&void 0==d.actions[action].dataPlacement?'data-placement="top" ':"",a+=d.actions[action].awPopOver?'aw-pop-over="'+
|
||||
|
@ -36,7 +36,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
scope.formModalHeader = 'Add Groups';
|
||||
scope.formModalCancelShow = true;
|
||||
scope.formModalActionClass = 'btn btn-success';
|
||||
|
||||
|
||||
$('.popover').remove(); //remove any lingering pop-overs
|
||||
$('#form-modal .btn-none').removeClass('btn-none').addClass('btn-success');
|
||||
$('#form-modal').modal({ backdrop: 'static', keyboard: false });
|
||||
|
||||
|
@ -47,7 +47,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
||||
scope.removeHostsReload = scope.$on('hostsReload', function() {
|
||||
HostsReload(params);
|
||||
});
|
||||
|
||||
|
||||
$('.popover').remove(); //remove any lingering pop-overs
|
||||
$('#form-modal .btn-none').removeClass('btn-none').addClass('btn-success');
|
||||
$('#form-modal').modal({ backdrop: 'static', keyboard: false });
|
||||
|
||||
|
@ -57,6 +57,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
|
||||
if (options.modal) {
|
||||
this.scope.formHeader = (options.mode == 'add') ? form.addTitle : form.editTitle;
|
||||
$('.popover').remove(); //remove any lingering pop-overs
|
||||
$('#form-modal').modal({ backdrop: 'static', keyboard: false });
|
||||
}
|
||||
return this.scope;
|
||||
|
@ -60,6 +60,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
||||
if (options.mode == 'lookup') {
|
||||
// options should include {hdr: <dialog header>, action: <function...> }
|
||||
this.scope.lookupHeader = options.hdr;
|
||||
$('.popover').remove(); //remove any lingering pop-overs
|
||||
$('#lookup-modal').modal({ backdrop: 'static', keyboard: false });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user