Skip to content

Commit 29ca656

Browse files
committed
Merge branch 'main' into svelte5
2 parents 2d1761a + edfd626 commit 29ca656

13 files changed

+48
-39
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
*Note: Numbers like (\#123) point to closed Pull Requests on the fractal-web repository.*
22

3+
# 1.17.4
4+
5+
* Fixed search box not working in workflow submission modal (\#787);
6+
* Fixed "Get token" button not working in Safari (\#787);
7+
* Added a disclaimer to non-processed-images warning (\#787);
8+
39
# 1.17.3
410

511
* Displayed warning when attempting to continue a workflow on unprocessed images (\#774);

docs/version-compatibility.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ The following table shows which `fractal-server` versions are compatible with wh
44

55
| fractal-web | fractal-server |
66
|-------------|----------------|
7+
| 1.17.4 | 2.14.1 |
78
| 1.17.3 | 2.14.1 |
89
| 1.17.2 | 2.14.0 |
910
| 1.17.1 | 2.14.0 |

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fractal-web",
3-
"version": "1.17.3",
3+
"version": "1.17.4",
44
"private": true,
55
"scripts": {
66
"dev": "vite dev",

src/lib/components/common/Modal.svelte

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
firstInput.focus();
5959
}
6060
}
61+
if (!focus) {
62+
restoreModalFocus();
63+
}
6164
});
6265
modal.addEventListener('hidden.bs.modal', onClose);
6366
}
@@ -132,6 +135,16 @@
132135
// eslint-disable-next-line no-undef
133136
return new bootstrap.Modal(modalElement);
134137
}
138+
139+
/**
140+
* Restore focus on modal, otherwise it will not be possible to close it using the esc key
141+
*/
142+
export function restoreModalFocus() {
143+
const modal = document.querySelector('.modal.show');
144+
if (modal instanceof HTMLElement) {
145+
modal.focus();
146+
}
147+
}
135148
</script>
136149

137150
<!-- Note: tabindex="-1" is needed to fix escape key not working in some cases -->

src/lib/components/jobs/RunStatusModal.svelte

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
showZarrUrls = true;
136136
selectedUnit = unit;
137137
await tick();
138-
restoreModalFocus();
138+
modal?.restoreModalFocus();
139139
}
140140
141141
async function back() {
@@ -144,7 +144,7 @@
144144
selectedUnit = undefined;
145145
await tick();
146146
setStatusFilterSelector();
147-
restoreModalFocus();
147+
modal?.restoreModalFocus();
148148
}
149149
150150
function setStatusFilterSelector() {
@@ -194,16 +194,6 @@
194194
await loadRun(page, pageSize);
195195
}
196196
197-
/**
198-
* Restore focus on modal, otherwise it will not be possible to close it using the esc key
199-
*/
200-
function restoreModalFocus() {
201-
const modal = document.querySelector('.modal.show');
202-
if (modal instanceof HTMLElement) {
203-
modal.focus();
204-
}
205-
}
206-
207197
let hasZarrUrlsInTable = $derived(
208198
data !== undefined && data.items.find((u) => u.zarr_urls.length === 1) !== undefined
209199
);

src/lib/components/v2/workflow/RunWorkflowModal.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@
273273
}
274274
}
275275
checkingConfiguration = true;
276+
modal?.restoreModalFocus();
276277
}
277278
278279
/**
@@ -528,7 +529,7 @@
528529
);
529530
</script>
530531
531-
<Modal id="runWorkflowModal" centered={true} bind:this={modal} size="xl" scrollable={true}>
532+
<Modal id="runWorkflowModal" centered={true} bind:this={modal} size="xl" scrollable={true} focus={false}>
532533
{#snippet header()}
533534
<h5 class="modal-title">
534535
{#if mode === 'run'}

src/routes/+layout.svelte

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,30 @@
9292
}
9393
9494
async function getToken() {
95+
const promise = getTokenPromise();
96+
await navigator.clipboard.write([new ClipboardItem({ 'text/plain': promise })]);
97+
const toastElement = document.getElementById('tokenCopiedToast');
98+
if (!toastElement) {
99+
return;
100+
}
101+
// @ts-expect-error
102+
// eslint-disable-next-line no-undef
103+
const toast = new bootstrap.Toast(toastElement);
104+
toast.show();
105+
}
106+
107+
/**
108+
* Safari doesn't allow to run asynchronous code between the click event and the
109+
* clipboard write, so we need to pass the promise to the ClipboardItem constructor.
110+
*/
111+
async function getTokenPromise() {
95112
const response = await fetch(`/profile/token`);
96113
if (response.ok) {
97114
const { token } = await response.json();
98-
await navigator.clipboard.writeText(token);
99-
const toastElement = document.getElementById('tokenCopiedToast');
100-
if (!toastElement) {
101-
return;
102-
}
103-
// @ts-expect-error
104-
// eslint-disable-next-line no-undef
105-
const toast = new bootstrap.Toast(toastElement);
106-
toast.show();
115+
// Chrome only accept a promise returning Blob type, with proper content type.
116+
return new Blob([token], { type: 'text/plain' });
107117
}
118+
throw new Error('Unable to retrieve token');
108119
}
109120
110121
const selectedSection = $derived(getSelectedSection(page.url.pathname));

tests/v2/import_export_args.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from './workflow_fixture.js';
2-
import { waitModalClosed, waitPageLoading } from '../utils.js';
2+
import { closeModal, waitModalClosed, waitPageLoading } from '../utils.js';
33
import { createFakeTask, deleteTask } from './task_utils.js';
44
import { fileURLToPath } from 'url';
55
import path from 'path';

tests/v2/run_mock_tasks.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ test('Run mock tasks [v2]', async ({ page, workflow }) => {
175175
.getByRole('option', { selected: true })
176176
).toHaveText('generic_task');
177177
await modal.getByRole('button', { name: 'Run', exact: true }).click();
178-
await modal.getByRole('button', { name: 'Continue anyway', exact: true }).click();
179178
await modal.getByRole('button', { name: 'Confirm' }).click();
180179
await waitModalClosed(page);
181180
});

0 commit comments

Comments
 (0)