antares/src/renderer/components/WorkspaceConnectPanel.vue

83 lines
2.0 KiB
Vue
Raw Normal View History

<template>
2020-05-18 18:06:32 +02:00
<div class="columns">
<div class="column col-12 empty text-light">
<div class="empty-icon">
<i class="mdi mdi-48px mdi-power-plug-off" />
</div>
<p class="empty-title h5">
2020-05-25 15:37:59 +02:00
{{ $t('word.disconnected') }}
</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') }}
</button>
</div>
</div>
2020-05-24 11:03:20 +02:00
<ModalAskCredentials
v-if="isAsking"
@closeAsking="closeAsking"
@credentials="continueTest"
/>
</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';
export default {
2020-06-03 20:56:44 +02:00
name: 'WorkspaceConnectPanel',
2020-05-24 11:03:20 +02:00
components: {
ModalAskCredentials
},
props: {
connection: Object
},
data () {
return {
2020-05-24 11:03:20 +02:00
isConnecting: false,
isAsking: false
};
},
methods: {
...mapActions({
2020-05-19 18:06:05 +02:00
connectWorkspace: 'workspaces/connectWorkspace'
}),
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;
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;
}
</style>