MCPcopy Create free account
hub / github.com/parse-community/parse-dashboard / updateScriptOrder

Method updateScriptOrder

src/lib/ScriptManager.js:145–161  ·  view source on GitHub ↗

* Updates the order of open scripts * @param {string} appId - The application ID * @param {Array} openScripts - Array of scripts with their new order * @returns {Promise}

(appId, openScripts)

Source from the content-addressed store, hash-verified

143 * @returns {Promise}
144 */
145 async updateScriptOrder(appId, openScripts) {
146 const allScripts = await this.getScripts(appId);
147 const openScriptIds = openScripts.map(script => script.id);
148
149 const updatedScripts = allScripts.map(script => {
150 const openScript = openScripts.find(os => os.id === script.id);
151 if (openScript) {
152 return { ...script, ...openScript };
153 } else if (openScriptIds.includes(script.id)) {
154 // Script was previously open but not in the new list, close it
155 return { ...script, order: undefined };
156 }
157 return script;
158 });
159
160 await this.saveScripts(appId, updatedScripts);
161 }
162
163 /**
164 * Completely deletes a script from storage

Callers 1

Calls 2

getScriptsMethod · 0.95
saveScriptsMethod · 0.95

Tested by

no test coverage detected