2018-06-14 03:20:42 +03:00
|
|
|
import { createQueryParams, getProjectUrl } from '../helpers/url';
|
2018-05-25 20:32:21 +03:00
|
|
|
|
2018-06-14 03:20:42 +03:00
|
|
|
const uri = getProjectUrl('/job-log-url/');
|
2018-05-25 20:32:21 +03:00
|
|
|
|
|
|
|
export default class JobLogUrlModel {
|
|
|
|
constructor(data) {
|
|
|
|
Object.assign(this, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// the options parameter is used to filter/limit the list of objects
|
|
|
|
// ``signal`` is an AbortController signal.
|
|
|
|
static getList(options, signal) {
|
|
|
|
return fetch(`${uri}${createQueryParams(options)}`, { signal })
|
|
|
|
.then(resp => resp.json().then(data => (
|
|
|
|
data.map((elem) => {
|
2018-06-14 03:20:42 +03:00
|
|
|
const buildUrl = elem.url.slice(0, elem.url.lastIndexOf('/')) + '/';
|
2018-05-25 20:32:21 +03:00
|
|
|
elem.buildUrl = buildUrl;
|
|
|
|
return new JobLogUrlModel(elem);
|
|
|
|
})
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
}
|