hotfix (dataset): enhance dataset editing and validation
- Modified the TableKeywords component to remove the external_key reset when the type is updated, only resetting the value. - Updated the DatasetController to pass authorization checks (`can.edit`, `can.delete`) to the edit view. - Updated the arrayContainsTypes validation rule to improve the error messages for titles and descriptions, clarifying the requirements for main and translated entries. - Updated the Dataset Edit view to: - Remove unused code and comments. - Add authorization checks to the save button. - Add a release button. - Add icons to the save and release buttons. - Add a computed property `hasUnsavedChanges` to determine if there are unsaved changes in the form.
This commit is contained in:
parent
2cb33a779c
commit
c3ae4327b7
4 changed files with 83 additions and 55 deletions
|
@ -926,7 +926,7 @@ export default class DatasetController {
|
|||
// throw new GeneralException(trans('exceptions.publish.release.update_error'));
|
||||
}
|
||||
|
||||
public async edit({ request, inertia, response }: HttpContext) {
|
||||
public async edit({ request, inertia, response, auth }: HttpContext) {
|
||||
const id = request.param('id');
|
||||
const datasetQuery = Dataset.query().where('id', id);
|
||||
datasetQuery
|
||||
|
@ -1015,6 +1015,10 @@ export default class DatasetController {
|
|||
referenceIdentifierTypes: Object.entries(ReferenceIdentifierTypes).map(([key, value]) => ({ value: key, label: value })),
|
||||
relationTypes: Object.entries(RelationTypes).map(([key, value]) => ({ value: key, label: value })),
|
||||
doctypes: DatasetTypes,
|
||||
can: {
|
||||
edit: await auth.user?.can(['dataset-edit']),
|
||||
delete: await auth.user?.can(['dataset-delete']),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue