|
7 | 7 | } from '$lib/common/job_utilities'; |
8 | 8 | import BooleanIcon from 'fractal-components/common/BooleanIcon.svelte'; |
9 | 9 | import Modal from '$lib/components/common/Modal.svelte'; |
10 | | - import { onMount } from 'svelte'; |
| 10 | + import { onMount, tick } from 'svelte'; |
11 | 11 | import DatasetImagesTable from '../projects/datasets/DatasetImagesTable.svelte'; |
12 | 12 |
|
13 | 13 | /** @type {import('fractal-components/types/api').DatasetV2[]} */ |
|
291 | 291 | imagePage = await response.json(); |
292 | 292 | } |
293 | 293 | datasetImagesLoading = false; |
| 294 | + await tick(); |
| 295 | + datasetImagesTable?.reload(); |
| 296 | + } |
| 297 | +
|
| 298 | + async function cancel() { |
| 299 | + checkingConfiguration = false; |
| 300 | + await tick(); |
| 301 | + datasetImagesTable?.reload(); |
294 | 302 | } |
295 | 303 |
|
296 | 304 | onMount(async () => { |
297 | 305 | await loadSlurmAccounts(); |
298 | 306 | }); |
299 | | -
|
300 | | - let opened = false; |
301 | 307 | </script> |
302 | 308 |
|
303 | | -<Modal |
304 | | - id="runWorkflowModal" |
305 | | - centered={true} |
306 | | - bind:this={modal} |
307 | | - size="xl" |
308 | | - onOpen={() => (opened = true)} |
309 | | - onClose={() => (opened = false)} |
310 | | - scrollable={true} |
311 | | -> |
| 309 | +<Modal id="runWorkflowModal" centered={true} bind:this={modal} size="xl" scrollable={true}> |
312 | 310 | <svelte:fragment slot="header"> |
313 | 311 | <h5 class="modal-title"> |
314 | 312 | {#if mode === 'run'} |
|
424 | 422 | {/each} |
425 | 423 | </select> |
426 | 424 | </div> |
427 | | - {#key opened} |
428 | | - <div class="accordion" id="accordion-run-workflow"> |
| 425 | + <div class="accordion" id="accordion-run-workflow"> |
| 426 | + <div class="accordion-item"> |
| 427 | + <h2 class="accordion-header"> |
| 428 | + <button |
| 429 | + class="accordion-button collapsed" |
| 430 | + type="button" |
| 431 | + data-bs-toggle="collapse" |
| 432 | + data-bs-target="#collapse-workflow-advanced-options" |
| 433 | + aria-expanded="false" |
| 434 | + aria-controls="collapse-workflow-advanced-options" |
| 435 | + > |
| 436 | + Advanced options |
| 437 | + </button> |
| 438 | + </h2> |
| 439 | + <div |
| 440 | + id="collapse-workflow-advanced-options" |
| 441 | + class="accordion-collapse collapse" |
| 442 | + data-bs-parent="#accordion-run-workflow" |
| 443 | + > |
| 444 | + <div class="accordion-body"> |
| 445 | + <div class="mb-3"> |
| 446 | + <label for="workerInit" class="form-label">Worker initialization (Optional)</label> |
| 447 | + <textarea |
| 448 | + name="workerInit" |
| 449 | + id="workerInit" |
| 450 | + class="form-control font-monospace" |
| 451 | + rows="5" |
| 452 | + disabled={checkingConfiguration} |
| 453 | + bind:value={workerInitControl} |
| 454 | + /> |
| 455 | + </div> |
| 456 | + {#if slurmAccounts.length > 0} |
| 457 | + <div class="mb-3"> |
| 458 | + <div class="form-check"> |
| 459 | + <input |
| 460 | + class="form-check-input" |
| 461 | + type="checkbox" |
| 462 | + id="setSlurmAccount" |
| 463 | + bind:checked={setSlurmAccount} |
| 464 | + /> |
| 465 | + <label class="form-check-label" for="setSlurmAccount"> |
| 466 | + Set SLURM account |
| 467 | + </label> |
| 468 | + </div> |
| 469 | + </div> |
| 470 | + {#if setSlurmAccount} |
| 471 | + <div class="mb-3"> |
| 472 | + <label for="slurmAccount" class="form-label">SLURM account</label> |
| 473 | + <select |
| 474 | + name="slurmAccount" |
| 475 | + id="slurmAccount" |
| 476 | + class="form-select" |
| 477 | + disabled={checkingConfiguration} |
| 478 | + bind:value={slurmAccount} |
| 479 | + > |
| 480 | + {#each slurmAccounts as account} |
| 481 | + <option>{account}</option> |
| 482 | + {/each} |
| 483 | + </select> |
| 484 | + </div> |
| 485 | + {/if} |
| 486 | + {/if} |
| 487 | + </div> |
| 488 | + </div> |
| 489 | + </div> |
| 490 | + {#if selectedDataset && imagePage && imagePage.images.length > 0 && firstTaskIndex !== undefined && mode !== 'restart'} |
429 | 491 | <div class="accordion-item"> |
430 | 492 | <h2 class="accordion-header"> |
431 | 493 | <button |
432 | 494 | class="accordion-button collapsed" |
433 | 495 | type="button" |
434 | 496 | data-bs-toggle="collapse" |
435 | | - data-bs-target="#collapse-workflow-advanced-options" |
| 497 | + data-bs-target="#collapse-workflow-image-list" |
436 | 498 | aria-expanded="false" |
437 | | - aria-controls="collapse-workflow-advanced-options" |
| 499 | + aria-controls="collapse-workflow-image-list" |
438 | 500 | > |
439 | | - Advanced options |
| 501 | + Image list |
440 | 502 | </button> |
441 | 503 | </h2> |
442 | 504 | <div |
443 | | - id="collapse-workflow-advanced-options" |
| 505 | + id="collapse-workflow-image-list" |
444 | 506 | class="accordion-collapse collapse" |
445 | 507 | data-bs-parent="#accordion-run-workflow" |
446 | 508 | > |
447 | 509 | <div class="accordion-body"> |
448 | | - <div class="mb-3"> |
449 | | - <label for="workerInit" class="form-label">Worker initialization (Optional)</label |
450 | | - > |
451 | | - <textarea |
452 | | - name="workerInit" |
453 | | - id="workerInit" |
454 | | - class="form-control font-monospace" |
455 | | - rows="5" |
456 | | - disabled={checkingConfiguration} |
457 | | - bind:value={workerInitControl} |
| 510 | + {#if checkingConfiguration} |
| 511 | + This job will process {imagePage.total_count} |
| 512 | + {imagePage.total_count === 1 ? 'image' : 'images'}. |
| 513 | + {:else} |
| 514 | + <DatasetImagesTable |
| 515 | + bind:this={datasetImagesTable} |
| 516 | + dataset={selectedDataset} |
| 517 | + bind:imagePage |
| 518 | + {initialFilterValues} |
| 519 | + {attributeFiltersEnabled} |
| 520 | + useDatasetFilters={false} |
| 521 | + vizarrViewerUrl={null} |
| 522 | + runWorkflowModal={true} |
458 | 523 | /> |
459 | | - </div> |
460 | | - {#if slurmAccounts.length > 0} |
461 | | - <div class="mb-3"> |
462 | | - <div class="form-check"> |
463 | | - <input |
464 | | - class="form-check-input" |
465 | | - type="checkbox" |
466 | | - id="setSlurmAccount" |
467 | | - bind:checked={setSlurmAccount} |
468 | | - /> |
469 | | - <label class="form-check-label" for="setSlurmAccount"> |
470 | | - Set SLURM account |
471 | | - </label> |
472 | | - </div> |
473 | | - </div> |
474 | | - {#if setSlurmAccount} |
475 | | - <div class="mb-3"> |
476 | | - <label for="slurmAccount" class="form-label">SLURM account</label> |
477 | | - <select |
478 | | - name="slurmAccount" |
479 | | - id="slurmAccount" |
480 | | - class="form-select" |
481 | | - disabled={checkingConfiguration} |
482 | | - bind:value={slurmAccount} |
483 | | - > |
484 | | - {#each slurmAccounts as account} |
485 | | - <option>{account}</option> |
486 | | - {/each} |
487 | | - </select> |
488 | | - </div> |
489 | | - {/if} |
490 | 524 | {/if} |
491 | 525 | </div> |
492 | 526 | </div> |
493 | 527 | </div> |
494 | | - {#if selectedDataset && imagePage && imagePage.images.length > 0 && firstTaskIndex !== undefined && mode !== 'restart'} |
495 | | - <div class="accordion-item"> |
496 | | - <h2 class="accordion-header"> |
497 | | - <button |
498 | | - class="accordion-button collapsed" |
499 | | - type="button" |
500 | | - data-bs-toggle="collapse" |
501 | | - data-bs-target="#collapse-workflow-image-list" |
502 | | - aria-expanded="false" |
503 | | - aria-controls="collapse-workflow-image-list" |
504 | | - > |
505 | | - Image list |
506 | | - </button> |
507 | | - </h2> |
508 | | - <div |
509 | | - id="collapse-workflow-image-list" |
510 | | - class="accordion-collapse collapse" |
511 | | - data-bs-parent="#accordion-run-workflow" |
512 | | - > |
513 | | - <div class="accordion-body"> |
514 | | - {#if checkingConfiguration} |
515 | | - This job will process {imagePage.total_count} |
516 | | - {imagePage.total_count === 1 ? 'image' : 'images'}. |
517 | | - {:else} |
518 | | - <DatasetImagesTable |
519 | | - bind:this={datasetImagesTable} |
520 | | - dataset={selectedDataset} |
521 | | - bind:imagePage |
522 | | - {initialFilterValues} |
523 | | - {attributeFiltersEnabled} |
524 | | - useDatasetFilters={false} |
525 | | - vizarrViewerUrl={null} |
526 | | - runWorkflowModal={true} |
527 | | - /> |
528 | | - {/if} |
529 | | - </div> |
530 | | - </div> |
531 | | - </div> |
532 | | - {/if} |
533 | | - {#if datasetImagesLoading} |
534 | | - <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" /> |
535 | | - {/if} |
536 | | - </div> |
537 | | - {/key} |
| 528 | + {/if} |
| 529 | + {#if datasetImagesLoading} |
| 530 | + <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" /> |
| 531 | + {/if} |
| 532 | + </div> |
538 | 533 | {#if checkingConfiguration} |
539 | 534 | <hr /> |
540 | 535 | <h6 class="mt-3">Applied filters</h6> |
|
561 | 556 | </svelte:fragment> |
562 | 557 | <svelte:fragment slot="footer"> |
563 | 558 | {#if checkingConfiguration} |
564 | | - <button class="btn btn-warning" on:click={() => (checkingConfiguration = false)}> |
565 | | - Cancel |
566 | | - </button> |
| 559 | + <button class="btn btn-warning" on:click={cancel}> Cancel </button> |
567 | 560 | <button |
568 | 561 | class="btn btn-primary" |
569 | 562 | on:click|preventDefault={handleApplyWorkflow} |
|
0 commit comments