-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy pathAuthTokenDeleteDialog.vue
More file actions
85 lines (76 loc) · 2.13 KB
/
Copy pathAuthTokenDeleteDialog.vue
File metadata and controls
85 lines (76 loc) · 2.13 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!--
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import type { IDialogButton } from '@nextcloud/dialogs'
import type { IToken } from '../store/authtoken.ts'
import { translate as t } from '@nextcloud/l10n'
import { computed } from 'vue'
import NcDialog from '@nextcloud/vue/components/NcDialog'
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
import { TokenType } from '../store/authtoken.ts'
const props = defineProps<{
/** The token being revoked */
token: IToken
/** Whether the dialog is open */
open: boolean
}>()
const emit = defineEmits<{
'update:open': [open: boolean]
confirm: []
}>()
const wiping = computed(() => props.token.type === TokenType.WIPING_TOKEN)
const messages = computed(() => {
if (wiping.value) {
return {
title: t('settings', 'Revoke and cancel pending wipe?'),
body: t('settings', 'Only continue if you no longer need the device to be wiped.'),
action: t('settings', 'Revoke and cancel wipe'),
}
}
return {
title: t('settings', 'Revoke app password?'),
body: t('settings', 'The app or device will lose access on its next sync. This cannot be undone.'),
action: t('settings', 'Revoke'),
}
})
const buttons = computed<IDialogButton[]>(() => [
{
label: t('settings', 'Cancel'),
variant: 'tertiary',
callback: () => emit('update:open', false),
},
{
label: messages.value.action,
variant: 'error',
callback: () => {
emit('confirm')
emit('update:open', false)
},
},
])
</script>
<template>
<NcDialog
:open="open"
:name="messages.title"
:buttons="buttons"
size="normal"
@update:open="emit('update:open', $event)">
<NcNoteCard
v-if="wiping"
:heading="t('settings', 'Remote wipe has not started yet.')"
type="error">
{{ t('settings', 'Revoking now cancels the wipe. The device keeps its synced data.') }}
</NcNoteCard>
<p class="auth-token-delete-dialog__body">
{{ messages.body }}
</p>
</NcDialog>
</template>
<style lang="scss" scoped>
.auth-token-delete-dialog__body {
margin-block-start: calc(var(--default-grid-baseline) * 2);
}
</style>