mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Fixed project related links on home page. Add missing Reset button to all list pages. Fixed bug in sort that prevented searching where drop-down item is empty.
This commit is contained in:
parent
4f46ad63db
commit
8afdb710be
@ -13,7 +13,7 @@
|
||||
function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, ProjectList,
|
||||
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
||||
ClearScope, ProcessErrors, GetBasePath, SelectionInit, ProjectUpdate, ProjectStatus,
|
||||
FormatDate, Refresh, Wait, Stream)
|
||||
FormatDate, Refresh, Wait, Stream, GetChoices)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@ -41,34 +41,77 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
$('#prompt-modal').off();
|
||||
|
||||
if (scope.projects) {
|
||||
for (var i=0; i < scope.projects.length; i++) {
|
||||
if (scope.projects[i].status == 'ok') {
|
||||
scope.projects[i].status = 'n/a';
|
||||
}
|
||||
switch(scope.projects[i].status) {
|
||||
case 'n/a':
|
||||
scope.projects[i].badge = 'none';
|
||||
break;
|
||||
case 'updating':
|
||||
case 'successful':
|
||||
case 'ok':
|
||||
scope.projects[i].badge = 'false';
|
||||
break;
|
||||
case 'never updated':
|
||||
case 'failed':
|
||||
case 'missing':
|
||||
scope.projects[i].badge = 'true';
|
||||
break;
|
||||
}
|
||||
scope.projects[i].last_updated = (scope.projects[i].last_updated !== null) ?
|
||||
FormatDate(new Date(scope.projects[i].last_updated)) : null;
|
||||
}
|
||||
for (var i=0; i < scope.projects.length; i++) {
|
||||
if (scope.projects[i].status == 'ok') {
|
||||
scope.projects[i].status = 'n/a';
|
||||
}
|
||||
switch(scope.projects[i].status) {
|
||||
case 'n/a':
|
||||
scope.projects[i].badge = 'none';
|
||||
break;
|
||||
case 'updating':
|
||||
case 'successful':
|
||||
case 'ok':
|
||||
scope.projects[i].badge = 'false';
|
||||
break;
|
||||
case 'never updated':
|
||||
case 'failed':
|
||||
case 'missing':
|
||||
scope.projects[i].badge = 'true';
|
||||
break;
|
||||
}
|
||||
scope.projects[i].last_updated = (scope.projects[i].last_updated !== null) ?
|
||||
FormatDate(new Date(scope.projects[i].last_updated)) : null;
|
||||
|
||||
for (var j=0; j < scope.project_scm_type_options.length; j++) {
|
||||
if (scope.project_scm_type_options[j].value == scope.projects[i].scm_type) {
|
||||
scope.projects[i].scm_type = scope.project_scm_type_options[j].label
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchInit({ scope: scope, set: 'projects', list: list, url: defaultUrl });
|
||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||
scope.search(list.iterator);
|
||||
if (scope.removeChoicesReady) {
|
||||
scope.removeChoicesReady();
|
||||
}
|
||||
scope.removeChoicesReady = scope.$on('choicesReady', function() {
|
||||
|
||||
list.fields.scm_type.searchOptions = scope.project_scm_type_options;
|
||||
|
||||
if ($routeParams['scm_type'] && $routeParams['status']) {
|
||||
// Request coming from home page. User wants all errors for an scm_type
|
||||
defaultUrl += '?status=' + $routeParams['status'];
|
||||
}
|
||||
|
||||
SearchInit({ scope: scope, set: 'projects', list: list, url: defaultUrl });
|
||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||
|
||||
if ($routeParams['scm_type']) {
|
||||
scope[list.iterator + 'SearchField'] = 'scm_type';
|
||||
scope[list.iterator + 'SelectShow'] = true;
|
||||
scope[list.iterator + 'SearchSelectOpts'] = list.fields['scm_type'].searchOptions;
|
||||
scope[list.iterator + 'SearchFieldLabel'] = list.fields['scm_type'].label.replace(/\<br\>/g,' ');
|
||||
for (var opt in list.fields['scm_type'].searchOptions) {
|
||||
if (list.fields['scm_type'].searchOptions[opt].value == $routeParams['scm_type']) {
|
||||
scope[list.iterator + 'SearchSelectValue'] = list.fields['scm_type'].searchOptions[opt];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
scope.search(list.iterator);
|
||||
});
|
||||
|
||||
// Load the list of options for Kind
|
||||
GetChoices({
|
||||
scope: scope,
|
||||
url: defaultUrl,
|
||||
field: 'scm_type',
|
||||
variable: 'project_scm_type_options',
|
||||
callback: 'choicesReady'
|
||||
});
|
||||
|
||||
|
||||
LoadBreadCrumbs();
|
||||
|
||||
@ -232,7 +275,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
|
||||
ProjectsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList',
|
||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
|
||||
'GetBasePath', 'SelectionInit', 'ProjectUpdate', 'ProjectStatus', 'FormatDate', 'Refresh', 'Wait', 'Stream'];
|
||||
'GetBasePath', 'SelectionInit', 'ProjectUpdate', 'ProjectStatus', 'FormatDate', 'Refresh', 'Wait', 'Stream',
|
||||
'GetChoices' ];
|
||||
|
||||
|
||||
function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm,
|
||||
|
||||
@ -346,7 +346,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
else if ( (list.fields[scope[iterator + 'SearchField' + modifier]].searchType == 'select') &&
|
||||
(scope[iterator + 'SearchSelectValue' + modifier].value == '' ||
|
||||
scope[iterator + 'SearchSelectValue' + modifier].value == null) ) {
|
||||
scope[iterator + 'SearchParams'] += '&' + scope[iterator + 'SearchField' + modifier];
|
||||
scope[iterator + 'SearchParams'] += '&' + scope[iterator + 'SearchField' + modifier] + '__';
|
||||
}
|
||||
else {
|
||||
scope[iterator + 'SearchParams'] += '&' + scope[iterator + 'SearchField' + modifier] + '__';
|
||||
|
||||
@ -62,6 +62,15 @@ angular.module('CredentialsListDefinition', [])
|
||||
"class": 'btn-success btn-xs',
|
||||
awToolTip: 'Create a new credential'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -110,6 +110,15 @@ angular.module('HomeGroupListDefinition', [])
|
||||
},
|
||||
|
||||
actions: {
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -81,6 +81,15 @@ angular.module('HomeHostListDefinition', [])
|
||||
},
|
||||
|
||||
actions: {
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -89,6 +89,15 @@ angular.module('InventoriesListDefinition', [])
|
||||
"class": 'btn-xs btn-success',
|
||||
awToolTip: 'Create a new inventory'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -136,6 +136,15 @@ angular.module('InventorySummaryDefinition', [])
|
||||
ngClick: "refresh()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -89,11 +89,20 @@ angular.module('JobEventsListDefinition', [])
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-refresh",
|
||||
mode: 'all',
|
||||
ngShow: "job_status == 'pending' || job_status == 'waiting' || job_status == 'running'",
|
||||
//ngShow: "job_status == 'pending' || job_status == 'waiting' || job_status == 'running'",
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Refresh the page",
|
||||
ngClick: "refresh()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -128,6 +128,15 @@ angular.module('JobHostDefinition', [])
|
||||
awToolTip: "Refresh the page",
|
||||
ngClick: "refresh()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -38,6 +38,15 @@ angular.module('JobTemplatesListDefinition', [])
|
||||
basePaths: ['job_templates'],
|
||||
awToolTip: 'Create a new template'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -83,6 +83,15 @@ angular.module('JobsListDefinition', [])
|
||||
awToolTip: "Refresh the page",
|
||||
ngClick: "refresh()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -51,6 +51,15 @@ angular.module('PermissionListDefinition', [])
|
||||
awToolTip: 'Add a new permission',
|
||||
ngShow: 'PermissionAddAllowed'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -29,6 +29,13 @@ angular.module('ProjectsListDefinition', [])
|
||||
columnClass: 'hidden-sm hidden-xs',
|
||||
excludeModal: true
|
||||
},
|
||||
scm_type: {
|
||||
label: 'SCM Type',
|
||||
searchType: 'select',
|
||||
searchOptions: [], // will be set by Options call to projects resource
|
||||
excludeModal: true,
|
||||
nosort: true
|
||||
},
|
||||
status: {
|
||||
label: 'Update Status',
|
||||
ngClick: 'showSCMStatus(\{\{ project.id \}\})',
|
||||
@ -72,7 +79,7 @@ angular.module('ProjectsListDefinition', [])
|
||||
dataTitle: 'Project Status',
|
||||
iconSize: 'large'
|
||||
},
|
||||
refresh: {
|
||||
refresh: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-refresh",
|
||||
mode: 'all',
|
||||
@ -81,6 +88,15 @@ angular.module('ProjectsListDefinition', [])
|
||||
ngClick: "refresh()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -43,6 +43,15 @@ angular.module('TeamsListDefinition', [])
|
||||
"class": 'btn-xs btn-success',
|
||||
awToolTip: 'Create a new team'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -43,6 +43,15 @@ angular.module('UserListDefinition', [])
|
||||
"class": 'btn-success btn-xs',
|
||||
awToolTip: 'Create a new user'
|
||||
},
|
||||
reset: {
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-undo",
|
||||
mode: 'all',
|
||||
'class': 'btn-xs btn-primary',
|
||||
awToolTip: "Reset the search filter",
|
||||
ngClick: "resetSearch()",
|
||||
iconSize: 'large'
|
||||
},
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
|
||||
@ -32,50 +32,7 @@ angular.module('ObjectCountWidget', ['RestServices', 'Utilities'])
|
||||
html += "</tr>\n";
|
||||
html += "</thead>\n";
|
||||
html += "<tbody>\n";
|
||||
|
||||
/*function makeRow(params) {
|
||||
var html = '';
|
||||
var label = params.label;
|
||||
var link = params.link;
|
||||
var fail_link = params.fail_link;
|
||||
var count = params.count;
|
||||
var fail = params.fail;
|
||||
|
||||
html += "<tr><td class=\"capitalize\">\n";
|
||||
html += "<a href=\"/#/";
|
||||
var link;
|
||||
switch(label) {
|
||||
case 'inventory':
|
||||
link = 'inventories';
|
||||
break;
|
||||
case 'hosts':
|
||||
link = 'home/hosts';
|
||||
break;
|
||||
case 'groups':
|
||||
link = 'home/groups';
|
||||
break;
|
||||
default:
|
||||
link = label;
|
||||
break;
|
||||
}
|
||||
html += link;
|
||||
html += "\"";
|
||||
html += (label == 'hosts' || label == 'groups') ? " class=\"pad-left-sm\" " : "";
|
||||
html += ">";
|
||||
if (label == 'inventory') {
|
||||
html += 'inventories';
|
||||
}
|
||||
else {
|
||||
html += label.replace(/\_/g,' ');
|
||||
}
|
||||
html += "</a></td>\n"
|
||||
html += "<td class=\"text-right\"><a href=\"/#/";
|
||||
html += ( label == 'inventory') ? 'inventories' : label;
|
||||
html += "\">";
|
||||
html += counts[keys[i]] + "</a></td></tr>\n";
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
function makeRow(params) {
|
||||
var html = '';
|
||||
var label = params.label;
|
||||
@ -95,7 +52,7 @@ angular.module('ObjectCountWidget', ['RestServices', 'Utilities'])
|
||||
html += makeRow({
|
||||
label: keys[i],
|
||||
link: '/#/' + keys[i],
|
||||
count: [(dashboard[keys[i]] && dashboard[keys[i]].total) ? dashboard[keys[i]].total : 0],
|
||||
count: [(dashboard[keys[i]] && dashboard[keys[i]].total) ? dashboard[keys[i]].total : 0]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user