-
Notifications
You must be signed in to change notification settings - Fork 5
/
SelectDatasetDialog.vue
68 lines (57 loc) · 1.65 KB
/
SelectDatasetDialog.vue
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
<template>
<el-dialog
:title="text('Choose your dataset')"
:visible="showSelectDialog"
:close-on-click-modal="false"
:before-close="dialogCancelHandler"
class="dsa-select-dataset-dialog"
>
<template slot="title">
<span class="el-dialog__title">{{ text('Choose your dataset') }}</span>
<el-button @click="editNewDataset" class="dsa-add-new-dataset">{{ text('Add new dataset') }}</el-button>
</template>
<p class="dsa-hint">{{ text('hint') }}</p>
<DatasetList />
</el-dialog>
</template>
<script>
import {mapState} from 'vuex'
import DatasetList from '@/components/DatasetList.vue'
export default {
components: {
DatasetList
},
computed: {
...mapState([
'showSelectDialog' /** {boolean} Visibility of the dialog. */
])
},
methods: {
/**
* Close the select dialog and start editing a new dataset.
*/
editNewDataset () {
this.$store.commit('closeSelectDialog')
this.$store.commit('editNewDataset')
},
/**
* Handle cancelling of the element-ui dialog.
* Close the select dialog and call done().
* @param {function} done - Passed by element-ui dialog. Call done() to finish closing the dialog.
*/
dialogCancelHandler (done) {
this.$store.commit('closeSelectDialog')
done()
},
text (text) {
switch (text) {
case 'Choose your dataset': return Drupal.t('Choose your dataset')
case 'Add new dataset': return Drupal.t('Add new dataset')
case 'hint': return Drupal.t('Click on the dataset you would like to choose for this action')
}
}
}
}
</script>
<style lang="css">
</style>