Murali-group / GraphSpace

The interactive graph sharing website.
http://graphspace.org
GNU General Public License v2.0
30 stars 41 forks source link

Modify graph metadata using UI #317

Open jlaw9 opened 7 years ago

jlaw9 commented 7 years ago

The main missing UI features to modify graph metadata are:

Users should be able to edit the title and tags in the "Graph Visualization" tab and the graph inforomation/legend in the "Graph Information" tab

bruce-wayne99 commented 6 years ago

I would like to work on this issue.

tmmurali commented 6 years ago

@jlaw9 @adbharadwaj Can you help @bruce-wayne99 to get started on fixing this issue?

Thanks for the offer, @bruce-wayne99. We welcome new contributors!

adbharadwaj commented 6 years ago

@bruce-wayne99, Thanks for offering to work on this issue. Here is how I would do it I was a newbie in GraphSpace project.

Step 1

You can find detailed documentation on how the graph information, tags, title, and legend is populated using the following link.

Graph Data Attributes Attributes Treated Specially by GraphSpace

Although the above-mentioned sub-section should be sufficient, I highly encourage you to understand go through entire section on CYJS format to get a more thorough understanding.

Step 2

Go through our update/put /graphs/{id} API works. Play around with it on your local setup. Try to update all of three fields mentioned above and understand the input and output data format.

Here are some useful links:

  1. API Reference
  2. Tutorial: How to use GraphSpace APIs

Step 3

Since the API call for this feature will be from UI, we don't have to authenticate our calls using BasicAuth. Instead, we need to authenticate it using CSRF tokens.

The good thing is we already have a JS API to handle graph update in our JS library. All you need to worry about is sending in the right input data and hence, step 1 and 2 is really important.

Here is a sample call where we are updating the graph to make it public.

apis.graphs.update(graph_id, {
                'is_public': 1
            },
            successCallback = function (response) {
                // This method is called when group_to_graph relationship is successfully deleted.
                // The entry from the table is deleted.
                $(e).parent().find('.unshare-graph-btn').removeClass('hidden');
                $(e).addClass('hidden');

            },
            errorCallback = function (xhr, status, errorThrown) {
                // This method is called when  error occurs while deleting group_to_graph relationship.
                $.notify({
                    message: xhr.responseJSON.error_message
                }, {
                    type: 'danger'
                });

            });

Step 4

Write the code !!

@bruce-wayne99, I would be happy to discuss the user experience flow with you on this thread, if you need to. Some tips:

bruce-wayne99 commented 6 years ago

@adbharadwaj I actually thought of adding buttons like 'Edit name', 'Add Tag', 'Remove Tag', 'Edit description' in the graph table. As shown in the figure below. present-UI Correct me if there is a better way to provide UI to modify graph meta data.

tmmurali commented 6 years ago

@bruce-wayne99 In principle, this UI is good but a challenge is that as we expand the list of items we want to be editable the number of buttons increases.

Another option to consider is show an "Edit" icon (usually looks like a pen). Upon clicking this icon, either (i) a new page opens up that allows editing of all metadata associated with the graph or (ii) the appropriate columns in the table become editable in place.

I like option (i) more since it allows metadata that is not shown in the table to edited. But a minor drawback is that it requires opening a new page.

@adbharadwaj Comments?

bruce-wayne99 commented 6 years ago

@tmmurali So, Iam thinking of implementing an Edit icon for each graph and on clicking the Edit option a new modal opens up just like the way for Remove where for each meta data field an input tag can be specified where he can enter new values for the data and clicking the submit button triggers an AJAX request. Suggest me if this could be done in a better way.

adbharadwaj commented 6 years ago

I like what @tmmurali suggested in option (i).

Another option would be to create a new page for editing and that means you will have to add a new url-route. I would rather create a client-side util on the graph page.

So instead of editing from the graphs list page, users should be editing on the page for a given graph. Something like edit description feature in GitHub.

Edit description

Let me know if you have more questions.

bruce-wayne99 commented 6 years ago

@adbharadwaj i have implemented editing name and title of the graph. The following is a gif of the implementation. Please have a look at it. updating_name_title Suggest me if any changes can be made!

adbharadwaj commented 6 years ago

@bruce-wayne99 Looks promising! Can you make it look like Github? You can refer to the GIF in my previous comment. Ideally we wouldn't wanna hide the graph while editing the name and description. For tags, you can refer to Github's tags edit functionality. Let me know if you have more questions.

bruce-wayne99 commented 6 years ago

@adbharadwaj sorry for the late response, I was having exams, since the graph visualization and graph information are on different panels, should i display the name, description, tags, title for the graph in the visualization tab and then provide edit/cancel options for the user in the visualization tab?

adbharadwaj commented 6 years ago

@bruce-wayne99 We need to split this into two parts.

  1. On graph visualization page, we should allow a user to edit the name, title, and tags of the graph.
  2. On graph information page, we should allow a user to edit all of the graph data attributes like name, title, tags, description etc.
bruce-wayne99 commented 6 years ago

@adbharadwaj I have implemented editing name,title,description functionality. gif of the implementation : final I have gone through the tags implementation of github but there are using a new page for displaying all the tags and editing them as shown in the screen shot. screenshot from 2018-02-12 14-10-04 Please suggest me regarding implementation of add/remove tags.

tmmurali commented 6 years ago

Thanks. This implementation looks nice.

Is the edit button seen only by the user of the graph?

On Mon, Feb 12, 2018 at 3:46 AM, Subramanyam Makam <notifications@github.com

wrote:

@adbharadwaj https://github.com/adbharadwaj I have implemented editing name,title,description functionality. gif of the implementation : [image: final] https://user-images.githubusercontent.com/25129274/36088891-1e900b70-0fff-11e8-873c-ef7137b244ec.gif I have gone through the tags implementation github but there are using a new page for displaying all the tags and editing them as shown in the screen shot. [image: screenshot from 2018-02-12 14-10-04] https://user-images.githubusercontent.com/25129274/36088898-259f2c5c-0fff-11e8-80ea-7c44dcfc60e9.png Please suggest me regarding implementation of add/remove tags.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Murali-group/GraphSpace/issues/317#issuecomment-364859494, or mute the thread https://github.com/notifications/unsubscribe-auth/AGkWUJ2FVaHVNNTNaS-p6iLkyb6lk9DGks5tT_pdgaJpZM4O6aC1 .

tmmurali commented 6 years ago

Sorry. I meant to say "owner of the graph".

On Mon, Feb 12, 2018 at 10:49 AM, T. M. Murali murali@cs.vt.edu wrote:

Thanks. This implementation looks nice.

Is the edit button seen only by the user of the graph?

On Mon, Feb 12, 2018 at 3:46 AM, Subramanyam Makam < notifications@github.com> wrote:

@adbharadwaj https://github.com/adbharadwaj I have implemented editing name,title,description functionality. gif of the implementation : [image: final] https://user-images.githubusercontent.com/25129274/36088891-1e900b70-0fff-11e8-873c-ef7137b244ec.gif I have gone through the tags implementation github but there are using a new page for displaying all the tags and editing them as shown in the screen shot. [image: screenshot from 2018-02-12 14-10-04] https://user-images.githubusercontent.com/25129274/36088898-259f2c5c-0fff-11e8-80ea-7c44dcfc60e9.png Please suggest me regarding implementation of add/remove tags.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Murali-group/GraphSpace/issues/317#issuecomment-364859494, or mute the thread https://github.com/notifications/unsubscribe-auth/AGkWUJ2FVaHVNNTNaS-p6iLkyb6lk9DGks5tT_pdgaJpZM4O6aC1 .

bruce-wayne99 commented 6 years ago

Yes, the edit button will only appear if user-id is same as the owner-id.

adbharadwaj commented 6 years ago

@bruce-wayne99 Looks great. Few more suggestions.

Let me know if you have any questions.

adbharadwaj commented 6 years ago

This is how add topics look like on GitHub.

screen shot 2018-02-13 at 4 14 36 pm
bruce-wayne99 commented 6 years ago

@adbharadwaj Sir, @tmmurali Sir,

adbharadwaj commented 6 years ago

@bruce-wayne99 A few more suggestions,

Basically, use your discretion to come up with a neat UI.

bruce-wayne99 commented 6 years ago

@adbharadwaj Sir,

tmmurali commented 6 years ago

@bruce-wayne99 @adbharadwaj This implementation looks good. Two points:

  1. Having both an "Edit" button and a "Manage tags" button is bound to be confusing. The user will wonder (before clicking "Edit") about what it does. Can we not unite them in one button?

  2. Are we changing the database to record these edits? Will other users who can see the graph get a notification of the changes and what the changes are? Is the plan to add new issues to address these must-have functions? In that case, we should create a separate branch for edit functionality, should we not?

bruce-wayne99 commented 6 years ago

@adbharadwaj , @tmmurali Sir,

adbharadwaj commented 6 years ago

@tmmurali

  1. I agree that we should have one edit button.
  2. Yes, the notifications will be automatically generated once the notification framework is merged. IN the notification framework, we currently have a wrapper function on update data access layer function which will trigger the notification, irrespective which element on the UI or API triggers the update.

@bruce-wayne99 Do not worry about the notification in this pull request. That will be taken care when we merge the notifications pull request. For now, just unite the edits under one button and let us know.

bruce-wayne99 commented 6 years ago

@adbharadwaj, @tmmurali Sir, I have made a pull request for this issue please look at it.