-
Notifications
You must be signed in to change notification settings - Fork 3
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
Graph selection info #53
Conversation
There was a problem hiding this 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'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.']; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified
src/path-graph.js
Outdated
}))(SelectedNodeInfo); | ||
|
||
// selected edge info component | ||
class SelectedEdgeInfo extends Component { |
There was a problem hiding this comment.
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
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorporated.
There was a problem hiding this comment.
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.']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//www.
to ^www.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@dongbohu Was able to fix most of the npm warnings. Turns out but per this comment it's out of our control it seems like. |
@vincerubinetti: Thanks. That is good enough. Please feel free to file another PR (or put in #54). |
Adds node/edge selection and its relevant info
Closes #31