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

allows us to set OPTIONS request endpoints per list field, adds additional logging to catch list configs with missing basePath param. Resolves #1626

remove debug line
This commit is contained in:
Leigh Johnson 2016-04-20 16:28:38 -04:00
parent caab667684
commit dd0340f909
2 changed files with 16 additions and 8 deletions

View File

@ -11,13 +11,13 @@ export default function(){
iterator: 'notification',
index: false,
hover: false,
basePath: 'notifications',
fields: {
name: {
key: true,
label: 'Name',
columnClass: 'col-md-3 col-sm-9 col-xs-9',
linkTo: '/#/notifications/{{notifier.id}}'
linkTo: '/#/notifications/{{notifier.id}}',
},
notification_type: {
label: 'Type',

View File

@ -1,4 +1,4 @@
export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', function(Rest, $q, GetBasePath, Wait, ProcessErrors) {
export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', function(Rest, $q, GetBasePath, Wait, ProcessErrors, $log) {
var that = this;
// parse the field config object to return
// one of the searchTypes (for the left dropdown)
@ -79,11 +79,12 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', function(R
if (needsRequest.length) {
// make the options request to reutrn the typeOptions
Rest.setUrl(basePath);
Rest.setUrl(needsRequest[0].basePath ? needsRequest[0].basePath : basePath);
Rest.options()
.success(function (data) {
var options = data.actions.GET;
needsRequest = needsRequest
try {
var options = data.actions.GET;
needsRequest = needsRequest
.map(function (option) {
option.typeOptions = options[option
.value]
@ -94,8 +95,15 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', function(R
label: i[1]
};
});
return option;
});
return option;
});
}
catch(err){
if (basePath === ''){
$log.error('Cannot retrieve OPTIONS because the basePath parameter is not set on the list with the following fieldset: \n', list);
}
else { $log.error(err); }
}
Wait("stop");
defer.resolve(joinOptions());
})