mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 13:57:39 -02:30
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:
@@ -11,13 +11,13 @@ export default function(){
|
|||||||
iterator: 'notification',
|
iterator: 'notification',
|
||||||
index: false,
|
index: false,
|
||||||
hover: false,
|
hover: false,
|
||||||
|
basePath: 'notifications',
|
||||||
fields: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
key: true,
|
key: true,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
columnClass: 'col-md-3 col-sm-9 col-xs-9',
|
columnClass: 'col-md-3 col-sm-9 col-xs-9',
|
||||||
linkTo: '/#/notifications/{{notifier.id}}'
|
linkTo: '/#/notifications/{{notifier.id}}',
|
||||||
},
|
},
|
||||||
notification_type: {
|
notification_type: {
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
|
|||||||
@@ -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;
|
var that = this;
|
||||||
// parse the field config object to return
|
// parse the field config object to return
|
||||||
// one of the searchTypes (for the left dropdown)
|
// one of the searchTypes (for the left dropdown)
|
||||||
@@ -79,11 +79,12 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', function(R
|
|||||||
|
|
||||||
if (needsRequest.length) {
|
if (needsRequest.length) {
|
||||||
// make the options request to reutrn the typeOptions
|
// make the options request to reutrn the typeOptions
|
||||||
Rest.setUrl(basePath);
|
Rest.setUrl(needsRequest[0].basePath ? needsRequest[0].basePath : basePath);
|
||||||
Rest.options()
|
Rest.options()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
var options = data.actions.GET;
|
try {
|
||||||
needsRequest = needsRequest
|
var options = data.actions.GET;
|
||||||
|
needsRequest = needsRequest
|
||||||
.map(function (option) {
|
.map(function (option) {
|
||||||
option.typeOptions = options[option
|
option.typeOptions = options[option
|
||||||
.value]
|
.value]
|
||||||
@@ -94,8 +95,15 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', function(R
|
|||||||
label: i[1]
|
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");
|
Wait("stop");
|
||||||
defer.resolve(joinOptions());
|
defer.resolve(joinOptions());
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user