Skip to content
Snippets Groups Projects
Verified Commit 862f677c authored by Kirill Stytsenko's avatar Kirill Stytsenko
Browse files

Improve "back" functionality #92

parent 965933e6
Branches
Tags
3 merge requests!81New stable release,!43Merge dev to master,!41UI March
...@@ -85,8 +85,9 @@ ...@@ -85,8 +85,9 @@
</v-row> </v-row>
<v-row dense> <v-row dense>
<v-col> <v-col>
<v-btn color="blue-grey" class="white--text" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table/${item.id}`"> <v-btn outlined :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table/${item.id}`">
More <v-icon>mdi-table</v-icon>
View
</v-btn> </v-btn>
</v-col> </v-col>
<v-col class="align-right"> <v-col class="align-right">
...@@ -176,7 +177,8 @@ export default { ...@@ -176,7 +177,8 @@ export default {
}, },
mounted () { mounted () {
this.$root.$on('table-create', this.refresh) this.$root.$on('table-create', this.refresh)
this.refresh() const table = this.$store.state.table
this.refresh(table ? table.id : null)
}, },
methods: { methods: {
async details (tableId, clicked = false) { async details (tableId, clicked = false) {
...@@ -186,8 +188,8 @@ export default { ...@@ -186,8 +188,8 @@ export default {
} }
try { try {
const res = await this.$axios.get(`/api/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/table/${tableId}`) const res = await this.$axios.get(`/api/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/table/${tableId}`)
console.debug('table', res.data)
this.tableDetails = res.data this.tableDetails = res.data
this.$store.commit('SET_TABLE', this.tableDetails)
} catch (err) { } catch (err) {
this.tableDetails = undefined this.tableDetails = undefined
this.$toast.error('Could not get table details.') this.$toast.error('Could not get table details.')
...@@ -205,8 +207,9 @@ export default { ...@@ -205,8 +207,9 @@ export default {
this.loading = false this.loading = false
if (tableId) { this.openPanelByTableId(tableId) } if (tableId) { this.openPanelByTableId(tableId) }
} catch (err) { } catch (err) {
this.$toast.error('Could not list table.') this.$toast.error('Could not load tables.')
} }
this.$store.commit('SET_TABLE', null)
}, },
async deleteTable () { async deleteTable () {
try { try {
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
</v-toolbar-title> </v-toolbar-title>
<v-spacer /> <v-spacer />
<v-toolbar-title> <v-toolbar-title>
<v-btn class="mr-2" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table`">
<v-icon left>mdi-arrow-left</v-icon> Back
</v-btn>
<v-btn class="mr-2" :disabled="!token" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table/${$route.params.table_id}/import`"> <v-btn class="mr-2" :disabled="!token" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table/${$route.params.table_id}/import`">
<v-icon left>mdi-cloud-upload</v-icon> Import csv <v-icon left>mdi-cloud-upload</v-icon> Import csv
</v-btn> </v-btn>
......
...@@ -246,7 +246,8 @@ export default { ...@@ -246,7 +246,8 @@ export default {
text: `${this.$route.params.database_id}`, text: `${this.$route.params.database_id}`,
to: `/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/info`, to: `/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/info`,
activeClass: '' activeClass: ''
} },
{ text: 'Tables', to: `/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/table`, activeClass: '' }
], ],
rules: { rules: {
required: value => !!value || 'Required' required: value => !!value || 'Required'
......
export const state = () => ({ export const state = () => ({
db: null,
token: null, token: null,
user: null user: null,
db: null,
table: null
}) })
export const mutations = { export const mutations = {
...@@ -13,5 +14,13 @@ export const mutations = { ...@@ -13,5 +14,13 @@ export const mutations = {
}, },
SET_USER (state, user) { SET_USER (state, user) {
state.user = user state.user = user
},
/**
Workaround. Helps to go 'back' from table data view and
have the accordion open on the same table
*/
SET_TABLE (state, table) {
state.table = table
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment