aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/src/views')
-rw-r--r--apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue93
-rw-r--r--apps/files_sharing/src/views/PublicAuthPrompt.vue123
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue26
-rw-r--r--apps/files_sharing/src/views/SharingTab.vue25
4 files changed, 117 insertions, 150 deletions
diff --git a/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue b/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue
index 5571e5e9f5d..33fec9af028 100644
--- a/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue
+++ b/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue
@@ -5,13 +5,29 @@
<template>
<NcEmptyContent class="file-drop-empty-content"
data-cy-files-sharing-file-drop
- :name="t('files_sharing', 'File drop')">
+ :name="name">
<template #icon>
<NcIconSvgWrapper :svg="svgCloudUpload" />
</template>
<template #description>
- {{ t('files_sharing', 'Upload files to {foldername}.', { foldername }) }}
- {{ disclaimer === '' ? '' : t('files_sharing', 'By uploading files, you agree to the terms of service.') }}
+ <p>
+ {{ shareNote || t('files_sharing', 'Upload files to {foldername}.', { foldername }) }}
+ </p>
+ <p v-if="disclaimer">
+ {{ t('files_sharing', 'By uploading files, you agree to the terms of service.') }}
+ </p>
+ <NcNoteCard v-if="getSortedUploads().length"
+ class="file-drop-empty-content__note-card"
+ type="success">
+ <h2 id="file-drop-empty-content__heading">
+ {{ t('files_sharing', 'Successfully uploaded files') }}
+ </h2>
+ <ul aria-labelledby="file-drop-empty-content__heading" class="file-drop-empty-content__list">
+ <li v-for="file in getSortedUploads()" :key="file">
+ {{ file }}
+ </li>
+ </ul>
+ </NcNoteCard>
</template>
<template #action>
<template v-if="disclaimer">
@@ -34,16 +50,24 @@
</NcEmptyContent>
</template>
+<script lang="ts">
+/* eslint-disable import/first */
+
+// We need this on module level rather than on the instance as view will be refreshed by the files app after uploading
+const uploads = new Set<string>()
+</script>
+
<script setup lang="ts">
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
-import { getUploader, UploadPicker } from '@nextcloud/upload'
+import { getUploader, UploadPicker, UploadStatus } from '@nextcloud/upload'
import { ref } from 'vue'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcDialog from '@nextcloud/vue/components/NcDialog'
import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
+import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
import svgCloudUpload from '@mdi/svg/svg/cloud-upload.svg?raw'
defineProps<{
@@ -51,17 +75,62 @@ defineProps<{
}>()
const disclaimer = loadState<string>('files_sharing', 'disclaimer', '')
+const shareLabel = loadState<string>('files_sharing', 'label', '')
+const shareNote = loadState<string>('files_sharing', 'note', '')
+
+const name = shareLabel || t('files_sharing', 'File drop')
+
const showDialog = ref(false)
const uploadDestination = getUploader().destination
-</script>
-<style scoped>
-:deep(.terms-of-service-dialog) {
- min-height: min(100px, 20vh);
+getUploader()
+ .addNotifier((upload) => {
+ if (upload.status === UploadStatus.FINISHED && upload.file.name) {
+ // if a upload is finished and is not a meta upload (name is set)
+ // then we add the upload to the list of finished uploads to be shown to the user
+ uploads.add(upload.file.name)
+ }
+ })
+
+/**
+ * Get the previous uploads as sorted list
+ */
+function getSortedUploads() {
+ return [...uploads].sort((a, b) => a.localeCompare(b))
}
-/* TODO fix in library */
-.file-drop-empty-content :deep(.empty-content__action) {
- display: flex;
- gap: var(--default-grid-baseline);
+</script>
+
+<style scoped lang="scss">
+.file-drop-empty-content {
+ margin: auto;
+ max-width: max(50vw, 300px);
+
+ .file-drop-empty-content__note-card {
+ width: fit-content;
+ margin-inline: auto;
+ }
+
+ #file-drop-empty-content__heading {
+ margin-block: 0 10px;
+ font-weight: bold;
+ font-size: 20px;
+ }
+
+ .file-drop-empty-content__list {
+ list-style: inside;
+ max-height: min(350px, 33vh);
+ overflow-y: scroll;
+ padding-inline-end: calc(2 * var(--default-grid-baseline));
+ }
+
+ :deep(.terms-of-service-dialog) {
+ min-height: min(100px, 20vh);
+ }
+
+ /* TODO fix in library */
+ :deep(.empty-content__action) {
+ display: flex;
+ gap: var(--default-grid-baseline);
+ }
}
</style>
diff --git a/apps/files_sharing/src/views/PublicAuthPrompt.vue b/apps/files_sharing/src/views/PublicAuthPrompt.vue
deleted file mode 100644
index 39f5adc4650..00000000000
--- a/apps/files_sharing/src/views/PublicAuthPrompt.vue
+++ /dev/null
@@ -1,123 +0,0 @@
-<!--
- - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- - SPDX-License-Identifier: AGPL-3.0-or-later
--->
-
-<template>
- <NcDialog :buttons="dialogButtons"
- class="public-auth-prompt"
- data-cy-public-auth-prompt-dialog
- is-form
- :can-close="false"
- :name="dialogName"
- @submit="$emit('close', name)">
- <p v-if="owner" class="public-auth-prompt__subtitle">
- {{ t('files_sharing', '{ownerDisplayName} shared a folder with you.', { ownerDisplayName }) }}
- </p>
-
- <!-- Header -->
- <NcNoteCard class="public-auth-prompt__header"
- :text="t('files_sharing', 'To upload files, you need to provide your name first.')"
- type="info" />
-
- <!-- Form -->
- <NcTextField ref="input"
- class="public-auth-prompt__input"
- data-cy-public-auth-prompt-dialog-name
- :label="t('files_sharing', 'Name')"
- :placeholder="t('files_sharing', 'Enter your name')"
- minlength="2"
- name="name"
- required
- :value.sync="name" />
- </NcDialog>
-</template>
-
-<script lang="ts">
-import { defineComponent } from 'vue'
-import { t } from '@nextcloud/l10n'
-
-import NcDialog from '@nextcloud/vue/components/NcDialog'
-import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
-import NcTextField from '@nextcloud/vue/components/NcTextField'
-import { loadState } from '@nextcloud/initial-state'
-
-export default defineComponent({
- name: 'PublicAuthPrompt',
-
- components: {
- NcDialog,
- NcNoteCard,
- NcTextField,
- },
-
- props: {
- /**
- * Preselected nickname
- * @default '' No name preselected by default
- */
- nickname: {
- type: String,
- default: '',
- },
- },
-
- setup() {
- return {
- t,
-
- owner: loadState('files_sharing', 'owner', ''),
- ownerDisplayName: loadState('files_sharing', 'ownerDisplayName', ''),
- label: loadState('files_sharing', 'label', ''),
- note: loadState('files_sharing', 'note', ''),
- filename: loadState('files_sharing', 'filename', ''),
- }
- },
-
- data() {
- return {
- name: '',
- }
- },
-
- computed: {
- dialogName() {
- return this.t('files_sharing', 'Upload files to {folder}', { folder: this.label || this.filename })
- },
- dialogButtons() {
- return [{
- label: t('files_sharing', 'Submit name'),
- type: 'primary',
- nativeType: 'submit',
- }]
- },
- },
-
- watch: {
- /** Reset name to pre-selected nickname (e.g. Talk / Collabora ) */
- nickname: {
- handler() {
- this.name = this.nickname
- },
- immediate: true,
- },
- },
-})
-</script>
-<style scoped lang="scss">
-.public-auth-prompt {
- &__subtitle {
- // Smaller than dialog title
- font-size: 1.25em;
- margin-block: 0 calc(3 * var(--default-grid-baseline));
- }
-
- &__header {
- margin-block: 0 calc(3 * var(--default-grid-baseline));
- }
-
- &__input {
- margin-block: calc(4 * var(--default-grid-baseline)) calc(2 * var(--default-grid-baseline));
- }
-}
-</style>
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index 8912ff340b7..f1fb78e548b 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -226,19 +226,6 @@
{{ t('files_sharing', 'Delete') }}
</NcCheckboxRadioSwitch>
</section>
- <div class="sharingTabDetailsView__delete">
- <NcButton v-if="!isNewShare"
- :aria-label="t('files_sharing', 'Delete share')"
- :disabled="false"
- :readonly="false"
- type="tertiary"
- @click.prevent="removeShare">
- <template #icon>
- <CloseIcon :size="16" />
- </template>
- {{ t('files_sharing', 'Delete share') }}
- </NcButton>
- </div>
</section>
</div>
</div>
@@ -249,6 +236,19 @@
@click="cancel">
{{ t('files_sharing', 'Cancel') }}
</NcButton>
+ <div class="sharingTabDetailsView__delete">
+ <NcButton v-if="!isNewShare"
+ :aria-label="t('files_sharing', 'Delete share')"
+ :disabled="false"
+ :readonly="false"
+ variant="tertiary"
+ @click.prevent="removeShare">
+ <template #icon>
+ <CloseIcon :size="20" />
+ </template>
+ {{ t('files_sharing', 'Delete share') }}
+ </NcButton>
+ </div>
<NcButton type="primary"
data-cy-files-sharing-share-editor-action="save"
:disabled="creating"
diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue
index e50c3292055..82a11dea2e0 100644
--- a/apps/files_sharing/src/views/SharingTab.vue
+++ b/apps/files_sharing/src/views/SharingTab.vue
@@ -100,7 +100,7 @@
:file-info="fileInfo"
@open-sharing-details="toggleShareDetailsView" />
<!-- link shares list -->
- <SharingLinkList v-if="!loading"
+ <SharingLinkList v-if="!loading && isLinkSharingAllowed"
ref="linkShareList"
:can-reshare="canReshare"
:file-info="fileInfo"
@@ -157,6 +157,7 @@
<script>
import { getCurrentUser } from '@nextcloud/auth'
+import { getCapabilities } from '@nextcloud/capabilities'
import { orderBy } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
import { generateOcsUrl } from '@nextcloud/router'
@@ -242,7 +243,24 @@ export default {
* @return {boolean}
*/
isSharedWithMe() {
- return Object.keys(this.sharedWithMe).length > 0
+ return this.sharedWithMe !== null
+ && this.sharedWithMe !== undefined
+ },
+
+ /**
+ * Is link sharing allowed for the current user?
+ *
+ * @return {boolean}
+ */
+ isLinkSharingAllowed() {
+ const currentUser = getCurrentUser()
+ if (!currentUser) {
+ return false
+ }
+
+ const capabilities = getCapabilities()
+ const publicSharing = capabilities.files_sharing?.public || {}
+ return publicSharing.enabled === true
},
canReshare() {
@@ -257,6 +275,9 @@ export default {
},
externalShareInputPlaceholder() {
+ if (!this.isLinkSharingAllowed) {
+ return t('files_sharing', 'Federated cloud ID')
+ }
return this.config.showFederatedSharesAsInternal
? t('files_sharing', 'Email')
: t('files_sharing', 'Email, federated cloud ID')