aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-07-09 12:09:42 +0200
committerJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-07-12 20:14:30 +0200
commitbc5839e5b5e2192ed7d2dd2173ab5ca72b1d8ebc (patch)
tree72273e3ce20c1eb2105d01091061948c43b115ea /apps/files_sharing/src
parenta65cdd1e700d00ad52a9bcc2dada26f79d8f270d (diff)
downloadnextcloud-server-bc5839e5b5e2192ed7d2dd2173ab5ca72b1d8ebc.tar.gz
nextcloud-server-bc5839e5b5e2192ed7d2dd2173ab5ca72b1d8ebc.zip
chore(files_sharing): cleanup NewFileRequestDialog vue
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog.vue13
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue (renamed from apps/files_sharing/src/components/NewFileRequestDialog/FileRequestDatePassword.vue)30
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue (renamed from apps/files_sharing/src/components/NewFileRequestDialog/FileRequestFinish.vue)7
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue (renamed from apps/files_sharing/src/components/NewFileRequestDialog/FileRequestIntro.vue)0
4 files changed, 28 insertions, 22 deletions
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog.vue b/apps/files_sharing/src/components/NewFileRequestDialog.vue
index 2f3eab0b091..b0a969c25f1 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog.vue
@@ -23,6 +23,7 @@
<form ref="form"
class="file-request-dialog__form"
aria-labelledby="file-request-dialog-description"
+ aria-live="polite"
data-cy-file-request-dialog-form
@submit.prevent.stop="">
<FileRequestIntro v-show="currentStep === STEP.FIRST"
@@ -33,8 +34,8 @@
:note.sync="note" />
<FileRequestDatePassword v-show="currentStep === STEP.SECOND"
- :deadline.sync="deadline"
:disabled="loading"
+ :expiration-date.sync="expirationDate"
:password.sync="password" />
<FileRequestFinish v-if="share"
@@ -124,9 +125,9 @@ import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import IconCheck from 'vue-material-design-icons/Check.vue'
import IconNext from 'vue-material-design-icons/ArrowRight.vue'
-import FileRequestDatePassword from './NewFileRequestDialog/FileRequestDatePassword.vue'
-import FileRequestFinish from './NewFileRequestDialog/FileRequestFinish.vue'
-import FileRequestIntro from './NewFileRequestDialog/FileRequestIntro.vue'
+import FileRequestDatePassword from './NewFileRequestDialog/NewFileRequestDialogDatePassword.vue'
+import FileRequestFinish from './NewFileRequestDialog/NewFileRequestDialogFinish.vue'
+import FileRequestIntro from './NewFileRequestDialog/NewFileRequestDialogIntro.vue'
import Share from '../models/Share'
import logger from '../services/logger'
@@ -182,7 +183,7 @@ export default defineComponent({
label: '',
note: '',
- deadline: null as Date | null,
+ expirationDate: null as Date | null,
password: null as string | null,
share: null as Share | null,
@@ -249,7 +250,7 @@ export default defineComponent({
this.loading = true
// Format must be YYYY-MM-DD
- const expireDate = this.deadline ? this.deadline.toISOString().split('T')[0] : undefined
+ const expireDate = this.expirationDate ? this.expirationDate.toISOString().split('T')[0] : undefined
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares')
try {
const request = await axios.post<OCSResponse>(shareUrl, {
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/FileRequestDatePassword.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
index cf7cf4bcb08..1087fdd5a06 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/FileRequestDatePassword.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
@@ -19,25 +19,25 @@
<!-- Enable expiration -->
<legend>{{ t('files_sharing', 'When should the request expire ?') }}</legend>
<NcCheckboxRadioSwitch v-show="!defaultExpireDateEnforced"
- :checked="defaultExpireDateEnforced || deadline !== null"
+ :checked="defaultExpireDateEnforced || expirationDate !== null"
:disabled="disabled || defaultExpireDateEnforced"
@update:checked="onToggleDeadline">
- {{ t('files_sharing', 'Set a submission deadline') }}
+ {{ t('files_sharing', 'Set a submission expirationDate') }}
</NcCheckboxRadioSwitch>
<!-- Date picker -->
- <NcDateTimePickerNative v-if="deadline !== null"
- id="file-request-dialog-deadline"
+ <NcDateTimePickerNative v-if="expirationDate !== null"
+ id="file-request-dialog-expirationDate"
:disabled="disabled"
:hide-label="true"
:max="maxDate"
:min="minDate"
:placeholder="t('files_sharing', 'Select a date')"
:required="defaultExpireDateEnforced"
- :value="deadline"
- name="deadline"
+ :value="expirationDate"
+ name="expirationDate"
type="date"
- @update:value="$emit('update:deadline', $event)"/>
+ @update:value="$emit('update:expirationDate', $event)"/>
</fieldset>
<!-- Password -->
@@ -113,7 +113,7 @@ export default defineComponent({
required: false,
default: false,
},
- deadline: {
+ expirationDate: {
type: Date as PropType<Date | null>,
required: false,
default: null,
@@ -126,7 +126,7 @@ export default defineComponent({
},
emits: [
- 'update:deadline',
+ 'update:expirationDate',
'update:password',
],
@@ -157,15 +157,15 @@ export default defineComponent({
computed: {
passwordAndExpirationSummary(): string {
- if (this.deadline && this.password) {
+ if (this.expirationDate && this.password) {
return this.t('files_sharing', 'The request will expire on {date} at midnight and will be password protected.', {
- date: this.deadline.toLocaleDateString(),
+ date: this.expirationDate.toLocaleDateString(),
})
}
- if (this.deadline) {
+ if (this.expirationDate) {
return this.t('files_sharing', 'The request will expire on {date} at midnight.', {
- date: this.deadline.toLocaleDateString(),
+ date: this.expirationDate.toLocaleDateString(),
})
}
@@ -180,7 +180,7 @@ export default defineComponent({
mounted() {
// If defined, we set the default expiration date
if (this.defaultExpireDate) {
- this.$emit('update:deadline', sharingConfig.defaultExpirationDate)
+ this.$emit('update:expirationDate', sharingConfig.defaultExpirationDate)
}
// If enforced, we cannot set a date before the default expiration days (see admin settings)
@@ -196,7 +196,7 @@ export default defineComponent({
methods: {
onToggleDeadline(checked: boolean) {
- this.$emit('update:deadline', checked ? new Date() : null)
+ this.$emit('update:expirationDate', checked ? new Date() : null)
},
async onTogglePassword(checked: boolean) {
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/FileRequestFinish.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
index 0c30a8bf261..423565f4d48 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/FileRequestFinish.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue
@@ -124,9 +124,14 @@ export default defineComponent({
methods: {
async copyShareLink(event: MouseEvent) {
+ if (this.isCopied) {
+ this.isCopied = false
+ return
+ }
+
if (!navigator.clipboard) {
// Clipboard API not available
- showError(this.t('files_sharing', 'Clipboard is not available'))
+ window.prompt(this.t('files_sharing', 'Automatically copying failed, please copy the share link manually'), this.shareLink)
return
}
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/FileRequestIntro.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue
index 766fbc3fc22..766fbc3fc22 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/FileRequestIntro.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue