antares/src/renderer/components/DatabaseWorkspace.vue

58 lines
1.3 KiB
Vue
Raw Normal View History

2020-05-14 15:21:57 +02:00
<template>
<div v-show="selectedConnection === connection.uid" class="workspace column columns">
2020-05-15 17:52:59 +02:00
<DatabaseExploreBar :connection="connection" />
2020-05-14 15:21:57 +02:00
<div class="workspace-tabs column">
2020-05-15 17:52:59 +02:00
<p>{{ connection }}</p>
2020-05-14 15:21:57 +02:00
</div>
</div>
</template>
<script>
2020-05-15 17:52:59 +02:00
import { mapGetters, mapActions } from 'vuex';
2020-05-14 15:21:57 +02:00
import Connection from '@/ipc-api/Connection';
import DatabaseExploreBar from '@/components/DatabaseExploreBar';
export default {
name: 'DatabaseWorkspace',
components: {
DatabaseExploreBar
},
props: {
connection: Object
},
data () {
return {
structure: null
};
},
computed: {
...mapGetters({
selectedConnection: 'connections/getSelected'
})
},
async created () {
this.isConnected = await Connection.checkConnection(this.connection.uid);
2020-05-15 17:52:59 +02:00
if (this.isConnected) {
try {
this.structure = await Connection.connect(this.connection);// TODO: use refresh
}
catch (err) {
this.addNotification({ status: 'error', message: err.stack });
}
}
2020-05-14 15:21:57 +02:00
},
methods: {
2020-05-15 17:52:59 +02:00
...mapActions({
addNotification: 'notifications/addNotification'
})
2020-05-14 15:21:57 +02:00
}
};
</script>
<style lang="scss">
.workspace{
padding: 0;
margin: 0;
}
</style>