tenders-exposed / elvis-ember

**el.vis** - a tool for visualising public (EU) tenders big data
https://talk.tenders.exposed
GNU Affero General Public License v3.0
8 stars 2 forks source link

Update network button #533

Open georgiana-b opened 4 years ago

georgiana-b commented 4 years ago

As part of https://github.com/georgiana-b/defense-elvis-backend/pull/19 we already added the functionality to update a network.

However, as discussed with the clients, we don't want to set off the update automatically because we want to give the user the opportunity to take a photo of the existing network before regenerating it, just in case they want to do a comparison later.

Therefore, we need to create a mechanism to:

  1. signal to the user that an existing network needs updating
  2. provide the controller logic to actually set off the update

On the backend, a new field will be added to the Network: need_update: true/false. This field will be set to true after a new data import, to signal that the network needs to be regenerated in order to include the latest data.

Then on frontend, on GET /network/{id}, if the network has needs_update: true and the user is the owner of the network, we will display a message that says:

The underlying data of this network has been updated. Please regenerate the network to make sure you see the latest data and avoid inconsistencies: [BUTTON TO REGENERATE]

I suggest we use the word REGENERATE instead of UPDATE just because we want to convey to the user that some of the data will be lost. However I think it's also necessary to have a tooltip with extra information explaining that: Some of the nodes will be removed, some will be added and some will be updated. We will keep in the cluster the nodes that haven't been removed and we will recalculate the cluster based on their latest values.

Pushing REGENERATE will sent a request on PUT /network/{id} that will return the updated network. Then we just render the update network as we would after a GET or CREATE.

georgiana-b commented 4 years ago

For the networks that are anonymous I suggest we apply a similar technique. When someone tried to GET /network/{id} on the anonymous network we show them the message as hope that they will push the button. If they don't that's also fine, the network will remain outdated until somebody does.

Alternatively we could set off the update automatically for the anonymous networks from the frontend and then just display a message like This network has been just been updated with the latest data.

@zufanka Let me know which one you prefer.

zufanka commented 4 years ago

Hi @georgiana-b !

I would probably keep the same work flow on all the networks, anonymous and not anonymous.

And I would also actually go for UPDATE instead of REGENERATE, it's a more relatable word in the context.

Would it make sense to have @chutko create a design and template for this first?

georgiana-b commented 4 years ago

It would help but I think we can get away with a simple message at the top of the page above the network.