Skip to content

Commit 5364410

Browse files
authored
Merge pull request #1434 from nextcloud/warn-table-manager
enh: warn during table manager promotion/demotion
2 parents 07d64dd + e43d48b commit 5364410

File tree

4 files changed

+56
-25
lines changed

4 files changed

+56
-25
lines changed

cypress/support/commands.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ Cypress.Commands.add('addUserToGroup', (userId, groupId) => {
470470

471471
Cypress.Commands.add('removeColumn', (title) => {
472472
cy.get('.custom-table table tr th .cell').contains(title).click()
473-
cy.get('.v-popper__popper ul.nc-button-group-content').last().get('button').last().click()
474-
cy.get('.modal__content button').contains('Confirm').click()
473+
cy.get('[data-cy="deleteColumnActionBtn"] button').click()
474+
cy.get('[data-cy="confirmDialog"] button').contains('Confirm').click()
475475
})
476476

477477
// fill in a value in the 'create row' or 'edit row' model

src/modules/sidebar/partials/ShareList.vue

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</NcActionCheckbox>
6565
<NcActionButton v-if="!isView && !personHasTableManagePermission(share.receiver)"
6666
:close-after-click="true"
67-
@click="promoteToManager(share)">
67+
@click="warnOnPromote(share)">
6868
<template #icon>
6969
<Crown :size="20" />
7070
</template>
@@ -114,6 +114,16 @@
114114
<div v-else>
115115
{{ t('tables', 'No shares') }}
116116
</div>
117+
<div>
118+
<DialogConfirmation :description="t('tables', 'After table promotion, any applications based on this table created by the share recipients will continue to consume its data even if you demote them later')"
119+
:title="t('tables', 'Confirm table manager promotion')"
120+
:cancel-title="t('tables', 'Cancel')"
121+
:confirm-title="t('tables', 'Promote to table manager')"
122+
confirm-class="warning"
123+
:show-modal="showModal"
124+
@confirm="promoteToManager"
125+
@cancel="showModal=false" />
126+
</div>
117127
</div>
118128
</template>
119129

@@ -127,6 +137,9 @@ import Crown from 'vue-material-design-icons/Crown.vue'
127137
import Information from 'vue-material-design-icons/Information.vue'
128138
import Account from 'vue-material-design-icons/Account.vue'
129139
import moment from '@nextcloud/moment'
140+
import { showWarning } from '@nextcloud/dialogs'
141+
import DialogConfirmation from '../../../shared/modals/DialogConfirmation.vue'
142+
import '@nextcloud/dialogs/style.css'
130143
131144
export default {
132145
components: {
@@ -142,6 +155,7 @@ export default {
142155
NcActionSeparator,
143156
OpenInNew,
144157
Crown,
158+
DialogConfirmation,
145159
},
146160
147161
mixins: [formatting],
@@ -158,6 +172,8 @@ export default {
158172
loading: false,
159173
// To enable the share info popup
160174
debug: false,
175+
showModal: false,
176+
currentShare: {},
161177
}
162178
},
163179
@@ -205,10 +221,18 @@ export default {
205221
updatePermission(share, permission, value) {
206222
this.$emit('update', { id: share.id, permission, value })
207223
},
208-
promoteToManager(share) {
209-
this.$emit('update', { id: share.id, permission: 'manage', value: true })
224+
warnOnPromote(share) {
225+
this.currentShare = share
226+
this.showModal = true
227+
},
228+
promoteToManager() {
229+
if (!this.currentShare) return
230+
this.$emit('update', { id: this.currentShare?.id, permission: 'manage', value: true })
231+
this.currentShare = {}
232+
this.showModal = false
210233
},
211-
demoteManager(share) {
234+
async demoteManager(share) {
235+
showWarning(t('tables', 'Any application created by a demoted share recipients using a shared table will continue to consume its data.', { share: share.displayName }))
212236
this.$emit('update', { id: share.id, permission: 'manage', value: false })
213237
},
214238
personHasTableManagePermission(userId) {

src/shared/components/ncTable/partials/TableHeaderColumnOptions.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
</NcActionButton>
111111
<NcActionButton v-if="showDeleteColumn"
112112
:aria-label="t('tables', 'Delete column')"
113+
data-cy="deleteColumnActionBtn"
113114
@click="deleteColumn()">
114115
<template #icon>
115116
<Delete :size="25" />

src/shared/modals/DialogConfirmation.vue

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<NcModal v-if="showModal" @close="$emit('cancel')">
7-
<div class="modal__content">
8-
<div class="row">
9-
<div v-if="title" class="col-4">
10-
<h2>{{ title }}</h2>
11-
</div>
12-
<div v-if="description" class="col-4">
13-
<p>{{ description }}</p>
14-
</div>
15-
</div>
16-
<div class="row space-T">
17-
<div class="fix-col-4 end">
18-
<NcButton :type="confirmClass" :aria-label="confirmTitle" @click="$emit('confirm')">
19-
{{ confirmTitle }}
20-
</NcButton>
21-
</div>
6+
<NcDialog v-if="showModal" :out-transition="true"
7+
size="normal" close-on-click-outside :name="title" @closing="$emit('cancel')"
8+
data-cy="confirmDialog">
9+
<div class="row">
10+
<div v-if="description" class="col-4">
11+
<p>{{ description }}</p>
2212
</div>
2313
</div>
24-
</NcModal>
14+
<template #actions>
15+
<NcButton :aria-label="cancelTitle" :type="cancelClass" @click="$emit('cancel')">
16+
{{ cancelTitle }}
17+
</NcButton>
18+
<NcButton :type="confirmClass" :aria-label="confirmTitle" @click="$emit('confirm')">
19+
{{ confirmTitle }}
20+
</NcButton>
21+
</template>
22+
</NcDialog>
2523
</template>
2624

2725
<script>
28-
import { NcModal, NcButton } from '@nextcloud/vue'
26+
import { NcDialog, NcButton } from '@nextcloud/vue'
2927
3028
export default {
3129
name: 'DialogConfirmation',
3230
components: {
33-
NcModal,
31+
NcDialog,
3432
NcButton,
3533
},
3634
props: {
@@ -46,6 +44,14 @@ export default {
4644
type: String,
4745
default: null,
4846
},
47+
cancelTitle: {
48+
type: String,
49+
default: t('tables', 'Cancel'),
50+
},
51+
cancelClass: {
52+
type: String,
53+
default: 'tertiary',
54+
},
4955
confirmTitle: {
5056
type: String,
5157
default: t('tables', 'Confirm'),

0 commit comments

Comments
 (0)