()
| 2394 | } |
| 2395 | |
| 2396 | process() { |
| 2397 | const filePayload = Object.values(this.selectedMods).filter((x) => x.doAction) |
| 2398 | |
| 2399 | if ( filePayload.length === 0 ) { return } |
| 2400 | |
| 2401 | this.feedback.clsShow() |
| 2402 | this.infoData.clsHide() |
| 2403 | MA.byId('fileOpWorking').clsShow() |
| 2404 | MA.byId('fileOpSuccess').clsHide() |
| 2405 | MA.byId('fileOpDanger').clsHide() |
| 2406 | MA.byId('badFileFeedback').clsHide() |
| 2407 | |
| 2408 | window.main_IPC.files.process(filePayload).then((opResult) => { |
| 2409 | const didFail = opResult.some((x) => x.status === false ) |
| 2410 | if ( didFail ) { |
| 2411 | MA.byId('fileOpDanger').clsShow() |
| 2412 | MA.byId('fileOpWorking').clsHide() |
| 2413 | MA.byId('badFileFeedback').clsShow() |
| 2414 | const badFiles = opResult |
| 2415 | .filter((x) => x.status === false) |
| 2416 | .map((x) => { |
| 2417 | if ( x.type === 'delete' ) { |
| 2418 | return `<i class="bi bi-trash3"></i> ${x.source}` |
| 2419 | } |
| 2420 | return `-> ${x.dest}<br>` |
| 2421 | }) |
| 2422 | MA.byId('badFileList').innerHTML = badFiles.join('') |
| 2423 | } else { |
| 2424 | MA.byId('fileOpSuccess').clsShow() |
| 2425 | MA.byId('fileOpWorking').clsHide() |
| 2426 | } |
| 2427 | |
| 2428 | setTimeout(() => { |
| 2429 | this.overlay.hide() // File Canvas |
| 2430 | window.state.select.none() |
| 2431 | setTimeout(() => { |
| 2432 | window.main_IPC.folder.reload() |
| 2433 | }, 250) |
| 2434 | }, didFail ? 5000 : 1500) |
| 2435 | }) |
| 2436 | } |
| 2437 | |
| 2438 | // MARK: keyboard interaction |
| 2439 | key(type) { |
no test coverage detected