mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 11:25:08 -02:30
AC-331 Continued cleanup from Bootstrap upgrade and Inventory changes.
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, InventoryList,
|
function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, InventoryList,
|
||||||
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
||||||
ClearScope, ProcessErrors, GetBasePath)
|
ClearScope, ProcessErrors, GetBasePath, Wait)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -43,14 +43,16 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
|
|
||||||
var action = function() {
|
var action = function() {
|
||||||
var url = defaultUrl + id + '/';
|
var url = defaultUrl + id + '/';
|
||||||
|
$('#prompt-modal').modal('hide');
|
||||||
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.destroy()
|
Rest.destroy()
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
$('#prompt-modal').modal('hide');
|
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
|
Wait('stop');
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
$('#prompt-modal').modal('hide');
|
Wait('stop');
|
||||||
ProcessErrors(scope, data, status, null,
|
ProcessErrors(scope, data, status, null,
|
||||||
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
|
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
|
||||||
});
|
});
|
||||||
@@ -79,7 +81,7 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
|
|
||||||
InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList',
|
InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList',
|
||||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
|
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
|
||||||
'GetBasePath' ];
|
'GetBasePath', 'Wait' ];
|
||||||
|
|
||||||
|
|
||||||
function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm,
|
function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm,
|
||||||
@@ -219,6 +221,23 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
scope.inventoryLoadedRemove = scope.$on('inventoryLoaded', function() {
|
scope.inventoryLoadedRemove = scope.$on('inventoryLoaded', function() {
|
||||||
LoadSearchTree({ scope: scope, inventory_id: scope['inventory_id'] });
|
LoadSearchTree({ scope: scope, inventory_id: scope['inventory_id'] });
|
||||||
TreeInit(scope.TreeParams);
|
TreeInit(scope.TreeParams);
|
||||||
|
Rest.setUrl(scope.inventoryGroupsUrl);
|
||||||
|
Rest.get()
|
||||||
|
.success(function(data, status, headers, config) {
|
||||||
|
if (data.results.length == 0) {
|
||||||
|
// No groups exist yet, activate the groups tab
|
||||||
|
scope.showGroupHelp = true;
|
||||||
|
$('#inventory-tabs a[href="#inventory-groups"]').tab('show')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scope.showGroupHelp = false;
|
||||||
|
$('#inventory-tabs a[href="#inventory-hosts"]').tab('show')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.error(function(data, status, headers, config) {
|
||||||
|
ProcessErrors(scope, data, status, null,
|
||||||
|
{ hdr: 'Error!', msg: 'Failed to get inventory groups. GET returned status: ' + status });
|
||||||
|
});
|
||||||
if (!scope.$$phase) {
|
if (!scope.$$phase) {
|
||||||
scope.$digest();
|
scope.$digest();
|
||||||
}
|
}
|
||||||
@@ -236,13 +255,14 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
});
|
});
|
||||||
|
|
||||||
LoadInventory({ scope: scope, doPostSteps: true });
|
LoadInventory({ scope: scope, doPostSteps: true });
|
||||||
|
|
||||||
$('#inventory-tabs a[href="#inventory-hosts"]').on('show.bs.tab', function() {
|
$('#inventory-tabs a[href="#inventory-hosts"]').on('show.bs.tab', function() {
|
||||||
scope['hosts'] = null;
|
scope['hosts'] = null;
|
||||||
LoadSearchTree({ scope: scope, inventory_id: scope['inventory_id'] });
|
LoadSearchTree({ scope: scope, inventory_id: scope['inventory_id'] });
|
||||||
if (!scope.$$phase) {
|
if (!scope.$$phase) {
|
||||||
scope.$digest();
|
scope.$digest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
scope.filterInventory = function() {
|
scope.filterInventory = function() {
|
||||||
$rootScope.hostFailureFilter = scope.hostFailureFilter;
|
$rootScope.hostFailureFilter = scope.hostFailureFilter;
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ angular.module('InventoryFormDefinition', [])
|
|||||||
dropdown: {
|
dropdown: {
|
||||||
type: 'DropDown',
|
type: 'DropDown',
|
||||||
label: 'View',
|
label: 'View',
|
||||||
|
ngDisabled: 'host.last_job == null',
|
||||||
options: [
|
options: [
|
||||||
{ ngClick: 'viewJobs(\{\{ host.id \}\})', label: 'Jobs' },
|
{ ngClick: 'viewJobs(\{\{ host.id \}\})', label: 'Jobs' },
|
||||||
{ ngClick: "viewLastEvents(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
|
{ ngClick: "viewLastEvents(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
Rest.post(data)
|
Rest.post(data)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
|
scope.showGroupHelp = false; // get rid of the Hint
|
||||||
if (scope.variables) {
|
if (scope.variables) {
|
||||||
Rest.setUrl(data.related.variable_data);
|
Rest.setUrl(data.related.variable_data);
|
||||||
Rest.put(json_data)
|
Rest.put(json_data)
|
||||||
|
|||||||
@@ -349,7 +349,8 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
|
scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope.inventoryGroupsUrl = data.related.groups;
|
||||||
scope.TreeParams = { scope: scope, inventory: data };
|
scope.TreeParams = { scope: scope, inventory: data };
|
||||||
scope.variable_url = data.related.variable_data;
|
scope.variable_url = data.related.variable_data;
|
||||||
scope.relatedSets['hosts'] = { url: data.related.hosts, iterator: 'host' };
|
scope.relatedSets['hosts'] = { url: data.related.hosts, iterator: 'host' };
|
||||||
|
|||||||
@@ -481,8 +481,8 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
|||||||
html += "class=\"" + getFieldWidth() + "\">\n";
|
html += "class=\"" + getFieldWidth() + "\">\n";
|
||||||
// Use 'text' rather than 'number' so that our integer directive works correctly
|
// Use 'text' rather than 'number' so that our integer directive works correctly
|
||||||
html += (field.slider) ? "<div class=\"slider\" id=\"" + fld + "-slider\"></div>\n" : "";
|
html += (field.slider) ? "<div class=\"slider\" id=\"" + fld + "-slider\"></div>\n" : "";
|
||||||
html += "<input type=\"";
|
html += "<input ";
|
||||||
html += (field.spinner) ? "spinner" : "text";
|
html += (field.spinner) ? "" : "type=\"text\" ";
|
||||||
html += "\" value=\"" + field['default'] + "\" ";
|
html += "\" value=\"" + field['default'] + "\" ";
|
||||||
html += "class=\"form-control";
|
html += "class=\"form-control";
|
||||||
html += (field['class']) ? " " + field['class'] : "";
|
html += (field['class']) ? " " + field['class'] : "";
|
||||||
@@ -808,7 +808,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
|||||||
var button = this.form.buttons[btn];
|
var button = this.form.buttons[btn];
|
||||||
//button
|
//button
|
||||||
html += "<button type=\"button\" ";
|
html += "<button type=\"button\" ";
|
||||||
html += "class=\"btn btn-small";
|
html += "class=\"btn btn-sm";
|
||||||
html += (button['class']) ? " " + button['class'] : "";
|
html += (button['class']) ? " " + button['class'] : "";
|
||||||
html += "\" ";
|
html += "\" ";
|
||||||
if (button.ngClick) {
|
if (button.ngClick) {
|
||||||
@@ -919,6 +919,12 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
|||||||
html += "<div class=\"tab-content\">\n";
|
html += "<div class=\"tab-content\">\n";
|
||||||
html += "<div class=\"tab-pane active\" id=\"inventory-groups\">\n";
|
html += "<div class=\"tab-pane active\" id=\"inventory-groups\">\n";
|
||||||
|
|
||||||
|
html += "<div ng-show=\"showGroupHelp\" class=\"alert alert-dismissable alert-info\">\n";
|
||||||
|
html += "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>\n";
|
||||||
|
html += "<p><strong>Hint:</strong> Get started building your inventory by adding a group. After creating a group, " +
|
||||||
|
"use the Hosts tab to add hosts to the group."
|
||||||
|
html += "</div>\n";
|
||||||
|
|
||||||
// build the groups tab
|
// build the groups tab
|
||||||
html += "<div class=\"navbar groups-menu\">\n";
|
html += "<div class=\"navbar groups-menu\">\n";
|
||||||
html += "<a class=\"navbar-brand\" ng-bind-html-unsafe=\"selectedNodeName\" href=\"\"></a>\n";
|
html += "<a class=\"navbar-brand\" ng-bind-html-unsafe=\"selectedNodeName\" href=\"\"></a>\n";
|
||||||
@@ -935,15 +941,10 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
|||||||
"aw-tool-tip=\"Delete the selected group\" data-placement=\"bottom\"><i class=\"icon-trash\"></i> Delete Group</a></li>\n";
|
"aw-tool-tip=\"Delete the selected group\" data-placement=\"bottom\"><i class=\"icon-trash\"></i> Delete Group</a></li>\n";
|
||||||
html += "<li><a class=\"status\" ng-show=\"treeLoading\" href=\"\"><i class=\"icon-spinner icon-spin icon-large\"></i> Loading...</a></li>\n";
|
html += "<li><a class=\"status\" ng-show=\"treeLoading\" href=\"\"><i class=\"icon-spinner icon-spin icon-large\"></i> Loading...</a></li>\n";
|
||||||
html += "</ul>\n";
|
html += "</ul>\n";
|
||||||
/*html += "<form class=\"navbar-form\">\n";
|
|
||||||
html += "<label class=\"checkbox-inline\"><input type=\"checkbox\" ng-model=\"inventoryFailureFilter\" ng-change=\"filterInventory()\" > Only show groups with failed hosts" +
|
|
||||||
"</label>\n";
|
|
||||||
html += "</form>\n"; */
|
|
||||||
html += "</div><!-- navbar -->\n";
|
html += "</div><!-- navbar -->\n";
|
||||||
html += "<div id=\"tree-view\" class=\"tree-container\"></div>\n";
|
html += "<div id=\"tree-view\" class=\"tree-container\"></div>\n";
|
||||||
//html += "<span ng-show=\"has_active_failures == true\"><label class=\"checkbox inline\">";
|
|
||||||
//html += "<input ng-model=\"inventoryFailureFilter\" ng-change=\"filterInventory()\" type=\"checkbox\"" +
|
|
||||||
// ">Show only groups with failures</label></span></div>\n";
|
|
||||||
html += "</div><!-- inventory-groups -->\n";
|
html += "</div><!-- inventory-groups -->\n";
|
||||||
|
|
||||||
// build the hosts tab
|
// build the hosts tab
|
||||||
@@ -976,7 +977,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
|||||||
|
|
||||||
// Add actions(s)
|
// Add actions(s)
|
||||||
for (var action in form.related[itm].actions) {
|
for (var action in form.related[itm].actions) {
|
||||||
html += "<button type=\"button\" class=\"btn btn-mini ";
|
html += "<button type=\"button\" class=\"btn btn-sm ";
|
||||||
html += (form.related[itm].actions[action]['class']) ? form.related[itm].actions[action]['class'] : "btn-success";
|
html += (form.related[itm].actions[action]['class']) ? form.related[itm].actions[action]['class'] : "btn-success";
|
||||||
html += "\" ";
|
html += "\" ";
|
||||||
html += (form.related[itm]['actions'][action].id) ? this.attr(form.related[itm]['actions'][action],'id') : "";
|
html += (form.related[itm]['actions'][action].id) ? this.attr(form.related[itm]['actions'][action],'id') : "";
|
||||||
@@ -1130,7 +1131,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
|||||||
html += "<div class=\"col-lg-7\">\n";
|
html += "<div class=\"col-lg-7\">\n";
|
||||||
for (var act in form.related[itm].actions) {
|
for (var act in form.related[itm].actions) {
|
||||||
var action = form.related[itm].actions[act];
|
var action = form.related[itm].actions[act];
|
||||||
html += "<button type=\"button\" class=\"btn btn-mini ";
|
html += "<button type=\"button\" class=\"btn btn-sm ";
|
||||||
html += (form.related[itm].actions[act]['class']) ? form.related[itm].actions[act]['class'] : "btn-success";
|
html += (form.related[itm].actions[act]['class']) ? form.related[itm].actions[act]['class'] : "btn-success";
|
||||||
html += "\" ";
|
html += "\" ";
|
||||||
html += this.attr(action,'ngClick');
|
html += this.attr(action,'ngClick');
|
||||||
@@ -1193,7 +1194,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
|||||||
html += "<td class=\"actions\">";
|
html += "<td class=\"actions\">";
|
||||||
for (act in form.related[itm].fieldActions) {
|
for (act in form.related[itm].fieldActions) {
|
||||||
var action = form.related[itm].fieldActions[act];
|
var action = form.related[itm].fieldActions[act];
|
||||||
html += "<button type=\"button\" class=\"btn btn-mini";
|
html += "<button type=\"button\" class=\"btn btn-xs";
|
||||||
html += (action['class']) ? " " + action['class'] : "";
|
html += (action['class']) ? " " + action['class'] : "";
|
||||||
html += "\" " + this.attr(action,'ngClick');
|
html += "\" " + this.attr(action,'ngClick');
|
||||||
html += (action.awToolTip) ? this.attr(action,'awToolTip') : "";
|
html += (action.awToolTip) ? this.attr(action,'awToolTip') : "";
|
||||||
|
|||||||
@@ -103,13 +103,17 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
|
|||||||
|
|
||||||
html = "<td>\n";
|
html = "<td>\n";
|
||||||
html += "<div class=\"btn-group btn-group-sm\">\n";
|
html += "<div class=\"btn-group btn-group-sm\">\n";
|
||||||
html += "<button type=\"button\" class=\"btn btn-default btn-mini dropdown-toggle\" data-toggle=\"dropdown\">";
|
html += "<button type=\"button\" ";
|
||||||
|
html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : "";
|
||||||
|
html += "class=\"btn btn-default btn-mini dropdown-toggle\" data-toggle=\"dropdown\">";
|
||||||
html += field.label;
|
html += field.label;
|
||||||
html += " <span class=\"caret\"></span></button>\n";
|
html += " <span class=\"caret\"></span></button>\n";
|
||||||
html += "<ul class=\"dropdown-menu pull-right\" role=\"menu\" aria-labelledby=\"dropdownMenu1\">\n";
|
html += "<ul class=\"dropdown-menu pull-right\" role=\"menu\" aria-labelledby=\"dropdownMenu1\">\n";
|
||||||
for (var i=0; i < field.options.length; i++) {
|
for (var i=0; i < field.options.length; i++) {
|
||||||
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" ";
|
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" ";
|
||||||
html += "ng-click=\"" + field.options[i].ngClick + "\" ";
|
html += "ng-click=\"" + field.options[i].ngClick + "\" ";
|
||||||
|
html += (field.options[i].ngShow) ? "ng-show=\"" + field.options[i].ngShow + "\" " : "";
|
||||||
|
html += (field.options[i].ngHide) ? "ng-hide=\"" + field.options[i].ngHide + "\" " : "";
|
||||||
html += "href=\"\">" + field.options[i].label + "</a></li>\n";
|
html += "href=\"\">" + field.options[i].label + "</a></li>\n";
|
||||||
}
|
}
|
||||||
html += "</ul>\n";
|
html += "</ul>\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user