lml-main
Version:
This is now a mono repository published into many standalone packages.
98 lines • 3.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const selectors_1 = require("../../jobs/selectors");
exports.SET_ACTIVE_JOB = 'SET_ACTIVE_JOB';
exports.UNSET_ACTIVE_JOB = 'UNSET_ACTIVE_JOB';
exports.SET_JOB_EXPANDED = 'SET_JOB_EXPANDED';
exports.SET_JOB_COLLAPSED = 'SET_JOB_COLLAPSED';
exports.SET_ALL_JOBS_EXPANDED = 'SET_ALL_JOBS_EXPANDED';
exports.SET_ALL_JOBS_COLLAPSED = 'SET_ALL_JOBS_COLLAPSED';
exports.SET_JUMP_TO_JOB = 'SET_JUMP_TO_JOB';
exports.SET_VISIBLE_JOBS = 'SET_VISIBLE_JOBS';
exports.SHOW_JOB_DIRECTIONS = 'SHOW_JOB_DIRECTIONS';
exports.HIDE_JOB_DIRECTIONS = 'HIDE_JOB_DIRECTIONS';
/**
* Set the active job to a given id or to null
*
* @param refId
*/
exports.setActiveJob = (refId) => ({ type: exports.SET_ACTIVE_JOB, refId });
/**
* If the provided job refId is currently active then set it to null
*/
exports.unsetActiveJob = (refId) => ({ type: exports.UNSET_ACTIVE_JOB, refId });
/**
* Add a job's refId to the array of expanded jobs
*
* @param refId
* @param expanded
*/
exports.setJobExpanded = (refId) => ({ type: exports.SET_JOB_EXPANDED, refId });
/**
* Remove a job's refId from the array of expanded jobs
*
* @param refId
* @param expanded
*/
exports.setJobCollapsed = (refId) => ({ type: exports.SET_JOB_COLLAPSED, refId });
/**
* Mark all jobs as expanded
*/
exports.setAllJobsExpanded = () => ({
type: exports.SET_ALL_JOBS_EXPANDED,
});
/**
* Mark all jobs as expanded
*/
exports.setAllJobsCollapsed = () => ({
type: exports.SET_ALL_JOBS_COLLAPSED,
});
/**
* Set the showingDirections refId in the job flags state
*
* @param refId
* @param showingDirections
*/
exports.showJobDirections = (refId) => ({ type: exports.SHOW_JOB_DIRECTIONS, refId });
/**
* Reset the showingDirections refId in the job flags state
*
* @param refId
*/
exports.hideJobDirections = (refId) => ({ type: exports.HIDE_JOB_DIRECTIONS, refId });
/**
* Jumping to a particular job is required by the keyboard shortcuts
*
* @param refId
*/
exports.setJumpToJob = (refId) => ({ type: exports.SET_JUMP_TO_JOB, refId });
exports.expandActiveJob = () => (dispatch, getState) => {
const job = selectors_1.getActiveJob(getState());
if (job) {
dispatch(exports.setJobExpanded(job.refId));
}
};
exports.activateFirstJobIfNoneActive = () => (dispatch, getState) => {
const state = getState();
const job = selectors_1.getActiveJob(state);
if (!job) {
const first = selectors_1.getFirstJob(state);
dispatch(exports.setActiveJob(first.refId));
dispatch(exports.setJumpToJob(first.refId));
}
};
exports.activatePreviousJob = () => (dispatch, getState) => {
const prev = selectors_1.getPreviousJob(getState());
if (prev) {
dispatch(exports.setActiveJob(prev.refId));
// dispatch(setJumpToJob(prev.refId))
}
};
exports.activateNextJob = () => (dispatch, getState) => {
const next = selectors_1.getNextJob(getState());
if (next) {
dispatch(exports.setActiveJob(next.refId));
// dispatch(setJumpToJob(next.refId))
}
};
//# sourceMappingURL=flags.js.map