hotfix: enhance radio button and file upload components

- Improved the styling and functionality of the radio button component, including a new radio button style.
- Added a loading spinner to the file upload component to indicate when large files are being processed.
- Added the ability to sort files in the file upload component.
- Fixed an issue where the radio button component was not correctly updating the model value.
- Updated the dataset creation and edit forms to use the new radio button component.
- Added a global declaration for the `sort_order` property on the `File` interface.
- Updated the API to filter authors by first and last name.
- Removed the import of `_checkbox-radio-switch.css` as the radio button styling is now handled within the component.
This commit is contained in:
Kaimbacher 2025-03-27 16:04:23 +01:00
parent b93e46207f
commit 9823364670
11 changed files with 272 additions and 181 deletions

View file

@ -320,12 +320,17 @@ const nextStep = async () => {
} else if (formStep.value == 3) {
route = stardust.route('dataset.third.step');
}
// formStep.value++;
// When posting in steps 1-3, remove any file uploads from the data.
await form
.transform((data) => ({
...data,
rights: form.rights && form.rights == true ? 'true' : 'false',
}))
.transform((data: Dataset) => {
// Create payload and set rights (transforming to a string if needed)
const payload: any = { ...data, rights: data.rights ? 'true' : 'false' };
// Remove the files property so that the partial update is done without files
if (payload.files) {
delete payload.files;
}
return payload;
})
.post(route, {
onSuccess: () => {
// console.log(form.data());
@ -334,7 +339,6 @@ const nextStep = async () => {
},
});
};
const prevStep = () => {
formStep.value--;
};
@ -343,7 +347,7 @@ const submit = async () => {
let route = stardust.route('dataset.submit');
const files = form.files.map((obj) => {
return new File([obj.blob], obj.label, { type: obj.type, lastModified: obj.lastModified });
return new File([obj.blob], obj.label, { type: obj.type, lastModified: obj.lastModified, sort_order: obj.sort_order });
});
// formStep.value++;
@ -576,7 +580,7 @@ Removes a selected keyword
<FormField label="Licenses" wrap-body :class="{ 'text-red-400': form.errors.licenses }"
class="mt-8 w-full mx-2 flex-1">
<FormCheckRadioGroup v-model="form.licenses" name="roles" is-column
<FormCheckRadioGroup type="radio" v-model="form.licenses" name="licenses" is-column
:options="props.licenses" />
</FormField>

View file

@ -42,7 +42,7 @@
<!-- (2) licenses -->
<FormField label="Licenses" wrap-body :class="{ 'text-red-400': form.errors.licenses }"
class="mt-8 w-full mx-2 flex-1">
<FormCheckRadioGroup v-model="form.licenses" name="licenses" is-column :options="licenses" />
<FormCheckRadioGroup type="radio" v-model="form.licenses" name="licenses" is-column :options="licenses" />
</FormField>
<div class="flex flex-col md:flex-row">