mirror of
https://github.com/ansible/awx.git
synced 2026-03-15 16:07:30 -02:30
Dashboard
Fixing Rest error handling
This commit is contained in:
@@ -18,7 +18,7 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities'])
|
|||||||
target = params.target,
|
target = params.target,
|
||||||
//dashboard = params.dashboard,
|
//dashboard = params.dashboard,
|
||||||
|
|
||||||
html, element, url, license;
|
html, element, url, license, url;
|
||||||
|
|
||||||
|
|
||||||
html = "<div class=\"graph-container\">\n";
|
html = "<div class=\"graph-container\">\n";
|
||||||
@@ -33,17 +33,18 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities'])
|
|||||||
element = angular.element(document.getElementById(target));
|
element = angular.element(document.getElementById(target));
|
||||||
element.html(html);
|
element.html(html);
|
||||||
$compile(element)(scope);
|
$compile(element)(scope);
|
||||||
|
|
||||||
|
url = GetBasePath('config');
|
||||||
|
|
||||||
Rest.setUrl(GetBasePath('config'));
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function (data){
|
.success(function (data){
|
||||||
license = data.license_info.available_instances;
|
license = data.license_info.available_instances;
|
||||||
scope.$emit('licenseCountReady', license);
|
scope.$emit('licenseCountReady', license);
|
||||||
|
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
//Wait('stWaitop');
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard graph data: ' + status });
|
msg: 'Failed to get: ' + url + ' GET returned: ' + status });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -51,14 +52,15 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities'])
|
|||||||
scope.removeLicenseCountReady();
|
scope.removeLicenseCountReady();
|
||||||
}
|
}
|
||||||
scope.removeLicenseCountReady = scope.$on('licenseCountReady', function (e, license) {
|
scope.removeLicenseCountReady = scope.$on('licenseCountReady', function (e, license) {
|
||||||
Rest.setUrl(GetBasePath('dashboard')+'graphs/');
|
url = GetBasePath('dashboard')+'graphs/';
|
||||||
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
scope.$emit('hostDataReady', data, license);
|
scope.$emit('hostDataReady', data, license);
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
//Wait('stWaitop');
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get license info ' + status });
|
msg: 'Failed to get: ' + url + ' GET returned: ' + status });
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -68,7 +70,7 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities'])
|
|||||||
}
|
}
|
||||||
scope.removeHostDataReady = scope.$on('hostDataReady', function (e, data, license) {
|
scope.removeHostDataReady = scope.$on('hostDataReady', function (e, data, license) {
|
||||||
|
|
||||||
url = GetBasePath('dashboard')+'graphs/';
|
//url = GetBasePath('dashboard')+'graphs/';
|
||||||
var graphData = [
|
var graphData = [
|
||||||
{
|
{
|
||||||
"key" : "Hosts" ,
|
"key" : "Hosts" ,
|
||||||
|
|||||||
Reference in New Issue
Block a user