AzuraCast/frontend/vue/components/Stations/HlsStreams/EditModal.vue

65 lines
1.7 KiB
Vue

<template>
<modal-form ref="modal" :loading="loading" :title="langTitle" :error="error" :disable-save-button="v$.$invalid"
@submit="doSubmit" @hidden="clearContents">
<b-tabs content-class="mt-3" pills>
<form-basic-info :form="v$"></form-basic-info>
</b-tabs>
</modal-form>
</template>
<script>
import {required} from '@vuelidate/validators';
import BaseEditModal from '~/components/Common/BaseEditModal';
import FormBasicInfo from './Form/BasicInfo';
import mergeExisting from "~/functions/mergeExisting";
import {useVuelidateOnForm} from "~/components/Form/UseVuelidateOnForm";
export default {
name: 'EditModal',
emits: ['needs-restart'],
setup() {
const {form, resetForm, v$} = useVuelidateOnForm(
{
name: {required},
format: {required},
bitrate: {required}
},
{
name: null,
format: 'aac',
bitrate: 128
}
);
return {
form,
resetForm,
v$
}
},
mixins: [BaseEditModal],
components: {FormBasicInfo},
computed: {
langTitle() {
return this.isEditMode
? this.$gettext('Edit HLS Stream')
: this.$gettext('Add HLS Stream');
}
},
methods: {
populateForm(d) {
this.record = d;
this.form = mergeExisting(this.form, d);
},
onSubmitSuccess() {
this.$notifySuccess();
this.$emit('needs-restart');
this.$emit('relist');
this.close();
},
}
};
</script>