mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-04 16:01:51 -05:00
jshint fixes
This commit is contained in:
@@ -86,4 +86,4 @@ export default function() {
|
||||
|
||||
chartModel.update();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,48 +1,47 @@
|
||||
HostCountGraphData.$inject =
|
||||
export default
|
||||
[ "Rest",
|
||||
"GetBasePath",
|
||||
"ProcessErrors",
|
||||
"$q"
|
||||
]
|
||||
"$q",
|
||||
HostCountGraphData
|
||||
];
|
||||
|
||||
export default
|
||||
function HostCountGraphData(Rest, getBasePath, processErrors, $q) {
|
||||
function HostCountGraphData(Rest, getBasePath, processErrors, $q) {
|
||||
|
||||
function pluck(property, promise) {
|
||||
return promise.then(function(value) {
|
||||
return value[property];
|
||||
});
|
||||
}
|
||||
|
||||
function getLicenseData() {
|
||||
var url = getBasePath('config');
|
||||
Rest.setUrl(url);
|
||||
return Rest.get()
|
||||
.then(function (data){
|
||||
var license = data.data.license_info.instance_count;
|
||||
return license;
|
||||
});
|
||||
}
|
||||
|
||||
function getHostData() {
|
||||
var url = getBasePath('dashboard')+'graphs/inventory/';
|
||||
Rest.setUrl(url);
|
||||
return pluck('data', Rest.get());
|
||||
}
|
||||
|
||||
return {
|
||||
get: function() {
|
||||
return $q.all({
|
||||
license: getLicenseData(),
|
||||
hosts: getHostData()
|
||||
}).catch(function (response) {
|
||||
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
|
||||
processErrors(null, response.data, response.status, null, { hdr: 'Error!',
|
||||
msg: errorMessage
|
||||
});
|
||||
return response;
|
||||
return $q.reject(response);
|
||||
});
|
||||
}
|
||||
};
|
||||
function pluck(property, promise) {
|
||||
return promise.then(function(value) {
|
||||
return value[property];
|
||||
});
|
||||
}
|
||||
|
||||
function getLicenseData() {
|
||||
var url = getBasePath('config');
|
||||
Rest.setUrl(url);
|
||||
return Rest.get()
|
||||
.then(function (data){
|
||||
var license = data.data.license_info.instance_count;
|
||||
return license;
|
||||
});
|
||||
}
|
||||
|
||||
function getHostData() {
|
||||
var url = getBasePath('dashboard')+'graphs/inventory/';
|
||||
Rest.setUrl(url);
|
||||
return pluck('data', Rest.get());
|
||||
}
|
||||
|
||||
return {
|
||||
get: function() {
|
||||
return $q.all({
|
||||
license: getLicenseData(),
|
||||
hosts: getHostData()
|
||||
}).catch(function (response) {
|
||||
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
|
||||
processErrors(null, response.data, response.status, null, { hdr: 'Error!',
|
||||
msg: errorMessage
|
||||
});
|
||||
return $q.reject(response);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,54 +6,54 @@ export default
|
||||
"$q",
|
||||
JobStatusGraphData];
|
||||
|
||||
function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) {
|
||||
function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) {
|
||||
|
||||
function pluck(property, promise) {
|
||||
return promise.then(function(value) {
|
||||
return value[property];
|
||||
});
|
||||
}
|
||||
|
||||
function getData(period, jobType) {
|
||||
var url = getBasePath('dashboard')+'graphs/jobs/?period='+period+'&job_type='+jobType;
|
||||
Rest.setUrl(url);
|
||||
var result = Rest.get()
|
||||
.catch(function(response) {
|
||||
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
|
||||
|
||||
processErrors(null,
|
||||
response.data,
|
||||
response.status,
|
||||
null, {
|
||||
hdr: 'Error!',
|
||||
msg: errorMessage
|
||||
});
|
||||
return $q.reject(response);
|
||||
});
|
||||
|
||||
return pluck('data', result);
|
||||
}
|
||||
|
||||
return {
|
||||
destroyWatcher: angular.noop,
|
||||
setupWatcher: function(period, jobType) {
|
||||
this.destroyWatcher =
|
||||
$rootScope.$on('JobStatusChange', function() {
|
||||
getData(period, jobType).then(function(result) {
|
||||
$rootScope.
|
||||
$broadcast('DataReceived:JobStatusGraph',
|
||||
result);
|
||||
return result;
|
||||
});
|
||||
});
|
||||
},
|
||||
get: function(period, jobType) {
|
||||
|
||||
this.destroyWatcher();
|
||||
this.setupWatcher(period, jobType);
|
||||
|
||||
return getData(period, jobType);
|
||||
|
||||
}
|
||||
};
|
||||
function pluck(property, promise) {
|
||||
return promise.then(function(value) {
|
||||
return value[property];
|
||||
});
|
||||
}
|
||||
|
||||
function getData(period, jobType) {
|
||||
var url = getBasePath('dashboard')+'graphs/jobs/?period='+period+'&job_type='+jobType;
|
||||
Rest.setUrl(url);
|
||||
var result = Rest.get()
|
||||
.catch(function(response) {
|
||||
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
|
||||
|
||||
processErrors(null,
|
||||
response.data,
|
||||
response.status,
|
||||
null, {
|
||||
hdr: 'Error!',
|
||||
msg: errorMessage
|
||||
});
|
||||
return $q.reject(response);
|
||||
});
|
||||
|
||||
return pluck('data', result);
|
||||
}
|
||||
|
||||
return {
|
||||
destroyWatcher: angular.noop,
|
||||
setupWatcher: function(period, jobType) {
|
||||
this.destroyWatcher =
|
||||
$rootScope.$on('JobStatusChange', function() {
|
||||
getData(period, jobType).then(function(result) {
|
||||
$rootScope.
|
||||
$broadcast('DataReceived:JobStatusGraph',
|
||||
result);
|
||||
return result;
|
||||
});
|
||||
});
|
||||
},
|
||||
get: function(period, jobType) {
|
||||
|
||||
this.destroyWatcher();
|
||||
this.setupWatcher(period, jobType);
|
||||
|
||||
return getData(period, jobType);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user