2020-03-15 05:00:16 -04:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<transition name="fade">
|
2022-02-19 00:39:14 -05:00
|
|
|
<div v-if="show" class="modal is-active">
|
|
|
|
<div class="modal-background" @click="$emit('close')" />
|
2020-03-15 05:00:16 -04:00
|
|
|
<div class="modal-content fd-modal-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content">
|
2022-05-20 07:44:22 -04:00
|
|
|
<p class="title is-4" v-text="$t('dialog.remote-pairing.title')" />
|
2022-02-19 00:39:14 -05:00
|
|
|
<form @submit.prevent="kickoff_pairing">
|
2022-05-20 07:44:22 -04:00
|
|
|
<label class="label" v-text="pairing.remote" />
|
2020-03-15 05:00:16 -04:00
|
|
|
<div class="field">
|
|
|
|
<div class="control">
|
2022-05-20 07:44:22 -04:00
|
|
|
<input ref="pin_field" v-model="pairing_req.pin" class="input" type="text" placeholder="Enter pairing code" />
|
2020-03-15 05:00:16 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<footer class="card-footer">
|
2022-05-20 07:44:22 -04:00
|
|
|
<a class="card-footer-item has-text-danger" @click="$emit('close')">
|
|
|
|
<mdicon class="icon" name="cancel" size="16" />
|
|
|
|
<span class="is-size-7" v-text="$t('dialog.remote-pairing.cancel')" />
|
2020-03-15 05:00:16 -04:00
|
|
|
</a>
|
2022-05-20 07:44:22 -04:00
|
|
|
<a class="card-footer-item has-background-info has-text-white has-text-weight-bold" @click="kickoff_pairing">
|
|
|
|
<mdicon class="icon" name="cellphone" size="16" />
|
|
|
|
<span class="is-size-7" v-text="$t('dialog.remote-pairing.pair')" />
|
2020-03-15 05:00:16 -04:00
|
|
|
</a>
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-20 07:44:22 -04:00
|
|
|
<button class="modal-close is-large" aria-label="close" @click="$emit('close')" />
|
2020-03-15 05:00:16 -04:00
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ModalDialogRemotePairing',
|
2020-04-11 13:43:53 -04:00
|
|
|
props: ['show'],
|
2022-02-19 01:05:59 -05:00
|
|
|
emits: ['close'],
|
2020-03-15 05:00:16 -04:00
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
data() {
|
2020-03-15 05:00:16 -04:00
|
|
|
return {
|
|
|
|
pairing_req: { pin: '' }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
pairing() {
|
2020-03-15 05:00:16 -04:00
|
|
|
return this.$store.state.pairing
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
2022-02-19 00:39:14 -05:00
|
|
|
show() {
|
2020-03-15 05:00:16 -04:00
|
|
|
if (this.show) {
|
|
|
|
this.loading = false
|
|
|
|
|
|
|
|
// We need to delay setting the focus to the input field until the field is part of the dom and visible
|
|
|
|
setTimeout(() => {
|
|
|
|
this.$refs.pin_field.focus()
|
|
|
|
}, 10)
|
|
|
|
}
|
|
|
|
}
|
2022-02-19 00:39:14 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
kickoff_pairing() {
|
|
|
|
webapi.pairing_kickoff(this.pairing_req).then(() => {
|
|
|
|
this.pairing_req.pin = ''
|
|
|
|
})
|
|
|
|
}
|
2020-03-15 05:00:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|