MCPcopy Index your code
hub / github.com/bugy/script-server / startExecution

Function startExecution

web-src/src/main-app/store/scriptExecutionManager.js:119–160  ·  view source on GitHub ↗
({rootState, commit, dispatch})

Source from the content-addressed store, hash-verified

117 },
118
119 startExecution({rootState, commit, dispatch}) {
120 const store = this;
121
122 const parameterValues = clone(rootState.scriptSetup.parameterValues);
123 const scriptName = rootState.scriptConfig.scriptConfig.name;
124
125 const formData = parametersToFormData(parameterValues);
126 formData.append('__script_name', scriptName);
127
128 const executor = scriptExecutor(null, scriptName, parameterValues);
129 store.registerModule(['executions', 'temp'], executor);
130 store.dispatch('executions/temp/setInitialising');
131
132 dispatch('selectExecutor', executor);
133
134 axiosInstance.post('executions/start', formData)
135 .then(({data: executionId}) => {
136 store.unregisterModule(['executions', 'temp']);
137 store.registerModule(['executions', executionId], executor);
138
139 store.dispatch('executions/' + executionId + '/start', executionId);
140 store.dispatch('executions/' + executionId + '/reconnect');
141
142 commit('ADD_EXECUTOR', executor);
143
144 })
145 .catch(error => {
146 const status = get(error, 'response.status');
147 let data = get(error, 'response.data');
148 if (isNull(error.response) || isEmptyString(data)) {
149 data = 'Connection error. Please contact the system administrator';
150 }
151
152 store.dispatch('executions/temp/setErrorStatus');
153
154 if (status !== 401) {
155 store.dispatch('executions/temp/appendLog', '\n\n' + data);
156 }
157
158 store.unregisterModule(['executions', 'temp']);
159 });
160 },
161
162 stopAll({getters, dispatch}) {
163 const activeExecutors = getters.activeExecutors;

Callers

nothing calls this directly

Calls 5

parametersToFormDataFunction · 0.90
isNullFunction · 0.90
isEmptyStringFunction · 0.90
appendMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected