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.
118 lines
2.9 KiB
118 lines
2.9 KiB
4 years ago
|
<template>
|
||
|
<v-dialog
|
||
3 years ago
|
v-model="dialogShow"
|
||
4 years ago
|
persistent
|
||
3 years ago
|
max-width="450"
|
||
4 years ago
|
@keydown.esc="dialogShow = false"
|
||
|
@keydown.enter="$emit('create', view)"
|
||
|
>
|
||
|
<v-card class="elevation-1 backgroundColor">
|
||
3 years ago
|
<v-card-title class="primary subheading white--text py-2"> Create A New View </v-card-title>
|
||
4 years ago
|
|
||
3 years ago
|
<v-card-text class="py-6 px-10">
|
||
4 years ago
|
<v-text-field
|
||
|
ref="input"
|
||
|
v-model="view.alias"
|
||
3 years ago
|
solo
|
||
|
flat
|
||
|
dense
|
||
|
hide-details
|
||
|
label="Enter the Model Name"
|
||
|
class="mt-4 caption"
|
||
|
/>
|
||
4 years ago
|
|
||
|
<v-text-field
|
||
|
v-if="!projectPrefix"
|
||
|
v-model="view.name"
|
||
3 years ago
|
solo
|
||
|
flat
|
||
|
dense
|
||
|
hide-details
|
||
|
label="SQL View Name"
|
||
|
class="mt-4 caption"
|
||
|
/>
|
||
4 years ago
|
</v-card-text>
|
||
3 years ago
|
<v-divider />
|
||
4 years ago
|
|
||
|
<v-card-actions class="py-4 px-10">
|
||
3 years ago
|
<v-spacer />
|
||
4 years ago
|
<v-btn class="" @click="dialogShow = false">
|
||
3 years ago
|
{{ $t('general.cancel') }}
|
||
4 years ago
|
</v-btn>
|
||
|
<v-btn
|
||
|
:disabled="!(view.name && view.name.length) || !(view.alias && view.alias.length)"
|
||
3 years ago
|
color="primary"
|
||
3 years ago
|
@click="$emit('create', view)"
|
||
4 years ago
|
>
|
||
3 years ago
|
{{ $t('general.submit') }}
|
||
3 years ago
|
</v-btn>
|
||
4 years ago
|
</v-card-actions>
|
||
|
</v-card>
|
||
|
</v-dialog>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import inflection from 'inflection';
|
||
4 years ago
|
|
||
|
export default {
|
||
3 years ago
|
name: 'DlgViewCreate',
|
||
|
props: ['value'],
|
||
3 years ago
|
data() {
|
||
4 years ago
|
return {
|
||
|
view: {
|
||
3 years ago
|
name: '',
|
||
|
},
|
||
|
};
|
||
4 years ago
|
},
|
||
|
computed: {
|
||
|
dialogShow: {
|
||
3 years ago
|
get() {
|
||
3 years ago
|
return this.value;
|
||
3 years ago
|
},
|
||
3 years ago
|
set(v) {
|
||
3 years ago
|
this.$emit('input', v);
|
||
|
},
|
||
4 years ago
|
},
|
||
3 years ago
|
projectPrefix() {
|
||
3 years ago
|
return this.$store.getters['project/GtrProjectPrefix'];
|
||
|
},
|
||
3 years ago
|
},
|
||
|
watch: {
|
||
3 years ago
|
'view.alias'(v) {
|
||
3 years ago
|
this.$set(this.view, 'name', `${this.projectPrefix || ''}${inflection.underscore(v)}`);
|
||
|
},
|
||
4 years ago
|
},
|
||
3 years ago
|
mounted() {
|
||
4 years ago
|
setTimeout(() => {
|
||
3 years ago
|
this.$refs.input.$el.querySelector('input').focus();
|
||
|
}, 100);
|
||
|
},
|
||
|
};
|
||
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>
|
||
|
*
|
||
|
* @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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|