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

View File

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

View File

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

View File

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