mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.7 KiB
125 lines
3.7 KiB
4 years ago
|
<template>
|
||
|
<v-dialog v-model="dialogShow" persistent max-width="500">
|
||
|
<v-card>
|
||
3 years ago
|
<v-progress-linear v-if="progressbar" indeterminate color="green" />
|
||
4 years ago
|
<div class="px-2">
|
||
3 years ago
|
<v-card-title class="headline"> Change environment </v-card-title>
|
||
4 years ago
|
<v-card-text>
|
||
|
<div class="">
|
||
3 years ago
|
<v-select v-model="selectedEnv" hide-details dense :items="envList" label="Solo field" solo />
|
||
4 years ago
|
</div>
|
||
|
</v-card-text>
|
||
|
<v-card-actions>
|
||
3 years ago
|
<v-spacer />
|
||
|
<v-btn small :disabled="progressbar" @click="dialogShow = false">
|
||
3 years ago
|
<!-- Close -->
|
||
|
{{ $t('general.close') }}
|
||
3 years ago
|
</v-btn>
|
||
3 years ago
|
<v-btn color="primary" small :disabled="progressbar" @click="ChangeEnv"> Change </v-btn>
|
||
4 years ago
|
</v-card-actions>
|
||
|
</div>
|
||
|
</v-card>
|
||
|
</v-dialog>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import { mapGetters } from 'vuex';
|
||
|
import axios from 'axios';
|
||
4 years ago
|
|
||
3 years ago
|
export default {
|
||
|
name: 'ChangeEnv',
|
||
|
data: () => ({
|
||
3 years ago
|
selectedEnv: '_noco',
|
||
3 years ago
|
progressbar: false,
|
||
3 years ago
|
}),
|
||
|
computed: {
|
||
|
...mapGetters({
|
||
3 years ago
|
envList: 'project/GtrEnvList',
|
||
4 years ago
|
}),
|
||
3 years ago
|
dialogShow: {
|
||
3 years ago
|
get() {
|
||
3 years ago
|
return this.value;
|
||
4 years ago
|
},
|
||
3 years ago
|
set(val) {
|
||
3 years ago
|
this.$emit('input', val);
|
||
|
},
|
||
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
mounted() {
|
||
3 years ago
|
const unserializedList = this.$store.state.project.unserializedList;
|
||
|
this.selectedEnv =
|
||
|
(unserializedList[0] && unserializedList[0].projectJson && unserializedList[0].projectJson.workingEnv) || '_noco';
|
||
|
this.$store.watch(
|
||
|
state => {
|
||
|
const unserializedList = state.project.unserializedList;
|
||
|
return (
|
||
|
(unserializedList[0] && unserializedList[0].projectJson && unserializedList[0].projectJson.workingEnv) ||
|
||
|
'_noco'
|
||
|
);
|
||
|
},
|
||
|
value => {
|
||
|
this.selectedEnv = value;
|
||
|
}
|
||
|
);
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
async changeEnv() {
|
||
3 years ago
|
this.progressbar = true;
|
||
|
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'projectChangeEnv', { env: this.selectedEnv }]);
|
||
|
await new Promise(resolve => {
|
||
3 years ago
|
const interv = setInterval(() => {
|
||
3 years ago
|
axios
|
||
|
.create({
|
||
|
baseURL: `${this.$axios.defaults.baseURL}/dashboard`,
|
||
|
})
|
||
|
.get('')
|
||
|
.then(() => {
|
||
|
this.projectReloading = false;
|
||
|
clearInterval(interv);
|
||
|
resolve();
|
||
|
})
|
||
|
.catch(() => {});
|
||
|
}, 1000);
|
||
|
});
|
||
|
this.progressbar = false;
|
||
|
await this.$store.dispatch('users/ActSignOut');
|
||
4 years ago
|
|
||
3 years ago
|
await this.$store.dispatch('project/ActLoadProjectInfo');
|
||
3 years ago
|
if (this.$store.state.project.appInfo.projectHasAdmin === false) {
|
||
3 years ago
|
return this.$router.push('/start');
|
||
3 years ago
|
}
|
||
3 years ago
|
location.reload();
|
||
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
props: { value: Boolean },
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
3 years ago
|
<style scoped></style>
|
||
4 years ago
|
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
4 years ago
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
|
||
4 years ago
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|