Skip to content

Commit 20296cd

Browse files
authored
T347865: Ask for feedback before deleting a wikibase instance. (#801)
* Fix Settings panel position on the page * Added the "confirm delete" modal with fedback questions * Fix lint errors * Use v-dialog for the delete card * Modify delete card to be like on figma * Fix spacing between components on the confirm delete card * Fix bug on delete reason checkboxes
1 parent 52d3977 commit 20296cd

File tree

3 files changed

+120
-28
lines changed

3 files changed

+120
-28
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<template>
2+
<v-dialog v-model="open_dialog" width="auto" persistent>
3+
<v-card>
4+
<v-card-title>
5+
Confirm Deletion
6+
</v-card-title>
7+
<v-card-text class="align-start pb-4">
8+
Before you delete your Wikibase instance, <br/>
9+
please let us know the reason for your deletion.<br/>
10+
Please select all that apply.
11+
</v-card-text>
12+
<div class="px-4 pb-2">
13+
<v-checkbox
14+
class="ma-0" hide-details
15+
label="Was only used for Testing"
16+
v-model="deletion_reasons"
17+
value="Was only used for testing"
18+
/>
19+
<v-checkbox
20+
class="ma-0"
21+
hide-details
22+
label="Lacking essential
23+
functionality"
24+
v-model="deletion_reasons"
25+
value="Lacking essential functionality"
26+
/>
27+
<v-checkbox
28+
class="ma-0"
29+
hide-details
30+
label="Too complex to work with"
31+
v-model="deletion_reasons"
32+
value="Too complex to work with"
33+
/>
34+
<v-checkbox
35+
class="ma-0"
36+
hide-details
37+
label="Other reasons (please specify)"
38+
v-model="deletion_reasons"
39+
value="Other Reason"
40+
/>
41+
</div>
42+
<div class="px-4 align-self-stretch align-start">
43+
<p class="ma-0">Please elaborate:</p>
44+
<v-text-field
45+
class="ma-0"
46+
outlined
47+
dense
48+
hide-details
49+
v-model="inputReason"
50+
placeholder="e.g. ran out of space to create new wiki"
51+
></v-text-field>
52+
</div>
53+
<v-card-actions class="justify-end">
54+
<v-btn
55+
text
56+
@click='close'
57+
>Cancel</v-btn>
58+
<v-btn
59+
text
60+
@click="doDelete"
61+
variant="light"
62+
class="red--text"
63+
>Delete Wikibase</v-btn>
64+
</v-card-actions>
65+
</v-card>
66+
</v-dialog>
67+
</template>
68+
<script>
69+
export default {
70+
name: 'ConfirmDelete',
71+
props: [
72+
'wikiId'
73+
],
74+
data () {
75+
return {
76+
deletion_reasons: [],
77+
open_dialog: true,
78+
inputReason: ''
79+
}
80+
},
81+
methods: {
82+
doDelete () {
83+
const wiki = this.wikiId
84+
const deletionReasons = this.deletion_reasons
85+
86+
if (deletionReasons.includes('Other Reason')) {
87+
deletionReasons[deletionReasons.indexOf('Other Reason')] = this.inputReason
88+
}
89+
this.$store
90+
.dispatch('deleteWiki', { wiki, deletionReasons })
91+
.then(() => this.$router.push('/dashboard'))
92+
.catch(err => {
93+
console.log(err.response)
94+
alert('Something went wrong.')
95+
this.$router.push('/dashboard')
96+
})
97+
},
98+
close () {
99+
this.$emit('close')
100+
}
101+
}
102+
}
103+
</script>
104+
<style>
105+
</style>

src/components/Pages/ManageWiki/Cards/Delete.vue

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
11
<template>
2-
<v-card color="#fad1d0">
3-
<v-card-title>Delete Site</v-card-title>
4-
<v-card-text>
5-
Selecting Confirm Deletion will permanently delete the selected Wikibase instance.<br>
6-
All data associated with this instance will be purged permanently in 30 days.<br>
7-
<br>
8-
The domain will <strong>not</strong> be available for reuse.
9-
</v-card-text>
10-
<v-card-actions>
11-
<v-btn v-if="!expandDelete" @click="expandDelete = true" color="red">Delete site</v-btn>
12-
<v-btn v-if="expandDelete" @click="expandDelete = false" color="blue">Cancel deletion</v-btn>
13-
<v-btn v-if="expandDelete" @click="doDelete" color="red">Confirm deletion</v-btn>
14-
</v-card-actions>
2+
<v-card class="pa-4" color="#fad1d0">
3+
<p class="text-h5 ma-0">Delete Wikibase Instance</p>
4+
<p class="text-sm-body-2">
5+
Selecting Confirm Deletion will permanently delete the selected Wikibase instance. All data associated <br/>
6+
with this instance will be purged permanently in 30 days. The domain will <strong>not</strong> be available for reuse.
7+
</p>
8+
<v-btn @click="expandDelete = true" color="red" class="text-sm-button white--text">Delete site</v-btn>
9+
<ConfirmDelete v-if="expandDelete" :wiki-id=this.wikiId @close="expandDelete=false"/>
1510
</v-card>
1611
</template>
1712

1813
<script>
14+
import ConfirmDelete from '@/components/Pages/ManageWiki/Cards/ConfirmDelete.vue'
15+
1916
export default {
2017
name: 'Delete',
18+
components: { ConfirmDelete },
2119
props: [
2220
'wikiId'
2321
],
2422
data () {
2523
return {
2624
expandDelete: false
2725
}
28-
},
29-
methods: {
30-
doDelete () {
31-
const wiki = this.wikiId
32-
33-
this.$store
34-
.dispatch('deleteWiki', { wiki })
35-
.then(() => this.$router.push('/dashboard'))
36-
.catch(err => {
37-
console.log(err.response)
38-
alert('Something went wrong.')
39-
this.$router.push('/dashboard')
40-
})
41-
}
4226
}
4327
}
4428
</script>

src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
:disabled="waitForToggleUpdate"
1414
/>
1515
</v-col>
16-
<v-expansion-panels v-model="panel">
16+
<v-expansion-panels class="settings-panel" v-model="panel">
1717
<v-expansion-panel>
1818
<v-expansion-panel-header>
1919
<strong>SETTINGS</strong>
@@ -227,6 +227,9 @@ export default {
227227
padding-bottom: 0;
228228
padding-top: 0;
229229
}
230+
.settings-panel {
231+
position: static;
232+
}
230233
.answer-input-field {
231234
margin-right: 33px !important;
232235
}

0 commit comments

Comments
 (0)