Skip to content

Commit

Permalink
More TS work. Actually making progress, I swear!
Browse files Browse the repository at this point in the history
  • Loading branch information
BusterNeece committed Jan 19, 2025
1 parent 0f5e4c4 commit ec6b5de
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 28 deletions.
16 changes: 4 additions & 12 deletions frontend/components/Admin/CustomFields/EditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
@hidden="clearContents"
>
<admin-custom-fields-form
:form="v$"
v-model:form="form"
:auto-assign-types="autoAssignTypes"
/>
</modal-form>
</template>

<script setup lang="ts">
import {required} from '@vuelidate/validators';
import ModalForm from "~/components/Common/ModalForm.vue";
import AdminCustomFieldsForm from "~/components/Admin/CustomFields/Form.vue";
import {computed, ref} from "vue";
Expand All @@ -41,6 +40,7 @@ const {
loading,
error,
isEditMode,
form,
v$,
clearContents,
create,
Expand All @@ -51,16 +51,8 @@ const {
props,
emit,
$modal,
{
'name': {required},
'short_name': {},
'auto_assign': {}
},
{
'name': '',
'short_name': '',
'auto_assign': ''
},
{},
{},
);
const {$gettext} = useTranslate();
Expand Down
35 changes: 28 additions & 7 deletions frontend/components/Admin/CustomFields/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<form-group-field
id="edit_form_name"
class="col-md-6"
:field="form.name"
:field="v$.name"
:label="$gettext('Field Name')"
:description="$gettext('This will be used as the label when editing individual songs, and will show in API results.')"
/>

<form-group-field
id="edit_form_short_name"
class="col-md-6"
:field="form.short_name"
:field="v$.short_name"
:label="$gettext('Programmatic Name')"
>
<template #description>
Expand All @@ -24,7 +24,7 @@
<form-group-select
id="edit_form_auto_assign"
class="col-md-6"
:field="form.auto_assign"
:field="v$.auto_assign"
:label="$gettext('Automatically Set from ID3v2 Value')"
:options="autoAssignOptions"
:description="$gettext('Optionally select an ID3v2 metadata field that, if present, will be used to set this field\'s value.')"
Expand All @@ -38,12 +38,33 @@ import {computed} from "vue";
import {useTranslate} from "~/vendor/gettext";
import {forEach} from "lodash";
import FormGroupSelect from "~/components/Form/FormGroupSelect.vue";
import {VuelidateRef} from "~/functions/useVuelidateOnForm.ts";
import {required} from "@vuelidate/validators";
import {FormTabEmits, FormTabProps, useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab.ts";
const props = defineProps<{
form: VuelidateRef,
interface CustomFieldsProps extends FormTabProps {
autoAssignTypes: Record<string, string>
}>();
}
const props = defineProps<CustomFieldsProps>();
const emit = defineEmits<FormTabEmits>();
const {
v$
} = useVuelidateOnFormTab(
props,
emit,
{
'name': {required},
'short_name': {},
'auto_assign': {}
},
{
'name': '',
'short_name': '',
'auto_assign': ''
}
)
const {$gettext} = useTranslate();
Expand Down
25 changes: 17 additions & 8 deletions frontend/components/Admin/Users/EditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from "~/functions/useBaseEditModal";
import {useTranslate} from "~/vendor/gettext";
import ModalForm from "~/components/Common/ModalForm.vue";
import mergeExisting from "~/functions/mergeExisting.ts";
interface UsersEditModalProps extends BaseEditModalProps {
roles: Record<number, string>
Expand All @@ -53,16 +54,24 @@ const {
props,
emit,
$modal,
{},
{},
{
roles: {},
new_password: {}
},
{
roles: [],
new_password: null
},
{
populateForm: (data, formRef) => {
formRef.value = {
name: data.name,
email: data.email,
new_password: '',
roles: map(data.roles, 'id')
};
formRef.value = mergeExisting(
formRef.value,
{
...data,
roles: map(data.roles, 'id'),
new_password: ''
}
);
},
}
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/Public/WebDJ/PlaylistPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
v-if="!isPlaying || isPaused"
type="button"
class="btn btn-sm btn-success"
@click="play"
@click="play()"
>
<icon :icon="IconPlayCircle" />
</button>
Expand Down

0 comments on commit ec6b5de

Please sign in to comment.