|
34 | 34 | let checkingConfiguration = false; |
35 | 35 | /** @type {string[]} */ |
36 | 36 | let preSubmissionCheckResults = []; |
| 37 | + let ignorePreSubmissionCheck = false; |
37 | 38 | let setSlurmAccount = true; |
38 | 39 | /** @type {string[]} */ |
39 | 40 | let slurmAccounts = []; |
|
82 | 83 | applyingWorkflow = false; |
83 | 84 | checkingConfiguration = false; |
84 | 85 | preSubmissionCheckResults = []; |
| 86 | + ignorePreSubmissionCheck = false; |
85 | 87 | workerInitControl = ''; |
86 | 88 | if (mode === 'run' || mode === 'restart') { |
87 | 89 | firstTaskIndex = 0; |
|
214 | 216 |
|
215 | 217 | async function firstTaskIndexChanged() { |
216 | 218 | preSubmissionCheckResults = []; |
| 219 | + ignorePreSubmissionCheck = false; |
217 | 220 | await loadDatasetImages(); |
218 | 221 | // reset last task |
219 | 222 | if ( |
|
233 | 236 | async function showConfirmRun() { |
234 | 237 | if (datasetImagesTable) { |
235 | 238 | const params = await datasetImagesTable.applySearchFields(); |
236 | | - const valid = await preSubmissionCheck(params); |
237 | | - if (!valid) { |
238 | | - return; |
| 239 | + if (ignorePreSubmissionCheck) { |
| 240 | + preSubmissionCheckResults = []; |
| 241 | + ignorePreSubmissionCheck = false; |
| 242 | + } else { |
| 243 | + const valid = await preSubmissionCheck(params); |
| 244 | + if (!valid) { |
| 245 | + return; |
| 246 | + } |
239 | 247 | } |
240 | 248 | } |
241 | 249 | const wft = workflow.task_list[firstTaskIndex || 0]; |
|
276 | 284 | const valid = preSubmissionCheckResults.length === 0; |
277 | 285 | if (!valid) { |
278 | 286 | await tick(); |
279 | | - // scroll to error message |
| 287 | + // scroll to warning message |
280 | 288 | const modalBody = document.querySelector('.modal.show .modal-body'); |
281 | | - const errorAlert = document.getElementById('pre-submission-check-error'); |
282 | | - if (modalBody && errorAlert) { |
283 | | - const rect = errorAlert.getBoundingClientRect(); |
| 289 | + const warningAlert = document.getElementById('pre-submission-check-warning'); |
| 290 | + if (modalBody && warningAlert) { |
| 291 | + const bodyRect = modalBody.getBoundingClientRect(); |
| 292 | + const alertRect = warningAlert.getBoundingClientRect(); |
| 293 | + const alertRelativeY = alertRect.y - bodyRect.y; |
284 | 294 | modalBody.scrollTo({ |
285 | | - top: rect.y + rect.height, |
| 295 | + top: alertRelativeY + modalBody.scrollTop, |
286 | 296 | behavior: 'smooth' |
287 | 297 | }); |
288 | 298 | } |
|
539 | 549 | data-bs-parent="#accordion-run-workflow" |
540 | 550 | > |
541 | 551 | <div class="accordion-body"> |
| 552 | + {#if preSubmissionCheckResults.length > 0} |
| 553 | + <div class="alert alert-warning mb-0" id="pre-submission-check-warning"> |
| 554 | + You are trying to run a workflow without specifying what type of images should |
| 555 | + be processed. Specify the relevant type filter to continue. |
| 556 | + <button |
| 557 | + type="button" |
| 558 | + class="btn btn-warning mt-1" |
| 559 | + on:click={() => { |
| 560 | + ignorePreSubmissionCheck = true; |
| 561 | + showConfirmRun(); |
| 562 | + }} |
| 563 | + > |
| 564 | + Continue anyway |
| 565 | + </button> |
| 566 | + </div> |
| 567 | + {/if} |
542 | 568 | {#if checkingConfiguration} |
543 | 569 | This job will process {imagePage.total_count} |
544 | 570 | {imagePage.total_count === 1 ? 'image' : 'images'}. |
|
549 | 575 | bind:imagePage |
550 | 576 | {initialFilterValues} |
551 | 577 | {disabledTypes} |
| 578 | + highlightedTypes={preSubmissionCheckResults} |
552 | 579 | vizarrViewerUrl={null} |
553 | 580 | runWorkflowModal={true} |
554 | | - beforeSelectionChanged={() => (preSubmissionCheckResults = [])} |
| 581 | + beforeTypeSelectionChanged={(key) => { |
| 582 | + preSubmissionCheckResults = preSubmissionCheckResults.filter( |
| 583 | + (k) => k !== key |
| 584 | + ); |
| 585 | + }} |
555 | 586 | /> |
556 | 587 | {/if} |
557 | 588 | </div> |
558 | 589 | </div> |
559 | 590 | </div> |
560 | | - {#if preSubmissionCheckResults.length > 0} |
561 | | - <div class="alert alert-danger mt-3 alert-dismissible" id="pre-submission-check-error"> |
562 | | - Image list includes multiple values for the following types: |
563 | | - <ul> |
564 | | - {#each preSubmissionCheckResults as item} |
565 | | - <li><code>{item}</code></li> |
566 | | - {/each} |
567 | | - </ul> |
568 | | - Please select one specific value from the dropdown menu. |
569 | | - <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" /> |
570 | | - </div> |
571 | | - {/if} |
572 | 591 | {/if} |
573 | 592 | {#if datasetImagesLoading} |
574 | 593 | <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" /> |
|
0 commit comments