OED icon indicating copy to clipboard operation
OED copied to clipboard

show routed messages to user

Open huss opened this issue 2 years ago • 14 comments

Is your feature request related to a problem? Please describe.

PR #857 sends back messages from the conversion and unit routes in the desired way (code in src/server/routes/conversions.js or units.js). The API returns what is routed (e.g., src/client/app/utils/api/ConversionsApi.ts). The action that dispatches the code ignores the returned values (e.g., src/client/app/actions/conversions.ts) and just puts up generic messages. It would be nice to display the returned messages. Note it is often only done for failures as success does not return a value.

Examples of code already doing this are:

  • src/client/app/actions/meters.ts in submitEditedMeter() for failure.
  • src/client/app/components/csv/ReadingsCSVUploadComponent.tsx in handleSubmit() displays the message on success.

Describe the solution you'd like

The message returned from the route should be passed up the client call chain to an appropriate point to display. Note some code uses a window alert but the showSuccessNotification/showErrorNotification now have a time argument to control how long it stays up so that would probably be better. For some error messages where the user needs lots of time to read or wants to copy, then getting it to stay up until closed would be nice. I also have not checked how easy it is to copy the displayed text on these messages.

Additional context

There are other places with notices that could be investigated for similar changes.

huss avatar Feb 19 '23 20:02 huss

I'm working on this

ArtP1 avatar Mar 02 '23 23:03 ArtP1