vojtajina / helpdesk-client

Helpdesk application - simple JS client, written in angularjs, working with REST service
www.angularjs.org
59 stars 23 forks source link

Add app status indicator #5

Closed vojtajina closed 13 years ago

vojtajina commented 13 years ago

We should display status messages whenever the user is waiting...

UI - design

Add yellow box with the message into black toolbar at the top or bit bigger message to center of the screen... These are just ideas feel free to listen to your head / heart...

Messages

LOADING, when:

Note these ideas are just suggestions, feel free to do it your way ! You might come up with better idea then me...

All this logic should be in one place. I would create service $status or something like that. This service has one property message and couple of methods loading, deleting, saving or just generic set...

The main controller publishes this service into the scope, so that we can display the message in the UI - template. This message should be visible only when non-empty. Use ng:show to do so...

The service should use $browser.notifyWhenNoOutstandingRequests to be notified when no outstanding request and clear the message. Note this event the registered callback is always called just once, so you have to register at all over again. You will probably need $defer service as well, as this needs to be aynchronous, otherwise the callback will be called even before actual request...

So when anyone sets the message, the service should handle everything - change the message property, register callback to clear the message when all requests are finished. (should register always just one callback...)

Write unit test for this service first !

When this service is ready - use it in the controller. E.g. when creating ticket createTicket method is called, so inside this method, call $status.saving()...

Again unit test that - try to cover all cases...

The $status methods could take optional argument to display more verbosing messages like "saving ticket", "deleting project", ...