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

Database deletion

parent 2d0fc8e0
No related branches found
No related tags found
4 merge requests!23Sprint results,!18Merge Conflicts,!15Sprint ended, merge into master,!13UI Database/Tables CRUD
<template> <template>
<v-row v-if="db" justify="center" align="center"> <v-row v-if="db" dense justify="center" align="center">
<v-col cols="12" sm="8" md="6"> <v-col cols="10">
<h2> <h2>
{{ db.name }} {{ db.name }}
</h2> </h2>
<v-btn :to="`/db/${$route.params.db_id}/tables`">Tables</v-btn> <v-btn :to="`/db/${$route.params.db_id}/tables`">Tables</v-btn>
</v-col> </v-col>
<v-col class="align-right" cols="2">
<v-btn outlined color="error" @click="dialogDelete = true">Delete</v-btn>
</v-col>
<v-dialog v-model="dialogDelete" max-width="640">
<v-card>
<v-card-title class="headline">
Delete
</v-card-title>
<v-card-text class="pb-1">
Are you sure you want to drop this database?
</v-card-text>
<v-card-actions class="pl-4 pb-4 pr-4">
<v-btn @click="dialogDelete = false">
Cancel
</v-btn>
<v-spacer />
<v-btn color="error" @click="deleteDatabase()">
Delete
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row> </v-row>
</template> </template>
...@@ -14,7 +37,8 @@ export default { ...@@ -14,7 +37,8 @@ export default {
components: {}, components: {},
data () { data () {
return { return {
db: null db: null,
dialogDelete: false
} }
}, },
async mounted () { async mounted () {
...@@ -24,6 +48,19 @@ export default { ...@@ -24,6 +48,19 @@ export default {
} catch (err) { } catch (err) {
this.$toast.error('Could not load database.') this.$toast.error('Could not load database.')
} }
},
methods: {
async deleteDatabase () {
try {
await this.$axios.delete(
`http://localhost:9092/api/database/${this.$route.params.db_id}`)
this.$router.push({ path: '/databases' })
this.$toast.success(`Database "${this.db.name}" deleted.`)
} catch (err) {
this.$toast.error('Could not delete database.')
}
this.dialogDelete = false
}
} }
} }
</script> </script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment