UNPKG

lml-main

Version:

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

28 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const cosmoui_1 = require("cosmoui"); const selectors_1 = require("../../jobs/selectors"); const constants_1 = require("../../allocation/constants"); exports.showAllocationModal = (jobRefId) => (dispatch, getState) => { // only show this modal if a job has been selected const state = getState(); const activeJob = selectors_1.getActiveJob(state); if (!activeJob) { dispatch(cosmoui_1.notificationWarning('Please select a job before attempting to allocate')); return; } // if this job is already allocated then we need to show the reallocation modal if (activeJob.currentAllocation) { dispatch(exports.showDeallocationModal(activeJob)); return; } // otherwise show the normal allocation modal dispatch(cosmoui_1.openModal(constants_1.ALLOCATION_MODAL_KEY, { jobRefId })); }; /** * NOTE: the deallocation modal is also the reallocation modal * You can choose between one or the other * @param job */ exports.showDeallocationModal = (job) => cosmoui_1.openModal(constants_1.DEALLOCATION_MODAL_KEY, { job }); //# sourceMappingURL=modals.js.map