1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Added help pop-overs and new help button to the Add Existing Host s and Add Groups dialogs on Inventories page.

This commit is contained in:
chouseknecht 2013-07-09 17:07:02 -04:00
parent 9372a68f89
commit f4bba01271
5 changed files with 43 additions and 16 deletions

View File

@ -4,7 +4,7 @@
*
* awx-min.js
*
* master-9bbee34, Tue Jul 9 15:25:41 2013 -0400
* master-e3d0344, Tue Jul 9 15:40:33 2013 -0400
*
*/
var urlPrefix="/static/";
@ -262,9 +262,9 @@ function(c,e){for(var l=[],a=0;a<e.length;a++)m.setUrl("/api/v1/organizations/"+
{mode:"lookup",hdr:"Select Organization"});l.selectAction=function(){for(var a=!1,c=0;c<l[k.name].length;c++)"success"==l[k.iterator+"_"+l[k.name][c].id+"_class"]&&(a=!0,e.organization=l[k.name][c].id,e.organization_name=l[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.")};l.toggle_organization=function(a){if(l[k.name])for(var c=0;c<l[k.name].length;c++)l[k.iterator+"_"+l[k.name][c].id+"_class"]=
"";null!=a&&void 0!=a&&(l[k.iterator+"_"+a+"_class"]="success")};c({scope:l,set:k.name,list:k,url:"/api/v1/organizations/"});p({scope:l,list:k,url:"/api/v1/organizations/",mode:"lookup"});e.search(k.iterator);l.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",index:!0,well:!1,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}},actions:{add:{label:"Create New Group",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:"Select Host",editTitle:"Hosts",index:!0,well:!0,fields:{name:{key:!0,label:"Host Name",linkTo:"/inventories/{{ inventory_id }}/hosts/{{ host.id }}"},description:{label:"Description"}},actions:{},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",
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",index:!0,well:!1,fields:{name:{key:!0,label:"Name"},description:{label:"Description"}},actions:{add:{label:"Create New Group",icon:"icon-plus",mode:"all",ngClick:"createGroup()","class":"btn-success btn-small",awToolTip:"Create a new group"},help:{awPopOver:"Select groups by clicking on each group you wish to add. Add the selected groups to your inventory or to the selected parent group by clicking the Select button. You can also create a new group by clicking the Create New Group button.",
dataPlacement:"left",dataContainer:"#form-modal",icon:"icon-question-sign",mode:"all","class":"btn-small btn-info",awToolTip:"Click for help",dataTitle:"Adding Groups"}},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:"Select Host",editTitle:"Hosts",index:!0,well:!0,fields:{name:{key:!0,label:"Host Name",linkTo:"/inventories/{{ inventory_id }}/hosts/{{ host.id }}"},description:{label:"Description"}},actions:{help:{awPopOver:"Select hosts by clicking on each host you wish to add. Add the selected hosts to the group by clicking the Select button.",dataPlacement:"left",dataContainer:"#form-modal",icon:"icon-question-sign",
mode:"all","class":"btn-small btn-info",awToolTip:"Click for help",dataTitle:"Selecting Hosts"}},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 inventory"}},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",
@ -329,7 +329,7 @@ this.buildField(b,d,c));a+="</div>\x3c!-- column 2 --\x3e\n";a+="</div>\x3c!-- i
'<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+"')\">&larr; 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+"')\">&rarr; 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+"')\">&larr; 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+"')\">&rarr; 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" aw-tool-tip="Add existing groups or create a new group" data-placement="bottom"><i class="icon-plus"></i> Add Group</button>',
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" aw-tool-tip="Add existing groups or create a new group" data-placement="bottom"><i class="icon-plus"></i> Add Groups</button>',
html+='<button ng-click="editGroup()" ng-hide="groupEditHide" id="inv-group-edit" class="btn btn-mini btn-success" aw-tool-tip="Edit the selected group" data-placement="bottom" <i class="icon-edit"></i> Edit Group</button>',html+='<button ng-click="deleteGroup()" ng-hide="groupDeleteHide" id="inv-group-delete" aw-tool-tip="Delete the selected group" data-placement="bottom" 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 ',html+=d.related[b].actions[h]["class"]?d.related[b].actions[h]["class"]:"btn-success",html+='" ',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],
@ -357,14 +357,15 @@ k+'\')" class="input-mini',c+=g?" field-mini-height":"",c+=' page-size">\n',c+='
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">&times;</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">&times;</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=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,
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?this.attr(d.actions[action],
"awPopOver"):"",a+=d.actions[action].dataPlacement?this.attr(d.actions[action],"dataPlacement"):"",a+=d.actions[action].dataContainer?this.attr(d.actions[action],"dataContainer"):"",a+=d.actions[action].dataTitle?this.attr(d.actions[action],"dataTitle"):"",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)h="The API responded with a 403 Access Denied error. You do not have permission to perform the requested action. ",h=g.detail?h+("Detail: "+
g.detail):h+"Please contact your system administrator.",m("Access Denied",h);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&&

View File

@ -25,7 +25,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
var list = HostList;
var defaultUrl = GetBasePath('inventory') + inventory_id + '/hosts/';
var view = GenerateList;
var scope = view.inject(HostList, {
id: 'form-modal-body',
mode: 'select',

View File

@ -35,6 +35,18 @@ angular.module('GroupListDefinition', [])
ngClick: 'createGroup()',
"class": 'btn-success btn-small',
awToolTip: 'Create a new group'
},
help: {
awPopOver: "Select groups by clicking on each group you wish to add. Add the selected groups to your inventory " +
"or to the selected parent group by clicking the Select button. You can also create a new group by clicking the " +
"Create New Group button.",
dataPlacement: 'left',
dataContainer: "#form-modal",
icon: "icon-question-sign",
mode: 'all',
'class': 'btn-small btn-info',
awToolTip: 'Click for help',
dataTitle: 'Adding Groups'
}
},

View File

@ -16,7 +16,7 @@ angular.module('HostListDefinition', [])
editTitle: 'Hosts',
index: true,
well: true,
fields: {
name: {
key: true,
@ -29,6 +29,16 @@ angular.module('HostListDefinition', [])
},
actions: {
help: {
awPopOver: "Select hosts by clicking on each host you wish to add. Add the selected hosts to the group by clicking the Select button.",
dataPlacement: 'left',
dataContainer: "#form-modal",
icon: "icon-question-sign",
mode: 'all',
'class': 'btn-small btn-info',
awToolTip: 'Click for help',
dataTitle: 'Selecting Hosts'
}
},
fieldActions: {

View File

@ -128,7 +128,11 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
html += "\" ";
html += (list.actions[action].ngHide) ? this.attr(list.actions[action],'ngHide') : "";
html += (list.actions[action].awToolTip) ? this.attr(list.actions[action],'awToolTip') : "";
html += (list.actions[action].awToolTip) ? "data-placement=\"top\" " : "";
html += (list.actions[action].awToolTip && list.actions[action].dataPlacement == undefined) ? "data-placement=\"top\" " : "";
html += (list.actions[action].awPopOver) ? this.attr(list.actions[action],'awPopOver') : "";
html += (list.actions[action].dataPlacement) ? this.attr(list.actions[action], 'dataPlacement') : "";
html += (list.actions[action].dataContainer) ? this.attr(list.actions[action], 'dataContainer') : "";
html += (list.actions[action].dataTitle) ? this.attr(list.actions[action], 'dataTitle') : "";
html += " >" + this.icon(list.actions[action].icon);
html += (list.actions[action].label) ? " " + list.actions[action].label : "";
html += "</button> ";