|
2 | 2 | - SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors |
3 | 3 | - SPDX-License-Identifier: AGPL-3.0-or-later |
4 | 4 | --> |
| 5 | + |
| 6 | +<script setup lang="ts"> |
| 7 | +import type { IOauthClient } from '../views/AdminSettings.vue' |
| 8 | +
|
| 9 | +import { t } from '@nextcloud/l10n' |
| 10 | +import NcButton from '@nextcloud/vue/components/NcButton' |
| 11 | +import NcPasswordField from '@nextcloud/vue/components/NcPasswordField' |
| 12 | +import IconTrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue' |
| 13 | +
|
| 14 | +defineProps<{ |
| 15 | + /** |
| 16 | + * The OAuth client to display |
| 17 | + */ |
| 18 | + client: IOauthClient |
| 19 | +}>() |
| 20 | +
|
| 21 | +defineEmits<{ |
| 22 | + delete: [] |
| 23 | +}>() |
| 24 | +</script> |
| 25 | + |
5 | 26 | <template> |
6 | 27 | <tr> |
7 | | - <td>{{ name }}</td> |
8 | | - <td>{{ redirectUri }}</td> |
9 | | - <td><code>{{ clientId }}</code></td> |
| 28 | + <td>{{ client.name }}</td> |
10 | 29 | <td> |
11 | | - <div class="action-secret"> |
12 | | - <code>{{ renderedSecret }}</code> |
13 | | - <NcButton |
14 | | - v-if="clientSecret !== ''" |
15 | | - variant="tertiary-no-background" |
16 | | - :aria-label="toggleAriaLabel" |
17 | | - @click="toggleSecret"> |
18 | | - <template #icon> |
19 | | - <EyeOutline :size="20" /> |
20 | | - </template> |
21 | | - </NcButton> |
22 | | - </div> |
| 30 | + <code :class="$style.oAuthItem__code">{{ client.redirectUri }}</code> |
23 | 31 | </td> |
24 | | - <td class="action-column"> |
| 32 | + <td> |
| 33 | + <code :class="$style.oAuthItem__code">{{ client.clientId }}</code> |
| 34 | + </td> |
| 35 | + <td> |
| 36 | + <NcPasswordField |
| 37 | + v-if="client.clientSecret" |
| 38 | + :class="$style.oAuthItem__clientSecret" |
| 39 | + :aria-label="t('oauth2', 'Secret key')" |
| 40 | + as-text |
| 41 | + :model-value="client.clientSecret" |
| 42 | + show-trailing-button /> |
| 43 | + <span v-else>*****</span> |
| 44 | + </td> |
| 45 | + <td> |
25 | 46 | <NcButton |
26 | | - variant="tertiary-no-background" |
27 | 47 | :aria-label="t('oauth2', 'Delete')" |
28 | | - @click="$emit('delete', id)"> |
| 48 | + :title="t('oauth2', 'Delete')" |
| 49 | + variant="error" |
| 50 | + @click="$emit('delete')"> |
29 | 51 | <template #icon> |
30 | | - <Delete |
31 | | - :size="20" |
32 | | - :title="t('oauth2', 'Delete')" /> |
| 52 | + <IconTrashCanOutline :size="20" /> |
33 | 53 | </template> |
34 | 54 | </NcButton> |
35 | 55 | </td> |
36 | 56 | </tr> |
37 | 57 | </template> |
38 | 58 |
|
39 | | -<script> |
40 | | -
|
41 | | -import NcButton from '@nextcloud/vue/components/NcButton' |
42 | | -import EyeOutline from 'vue-material-design-icons/EyeOutline.vue' |
43 | | -import Delete from 'vue-material-design-icons/TrashCanOutline.vue' |
44 | | -
|
45 | | -export default { |
46 | | - name: 'OAuthItem', |
47 | | - components: { |
48 | | - Delete, |
49 | | - NcButton, |
50 | | - EyeOutline, |
51 | | - }, |
52 | | -
|
53 | | - props: { |
54 | | - client: { |
55 | | - type: Object, |
56 | | - required: true, |
57 | | - }, |
58 | | - }, |
59 | | -
|
60 | | - data() { |
61 | | - return { |
62 | | - id: this.client.id, |
63 | | - name: this.client.name, |
64 | | - redirectUri: this.client.redirectUri, |
65 | | - clientId: this.client.clientId, |
66 | | - clientSecret: this.client.clientSecret, |
67 | | - renderSecret: false, |
68 | | - } |
69 | | - }, |
70 | | -
|
71 | | - computed: { |
72 | | - renderedSecret() { |
73 | | - if (this.renderSecret) { |
74 | | - return this.clientSecret |
75 | | - } else { |
76 | | - return '****' |
77 | | - } |
78 | | - }, |
79 | | -
|
80 | | - toggleAriaLabel() { |
81 | | - if (!this.renderSecret) { |
82 | | - return t('oauth2', 'Show client secret') |
83 | | - } |
84 | | - return t('oauth2', 'Hide client secret') |
85 | | - }, |
86 | | - }, |
87 | | -
|
88 | | - methods: { |
89 | | - toggleSecret() { |
90 | | - this.renderSecret = !this.renderSecret |
91 | | - }, |
92 | | - }, |
| 59 | +<style module> |
| 60 | +.oAuthItem__code { |
| 61 | + display: inline-block; |
| 62 | + overflow-x: scroll; |
| 63 | + padding-block: var(--default-grid-baseline); |
| 64 | + text-wrap: nowrap; |
| 65 | + vertical-align: middle; |
| 66 | + width: 100%; |
93 | 67 | } |
94 | | -</script> |
95 | | - |
96 | | -<style scoped> |
97 | | - .action-secret { |
98 | | - display: flex; |
99 | | - align-items: center; |
100 | | - } |
101 | | -
|
102 | | - .action-secret code { |
103 | | - padding-top: 5px; |
104 | | - } |
105 | 68 |
|
106 | | - td code { |
107 | | - display: inline-block; |
108 | | - vertical-align: middle; |
109 | | - } |
110 | | -
|
111 | | - table.inline td { |
112 | | - border: none; |
113 | | - padding: 5px; |
114 | | - } |
115 | | -
|
116 | | - .action-column { |
117 | | - display: flex; |
118 | | - justify-content: flex-end; |
119 | | - padding-inline-end: 0; |
120 | | - } |
| 69 | +.oAuthItem__clientSecret { |
| 70 | + min-width: 200px; |
| 71 | +} |
121 | 72 | </style> |
0 commit comments