1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import { t } from '@nextcloud/l10n'
import { computed, ref } from 'vue'
import NcDialog from '@nextcloud/vue/components/NcDialog'
import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
const props = defineProps<{
/** Name of the share */
name: string
/** Display name of the owner */
owner: string
/** The remote instance name */
remote: string
/** True if the user should enter a password */
passwordRequired: boolean
}>()
const emit = defineEmits<{
(e: 'close', state: boolean, password?: string): void
}>()
const password = ref('')
/**
* The dialog buttons
*/
const buttons = computed(() => [
{
label: t('federatedfilesharing', 'Cancel'),
callback: () => emit('close', false),
},
{
label: t('federatedfilesharing', 'Add remote share'),
nativeType: props.passwordRequired ? 'submit' : undefined,
type: 'primary',
callback: () => emit('close', true, password.value),
},
])
</script>
<template>
<NcDialog :buttons="buttons"
:is-form="passwordRequired"
:name="t('federatedfilesharing', 'Remote share')"
@submit="emit('close', true, password)">
<p>
{{ t('federatedfilesharing', 'Do you want to add the remote share {name} from {owner}@{remote}?', { name, owner, remote }) }}
</p>
<NcPasswordField v-if="passwordRequired"
class="remote-share-dialog__password"
:label="t('federatedfilesharing', 'Remote share password')"
:value.sync="password" />
</NcDialog>
</template>
<style scoped lang="scss">
.remote-share-dialog {
&__password {
margin-block: 1em .5em;
}
}
</style>
|