UNPKG

lml-main

Version:

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

73 lines 2.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var redux_rx_http_1 = require("redux-rx-http"); var ts_utils_1 = require("@lml/ts-utils"); exports.FETCH_JOB_INCIDENT_CODES = redux_rx_http_1.createRxHttpActionTypes('FETCH_JOB_INCIDENT_CODES'); exports.POST_JOB_INCIDENT = redux_rx_http_1.createRxHttpActionTypes('POST_JOB_INCIDENT'); exports.DELETE_JOB_INCIDENT = redux_rx_http_1.createRxHttpActionTypes('DELETE_JOB_INCIDENT'); exports.SET_JOB_INCIDENT = 'SET_JOB_INCIDENT'; exports.SET_JOB_INCIDENTS_BATCH = 'SET_JOB_INCIDENTS_BATCH'; exports.SET_JOB_INCIDENT_CODES = 'SET_JOB_INCIDENT_CODES'; exports.fetchJobIncidentCodes = function (args) { if (args === void 0) { args = {}; } return redux_rx_http_1.rxHttpGet('/v2/incidents/codes', exports.FETCH_JOB_INCIDENT_CODES, {}, tslib_1.__assign({}, args)); }; exports.postJobIncident = function (jobId, impact, reason, comment, user, args) { if (args === void 0) { args = {}; } var body = { jobId: jobId, reason: reason, impact: impact, comment: comment, timestamp: ts_utils_1.utcNow(), user: user, }; return redux_rx_http_1.rxHttpPost('/v2/incidents', exports.POST_JOB_INCIDENT, body, { args: tslib_1.__assign({ jobId: jobId, impact: impact, reason: reason, comment: comment }, args), }); }; exports.deleteJobIncident = function (jobId, incidentId, username) { var config = { request: { body: { username: username, timestamp: ts_utils_1.utcNow(), }, }, args: { jobId: jobId, incidentId: incidentId, }, }; var url = "/v1/incidents/incident/" + jobId + "/" + incidentId; return redux_rx_http_1.rxHttpDelete(url, exports.DELETE_JOB_INCIDENT, config); }; /** * Set a job incident in the state * * @param incident */ exports.setJobIncident = function (refId, incident) { return ({ type: exports.SET_JOB_INCIDENT, refId: refId, incident: incident }); }; /** * Set an array of job incidents in the state * * @param incidents */ exports.setJobIncidents = function (refId, incidents) { return ({ type: exports.SET_JOB_INCIDENTS_BATCH, refId: refId, incidents: incidents }); }; /** * Set the list of incident impact and reason codes that the controller must choose from * * @param impactCodes */ exports.setJobIncidentCodes = function (impacts, reasons) { return ({ type: exports.SET_JOB_INCIDENT_CODES, impacts: impacts, reasons: reasons }); }; //# sourceMappingURL=incidents.js.map