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">
|
2020-08-12 10:48:18 +02:00
|
|
|
<i class="mdi mdi-48px mdi-power-plug-off" />
|
2020-05-17 19:34:56 +02:00
|
|
|
</div>
|
|
|
|
<p class="empty-title h5">
|
2020-05-25 15:37:59 +02:00
|
|
|
{{ $t('word.disconnected') }}
|
2020-05-17 19:34:56 +02:00
|
|
|
</p>
|
|
|
|
<div class="empty-action">
|
|
|
|
<button
|
|
|
|
class="btn btn-success"
|
|
|
|
:class="{'loading': isConnecting}"
|
|
|
|
@click="startConnection"
|
|
|
|
>
|
2020-05-25 15:37:59 +02:00
|
|
|
{{ $t('word.connect') }}
|
2020-05-17 19:34:56 +02:00
|
|
|
</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 {
|
2020-06-03 20:56:44 +02:00
|
|
|
name: 'WorkspaceConnectPanel',
|
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({
|
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>
|
2020-07-31 18:16:28 +02:00
|
|
|
.empty {
|
|
|
|
height: 100%;
|
|
|
|
border-radius: 0;
|
|
|
|
background: transparent;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
2020-05-17 19:34:56 +02:00
|
|
|
</style>
|