Skip to content

Commit b405639

Browse files
committed
cernbox-integration: show download link instead of direct link in a public link
1 parent dd4a54c commit b405639

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

cernbox-integration/src/components/PathDetails.vue

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</div>
5757
</td>
5858
</tr>
59-
<tr v-if="!isTrashbinContext" data-testid="eosDirectLink">
59+
<tr v-if="!isTrashbinContext && !isPublicLinkContext" data-testid="eosDirectLink">
6060
<th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Direct link')" />
6161
<td>
6262
<div class="oc-flex oc-flex-middle oc-flex-between">
@@ -80,6 +80,30 @@
8080
</div>
8181
</td>
8282
</tr>
83+
<tr v-if="isPublicLinkContext" data-testid="eosDownloadLink">
84+
<th scope="col" class="oc-pr-s oc-font-semibold" v-text="$gettext('Download link')" />
85+
<td>
86+
<div class="oc-flex oc-flex-middle oc-flex-between">
87+
<p v-oc-tooltip="downloadLink" class="oc-my-rm oc-text-truncate" v-text="downloadLink" />
88+
<oc-button
89+
v-if="isClipboardCopySupported"
90+
v-oc-tooltip="copyDownloadLinkLabel"
91+
:aria-label="copyDownloadLinkLabel"
92+
appearance="raw"
93+
:variation="copiedDownload ? 'success' : 'passive'"
94+
@click="copyDownloadLinkToClipboard"
95+
>
96+
<oc-icon
97+
v-if="copiedDownload"
98+
key="oc-copy-to-clipboard-copied"
99+
name="checkbox-circle"
100+
class="_clipboard-success-animation"
101+
/>
102+
<oc-icon v-else key="oc-copy-to-clipboard-copy" name="file-copy" />
103+
</oc-button>
104+
</div>
105+
</td>
106+
</tr>
83107
</template>
84108
<script lang="ts">
85109
import { computed, defineComponent, unref, ref } from 'vue'
@@ -103,6 +127,7 @@ export default defineComponent({
103127
const isPublicLinkContext = authStore.publicLinkContextReady
104128
105129
const copiedDirect = ref(false)
130+
const copiedDownload = ref(false)
106131
const copiedEos = ref(false)
107132
const copiedSamba = ref(false)
108133
const {
@@ -117,6 +142,8 @@ export default defineComponent({
117142
118143
const directLink = computed(() => props.resource.privateLink)
119144
145+
const downloadLink = computed(() => props.resource.downloadURL)
146+
120147
const copyEosPathToClipboard = () => {
121148
copy(unref(eosPath))
122149
copiedEos.value = unref(copied)
@@ -171,20 +198,33 @@ export default defineComponent({
171198
})
172199
}
173200
201+
const copyDownloadLinkToClipboard = () => {
202+
copy(unref(downloadLink))
203+
copiedDirect.value = unref(copied)
204+
messageStore.showMessage({
205+
title: $gettext('Download link copied'),
206+
desc: $gettext('The download link has been copied to your clipboard.')
207+
})
208+
}
209+
174210
return {
175211
isPublicLinkContext,
176212
isTrashbinContext,
177213
isClipboardCopySupported,
178214
directLink,
179215
copiedDirect,
216+
downloadLink,
217+
copiedDownload,
180218
copiedEos,
181219
copiedSamba,
182220
sambaPath,
183221
eosPath,
184222
copyDirectLinkToClipboard,
223+
copyDownloadLinkToClipboard,
185224
copyEosPathToClipboard,
186225
copySambaPathToClipboard,
187226
copyDirectLinkLabel: computed(() => $gettext('Copy direct link')),
227+
copyDownloadLinkLabel: computed(() => $gettext('Copy download link')),
188228
copyEosPathLabel: computed(() => $gettext('Copy FUSE path')),
189229
copySambaPathLabel: computed(() => $gettext('Copy Windows path'))
190230
}

0 commit comments

Comments
 (0)