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.
276 lines
6.6 KiB
276 lines
6.6 KiB
4 years ago
|
<template>
|
||
|
<v-container class="ma-0 pa-0" fluid>
|
||
|
<v-toolbar height="42" class="toolbar-border-bottom elevation-0">
|
||
3 years ago
|
<v-breadcrumbs
|
||
|
:items="[{
|
||
|
text: nodes.env,
|
||
4 years ago
|
disabled: true,
|
||
|
href: '#'
|
||
|
},{
|
||
3 years ago
|
text: nodes.dbAlias,
|
||
4 years ago
|
disabled: true,
|
||
|
href: '#'
|
||
3 years ago
|
}]"
|
||
|
divider=">"
|
||
|
small
|
||
|
>
|
||
|
<template #divider>
|
||
|
<v-icon small color="grey lighten-2">
|
||
|
forward
|
||
|
</v-icon>
|
||
4 years ago
|
</template>
|
||
|
</v-breadcrumbs>
|
||
|
|
||
|
<p class=" pt-3">
|
||
|
Seed Database
|
||
|
</p>
|
||
|
|
||
3 years ago
|
<v-spacer />
|
||
4 years ago
|
|
||
3 years ago
|
<x-btn small icon="mdi-numeric-1-circle" outlined color="primary" @click="dialogShow = true">
|
||
|
Seed Initialise
|
||
|
</x-btn>
|
||
4 years ago
|
<!-- <x-btn outlined @click="seedTerm" color="red"> Clear all tables</x-btn>-->
|
||
3 years ago
|
<x-btn small outlined icon="mdi-play" color="primary" @click="seedStart">
|
||
|
Start Seeding
|
||
|
</x-btn>
|
||
|
<x-btn small outlined icon="mdi-stop" @click="seedStop">
|
||
|
Stop Seeding
|
||
|
</x-btn>
|
||
|
<x-btn small outlined :disabled="disableSaveButton" icon="save" @click="seedSettingsUpdate">
|
||
|
Save Settings
|
||
|
</x-btn>
|
||
4 years ago
|
</v-toolbar>
|
||
|
|
||
|
<v-row class="mx-0">
|
||
|
<v-col cols="8" offset="2">
|
||
|
<v-simple-table class="ma-0 pa-0">
|
||
|
<thead>
|
||
3 years ago
|
<tr>
|
||
|
<th class="text-left" width="20%">
|
||
|
Key
|
||
|
</th>
|
||
|
<th class="text-left">
|
||
|
Value
|
||
|
</th>
|
||
|
</tr>
|
||
4 years ago
|
</thead>
|
||
|
<tbody>
|
||
3 years ago
|
<tr v-for="(value,key) in settings" :key="key">
|
||
|
<td>{{ key }}</td>
|
||
|
<td>
|
||
|
<v-text-field
|
||
|
v-model="settings[key].value"
|
||
|
:label="settings[key].description"
|
||
|
hide-details
|
||
|
type="number"
|
||
|
step="1"
|
||
|
@input="disableSaveButton = false"
|
||
|
/>
|
||
|
<!-- <p class="caption">{{settings[key].description}}</p>-->
|
||
|
</td>
|
||
|
</tr>
|
||
4 years ago
|
</tbody>
|
||
|
</v-simple-table>
|
||
|
</v-col>
|
||
|
</v-row>
|
||
|
|
||
|
<dlgLabelSubmitCancel
|
||
|
v-if="dialogShow"
|
||
3 years ago
|
:dialog-show="dialogShow"
|
||
|
:actions-mtd="dlgAction"
|
||
|
css-style="border:1px solid grey;height:300px"
|
||
4 years ago
|
heading="This will recreate all the faker function mapping!"
|
||
|
type="info"
|
||
|
/>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import { mapGetters } from 'vuex'
|
||
3 years ago
|
import dlgLabelSubmitCancel from '../utils/DlgLabelSubmitCancel'
|
||
3 years ago
|
|
||
|
export default {
|
||
|
components: {
|
||
|
dlgLabelSubmitCancel
|
||
|
},
|
||
3 years ago
|
data() {
|
||
3 years ago
|
return {
|
||
|
settings: {},
|
||
|
dialogShow: false,
|
||
|
disableSaveButton: true
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
...mapGetters({ sqlMgr: 'sqlMgr/sqlMgr' })
|
||
|
},
|
||
|
watch: {},
|
||
3 years ago
|
async created() {
|
||
3 years ago
|
this.seedsFolder = this.sqlMgr.projectGetFolder({
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
|
})
|
||
|
const result = await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
|
||
|
{
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
|
},
|
||
|
'seedSettingsRead',
|
||
|
{
|
||
|
seedsFolder: this.seedsFolder
|
||
|
}])
|
||
|
|
||
|
if (!Object.keys(result.data).length) {
|
||
|
await this.seedInit()
|
||
|
} else {
|
||
|
this.settings = result.data
|
||
|
}
|
||
|
},
|
||
3 years ago
|
mounted() {
|
||
3 years ago
|
},
|
||
3 years ago
|
beforeDestroy() {
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
async dlgAction(action = '') {
|
||
3 years ago
|
console.log('dlgAction', action)
|
||
|
if (action === 'hideDialog') {
|
||
|
this.dialogShow = false
|
||
|
} else {
|
||
|
this.dialogShow = false
|
||
|
await this.seedInit()
|
||
|
}
|
||
4 years ago
|
},
|
||
3 years ago
|
async seedInit() {
|
||
3 years ago
|
try {
|
||
|
const result = await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
|
||
|
{
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
|
},
|
||
|
'seedInit',
|
||
|
{
|
||
|
seedsFolder: this.seedsFolder
|
||
|
}])
|
||
|
|
||
|
this.settings = result.data
|
||
|
} catch (e) {
|
||
|
console.log(e)
|
||
|
throw e
|
||
|
}
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
async seedTerm() {
|
||
3 years ago
|
try {
|
||
|
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
|
||
|
{
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
|
},
|
||
|
'seedTerm',
|
||
|
{
|
||
|
seedsFolder: this.seedsFolder
|
||
|
}])
|
||
|
} catch (e) {
|
||
|
console.log(e)
|
||
|
throw e
|
||
|
}
|
||
|
},
|
||
4 years ago
|
|
||
3 years ago
|
async seedStart() {
|
||
3 years ago
|
try {
|
||
3 years ago
|
setTimeout(async() => {
|
||
3 years ago
|
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
|
||
4 years ago
|
{
|
||
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
|
},
|
||
3 years ago
|
'seedStart',
|
||
4 years ago
|
{
|
||
3 years ago
|
seedsFolder: this.seedsFolder
|
||
|
}])
|
||
|
})
|
||
|
} catch (e) {
|
||
|
console.log(e)
|
||
|
throw e
|
||
|
}
|
||
|
},
|
||
4 years ago
|
|
||
3 years ago
|
async seedStop() {
|
||
3 years ago
|
try {
|
||
|
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
|
||
|
{
|
||
4 years ago
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
3 years ago
|
},
|
||
|
'seedStop',
|
||
|
{
|
||
|
seedsFolder: this.seedsFolder
|
||
|
}])
|
||
|
} catch (e) {
|
||
|
console.log(e)
|
||
|
throw e
|
||
4 years ago
|
}
|
||
|
},
|
||
|
|
||
3 years ago
|
async seedSettingsUpdate() {
|
||
3 years ago
|
try {
|
||
|
this.settings.rows.value = +this.settings.rows.value > 100 ? 100 : this.settings.rows.value
|
||
|
|
||
|
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [{
|
||
4 years ago
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias
|
||
3 years ago
|
}, 'seedSettingsCreate', {
|
||
4 years ago
|
seedsFolder: this.seedsFolder,
|
||
3 years ago
|
settings: this.settings
|
||
|
}])
|
||
|
this.disableSaveButton = true
|
||
|
} catch (e) {
|
||
|
console.log(e)
|
||
|
throw e
|
||
4 years ago
|
}
|
||
3 years ago
|
}
|
||
|
|
||
|
},
|
||
|
|
||
3 years ago
|
beforeCreated() {
|
||
3 years ago
|
},
|
||
3 years ago
|
destroy() {
|
||
3 years ago
|
},
|
||
|
directives: {},
|
||
3 years ago
|
validate({ params }) {
|
||
3 years ago
|
return true
|
||
|
},
|
||
3 years ago
|
head() {
|
||
3 years ago
|
return {}
|
||
|
},
|
||
|
props: ['nodes']
|
||
|
}
|
||
4 years ago
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
*
|
||
|
* @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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|