Jira Module Dashboard gadget - Custom UI

When using the Dashboard gadget module in a Forge custom UI setting, how can the app store configuration data in the gadget configuration object? If this is not possible for a Custom UI yet, I suppose I could save the configuration data in the Forge app storage (using, for instance, the gadget id as the key). But how would the gadget know when to switch to a non-edit context (and vice versa)?

Thanks,
Thorsten

Hi @tbu ,

Yes, I think you are on the right track. The Forge dashboard widget module doesn’t provide Custom UI based implementations with a separate entry point like it does for UI Kit. For Custom UI, you would store the configuration in Forge storage against the gadget ID as you suggested.

The reference docs includes a section showing how you can detect whether the extension point has been triggered in view or edit mode, allowing you to provide seperate UI experiences:

return context.extension.entryPoint === 'edit' ? <Edit/> : <View/>;

Regarding your question about “how would the gadget know when to switch to a non-edit context (and vice versa)?”, I believe the dashboard gadget extension point will be re-rendered each time the user toggles between edit and view mode. This would trigger the re-rendering of your entry point above.

Regards,
Dugald

Hi @dmorrow,
thanks for your reply.

I believe the dashboard gadget extension point will be re-rendered each time the user toggles between edit and view mode.

Yes, but there does not seem to be a way for the user to toggle the modes. By default, in a custom UI setting, the gadget starts out in editing mode. The app displays, say, a custom form to edit the config. Upon the submit of the form data, the gadget container should then toggle to the view mode, but it is unclear what the app needs to do to trigger that (so far it just stores the config in the Forge storage).

With UI kit, you could use the DashboardGadgetEdit component where I suppose the mandatory onSubmit function does the trick. If there is no way to trigger that mode change for custom UI, it would mean that the gadget container would always remain in edit mode. While the app could work around that, it would have to provide an extra button for the user to toggle back to the edit mode (instead of the user being able to use the built-in “configure” menu point of the gadget container). From a UX point of view, that would be rather bad.

Best regards,
Thorsten

Hi @tbu ,

Yes, but there does not seem to be a way for the user to toggle the modes.

My understanding is that the user toggles modes using the Edit and Done buttons in the toolbar at the top right of the dashboards view:

The difference is that with Custom UI, submitting configuration changes won’t switch to view mode.

Regards,
Dugald