diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-14 14:53:52 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-14 14:53:52 +0300 |
commit | 158e0373b621079a714086791113a7e021e326dc (patch) | |
tree | 989bcee5d27a24e8cb338ddfcfc8e475f70dd91d /src/views/_sila/Settings/TransferInfo/ModalSnmp.vue | |
parent | a38f344867bba7e9770865d68990442acb632459 (diff) | |
download | webui-vue-158e0373b621079a714086791113a7e021e326dc.tar.xz |
finish snmp component
Diffstat (limited to 'src/views/_sila/Settings/TransferInfo/ModalSnmp.vue')
-rw-r--r-- | src/views/_sila/Settings/TransferInfo/ModalSnmp.vue | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/views/_sila/Settings/TransferInfo/ModalSnmp.vue b/src/views/_sila/Settings/TransferInfo/ModalSnmp.vue new file mode 100644 index 00000000..54679720 --- /dev/null +++ b/src/views/_sila/Settings/TransferInfo/ModalSnmp.vue @@ -0,0 +1,82 @@ +<template> + <b-modal + id="modal-snmp" + ref="modal" + :title="$t('global.action.add')" + @hidden="resetForm" + > + <b-form id="form-snmp" @submit.prevent="handleSubmit"> + <b-row> + <b-col sm="6"> + <b-form-group + :label="$t('pageTransfer.snmp.host')" + label-for="snmpHost" + > + <b-form-input id="snmpHost" v-model="host" type="text" /> + </b-form-group> + </b-col> + <b-col sm="6"> + <b-form-group + :label="$t('pageTransfer.snmp.port')" + label-for="snmpPort" + > + <b-form-input id="snmpPort" v-model="port" type="text" /> + </b-form-group> + </b-col> + </b-row> + </b-form> + <template #modal-footer="{ cancel }"> + <b-button variant="secondary" @click="cancel()"> + {{ $t('global.action.cancel') }} + </b-button> + <b-button form="form-snmp" type="submit" variant="primary" @click="onOk"> + {{ $t('global.action.add') }} + </b-button> + </template> + </b-modal> +</template> + +<script> +import VuelidateMixin from '@/components/_sila/Mixins/VuelidateMixin.js'; + +export default { + mixins: [VuelidateMixin], + data() { + return { + form: { + Destination: null, + SubscriptionType: 'SNMPTrap', + Protocol: 'SNMPv2c', + Context: 'testContext', + }, + host: null, + port: null, + }; + }, + methods: { + handleSubmit() { + this.$emit('ok', { + ...this.form, + Destination: this.host + this.port, + }); + this.closeModal(); + }, + closeModal() { + this.$nextTick(() => { + this.$refs.modal.hide(); + }); + }, + resetForm() { + this.host = null; + this.port = null; + this.form.Destination = null; + this.$emit('hidden'); + }, + onOk(bvModalEvt) { + // prevent modal close + bvModalEvt.preventDefault(); + this.handleSubmit(); + }, + }, +}; +</script> |