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

WiP

Former-commit-id: f501236a
parent 47268ec8
No related branches found
No related tags found
No related merge requests found
<template> <template>
<div> <div>
<v-progress-linear v-if="loading" :indeterminate="!error" /> <v-progress-linear v-if="loading" />
<v-card v-if="!loading && tables.length === 0" flat> <v-card v-if="!loading && tables.length === 0" flat>
<v-card-title> <v-card-title>
(no tables) (no tables)
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
{{ col.column_type }} {{ col.column_type }}
</td> </td>
<td> <td>
<DialogsColumnUnit :column="col" /> <DialogsColumnUnit :column="col" :table-id="tableDetails.id" />
</td> </td>
<td> <td>
<v-simple-checkbox v-model="col.is_primary_key" disabled aria-readonly="true" /> <v-simple-checkbox v-model="col.is_primary_key" disabled aria-readonly="true" />
......
...@@ -83,7 +83,8 @@ ...@@ -83,7 +83,8 @@
<v-btn <v-btn
color="blue darken-1" color="blue darken-1"
text text
@click="dialog = false"> :disabled="!model || !uri"
@click="save">
Save Save
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
...@@ -94,12 +95,14 @@ ...@@ -94,12 +95,14 @@
<script> <script>
export default { export default {
props: { props: {
column: { type: Object, default: () => ({}) } column: { type: Object, default: () => ({}) },
tableId: { type: Number, default: () => -1 }
}, },
data () { data () {
return { return {
dialog: false, dialog: false,
isLoading: false, isLoading: false,
saved: false,
model: null, model: null,
uri: null, uri: null,
search: null, search: null,
...@@ -108,8 +111,7 @@ export default { ...@@ -108,8 +111,7 @@ export default {
}, },
computed: { computed: {
name () { name () {
// TODO return this.saved && this.model && this.model.name
return null
}, },
items () { items () {
return this.entries && this.entries.map((entry) => { return this.entries && this.entries.map((entry) => {
...@@ -121,10 +123,10 @@ export default { ...@@ -121,10 +123,10 @@ export default {
}) })
} }
}, },
watch: { watch: {
async model (val) { async model (val) {
this.uri = null this.uri = null
this.saved = false
if (!val) { return } if (!val) { return }
try { try {
const res = await this.$axios.get(`/api/units/uri/${val.name}`) const res = await this.$axios.get(`/api/units/uri/${val.name}`)
...@@ -154,6 +156,37 @@ export default { ...@@ -154,6 +156,37 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
async save () {
try {
await this.$axios.post('/api/units/saveconcept', {
name: this.model.name,
uri: this.uri
})
} catch (error) {
const { status } = error.response
if (status !== 201 && status !== 400) {
this.$toast.error('Could not save concept.')
console.log(error)
}
}
console.log(this.$route.params.database_id, this.tableId, this.column)
try {
await this.$axios.post('/api/units/savecolumnsconcept', {
cdbid: Number(this.$route.params.database_id),
cid: this.column.id,
tid: this.tableId,
uri: this.uri
})
this.dialog = false
this.saved = true
this.$nextTick(() => {
this.$emit('save')
})
} catch (err) {
this.$toast.error('Could not save column unit.')
console.log(err)
}
}
} }
} }
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment