Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph selection info #53

Merged
merged 10 commits into from
May 9, 2019
Merged

Graph selection info #53

merged 10 commits into from
May 9, 2019

Conversation

vincerubinetti
Copy link
Collaborator

@vincerubinetti vincerubinetti commented May 9, 2019

image

Adds node/edge selection and its relevant info

Closes #31

@vincerubinetti vincerubinetti requested review from dhimmel and dongbohu May 9, 2019 17:40
Copy link
Contributor

@dongbohu dongbohu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments for you to consider. Thanks.

@@ -15,6 +15,8 @@ import { CollapsibleSection } from './collapsible-section.js';
import { NumberBox } from './number-box.js';
import { TextButton } from './buttons.js';
import { downloadSvg } from './util.js';
import { Tooltip } from './tooltip.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is getting bigger and bigger. I wonder whether it makes sense to split it into multiple ones.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can create an issue to split some of these files up, because this is not the only one getting very big. It will take a bit of time, so it probably makes sense to do this in a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds a good plan to me.

src/util.js Outdated

// remove unnecessary preceding 'www.' and etc from url
export function shortenUrl(url) {
const remove = ['http://', 'https://', 'www.'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One corner case: what if www is not the leading characters, such as this URL: mywww.com?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether it is a good idea to remove the leading www. Technically speaking, www is part of the domain name, so http(s)://www.foobar.com is not necessarily identical to http(s)://foobar.com.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is meant for display purposes only, not for navigation. It's just supposed to make the url look nicer when displayed, and decrease the horizontal space it takes up. When the user clicks on a url in a dynamic field, the full value including any http:// or www is displayed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. But still, you don't want to display mywww.com as my.com.

Copy link
Collaborator Author

@vincerubinetti vincerubinetti May 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could do more advanced filtering, like removing everything before the host, or possibly even using the javascript URL functionality to get the relevant bits of information, but I didn't think it was worthwhile to do since our database seems to be fairly clean. It was meant as just a very quick and basic UI optimization. Note that that function is only used in one place and on one specific field of a specific query. @dhimmel thoughts on necessity of this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL seems an overkill. What I meant is something like this:

  const targets = ['^http://', '^https://', '^www.'];
  for (const str of targets) {
    regex = new RegExp(str);
    url = url.replace(regex, '');
  }

(I renamed remove because using verb to name an array seems a little weird.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified

}))(SelectedNodeInfo);

// selected edge info component
class SelectedEdgeInfo extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some code duplication in this class and SelectedNodeInfo class. How hard is it going to be to remove the duplication (such as defining a abstract class that will be inherited by SelectedNodeInfo and SelectedEdgeInfo)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorporated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

src/util.js Outdated

// remove unnecessary preceding 'www.' and etc from url
export function shortenUrl(url) {
const regexes = ['^http://', '^https://', '//www.'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//www. to ^www.?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@vincerubinetti
Copy link
Collaborator Author

@dongbohu Was able to fix most of the npm warnings. Turns out react-scripts hadn't been updated in a long time. There's still one more warning remaining though:
image

but per this comment it's out of our control it seems like.

@vincerubinetti vincerubinetti merged commit f4201b1 into greenelab:master May 9, 2019
@dongbohu
Copy link
Contributor

dongbohu commented May 9, 2019

@vincerubinetti: Thanks. That is good enough. Please feel free to file another PR (or put in #54).

@vincerubinetti vincerubinetti deleted the graph-selection-info branch May 13, 2019 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add node/edge information on click in graph visualization
2 participants