1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Ask credentials on connection

This commit is contained in:
2020-05-24 11:03:20 +02:00
parent 63f07c0715
commit 755c34f782
4 changed files with 34 additions and 16 deletions

View File

@ -17,20 +17,30 @@
</button> </button>
</div> </div>
</div> </div>
<ModalAskCredentials
v-if="isAsking"
@closeAsking="closeAsking"
@credentials="continueTest"
/>
</div> </div>
</template> </template>
<script> <script>
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import ModalAskCredentials from '@/components/ModalAskCredentials';
export default { export default {
name: 'DatabaseConnectPanel', name: 'DatabaseConnectPanel',
components: {
ModalAskCredentials
},
props: { props: {
connection: Object connection: Object
}, },
data () { data () {
return { return {
isConnecting: false isConnecting: false,
isAsking: false
}; };
}, },
methods: { methods: {
@ -40,9 +50,24 @@ export default {
}), }),
async startConnection () { async startConnection () {
this.isConnecting = true; this.isConnecting = true;
if (this.connection.ask)
this.isAsking = true;
else {
await this.connectWorkspace(this.connection); await this.connectWorkspace(this.connection);
this.isConnecting = false; 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> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="modal active modal-sm"> <div class="modal active modal-sm">
<a class="modal-overlay" /> <a class="modal-overlay" />
<div class="modal-container"> <div class="modal-container p-0">
<div class="modal-header text-light"> <div class="modal-header text-light">
<div class="modal-title h6"> <div class="modal-title h6">
Credentials Credentials

View File

@ -146,24 +146,16 @@ export default {
}, },
isTesting: false, isTesting: false,
isAsking: false, isAsking: false,
connectionProxy: null localConnection: null
}; };
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
connection: 'connections/getSelectedConnection' connection: 'connections/getSelectedConnection'
}), })
localConnection: {
get () {
if (this.connectionProxy === null)
return Object.assign({}, this.connection);
else
return this.connectionProxy;
}, },
set (val) { created () {
this.connectionProxy = val; this.localConnection = Object.assign({}, this.connection);
}
}
}, },
methods: { methods: {
...mapActions({ ...mapActions({

View File

@ -210,6 +210,7 @@ export default {
async continueTest (credentials) { // if "Ask for credentials" is true async continueTest (credentials) { // if "Ask for credentials" is true
this.isAsking = false; this.isAsking = false;
const params = Object.assign({}, this.connection, credentials); const params = Object.assign({}, this.connection, credentials);
try { try {
const res = await Connection.makeTest(params); const res = await Connection.makeTest(params);
if (res.status === 'error') if (res.status === 'error')