Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions browser_tests/tests/dialog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ test.describe('Missing models warning', () => {

const downloadButton = missingModelsWarning.getByLabel('Download')
await expect(downloadButton).toBeVisible()

// Check that the copy URL button is also visible for Desktop environment
const copyUrlButton = missingModelsWarning.getByLabel('Copy URL')
await expect(copyUrlButton).toBeVisible()
})

test('Should display a warning when missing models are found in node properties', async ({
Expand All @@ -89,6 +93,10 @@ test.describe('Missing models warning', () => {

const downloadButton = missingModelsWarning.getByLabel('Download')
await expect(downloadButton).toBeVisible()

// Check that the copy URL button is also visible for Desktop environment
const copyUrlButton = missingModelsWarning.getByLabel('Copy URL')
await expect(copyUrlButton).toBeVisible()
})

test('Should not display a warning when no missing models are found', async ({
Expand Down
14 changes: 14 additions & 0 deletions src/components/common/ElectronFileDownload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
icon="pi pi-download"
@click="triggerDownload"
/>
<Button
v-if="status === null || status === 'error'"
:label="$t('g.copyURL')"
size="small"
outlined
:disabled="!!props.error"
@click="copyURL"
/>
</div>
</div>
<div
Expand Down Expand Up @@ -80,6 +88,7 @@ import ProgressBar from 'primevue/progressbar'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'

import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
import { useDownload } from '@/composables/useDownload'
import { useElectronDownloadStore } from '@/stores/electronDownloadStore'
import { formatSize } from '@/utils/formatUtil'
Expand All @@ -100,6 +109,7 @@ const status = ref<string | null>(null)
const fileSize = computed(() =>
download.fileSize.value ? formatSize(download.fileSize.value) : '?'
)
const { copyToClipboard } = useCopyToClipboard()
const electronDownloadStore = useElectronDownloadStore()
// @ts-expect-error fixme ts strict error
const [savePath, filename] = props.label.split('/')
Expand All @@ -126,4 +136,8 @@ const triggerDownload = async () => {
const triggerCancelDownload = () => electronDownloadStore.cancel(props.url)
const triggerPauseDownload = () => electronDownloadStore.pause(props.url)
const triggerResumeDownload = () => electronDownloadStore.resume(props.url)

const copyURL = async () => {
await copyToClipboard(props.url)
}
</script>