mirror of
https://github.com/ansible/awx.git
synced 2026-04-10 12:39:22 -02:30
AC-502 all links for Inventory widget on home page now work. Modified responding controllers to process all search parameters. Fixed Hosts and Groups links in the Summary widget. Added ability to edit host using modal dialog from /home/hosts page.
This commit is contained in:
@@ -95,12 +95,51 @@ function HomeGroups ($location, $routeParams, HomeGroupList, GenerateList, Proce
|
|||||||
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
||||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||||
|
|
||||||
|
// Process search params
|
||||||
if ($routeParams['has_active_failures']) {
|
if ($routeParams['has_active_failures']) {
|
||||||
scope[HomeGroupList.iterator + 'InputDisable'] = true;
|
scope[list.iterator + 'InputDisable'] = true;
|
||||||
scope[HomeGroupList.iterator + 'SearchValue'] = $routeParams['has_active_failures'];
|
scope[list.iterator + 'SearchValue'] = $routeParams['has_active_failures'];
|
||||||
scope[HomeGroupList.iterator + 'SearchField'] = 'has_active_failures';
|
scope[list.iterator + 'SearchField'] = 'has_active_failures';
|
||||||
scope[HomeGroupList.iterator + 'SearchFieldLabel'] = HomeGroupList.fields['has_active_failures'].label;
|
scope[list.iterator + 'SearchFieldLabel'] = list.fields['has_active_failures'].label;
|
||||||
scope[HomeGroupList.iterator + 'SearchSelectValue'] = ($routeParams['has_active_failures'] == 'true') ? { value: 1 } : { value: 0 };
|
scope[list.iterator + 'SearchSelectValue'] = ($routeParams['has_active_failures'] == 'true') ? { value: 1 } : { value: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($routeParams['status'] && !$routeParams['source']) {
|
||||||
|
scope[list.iterator + 'SearchField'] = 'status';
|
||||||
|
scope[list.iterator + 'SelectShow'] = true;
|
||||||
|
scope[list.iterator + 'SearchSelectOpts'] = list.fields['status'].searchOptions;
|
||||||
|
scope[list.iterator + 'SearchFieldLabel'] = list.fields['status'].label.replace(/\<br\>/g,' ');
|
||||||
|
for (var opt in list.fields['status'].searchOptions) {
|
||||||
|
if (list.fields['status'].searchOptions[opt].value == $routeParams['status']) {
|
||||||
|
scope[list.iterator + 'SearchSelectValue'] = list.fields['status'].searchOptions[opt];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($routeParams['source']) {
|
||||||
|
scope[list.iterator + 'SearchField'] = 'source';
|
||||||
|
scope[list.iterator + 'SelectShow'] = true;
|
||||||
|
scope[list.iterator + 'SearchSelectOpts'] = list.fields['source'].searchOptions;
|
||||||
|
scope[list.iterator + 'SearchFieldLabel'] = list.fields['source'].label.replace(/\<br\>/g,' ');
|
||||||
|
for (var opt in list.fields['source'].searchOptions) {
|
||||||
|
if (list.fields['source'].searchOptions[opt].value == $routeParams['source']) {
|
||||||
|
scope[list.iterator + 'SearchSelectValue'] = list.fields['source'].searchOptions[opt];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($routeParams['status']) {
|
||||||
|
scope[list.iterator + 'ExtraParms'] = '&inventory_source__status__icontains=' + $routeParams['status'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($routeParams['has_external_source']) {
|
||||||
|
scope[list.iterator + 'SearchField'] = 'has_external_source';
|
||||||
|
scope[list.iterator + 'SearchValue'] = list.fields['has_external_source'].searchValue;
|
||||||
|
scope[list.iterator + 'InputDisable'] = true;
|
||||||
|
scope[list.iterator + 'SearchType'] = 'in';
|
||||||
|
scope[list.iterator + 'SearchFieldLabel'] = list.fields['has_external_source'].label;
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
@@ -117,7 +156,7 @@ HomeGroups.$inject = [ '$location', '$routeParams', 'HomeGroupList', 'GenerateLi
|
|||||||
|
|
||||||
|
|
||||||
function HomeHosts ($location, $routeParams, HomeHostList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
function HomeHosts ($location, $routeParams, HomeHostList, GenerateList, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||||
GetBasePath, SearchInit, PaginateInit, FormatDate, SetHostStatus, ToggleHostEnabled) {
|
GetBasePath, SearchInit, PaginateInit, FormatDate, SetHostStatus, ToggleHostEnabled, HostsEdit) {
|
||||||
|
|
||||||
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.
|
||||||
@@ -156,10 +195,23 @@ function HomeHosts ($location, $routeParams, HomeHostList, GenerateList, Process
|
|||||||
|
|
||||||
scope.toggle_host_enabled = function(id, sources) { ToggleHostEnabled(id, sources, scope); }
|
scope.toggle_host_enabled = function(id, sources) { ToggleHostEnabled(id, sources, scope); }
|
||||||
|
|
||||||
|
scope.editHost = function(host_id, host_name) {
|
||||||
|
var host;
|
||||||
|
for (var i=0; i < scope['hosts'].length; i++) {
|
||||||
|
if (scope['hosts'][i].id == host_id) {
|
||||||
|
host = scope['hosts'][i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (host) {
|
||||||
|
HostsEdit({ host_id: host_id, inventory_id: host.inventory, group_id: null, hostsReload: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeGroups.$inject = [ '$location', '$routeParams', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
|
HomeGroups.$inject = [ '$location', '$routeParams', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller',
|
||||||
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'HostsStatusMsg', 'UpdateStatusMsg', 'ViewUpdateStatus',
|
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'HostsStatusMsg', 'UpdateStatusMsg', 'ViewUpdateStatus',
|
||||||
'SetHostStatus', 'ToggleHostEnabled'
|
'SetHostStatus', 'ToggleHostEnabled', 'HostsEdit'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -37,7 +37,6 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($routeParams['has_active_failures']) {
|
if ($routeParams['has_active_failures']) {
|
||||||
//scope.resetSearch(InventoryHostsForm.iterator);
|
|
||||||
scope[InventoryList.iterator + 'InputDisable'] = true;
|
scope[InventoryList.iterator + 'InputDisable'] = true;
|
||||||
scope[InventoryList.iterator + 'SearchValue'] = $routeParams['has_active_failures'];
|
scope[InventoryList.iterator + 'SearchValue'] = $routeParams['has_active_failures'];
|
||||||
scope[InventoryList.iterator + 'SearchField'] = 'has_active_failures';
|
scope[InventoryList.iterator + 'SearchField'] = 'has_active_failures';
|
||||||
@@ -45,6 +44,21 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
|
|||||||
scope[InventoryList.iterator + 'SearchSelectValue'] = ($routeParams['has_active_failures'] == 'true') ? { value: 1 } : { value: 0 };
|
scope[InventoryList.iterator + 'SearchSelectValue'] = ($routeParams['has_active_failures'] == 'true') ? { value: 1 } : { value: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($routeParams['has_inventory_sources']) {
|
||||||
|
scope[InventoryList.iterator + 'InputDisable'] = true;
|
||||||
|
scope[InventoryList.iterator + 'SearchValue'] = $routeParams['has_inventory_sources'];
|
||||||
|
scope[InventoryList.iterator + 'SearchField'] = 'has_inventory_sources';
|
||||||
|
scope[InventoryList.iterator + 'SearchFieldLabel'] = InventoryList.fields['has_inventory_sources'].label;
|
||||||
|
scope[InventoryList.iterator + 'SearchSelectValue'] = ($routeParams['has_inventory_sources'] == 'true') ? { value: 1 } : { value: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($routeParams['inventory_sources_with_failures']) {
|
||||||
|
// pass a value of true, however this field actually contains an integer value
|
||||||
|
scope[InventoryList.iterator + 'InputDisable'] = true;
|
||||||
|
scope[InventoryList.iterator + 'SearchField'] = 'inventory_sources_with_failures';
|
||||||
|
scope[InventoryList.iterator + 'SearchFieldLabel'] = InventoryList.fields['inventory_sources_with_failures'].label;
|
||||||
|
}
|
||||||
|
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
|
|
||||||
LoadBreadCrumbs();
|
LoadBreadCrumbs();
|
||||||
|
|||||||
@@ -393,7 +393,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
scope[list.iterator + 'InputDisable'] = true;
|
scope[list.iterator + 'InputDisable'] = true;
|
||||||
scope[list.iterator + 'SearchType'] = 'in';
|
scope[list.iterator + 'SearchType'] = 'in';
|
||||||
scope[list.iterator + 'SearchFieldLabel'] = list.fields['has_external_source'].label;
|
scope[list.iterator + 'SearchFieldLabel'] = list.fields['has_external_source'].label;
|
||||||
//=ec2,rackspace,file)
|
|
||||||
}
|
}
|
||||||
else if ($routeParams['status']) {
|
else if ($routeParams['status']) {
|
||||||
// with status param, called post update-submit
|
// with status param, called post update-submit
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
var host_id = params.host_id;
|
var host_id = params.host_id;
|
||||||
var inventory_id = params.inventory_id;
|
var inventory_id = params.inventory_id;
|
||||||
var group_id = params.group_id;
|
var group_id = params.group_id;
|
||||||
|
var hostsReload = (params.hostsReload == undefined || params.hostsReload) ? true : false;
|
||||||
|
|
||||||
var generator = GenerateForm;
|
var generator = GenerateForm;
|
||||||
var form = HostForm;
|
var form = HostForm;
|
||||||
@@ -367,7 +368,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
|
|||||||
|
|
||||||
function finished() {
|
function finished() {
|
||||||
$('#form-modal').modal('hide');
|
$('#form-modal').modal('hide');
|
||||||
scope.$emit('hostsReload');
|
if (hostsReload) {
|
||||||
|
scope.$emit('hostsReload');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -26,55 +26,60 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
var iterator = (params.iterator) ? params.iterator : list.iterator;
|
var iterator = (params.iterator) ? params.iterator : list.iterator;
|
||||||
var sort_order;
|
var sort_order;
|
||||||
|
|
||||||
// Set default values
|
function setDefaults() {
|
||||||
for (fld in list.fields) {
|
// Set default values
|
||||||
if (list.fields[fld].key) {
|
for (fld in list.fields) {
|
||||||
if (list.fields[fld].sourceModel) {
|
if (list.fields[fld].key) {
|
||||||
var fka = list.fields[fld].sourceModel + '__' + list.fields[fld].sourceField;
|
if (list.fields[fld].sourceModel) {
|
||||||
sort_order = (list.fields[fld].desc) ? '-' + fka : fka;
|
var fka = list.fields[fld].sourceModel + '__' + list.fields[fld].sourceField;
|
||||||
}
|
sort_order = (list.fields[fld].desc) ? '-' + fka : fka;
|
||||||
else {
|
}
|
||||||
sort_order = (list.fields[fld].desc) ? '-' + fld : fld;
|
else {
|
||||||
}
|
sort_order = (list.fields[fld].desc) ? '-' + fld : fld;
|
||||||
if (list.fields[fld].searchable == undefined || list.fields[fld].searchable == true) {
|
}
|
||||||
scope[iterator + 'SearchField'] = fld;
|
if (list.fields[fld].searchable == undefined || list.fields[fld].searchable == true) {
|
||||||
scope[iterator + 'SearchFieldLabel'] = list.fields[fld].label;
|
scope[iterator + 'SearchField'] = fld;
|
||||||
}
|
scope[iterator + 'SearchFieldLabel'] = list.fields[fld].label;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!scope[iterator + 'SearchField']) {
|
if (!scope[iterator + 'SearchField']) {
|
||||||
// A field marked as key may not be 'searchable'
|
// A field marked as key may not be 'searchable'
|
||||||
for (fld in list.fields) {
|
for (fld in list.fields) {
|
||||||
if (list.fields[fld].searchable == undefined || list.fields[fld].searchable == true) {
|
if (list.fields[fld].searchable == undefined || list.fields[fld].searchable == true) {
|
||||||
scope[iterator + 'SearchField'] = fld;
|
scope[iterator + 'SearchField'] = fld;
|
||||||
scope[iterator + 'SearchFieldLabel'] = list.fields[fld].label;
|
scope[iterator + 'SearchFieldLabel'] = list.fields[fld].label;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
scope[iterator + 'SearchType'] = 'icontains';
|
scope[iterator + 'SearchType'] = 'icontains';
|
||||||
scope[iterator + 'SearchTypeLabel'] = 'Contains';
|
scope[iterator + 'SearchTypeLabel'] = 'Contains';
|
||||||
scope[iterator + 'SearchParams'] = '';
|
scope[iterator + 'SearchParams'] = '';
|
||||||
scope[iterator + 'SearchValue'] = '';
|
scope[iterator + 'SearchValue'] = '';
|
||||||
scope[iterator + 'SelectShow'] = false; // show/hide the Select
|
scope[iterator + 'SelectShow'] = false; // show/hide the Select
|
||||||
scope[iterator + 'HideSearchType'] = false;
|
scope[iterator + 'HideSearchType'] = false;
|
||||||
scope[iterator + 'InputDisable'] = false;
|
scope[iterator + 'InputDisable'] = false;
|
||||||
|
scope[iterator + 'ExtraParms'] = '';
|
||||||
|
|
||||||
var f = scope[iterator + 'SearchField']
|
var f = scope[iterator + 'SearchField']
|
||||||
if (list.fields[f].searchType && ( list.fields[f].searchType == 'boolean'
|
if (list.fields[f].searchType && ( list.fields[f].searchType == 'boolean'
|
||||||
|| list.fields[f].searchType == 'select')) {
|
|| list.fields[f].searchType == 'select')) {
|
||||||
scope[iterator + 'SelectShow'] = true;
|
scope[iterator + 'SelectShow'] = true;
|
||||||
scope[iterator + 'SearchSelectOpts'] = list.fields[f].searchOptions;
|
scope[iterator + 'SearchSelectOpts'] = list.fields[f].searchOptions;
|
||||||
}
|
}
|
||||||
if (list.fields[f].searchType && list.fields[f].searchType == 'int') {
|
if (list.fields[f].searchType && list.fields[f].searchType == 'int') {
|
||||||
scope[iterator + 'HideSearchType'] = true;
|
scope[iterator + 'HideSearchType'] = true;
|
||||||
}
|
}
|
||||||
if (list.fields[f].searchType && list.fields[f].searchType == 'gtzero') {
|
if (list.fields[f].searchType && list.fields[f].searchType == 'gtzero') {
|
||||||
scope[iterator + "InputHide"] = true;
|
scope[iterator + "InputHide"] = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setDefaults();
|
||||||
|
|
||||||
// Functions to handle search widget changes
|
// Functions to handle search widget changes
|
||||||
scope.setSearchField = function(iterator, fld, label) {
|
scope.setSearchField = function(iterator, fld, label) {
|
||||||
@@ -126,12 +131,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
|
|
||||||
scope.resetSearch = function(iterator) {
|
scope.resetSearch = function(iterator) {
|
||||||
// Respdond to click of reset button
|
// Respdond to click of reset button
|
||||||
scope[iterator + "SearchValue"] = '';
|
setDefaults();
|
||||||
scope[iterator + "SearchSelectValue"] = '';
|
|
||||||
scope[iterator + 'SelectShow'] = false;
|
|
||||||
scope[iterator + 'HideSearchType'] = false;
|
|
||||||
scope[iterator + 'InputHide'] = false;
|
|
||||||
scope[iterator + 'InputDisable'] = false;
|
|
||||||
// Force removal of search keys from the URL
|
// Force removal of search keys from the URL
|
||||||
window.location = '/#' + $location.path();
|
window.location = '/#' + $location.path();
|
||||||
}
|
}
|
||||||
@@ -224,6 +224,9 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
if (page) {
|
if (page) {
|
||||||
url += '&page=' + page;
|
url += '&page=' + page;
|
||||||
}
|
}
|
||||||
|
if (scope[iterator + 'ExtraParms']) {
|
||||||
|
url += scope[iterator + 'ExtraParms'];
|
||||||
|
}
|
||||||
Refresh({ scope: scope, set: set, iterator: iterator, url: url });
|
Refresh({ scope: scope, set: set, iterator: iterator, url: url });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ angular.module('InventoriesListDefinition', [])
|
|||||||
searchType: 'boolean',
|
searchType: 'boolean',
|
||||||
searchValue: 'true',
|
searchValue: 'true',
|
||||||
searchOnly: true
|
searchOnly: true
|
||||||
|
},
|
||||||
|
inventory_sources_with_failures: {
|
||||||
|
label: 'Has inventory update failures?',
|
||||||
|
searchType: 'gtzero',
|
||||||
|
searchOnly: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ angular.module('InventorySyncStatusWidget', ['RestServices', 'Utilities'])
|
|||||||
var hostCount = 0;
|
var hostCount = 0;
|
||||||
var hostFails = 0;
|
var hostFails = 0;
|
||||||
var counts = 0;
|
var counts = 0;
|
||||||
var expectedCounts = 4;
|
var expectedCounts = 5;
|
||||||
var target = params.target;
|
var target = params.target;
|
||||||
var results = [];
|
var results = [];
|
||||||
var expected;
|
var expected;
|
||||||
@@ -71,15 +71,15 @@ angular.module('InventorySyncStatusWidget', ['RestServices', 'Utilities'])
|
|||||||
html += makeRow({ label: 'Inventories',
|
html += makeRow({ label: 'Inventories',
|
||||||
count: inventoryCount,
|
count: inventoryCount,
|
||||||
fail: inventoryFails,
|
fail: inventoryFails,
|
||||||
link: GetBasePath('inventory'),
|
link: '/#/inventories/?has_inventory_sources=true',
|
||||||
fail_link: GetBasePath('inventory') + '/?status=failed' });
|
fail_link: '/#/inventories/?inventory_sources_with_failures=true' });
|
||||||
rowcount++;
|
rowcount++;
|
||||||
}
|
}
|
||||||
if (groupCount > 0) {
|
if (groupCount > 0) {
|
||||||
html += makeRow({ label: 'Groups',
|
html += makeRow({ label: 'Groups',
|
||||||
count: groupCount,
|
count: groupCount,
|
||||||
fail: groupFails,
|
fail: groupFails,
|
||||||
link: '/#/home/groups/?has_inventory_sources=true',
|
link: '/#/home/groups/?has_external_source=true',
|
||||||
fail_link: '/#/home/groups/?status=failed' });
|
fail_link: '/#/home/groups/?status=failed' });
|
||||||
rowcount++;
|
rowcount++;
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,17 @@ angular.module('InventorySyncStatusWidget', ['RestServices', 'Utilities'])
|
|||||||
{ hdr: 'Error!', msg: 'Failed to get ' + url + '. GET status: ' + status });
|
{ hdr: 'Error!', msg: 'Failed to get ' + url + '. GET status: ' + status });
|
||||||
});
|
});
|
||||||
|
|
||||||
inventoryFails = 0;
|
var url = GetBasePath('inventory') + '?inventory_sources_with_failures__gt=0&page=1';
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.get()
|
||||||
|
.success( function(data, status, headers, config) {
|
||||||
|
inventoryFails=data.count;
|
||||||
|
scope.$emit('CountReceived');
|
||||||
|
})
|
||||||
|
.error( function(data, status, headers, config) {
|
||||||
|
ProcessErrors(scope, data, status, null,
|
||||||
|
{ hdr: 'Error!', msg: 'Failed to get ' + url + '. GET status: ' + status });
|
||||||
|
});
|
||||||
|
|
||||||
url = GetBasePath('inventory_sources') + '?source__in=ec2,rackspace&page=1';
|
url = GetBasePath('inventory_sources') + '?source__in=ec2,rackspace&page=1';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
@@ -215,7 +225,6 @@ angular.module('InventorySyncStatusWidget', ['RestServices', 'Utilities'])
|
|||||||
Rest.get()
|
Rest.get()
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
// figure out the scm_type we're looking at and its label
|
// figure out the scm_type we're looking at and its label
|
||||||
console.log('config');
|
|
||||||
var label = getLabel(config);
|
var label = getLabel(config);
|
||||||
var count = data.count;
|
var count = data.count;
|
||||||
var fail = 0;
|
var fail = 0;
|
||||||
|
|||||||
@@ -45,16 +45,30 @@ angular.module('ObjectCountWidget', ['RestServices', 'Utilities'])
|
|||||||
for (var i=0; i < keys.length; i++) {
|
for (var i=0; i < keys.length; i++) {
|
||||||
html += "<tr><td class=\"capitalize\">\n";
|
html += "<tr><td class=\"capitalize\">\n";
|
||||||
html += "<a href=\"/#/";
|
html += "<a href=\"/#/";
|
||||||
html += (keys[i] == 'inventory') ? 'inventories' : keys[i];
|
var link;
|
||||||
|
switch(keys[i]) {
|
||||||
|
case 'inventory':
|
||||||
|
link = 'inventories';
|
||||||
|
break;
|
||||||
|
case 'hosts':
|
||||||
|
link = 'home/hosts';
|
||||||
|
break;
|
||||||
|
case 'groups':
|
||||||
|
link = 'home/groups';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
link = keys[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
html += link;
|
||||||
html += "\"";
|
html += "\"";
|
||||||
html += (keys[i] == 'hosts' || keys[i] == 'groups') ? " class=\"pad-left-sm\" " : "";
|
html += (keys[i] == 'hosts' || keys[i] == 'groups') ? " class=\"pad-left-sm\" " : "";
|
||||||
html += ">";
|
html += ">";
|
||||||
if (keys[i] == 'inventory') {
|
if (keys[i] == 'inventory') {
|
||||||
html += 'Inventories';
|
html += 'inventories';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
html += keys[i].replace(/\_/g,' ');
|
html += keys[i].replace(/\_/g,' ');
|
||||||
//html += txt.substring(0,1).toUpperCase() + txt.substring(1);
|
|
||||||
}
|
}
|
||||||
html += "</a></td>\n"
|
html += "</a></td>\n"
|
||||||
html += "<td class=\"text-right\"><a href=\"/#/";
|
html += "<td class=\"text-right\"><a href=\"/#/";
|
||||||
|
|||||||
Reference in New Issue
Block a user