mirror of
https://github.com/Fabio286/mizar.git
synced 2025-03-12 23:10:03 +01:00
70 lines
1.5 KiB
Vue
70 lines
1.5 KiB
Vue
<template>
|
|
<div id="popcontainer">
|
|
<div class="popup">
|
|
<div class="box-100">
|
|
<h4>Nuovo Host</h4>
|
|
<div class="input-element">
|
|
<label>Indirizzo Host</label>
|
|
<input
|
|
v-model="host.host"
|
|
type="text"
|
|
required
|
|
autofocus
|
|
>
|
|
</div>
|
|
<div class="input-element">
|
|
<label>Porta</label>
|
|
<input
|
|
v-model.number="host.port"
|
|
min="1"
|
|
step="1"
|
|
type="number"
|
|
required
|
|
>
|
|
</div>
|
|
</div>
|
|
<div class="buttons">
|
|
<button class="cancel" @click="close">
|
|
Annulla
|
|
</button>
|
|
<button
|
|
class="confirm"
|
|
:disabled="validation"
|
|
@click="confirm"
|
|
>
|
|
Crea
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, computed } from 'vue';
|
|
|
|
const emit = defineEmits(['hideAddHost', 'createHost']);
|
|
|
|
const host = ref({
|
|
host: '',
|
|
port: '',
|
|
enabled: true
|
|
});
|
|
|
|
const validation = computed(() => {
|
|
return host.value.host === '' || host.value.port === '';
|
|
});
|
|
|
|
const close = () => {
|
|
emit('hideAddHost');
|
|
};
|
|
|
|
const confirm = () => {
|
|
emit('createHost', host.value);
|
|
host.value = {
|
|
host: '',
|
|
port: '',
|
|
enabled: true
|
|
};
|
|
};
|
|
</script>
|