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.
178 lines
5.0 KiB
178 lines
5.0 KiB
4 years ago
|
<template>
|
||
3 years ago
|
<v-row justify="center">
|
||
4 years ago
|
<v-dialog
|
||
3 years ago
|
:value="dialogShow"
|
||
4 years ago
|
persistent
|
||
3 years ago
|
max-width="850"
|
||
4 years ago
|
@keydown.esc="mtdDialogCancel()"
|
||
|
@click:outside="mtdDialogCancel()"
|
||
|
@keydown.enter="mtdDialogSubmit(trigger, newTrigger)"
|
||
3 years ago
|
>
|
||
|
<template #activator="{ on }">
|
||
|
<p class="hidden" v-on="on" />
|
||
4 years ago
|
</template>
|
||
|
<v-card class="elevation-20">
|
||
|
<v-card-title class="grey darken-2 subheading" style="height:30px">
|
||
|
<!-- {{
|
||
|
this.newTrigger
|
||
|
? "Add New Trigger"
|
||
|
: "Editing Trigger " + this.trigger.trigger_name
|
||
|
}} -->
|
||
|
</v-card-title>
|
||
|
<v-card-text class="pt-4 pl-4">
|
||
|
<p class="headline">
|
||
|
{{
|
||
3 years ago
|
newTrigger
|
||
4 years ago
|
? "Add New Trigger"
|
||
3 years ago
|
: "Editing Trigger " + trigger.trigger_name
|
||
4 years ago
|
}}
|
||
|
</p>
|
||
|
<v-form ref="form" v-model="valid">
|
||
|
<v-text-field
|
||
|
ref="focus"
|
||
|
v-model="trigger.trigger_name"
|
||
|
:counter="50"
|
||
|
label="Trigger Name"
|
||
|
:rules="formRules.trigger_name"
|
||
|
required
|
||
3 years ago
|
/>
|
||
4 years ago
|
<v-row justify="space-between">
|
||
3 years ago
|
<v-col class="pa-1" cols="6">
|
||
4 years ago
|
<v-autocomplete
|
||
3 years ago
|
v-model="trigger.timing"
|
||
4 years ago
|
label="Timing"
|
||
|
:full-width="false"
|
||
|
:items="triggerTimingOptions"
|
||
|
:rules="formRules.timing"
|
||
|
required
|
||
|
dense
|
||
3 years ago
|
/>
|
||
|
</v-col><v-col class="pa-1" cols="6">
|
||
4 years ago
|
<v-autocomplete
|
||
3 years ago
|
v-model="trigger.event"
|
||
4 years ago
|
label="Event"
|
||
|
:full-width="false"
|
||
|
:items="triggerEventOptions"
|
||
|
:rules="formRules.event"
|
||
|
required
|
||
|
dense
|
||
3 years ago
|
/>
|
||
|
</v-col>
|
||
|
</v-row>
|
||
4 years ago
|
</v-form>
|
||
|
<v-container>
|
||
|
<MonacoEditor
|
||
|
v-if="trigger.statement != undefined"
|
||
|
:code.sync="trigger.statement"
|
||
3 years ago
|
css-style="border:1px solid grey;height:300px"
|
||
4 years ago
|
/>
|
||
|
</v-container>
|
||
|
</v-card-text>
|
||
3 years ago
|
<v-divider />
|
||
4 years ago
|
|
||
|
<v-card-actions class="pa-4">
|
||
3 years ago
|
<v-spacer />
|
||
4 years ago
|
<v-btn class="" @click="mtdDialogCancel()">
|
||
3 years ago
|
<!-- Cancel -->
|
||
|
{{ $t('general.cancel') }}
|
||
4 years ago
|
</v-btn>
|
||
|
<v-btn
|
||
|
class="primary "
|
||
|
:disabled="!valid"
|
||
3 years ago
|
@click="mtdDialogSubmit(trigger, newTrigger)"
|
||
4 years ago
|
>
|
||
3 years ago
|
<u class="shortkey">S</u>ubmit
|
||
|
</v-btn>
|
||
4 years ago
|
</v-card-actions>
|
||
|
</v-card>
|
||
|
</v-dialog>
|
||
|
</v-row>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import { mapGetters } from 'vuex'
|
||
|
import MonacoEditor from '../../monaco/Monaco'
|
||
4 years ago
|
|
||
|
export default {
|
||
|
components: { MonacoEditor },
|
||
3 years ago
|
data() {
|
||
4 years ago
|
return {
|
||
|
valid: false,
|
||
|
formRules: {
|
||
|
trigger_name: [
|
||
3 years ago
|
v => !!v || 'Name is required',
|
||
|
v => (v && v.length <= 100) || 'Name must be less than 100 characters'
|
||
4 years ago
|
],
|
||
3 years ago
|
timing: [v => !!v || 'Timing is required'],
|
||
|
event: [v => !!v || 'Event is required'],
|
||
|
statement: [v => !!v || 'Statement is required']
|
||
4 years ago
|
},
|
||
3 years ago
|
triggerTimingOptions: ['BEFORE', 'AFTER'],
|
||
|
triggerEventOptions: ['INSERT', 'UPDATE', 'DELETE'],
|
||
4 years ago
|
trigger: {
|
||
3 years ago
|
table_name: this.nodes.table_name,
|
||
3 years ago
|
trigger_name: this.triggerObject.trigger || '',
|
||
|
timing: this.triggerObject.timing || 'BEFORE',
|
||
|
event: this.triggerObject.event || 'INSERT',
|
||
|
statement: this.triggerObject.statement || 'BEGIN\n\nEND;'
|
||
4 years ago
|
}
|
||
3 years ago
|
}
|
||
4 years ago
|
},
|
||
|
methods: {},
|
||
3 years ago
|
computed: { ...mapGetters({ sqlMgr: 'sqlMgr/sqlMgr' }) },
|
||
4 years ago
|
|
||
3 years ago
|
beforeCreated() {},
|
||
3 years ago
|
watch: {},
|
||
3 years ago
|
async created() {},
|
||
|
mounted() {
|
||
4 years ago
|
requestAnimationFrame(() => {
|
||
3 years ago
|
this.$refs.focus.focus()
|
||
|
})
|
||
4 years ago
|
},
|
||
3 years ago
|
beforeDestroy() {},
|
||
|
destroy() {},
|
||
3 years ago
|
directives: {},
|
||
3 years ago
|
validate({ params }) {
|
||
3 years ago
|
return true
|
||
4 years ago
|
},
|
||
3 years ago
|
head() {
|
||
3 years ago
|
return {}
|
||
4 years ago
|
},
|
||
|
props: [
|
||
3 years ago
|
'nodes',
|
||
|
'newTrigger',
|
||
|
'triggerObject',
|
||
|
'dialogShow',
|
||
|
'mtdDialogCancel',
|
||
|
'mtdDialogSubmit'
|
||
|
]
|
||
|
}
|
||
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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|