mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 09:48:51 -03:30
Fix any unhandled rejections
This commit is contained in:
@@ -22,6 +22,16 @@ function AtTruncateController (strings) {
|
||||
vm.truncatedString = string.substring(0, maxlength);
|
||||
};
|
||||
|
||||
vm.copyToClipboard = () => {
|
||||
vm.tooltip.popover.text = vm.strings.get('truncate.COPIED');
|
||||
|
||||
const textarea = el[0].getElementsByClassName('at-Truncate-textarea')[0];
|
||||
textarea.value = string;
|
||||
textarea.select();
|
||||
|
||||
document.execCommand('copy');
|
||||
};
|
||||
|
||||
vm.tooltip = {
|
||||
popover: {
|
||||
text: vm.strings.get('truncate.DEFAULT'),
|
||||
@@ -32,16 +42,6 @@ function AtTruncateController (strings) {
|
||||
click: vm.copyToClipboard
|
||||
}
|
||||
};
|
||||
|
||||
vm.copyToClipboard = () => {
|
||||
vm.tooltip.popover.text = vm.strings.get('truncate.COPIED');
|
||||
|
||||
const textarea = el[0].getElementsByClassName('at-Truncate-textarea')[0];
|
||||
textarea.value = string;
|
||||
textarea.select();
|
||||
|
||||
document.execCommand('copy');
|
||||
};
|
||||
}
|
||||
|
||||
AtTruncateController.$inject = ['ComponentsStrings'];
|
||||
|
||||
@@ -114,6 +114,9 @@ angular
|
||||
.constant('AngularScheduler.useTimezone', true)
|
||||
.constant('AngularScheduler.showUTCField', true)
|
||||
.constant('$timezones.definitions.location', urlPrefix + 'lib/angular-tz-extensions/tz/data')
|
||||
.config(['$locationProvider', function($locationProvider) {
|
||||
$locationProvider.hashPrefix('');
|
||||
}])
|
||||
.config(['$logProvider', function($logProvider) {
|
||||
$logProvider.debugEnabled($ENV['ng-debug'] || false);
|
||||
}])
|
||||
@@ -176,7 +179,7 @@ angular
|
||||
LoadConfig, Store, pendoService, Prompt, Rest, Wait,
|
||||
ProcessErrors, $state, GetBasePath, ConfigService, FeaturesService,
|
||||
$filter, SocketService, AppStrings, $transitions) {
|
||||
|
||||
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$state.matches = function(stateName) {
|
||||
return $state.current.name.search(stateName) > 0;
|
||||
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
},
|
||||
resolve: {
|
||||
groupData: ['$stateParams', 'GroupsService', function($stateParams, GroupsService) {
|
||||
return GroupsService.get({ id: $stateParams.group_id }).then(res => res.data.results[0]);
|
||||
return GroupsService.get({ id: $stateParams.group_id }).then(response => response.data.results[0]);
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,9 +19,7 @@ export default {
|
||||
},
|
||||
resolve: {
|
||||
host: ['$stateParams', 'HostsService', function($stateParams, HostsService) {
|
||||
return HostsService.get({ id: $stateParams.host_id }).then(function(res) {
|
||||
return res.data.results[0];
|
||||
});
|
||||
return HostsService.get({ id: $stateParams.host_id }).then((response) => response.data.results[0]);
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,9 +58,7 @@ export default {
|
||||
],
|
||||
host: ['$stateParams', 'HostsService', function($stateParams, HostsService) {
|
||||
if($stateParams.host_id){
|
||||
return HostsService.get({ id: $stateParams.host_id }).then(function(res) {
|
||||
return res.data.results[0];
|
||||
});
|
||||
return HostsService.get({ id: $stateParams.host_id }).then((res) => res.data.results[0]);
|
||||
}
|
||||
}],
|
||||
inventoryData: ['InventoriesService', '$stateParams', 'host', function(InventoriesService, $stateParams, host) {
|
||||
|
||||
@@ -322,8 +322,8 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
||||
} else {
|
||||
params.source = null;
|
||||
}
|
||||
SourcesService.post(params).then(function(res){
|
||||
let inventory_source_id = res.data.id;
|
||||
SourcesService.post(params).then((response) => {
|
||||
let inventory_source_id = response.data.id;
|
||||
$state.go('^.edit', {inventory_source_id: inventory_source_id}, {reload: true});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -21,13 +21,11 @@ export default {
|
||||
},
|
||||
resolve: {
|
||||
inventorySourceData: ['$stateParams', 'SourcesService', function($stateParams, SourcesService) {
|
||||
return SourcesService.get({id: $stateParams.inventory_source_id }).then(res => res.data.results[0]);
|
||||
return SourcesService.get({id: $stateParams.inventory_source_id }).then(response => response.data.results[0]);
|
||||
}],
|
||||
inventorySourcesOptions: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
|
||||
return InventoriesService.inventorySourcesOptions($stateParams.inventory_id)
|
||||
.then(function(res) {
|
||||
return res.data;
|
||||
});
|
||||
.then((response) => response.data);
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
let path = GetBasePath('inventory') + $stateParams.inventory_id + '/inventory_sources';
|
||||
|
||||
qs.search(path, $state.params[`${list.iterator}_search`])
|
||||
.then(function(searchResponse) {
|
||||
.then((searchResponse)=> {
|
||||
$scope[`${list.iterator}_dataset`] = searchResponse.data;
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
_.forEach($scope[list.name], buildStatusIndicators);
|
||||
|
||||
@@ -40,7 +40,7 @@ export default {
|
||||
},
|
||||
resolve: {
|
||||
inventorySourceOptions: ['SourcesService', (SourcesService) => {
|
||||
return SourcesService.options().then(res => res.data.actions.GET);
|
||||
return SourcesService.options().then(response => response.data.actions.GET);
|
||||
}],
|
||||
Dataset: ['SourcesListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
|
||||
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
|
||||
|
||||
@@ -1,137 +1,137 @@
|
||||
export default
|
||||
['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){
|
||||
return {
|
||||
stringifyParams: function(params){
|
||||
return _.reduce(params, (result, value, key) => {
|
||||
return result + key + '=' + value + '&';
|
||||
}, '');
|
||||
},
|
||||
// cute abstractions via fn.bind()
|
||||
url: function(){
|
||||
return '';
|
||||
},
|
||||
error: function(data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Call to ' + this.url + '. GET returned: ' + status });
|
||||
},
|
||||
success: function(data){
|
||||
return data;
|
||||
},
|
||||
// HTTP methods
|
||||
get: function(params){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
post: function(inventory_source){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources');
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(inventory_source)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
put: function(inventory_source){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + inventory_source.id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.put(inventory_source)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
delete: function(id){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.destroy()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
options: function(){
|
||||
this.url = GetBasePath('inventory_sources');
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.options()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this));
|
||||
},
|
||||
getCredential: function(id){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('credentials') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
getInventorySource: function(params){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
putInventorySource: function(params, url){
|
||||
Wait('start');
|
||||
this.url = url;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.put(params)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
// these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level
|
||||
associateGroup: function(group, target){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('groups') + target + '/children/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(group)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
disassociateGroup: function(group, parent){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('groups') + parent + '/children/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post({id: group, disassociate: 1})
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
promote: function(group, inventory){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory') + inventory + '/groups/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post({id: group, disassociate: 1})
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
encodeGroupBy(source, group_by){
|
||||
source = source && source.value ? source.value : '';
|
||||
if(source === 'ec2'){
|
||||
return _.map(group_by, 'value').join(',');
|
||||
}
|
||||
if(source === 'vmware'){
|
||||
group_by = _.map(group_by, (i) => {return i.value;});
|
||||
$("#inventory_source_group_by").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||
group_by.push(option.title);
|
||||
});
|
||||
group_by = (Array.isArray(group_by)) ? _.uniq(group_by).join() : "";
|
||||
return group_by;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){
|
||||
return {
|
||||
stringifyParams: function(params){
|
||||
return _.reduce(params, (result, value, key) => {
|
||||
return result + key + '=' + value + '&';
|
||||
}, '');
|
||||
},
|
||||
// cute abstractions via fn.bind()
|
||||
url: function(){
|
||||
return '';
|
||||
},
|
||||
error: function(data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Call to ' + this.url + '. GET returned: ' + status });
|
||||
},
|
||||
success: function(data){
|
||||
return data;
|
||||
},
|
||||
// HTTP methods
|
||||
get: function(params){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
post: function(inventory_source){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources');
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(inventory_source)
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
put: function(inventory_source){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + inventory_source.id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.put(inventory_source)
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
delete: function(id){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.destroy()
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
options: function(){
|
||||
this.url = GetBasePath('inventory_sources');
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.options()
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this));
|
||||
},
|
||||
getCredential: function(id){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('credentials') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
getInventorySource: function(params){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
putInventorySource: function(params, url){
|
||||
Wait('start');
|
||||
this.url = url;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.put(params)
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
// these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level
|
||||
associateGroup: function(group, target){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('groups') + target + '/children/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(group)
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
disassociateGroup: function(group, parent){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('groups') + parent + '/children/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post({id: group, disassociate: 1})
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
promote: function(group, inventory){
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory') + inventory + '/groups/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post({id: group, disassociate: 1})
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
encodeGroupBy(source, group_by){
|
||||
source = source && source.value ? source.value : '';
|
||||
if(source === 'ec2'){
|
||||
return _.map(group_by, 'value').join(',');
|
||||
}
|
||||
};
|
||||
}];
|
||||
if(source === 'vmware'){
|
||||
group_by = _.map(group_by, (i) => {return i.value;});
|
||||
$("#inventory_source_group_by").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||
group_by.push(option.title);
|
||||
});
|
||||
group_by = (Array.isArray(group_by)) ? _.uniq(group_by).join() : "";
|
||||
return group_by;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
}];
|
||||
@@ -23,8 +23,8 @@ export default
|
||||
this.url = GetBasePath('groups') + '?' + this.stringifyParams(params);
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
post: function(group){
|
||||
@@ -32,8 +32,8 @@ export default
|
||||
this.url = GetBasePath('groups');
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(group)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
put: function(group){
|
||||
@@ -41,8 +41,8 @@ export default
|
||||
this.url = GetBasePath('groups') + group.id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.put(group)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
delete: function(id){
|
||||
@@ -50,8 +50,8 @@ export default
|
||||
this.url = GetBasePath('groups') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.destroy()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
getCredential: function(id){
|
||||
@@ -59,8 +59,8 @@ export default
|
||||
this.url = GetBasePath('credentials') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
getInventorySource: function(params){
|
||||
@@ -68,8 +68,8 @@ export default
|
||||
this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
putInventorySource: function(params, url){
|
||||
@@ -77,8 +77,8 @@ export default
|
||||
this.url = url;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.put(params)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
// these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level
|
||||
@@ -87,8 +87,8 @@ export default
|
||||
this.url = GetBasePath('groups') + target + '/children/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(group)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
disassociateGroup: function(group, parent){
|
||||
@@ -96,8 +96,8 @@ export default
|
||||
this.url = GetBasePath('groups') + parent + '/children/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post({id: group, disassociate: 1})
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
associateHost: function(host, target){
|
||||
@@ -105,8 +105,8 @@ export default
|
||||
this.url = GetBasePath('groups') + target + '/hosts/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(host)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
disassociateHost: function(host, group){
|
||||
@@ -114,8 +114,8 @@ export default
|
||||
this.url = GetBasePath('groups') + group + '/hosts/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post({id: host, disassociate: 1})
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
promote: function(group, inventory){
|
||||
@@ -123,8 +123,8 @@ export default
|
||||
this.url = GetBasePath('inventory') + inventory + '/groups/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post({id: group, disassociate: 1})
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
this.url = GetBasePath('hosts') + '?' + this.stringifyParams(params);
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
post: function(host){
|
||||
@@ -39,8 +39,8 @@
|
||||
this.url = GetBasePath('hosts');
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.post(host)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
put: function(host){
|
||||
@@ -48,8 +48,8 @@
|
||||
this.url = GetBasePath('hosts') + host.id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.put(host)
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
delete: function(id){
|
||||
@@ -57,8 +57,8 @@
|
||||
this.url = GetBasePath('hosts') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.destroy()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
this.url = GetBasePath('inventory') + id;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
getBreadcrumbs: function(groups){
|
||||
@@ -36,8 +36,8 @@
|
||||
}).join('');
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this))
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
},
|
||||
rootHostsUrl: function(id){
|
||||
@@ -60,22 +60,22 @@
|
||||
this.url = GetBasePath('inventory') + inventoryId + '/inventory_sources';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.options()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this));
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this));
|
||||
},
|
||||
updateInventorySourcesGet: function(inventoryId) {
|
||||
this.url = GetBasePath('inventory') + inventoryId + '/update_inventory_sources';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this));
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this));
|
||||
},
|
||||
getHost: function(inventoryId, hostId) {
|
||||
this.url = GetBasePath('inventory') + inventoryId + '/hosts?id=' + hostId;
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.get()
|
||||
.then(this.then.bind(this))
|
||||
.catch(this.catch.bind(this));
|
||||
.then(this.success.bind(this))
|
||||
.catch(this.error.bind(this));
|
||||
}
|
||||
};
|
||||
}];
|
||||
|
||||
@@ -19,8 +19,7 @@ var hostEventModal = {
|
||||
hostEvent: ['jobResultsService', '$stateParams', function(jobResultsService, $stateParams) {
|
||||
return jobResultsService.getRelatedJobEvents($stateParams.id, {
|
||||
id: $stateParams.eventId
|
||||
}).then(function(res) {
|
||||
return res.data.results[0]; });
|
||||
}).then((response) => response.data.results[0]);
|
||||
}]
|
||||
},
|
||||
onExit: function() {
|
||||
|
||||
@@ -239,8 +239,8 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo
|
||||
url = url + id + '/job_events/?' + this.stringifyParams(params);
|
||||
Rest.setUrl(url);
|
||||
return Rest.get()
|
||||
.then(({data}) => {
|
||||
return data;
|
||||
.then((response) => {
|
||||
return response;
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||
|
||||
@@ -179,26 +179,26 @@ export default
|
||||
|
||||
if ($scope.has_other_prompts) {
|
||||
Rest.options()
|
||||
.success(options => {
|
||||
.then(options => {
|
||||
if ($scope.ask_job_type_on_launch) {
|
||||
let choices = getChoices(options, 'actions.POST.job_type.choices');
|
||||
let choices = getChoices(options.data, 'actions.POST.job_type.choices');
|
||||
let initialValue = _.get(data, 'defaults.job_type');
|
||||
let initialChoice = getChoiceFromValue(choices, initialValue);
|
||||
$scope.other_prompt_data.job_type_options = choices;
|
||||
$scope.other_prompt_data.job_type = initialChoice;
|
||||
}
|
||||
if ($scope.ask_verbosity_on_launch) {
|
||||
let choices = getChoices(options, 'actions.POST.verbosity.choices');
|
||||
let choices = getChoices(options.data, 'actions.POST.verbosity.choices');
|
||||
let initialValue = _.get(data, 'defaults.verbosity');
|
||||
let initialChoice = getChoiceFromValue(choices, initialValue);
|
||||
$scope.other_prompt_data.verbosity_options = choices;
|
||||
$scope.other_prompt_data.verbosity = initialChoice;
|
||||
}
|
||||
})
|
||||
.error((err, status) => {
|
||||
ProcessErrors($scope, err, status, null, {
|
||||
.catch((error) => {
|
||||
ProcessErrors($scope, error.data, error.status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: `Failed to get ${launch_url}. OPTIONS status: ${status}`
|
||||
msg: `Failed to get ${launch_url}. OPTIONS status: ${error.status}`
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -260,7 +260,8 @@ export default
|
||||
// Go out and get the credential types
|
||||
Rest.setUrl(GetBasePath('credential_types'));
|
||||
Rest.get()
|
||||
.success(function (credentialTypeData) {
|
||||
.then( (response) => {
|
||||
let credentialTypeData = response.data;
|
||||
let credential_types = {};
|
||||
$scope.credentialTypeOptions = [];
|
||||
credentialTypeData.results.forEach((credentialType => {
|
||||
@@ -273,6 +274,9 @@ export default
|
||||
}
|
||||
}));
|
||||
$scope.credential_types = credential_types;
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
// Figure out which step the user needs to start on
|
||||
@@ -296,7 +300,8 @@ export default
|
||||
// Go out and get some of the job details like inv, cred, name
|
||||
Rest.setUrl(GetBasePath('jobs') + $scope.submitJobId);
|
||||
Rest.get()
|
||||
.success(function (jobResultData) {
|
||||
.then( (response) => {
|
||||
let jobResultData = response.data;
|
||||
$scope.job_template_data = {
|
||||
name: jobResultData.name
|
||||
};
|
||||
|
||||
@@ -21,8 +21,8 @@ export default
|
||||
var data = license;
|
||||
data.eula_accepted = eula;
|
||||
return Rest.post(JSON.stringify(data))
|
||||
.success(function(res){
|
||||
return res;
|
||||
.then((response) =>{
|
||||
return response.data;
|
||||
})
|
||||
.catch(({res, status}) => {
|
||||
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
|
||||
|
||||
@@ -141,7 +141,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
})
|
||||
}, 5000);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -71,10 +71,10 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
|
||||
var notifier_url = url + id + column;
|
||||
Rest.setUrl(notifier_url);
|
||||
Rest.get()
|
||||
.success( function(data, i, j, obj) {
|
||||
var type = (obj.url.indexOf('success')>0) ? "notification_templates_success" : "notification_templates_error";
|
||||
if (data.results) {
|
||||
_.forEach(data.results, function(result){
|
||||
.then(function(response) {
|
||||
var type = (url.indexOf('success')>0) ? "notification_templates_success" : "notification_templates_error";
|
||||
if (response.data.results) {
|
||||
_.forEach(response.data.results, function(result){
|
||||
_.forEach(scope.notifications, function(notification){
|
||||
if(notification.id === result.id){
|
||||
notification[type] = true;
|
||||
|
||||
@@ -84,17 +84,17 @@ export default ['$scope', '$rootScope',
|
||||
$scope.copyTemplate = function(id) {
|
||||
Wait('start');
|
||||
TemplateCopyService.get(id)
|
||||
.success(function(res){
|
||||
TemplateCopyService.set(res)
|
||||
.success(function(res){
|
||||
Wait('stop');
|
||||
if(res.type && res.type === 'job_template') {
|
||||
$state.go('templates.editJobTemplate', {job_template_id: res.id}, {reload: true});
|
||||
}
|
||||
});
|
||||
.then((data) => {
|
||||
TemplateCopyService.set(data.results)
|
||||
.then((results) => {
|
||||
Wait('stop');
|
||||
if(results.type && results.type === 'job_template') {
|
||||
$state.go('templates.editJobTemplate', {job_template_id: results.id}, {reload: true});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(({res, status}) => {
|
||||
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors($rootScope, data, status, null, {hdr: 'Error!',
|
||||
msg: 'Call failed. Return status: '+ status});
|
||||
});
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export default
|
||||
ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){
|
||||
let path = `${GetBasePath('job_templates')}${$stateParams.id}`;
|
||||
Rest.setUrl(path);
|
||||
return Rest.get(path).then((res) => res.data);
|
||||
return Rest.get(path).then(response => response.data)
|
||||
}],
|
||||
UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
|
||||
function(Rest, GetBasePath, $stateParams, $q) {
|
||||
@@ -152,7 +152,7 @@ export default
|
||||
ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){
|
||||
let path = `${GetBasePath('workflow_job_templates')}${$stateParams.id}`;
|
||||
Rest.setUrl(path);
|
||||
return Rest.get(path).then((res) => res.data);
|
||||
return Rest.get(path).then(response => response.data)
|
||||
}],
|
||||
UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
|
||||
function(Rest, GetBasePath, $stateParams, $q) {
|
||||
@@ -242,7 +242,7 @@ export default
|
||||
ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){
|
||||
let path = `${GetBasePath('projects')}${$stateParams.id}`;
|
||||
Rest.setUrl(path);
|
||||
return Rest.get(path).then((res) => res.data);
|
||||
return Rest.get(path).then(response => response.data)
|
||||
}],
|
||||
UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
|
||||
function(Rest, GetBasePath, $stateParams, $q) {
|
||||
|
||||
@@ -27,7 +27,7 @@ export default ['$filter', '$state', '$stateParams', 'AddSchedule', 'Wait',
|
||||
|
||||
/*
|
||||
* This is a workaround for the angular-scheduler library inserting `ll` into fields after an
|
||||
* invalid entry and never unsetting them. Presumably null is being truncated down to 2 chars
|
||||
* invalid entry and never unsetting them. Presumably null is being truncated down to 2 chars
|
||||
* in that case.
|
||||
*
|
||||
* Because this same problem exists in the edit mode and because there's no inheritence, this
|
||||
|
||||
@@ -22,8 +22,7 @@ export default
|
||||
if (data.actions.POST) {
|
||||
canAddVal.resolve({canAdd: true, options: data});
|
||||
} else {
|
||||
canAddVal.reject(false);
|
||||
}
|
||||
canAddVal.resolve({canAdd: false}) }
|
||||
Wait("stop");
|
||||
});
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ export default
|
||||
self.socket.onopen = function () {
|
||||
$log.debug("Websocket connection opened. Socket readyState: " + self.socket.readyState);
|
||||
socketPromise.resolve();
|
||||
console.log('promise resolved, and readyState: '+ self.readyState);
|
||||
self.checkStatus();
|
||||
if(needsResubscribing){
|
||||
self.subscribe(self.getLast());
|
||||
@@ -116,6 +117,7 @@ export default
|
||||
if(this.socket){
|
||||
this.socket.close();
|
||||
delete this.socket;
|
||||
console.log("Socket deleted: "+this.socket);
|
||||
}
|
||||
},
|
||||
subscribe: function(state){
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
var defaultUrl = GetBasePath('job_templates') + '?id=' + id;
|
||||
Rest.setUrl(defaultUrl);
|
||||
return Rest.get()
|
||||
.success(function(res){
|
||||
return res;
|
||||
})
|
||||
.catch(({res, status}) => {
|
||||
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
|
||||
.then(response => response)
|
||||
.catch((error) => {
|
||||
ProcessErrors($rootScope, error.response, error.status, null, {hdr: 'Error!',
|
||||
msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status});
|
||||
});
|
||||
},
|
||||
@@ -25,25 +23,25 @@
|
||||
return Rest.get();
|
||||
},
|
||||
copySurvey: function(source, target){
|
||||
return this.getSurvey(source.related.survey_spec).success( (data) => {
|
||||
return this.getSurvey(source.related.survey_spec).then( (response) => {
|
||||
Rest.setUrl(target.related.survey_spec);
|
||||
return Rest.post(data);
|
||||
return Rest.post(response.data);
|
||||
});
|
||||
},
|
||||
set: function(data){
|
||||
set: function(results){
|
||||
var defaultUrl = GetBasePath('job_templates');
|
||||
var self = this;
|
||||
Rest.setUrl(defaultUrl);
|
||||
var name = this.buildName(data.results[0].name);
|
||||
data.results[0].name = name + ' @ ' + moment().format('h:mm:ss a'); // 2:49:11 pm
|
||||
return Rest.post(data.results[0])
|
||||
.success(function(job_template_res){
|
||||
var name = this.buildName(results[0].name);
|
||||
results[0].name = name + ' @ ' + moment().format('h:mm:ss a'); // 2:49:11 pm
|
||||
return Rest.post(results[0])
|
||||
.then((response) => {
|
||||
// also copy any associated survey_spec
|
||||
if (data.results[0].summary_fields.survey){
|
||||
return self.copySurvey(data.results[0], job_template_res).success( () => job_template_res);
|
||||
if (results[0].summary_fields.survey){
|
||||
return self.copySurvey(results[0], response.data).then( () => response.data);
|
||||
}
|
||||
else{
|
||||
return job_template_res;
|
||||
else {
|
||||
return response.data;
|
||||
}
|
||||
})
|
||||
.catch(({res, status}) => {
|
||||
|
||||
@@ -98,7 +98,8 @@ export default
|
||||
jobTemplateLoadFinished();
|
||||
}
|
||||
})
|
||||
.error(function (ret,status_code) {
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
if (status_code === 403) {
|
||||
/* user doesn't have access to see the project, no big deal. */
|
||||
$scope.disablePlaybookBecausePermissionDenied = true;
|
||||
@@ -142,7 +143,10 @@ export default
|
||||
$q.all(promises)
|
||||
.then(function(){
|
||||
Wait('stop');
|
||||
});
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -423,7 +427,6 @@ export default
|
||||
|
||||
$scope.$emit('jobTemplateLoaded', master);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -202,17 +202,21 @@ export default ['$scope', '$rootScope',
|
||||
if(template.type && template.type === 'job_template') {
|
||||
Wait('start');
|
||||
TemplateCopyService.get(template.id)
|
||||
.success(function(res){
|
||||
TemplateCopyService.set(res)
|
||||
.success(function(res){
|
||||
.then(function(response){
|
||||
TemplateCopyService.set(response.data.results)
|
||||
.then(function(results){
|
||||
Wait('stop');
|
||||
if(res.type && res.type === 'job_template') {
|
||||
$state.go('templates.editJobTemplate', {job_template_id: res.id}, {reload: true});
|
||||
if(results.type && results.type === 'job_template') {
|
||||
$state.go('templates.editJobTemplate', {job_template_id: results.id}, {reload: true});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(({res, status}) => {
|
||||
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
|
||||
})
|
||||
.catch((error)=> {
|
||||
console.log(error);
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
ProcessErrors($rootScope, error, status, null, {hdr: 'Error!',
|
||||
msg: 'Call failed. Return status: '+ status});
|
||||
});
|
||||
}
|
||||
|
||||
0
awx/ui/npm-debug.log.1254872885
Normal file
0
awx/ui/npm-debug.log.1254872885
Normal file
0
awx/ui/npm-debug.log.3063400582
Normal file
0
awx/ui/npm-debug.log.3063400582
Normal file
@@ -32,7 +32,7 @@
|
||||
"production": "webpack --config build/webpack.production.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"angular-mocks": "~1.4.14",
|
||||
"angular-mocks": "~1.6.6",
|
||||
"axios": "^0.16.2",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-istanbul": "^0.12.2",
|
||||
@@ -95,14 +95,13 @@
|
||||
"angular": "~1.6.6",
|
||||
"angular-breadcrumb": "git+https://git@github.com/ansible/angular-breadcrumb#0.4.1",
|
||||
"angular-codemirror": "git+https://git@github.com/ansible/angular-codemirror#1.0.4",
|
||||
"angular-cookies": "~1.4.14",
|
||||
"angular-cookies": "~1.6.6",
|
||||
"angular-drag-and-drop-lists": "git+https://git@github.com/ansible/angular-drag-and-drop-lists#1.4.0",
|
||||
"angular-duration-format": "^1.0.1",
|
||||
"angular-gettext": "^2.3.5",
|
||||
"angular-md5": "^0.1.8",
|
||||
"angular-moment": "^0.10.1",
|
||||
"angular-resource": "~1.4.14",
|
||||
"angular-sanitize": "~1.4.14",
|
||||
"angular-sanitize": "~1.6.6",
|
||||
"angular-scheduler": "git+https://git@github.com/ansible/angular-scheduler#0.1.1",
|
||||
"angular-tz-extensions": "git+https://git@github.com/ansible/angular-tz-extensions#0.3.13",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
|
||||
0
npm-debug.log.1381475670
Normal file
0
npm-debug.log.1381475670
Normal file
0
npm-debug.log.2251662136
Normal file
0
npm-debug.log.2251662136
Normal file
Reference in New Issue
Block a user