directus-extension-api-trigger-interface
directus-extension-api-trigger-interface copied to clipboard
navigate the browser to the collection list page
Hi , Thanks for the wonderful extension. we are exploring to use it heavily for our business logic implementaiton.
One question, Instead of reload the page after the API call, are we able to navigate the browser to the collection list page inside the onClick function?
I tried modify the reload logic
router.go(0);
into:
router.push('/content/collection1');
However, directus APP will ask the user to confirm leave for the unsaved changes. Actually the changes was already saved inside the API call, is it possible to navigate silently without user confirmation?
It's possible if you can modify the source code of Directus, edit this line to:
useEditsGuard(hasEdits, { ignorePrefix: '/content/collection1' });
It will bypass the confirm dialog if the path to go to starts with this string.
This is the only solution I can think of. I hope this can help you.
It's possible if you can modify the source code of Directus, edit this line to:
useEditsGuard(hasEdits, { ignorePrefix: '/content/collection1' });It will bypass the confirm dialog if the path to go to starts with this string.
This is the only solution I can think of. I hope this can help you.
Thanks for the workaround. I don't want to touch Directus source code.
Is it possible to change every field into it's original value? Or issue a save command inside the OnClick?
Ah, yes. You can use emit('setFieldValue', { field, value }); to set all fields to their original value. After that, there will be no change that needs to be saved.
Yes. I tried with no luck.
So strange, I set all of them to initial value, I even set all of them to undefined... but still Directus APP thinks there are changes.
Do you have any m2o, o2m, m2m, json field? Because even if you set them to their initial values, Directus still considers them as different values if they do not contain reference to the same object.
I see. Yes there is m2o field. Thanks for the clarification.