Sha256: 3f9e22af3dfe0f503168c0755eaae3424d79ec71d74fc8ec255881f6f339e546
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
import { foremanUrl } from 'foremanReact/common/helpers'; import { sprintf, translate as __ } from 'foremanReact/common/I18n'; import { post } from 'foremanReact/redux/API'; export const runFeature = (hostId, feature, label) => dispatch => { const url = foremanUrl( `/job_invocations?feature=${feature}&host_ids%5B%5D=${hostId}` ); const successToast = ({ request }) => { if (request.responseURL.includes('job_invocations?')) { return __('Opening job invocation form'); } return sprintf(__('%s job has been invoked'), label); }; const errorToast = ({ message }) => message; dispatch( post({ key: feature.toUpperCase(), url, successToast, errorToast, handleSuccess: ({ request }) => { if (request.responseURL.includes('job_invocations?')) { // checking if user should be redicted to finish setting up the job window.location.href = request.responseURL.replace( 'job_invocations?', 'job_invocations/new?' ); } }, }) ); };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_remote_execution-8.1.0 | webpack/react_app/components/FeaturesDropdown/actions.js |