Added emit

This commit is contained in:
Douglas Barone 2021-01-18 15:10:10 -04:00
parent a7d51c8cb1
commit b6426fb657
2 changed files with 12 additions and 8 deletions

View File

@ -7,7 +7,10 @@
</v-toolbar-title>
<v-spacer />
<v-toolbar-items>
<palo-alto-add-dialog v-model="addDialog" />
<palo-alto-add-dialog
v-model="addDialog"
@hostAdded="$apollo.queries.pAHosts.refetch()"
/>
<v-btn text color="primary" @click="addDialog = !addDialog">
<v-icon left>mdi-plus</v-icon>
Adicionar

View File

@ -3,6 +3,7 @@
<v-dialog
v-model="dialog"
max-width="800"
:persistent="loading"
:fullscreen="$vuetify.breakpoint.mdAndDown"
>
<v-stepper v-model="step">
@ -65,7 +66,7 @@
</v-card>
</v-stepper-content>
<v-stepper-content step="3">
<v-card :disabled="loading" :loading="loading">
<v-card :disabled="loading">
<v-card-title class="headline">
Adicionar host Palo Alto
</v-card-title>
@ -77,7 +78,6 @@
<v-col>
<v-text-field
v-model="description"
dense
outlined
label="Descrição"
hint="Ex.: PA-PP"
@ -88,7 +88,6 @@
<v-col>
<v-text-field
v-model="cidr"
dense
autocomplete="no"
outlined
label="IP (CIDR)"
@ -208,7 +207,7 @@ export default {
data: () => ({
loading: false,
dialog: false,
step: 3,
step: 1,
form: false,
showPassword: false,
@ -224,7 +223,7 @@ export default {
!!v ||
'Informe um endereço IP no formato CIDR, por exemplo: 10.1.0.2/21',
v => CIDR_RE.test(v) || 'Digite o IP no formato CIDR',
v => !!v.split('/')[1] || 'Digite a contagem de bits. Ex.: /21'
v => !!v?.split('/')[1] || 'Digite a contagem de bits. Ex.: /21'
],
userRules: [v => !!v || 'Digite o nome de usuário.'],
passwordRules: [v => !!v || 'Digite a senha'],
@ -242,7 +241,9 @@ export default {
methods: {
close() {
this.step = 1
this.ip = this.user = this.password = ''
this.$refs.form.reset()
this.$refs.form.resetValidation()
this.$emit('input', false)
},
async add() {
@ -263,7 +264,7 @@ export default {
note: this.note
}
})
this.$emit('hostAdded')
this.close()
} catch (e) {
this.error = e.message