MCPcopy Create free account
hub / github.com/bugy/script-server / selectExecutor

Function selectExecutor

web-src/src/main-app/store/scriptExecutionManager.js:199–221  ·  view source on GitHub ↗
({commit, state, dispatch}, executor)

Source from the content-addressed store, hash-verified

197 },
198
199 selectExecutor({commit, state, dispatch}, executor) {
200 const currentExecutor = state.currentExecutor;
201 if (!isNull(currentExecutor)) {
202 // Don't remove finished executor automatically, if it was cleaned up
203 // unless id is null, meaning it was an error
204 if (executor && !isNull(executor.state.id) && (executor.state.id === currentExecutor.state.id)) {
205 return;
206 }
207
208 if ([STATUS_FINISHED, STATUS_DISCONNECTED, STATUS_ERROR].includes(currentExecutor.state.status)) {
209 dispatch('_removeExecutor', currentExecutor);
210 }
211 }
212
213 commit('SELECT_EXECUTOR', executor);
214 if (executor) {
215 dispatch('scriptSetup/reloadModel', {
216 values: clone(executor.state.parameterValues),
217 forceAllowedValues: true,
218 scriptName: executor.state.scriptName
219 }, {root: true});
220 }
221 },
222
223 _removeExecutor({dispatch, state, commit}, executor) {
224 if (!(executor.state.id in state.executors)) {

Callers

nothing calls this directly

Calls 1

isNullFunction · 0.90

Tested by

no test coverage detected