treeherder/ui/models/jobLogUrl.js

23 строки
690 B
JavaScript

import { createQueryParams, getProjectUrl } from '../helpers/url';
const uri = getProjectUrl('/job-log-url/');
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) => {
const buildUrl = elem.url.slice(0, elem.url.lastIndexOf('/')) + '/';
elem.buildUrl = buildUrl;
return new JobLogUrlModel(elem);
})
)));
}
}