UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

83 lines 2.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var redux_rx_http_1 = require("redux-rx-http"); exports.FETCH_JOBS_BY_STATUS = redux_rx_http_1.createRxHttpActionTypes('FETCH_JOBS_BY_STATUS'); exports.SET_JOB_STATUS_BY_ID = 'SET_JOB_STATUS_BY_ID'; exports.SET_JOB_STATUSES_BY_ID_BATCH = 'SET_JOB_STATUSES_BY_ID_BATCH'; exports.SET_JOB_STATUS_SEARCH = 'SET_JOB_STATUS_SEARCH'; exports.CHANGE_JOB_STATUS = 'CHANGE_JOB_STATUS'; /** * Retrieve a list of jobs by status * Every search has a searchKey which allows you to save * the query params in the state next to the results * * @param searchKey * @param statuses * @param labels * @param start * @param end * @param lastKeys * @param order * @param showData * @param args */ exports.fetchJobsByStatus = function (searchKey, params, showData, args) { if (showData === void 0) { showData = 'jobStatuses'; } if (args === void 0) { args = {}; } var statuses = params.statuses, start = params.start, end = params.end, labels = params.labels, order = params.order, lastKeys = params.lastKeys; var query = { status: statuses.join(','), start: start, end: end, labels: labels.join(','), order: order, showData: showData, }; var url = '/v2/job-orchestration/by-status'; var body = lastKeys || {}; var config = { request: { query: query, }, args: tslib_1.__assign({ searchKey: searchKey, params: params, showData: showData }, args), }; return redux_rx_http_1.rxHttpPost(url, exports.FETCH_JOBS_BY_STATUS, body, config); }; /** * Save an individual JobStatusModel in the state * * @param jobStatus */ exports.setJobStatusById = function (jobStatus) { return ({ type: exports.SET_JOB_STATUS_BY_ID, jobStatus: jobStatus }); }; /** * Save an array of JobStatus models in the state * * @param jobStatuses */ exports.setJobStatusesByIdBatch = function (jobStatuses) { return ({ type: exports.SET_JOB_STATUSES_BY_ID_BATCH, jobStatuses: jobStatuses }); }; /** * Save a list of JobStatus results * * @param jobs */ exports.setJobStatusSearch = function (jobs, searchKey, params) { return ({ type: exports.SET_JOB_STATUS_SEARCH, jobs: jobs, searchKey: searchKey, params: params }); }; /** * Pre-empt the api response by updating the status of a job directly * * @param job * @param prevStatus * @param nextStatus */ exports.changeJobStatus = function (job, prevStatus, nextStatus) { return ({ type: exports.CHANGE_JOB_STATUS, job: job, prevStatus: prevStatus, nextStatus: nextStatus }); }; //# sourceMappingURL=status.js.map