2020-05-17 19:34:56 +02:00
|
|
|
<template>
|
2020-05-18 18:06:32 +02:00
|
|
|
<div class="columns">
|
2020-05-17 19:34:56 +02:00
|
|
|
<div class="column col-12 empty text-light">
|
|
|
|
<div class="empty-icon">
|
|
|
|
<i class="material-icons md-48">cloud_off</i>
|
|
|
|
</div>
|
|
|
|
<p class="empty-title h5">
|
|
|
|
Disconnected
|
|
|
|
</p>
|
|
|
|
<div class="empty-action">
|
|
|
|
<button
|
|
|
|
class="btn btn-success"
|
|
|
|
:class="{'loading': isConnecting}"
|
|
|
|
@click="startConnection"
|
|
|
|
>
|
|
|
|
Connect
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-24 11:03:20 +02:00
|
|
|
<ModalAskCredentials
|
|
|
|
v-if="isAsking"
|
|
|
|
@closeAsking="closeAsking"
|
|
|
|
@credentials="continueTest"
|
|
|
|
/>
|
2020-05-17 19:34:56 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-05-18 18:06:32 +02:00
|
|
|
import { mapActions } from 'vuex';
|
2020-05-24 11:03:20 +02:00
|
|
|
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
2020-05-17 19:34:56 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'DatabaseConnectPanel',
|
2020-05-24 11:03:20 +02:00
|
|
|
components: {
|
|
|
|
ModalAskCredentials
|
|
|
|
},
|
2020-05-17 19:34:56 +02:00
|
|
|
props: {
|
|
|
|
connection: Object
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
2020-05-24 11:03:20 +02:00
|
|
|
isConnecting: false,
|
|
|
|
isAsking: false
|
2020-05-17 19:34:56 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions({
|
|
|
|
addNotification: 'notifications/addNotification',
|
2020-05-19 18:06:05 +02:00
|
|
|
connectWorkspace: 'workspaces/connectWorkspace'
|
2020-05-17 19:34:56 +02:00
|
|
|
}),
|
|
|
|
async startConnection () {
|
|
|
|
this.isConnecting = true;
|
2020-05-24 11:03:20 +02:00
|
|
|
|
|
|
|
if (this.connection.ask)
|
|
|
|
this.isAsking = true;
|
|
|
|
else {
|
|
|
|
await this.connectWorkspace(this.connection);
|
|
|
|
this.isConnecting = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async continueTest (credentials) { // if "Ask for credentials" is true
|
|
|
|
this.isAsking = false;
|
|
|
|
const params = Object.assign({}, this.connection, credentials);
|
|
|
|
await this.connectWorkspace(params);
|
|
|
|
this.isConnecting = false;
|
|
|
|
},
|
|
|
|
closeAsking () {
|
|
|
|
this.isAsking = false;
|
2020-05-17 19:34:56 +02:00
|
|
|
this.isConnecting = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.empty{
|
|
|
|
height: 100%;
|
|
|
|
border-radius: 0;
|
|
|
|
background: transparent;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
</style>
|