mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-06 16:32:01 -05:00
event processing for details panel and initial stats bar integration
This commit is contained in:
@@ -23,26 +23,54 @@ function postRelaunch (params) {
|
||||
return $http(req);
|
||||
}
|
||||
|
||||
function getStats () {
|
||||
if (!this.has('GET', 'id')) {
|
||||
return Promise.reject(new Error('No property, id, exists'));
|
||||
}
|
||||
|
||||
if (!this.has('GET', 'related.job_events')) {
|
||||
return Promise.reject(new Error('No related property, job_events, exists'));
|
||||
}
|
||||
|
||||
const req = {
|
||||
method: 'GET',
|
||||
url: `${this.path}${this.get('id')}/job_events/`,
|
||||
params: { event: 'playbook_on_stats' },
|
||||
};
|
||||
|
||||
return $http(req)
|
||||
.then(({ data }) => {
|
||||
if (data.results.length > 0) {
|
||||
return data.results[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function JobModel (method, resource, config) {
|
||||
BaseModel.call(this, 'jobs');
|
||||
|
||||
this.Constructor = JobModel;
|
||||
|
||||
this.postRelaunch = postRelaunch.bind(this);
|
||||
this.getRelaunch = getRelaunch.bind(this);
|
||||
this.getStats = getStats.bind(this);
|
||||
|
||||
return this.create(method, resource, config);
|
||||
}
|
||||
|
||||
function JobModelLoader (_BaseModel_, _$http_) {
|
||||
BaseModel = _BaseModel_;
|
||||
function JobModelLoader (_$http_, _BaseModel_) {
|
||||
$http = _$http_;
|
||||
BaseModel = _BaseModel_;
|
||||
|
||||
return JobModel;
|
||||
}
|
||||
|
||||
JobModelLoader.$inject = [
|
||||
'$http',
|
||||
'BaseModel',
|
||||
'$http'
|
||||
];
|
||||
|
||||
export default JobModelLoader;
|
||||
|
||||
@@ -1,19 +1,54 @@
|
||||
let $http;
|
||||
let BaseModel;
|
||||
|
||||
function getStats () {
|
||||
if (!this.has('GET', 'id')) {
|
||||
return Promise.reject(new Error('No property, id, exists'));
|
||||
}
|
||||
|
||||
if (!this.has('GET', 'related.events')) {
|
||||
return Promise.reject(new Error('No related property, events, exists'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
const req = {
|
||||
method: 'GET',
|
||||
url: `${this.path}${this.get('id')}/events/`,
|
||||
params: { event: 'playbook_on_stats' },
|
||||
};
|
||||
|
||||
return $http(req)
|
||||
.then(({ data }) => {
|
||||
console.log(data);
|
||||
if (data.results.length > 0) {
|
||||
return data.results[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
})
|
||||
}
|
||||
|
||||
function ProjectUpdateModel (method, resource, config) {
|
||||
BaseModel.call(this, 'project_updates');
|
||||
|
||||
this.getStats = getStats;
|
||||
|
||||
this.Constructor = ProjectUpdateModel;
|
||||
|
||||
return this.create(method, resource, config);
|
||||
}
|
||||
|
||||
function ProjectUpdateModelLoader (_BaseModel_) {
|
||||
function ProjectUpdateModelLoader (_$http_, _BaseModel_) {
|
||||
$http = _$http_;
|
||||
BaseModel = _BaseModel_;
|
||||
|
||||
return ProjectUpdateModel;
|
||||
}
|
||||
|
||||
ProjectUpdateModelLoader.$inject = ['BaseModel'];
|
||||
ProjectUpdateModelLoader.$inject = [
|
||||
'$http',
|
||||
'BaseModel'
|
||||
];
|
||||
|
||||
export default ProjectUpdateModelLoader;
|
||||
|
||||
Reference in New Issue
Block a user