mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): bulk download click to download
This commit is contained in:
parent
04c060a89d
commit
fbd9ffdc5a
@ -1,5 +1,5 @@
|
|||||||
import type { UseToastOptions } from '@invoke-ai/ui-library';
|
import type { UseToastOptions } from '@invoke-ai/ui-library';
|
||||||
import { createStandaloneToast, theme, TOAST_OPTIONS } from '@invoke-ai/ui-library';
|
import { createStandaloneToast, ExternalLink, theme, TOAST_OPTIONS } from '@invoke-ai/ui-library';
|
||||||
import { logger } from 'app/logging/logger';
|
import { logger } from 'app/logging/logger';
|
||||||
import { startAppListening } from 'app/store/middleware/listenerMiddleware';
|
import { startAppListening } from 'app/store/middleware/listenerMiddleware';
|
||||||
import { t } from 'i18next';
|
import { t } from 'i18next';
|
||||||
@ -68,19 +68,19 @@ export const addBulkDownloadListeners = () => {
|
|||||||
|
|
||||||
// TODO(psyche): This URL may break in in some environments (e.g. Nvidia workbench) but we need to test it first
|
// TODO(psyche): This URL may break in in some environments (e.g. Nvidia workbench) but we need to test it first
|
||||||
const url = `/api/v1/images/download/${bulk_download_item_name}`;
|
const url = `/api/v1/images/download/${bulk_download_item_name}`;
|
||||||
const a = document.createElement('a');
|
|
||||||
a.style.display = 'none';
|
|
||||||
a.href = url;
|
|
||||||
a.download = bulk_download_item_name;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
|
|
||||||
const toastOptions: UseToastOptions = {
|
const toastOptions: UseToastOptions = {
|
||||||
id: bulk_download_item_name,
|
id: bulk_download_item_name,
|
||||||
title: t('gallery.bulkDownloadStarting'),
|
title: t('gallery.bulkDownloadReady', 'Download ready'),
|
||||||
status: 'success',
|
status: 'success',
|
||||||
description: bulk_download_item_name,
|
description: (
|
||||||
duration: 5000,
|
<ExternalLink
|
||||||
|
label={t('gallery.clickToDownload', 'Click here to download')}
|
||||||
|
href={url}
|
||||||
|
download={bulk_download_item_name}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
duration: null,
|
||||||
isClosable: true,
|
isClosable: true,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user