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

Adding Dynamo Dictionary link to Context Menu Help Popup #7572

Merged
merged 7 commits into from Feb 18, 2017

Conversation

yeexinc
Copy link
Contributor

@yeexinc yeexinc commented Feb 3, 2017

Purpose

This PR is to address DYN-306
A link to Dynamo Dictionary is added at the bottom of help menu popup window.
capture

If the size of the content is longer than the default window size, user has to scroll down to see the link. E.g.
capture2 capture3

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@aparajit-pratap

FYIs

@riteshchandawar @Racel

@Racel
Copy link
Contributor

Racel commented Feb 3, 2017

@yeexinc - Does the link go to the node's page in the dictionary or just to the front page? If it is just to the front page, that is fine for now. But, in the future, we should file another task to get the link pointing to the node's page. Is that doable?

@yeexinc
Copy link
Contributor Author

yeexinc commented Feb 5, 2017

@Racel , for now it only takes the user to the front page. Though I do agree that going to the node's page would make it a better feature.

@aparajit-pratap
Copy link
Contributor

aparajit-pratap commented Feb 6, 2017

@yeexinc as discussed you can easily link each node to its own help page in DynamoDictionary as suggested by @Racel . You would need to bind to the Category property of NodeModel to get the category information and use it to construct the path to be appended to the DynamoDictionary website.
For example: for the ByGeometryColor node, its Category property returns the string Display.Display.Display.Create. You can use this information together with the node name to reconstruct the path and append it to the website name such that you can reconstruct the complete URL, which will navigate the user directly to the node's page: http://dictionary.dynamobim.com/#/Display/Display/Display/Create/ByGeometryColor

@yeexinc
Copy link
Contributor Author

yeexinc commented Feb 6, 2017

Thank you for the review @aparajit-pratap , the new changes should direct the user to the node's help page now.
Some nodes have blank strings as their Category however, such as the Watch node and the Web Request node. In such cases the user will be directed to the Dynamo Dictionary's home page for now.


// Obtain the node's default name from its creation name.
// e.g. For creation name DSCore.Math.Max@double,double - the name "Max" is obtained and appended to the final link.
int indexAfter = (CreationName.LastIndexOf('@') == -1) ? CreationName.Length : CreationName.LastIndexOf('@');
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there should be an easier more straightforward way to retrieve the node name. Try using the Nickname or Name property of NodeModel.

Copy link
Contributor Author

@yeexinc yeexinc Feb 7, 2017

Choose a reason for hiding this comment

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

Thanks @aparajit-pratap , it appears that some nodes have empty strings as their Name (an example is AnalysisExtensions.IsAlmostEqualTo). Though, the actual name is still obtainable from CreationName, something which I don't quite understand as CreationName seems to return the node's Name property from their get method (line 77 of the code in this file).
Nickname changes accordingly with the UI when the user renames the node. Hence, I think that CreationName gives a better accuracy among the three.

string finalLink = Configurations.DynamoDictionary + "#/";
if (category == null || category == "")
{
return finalLink; // if there is no category, return the link to home page
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you simply return Configurations.DynamoDictionary. That way you won't have to wrap this up in a try-catch below, would you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was concerned that ((TextBlock)sender).Tag.ToString() in NodeHelpPrompt.xaml.cs may throw some unexpected errors, but that seems unlikely in this case. Will fix that in my next commit. Thanks!

@aparajit-pratap
Copy link
Contributor

@yeexinc please take a look at my comments and give them some thought. Thanks!

@Racel
Copy link
Contributor

Racel commented Feb 6, 2017

@aparajit-pratap @yeexinc - This is great that you got some of the nodes pointing to the correct dictionary location. Please keep in mind overloads where the category/node model approach might not be enough.

Take for instance, Point.ByCoordinates. In the dictionary, the first overload works as outlined in the approach @aparajit-pratap suggested. The subsequent overloads use the additional parameters as part of the url...http://dictionary.dynamobim.com/#/Geometry/Point/Create/ByCoordinates(x_double-y_double-z_double)

@aparajit-pratap
Copy link
Contributor

@Racel in the case of overloads therefore, the link may be misleading as it will always lead the user to the first overload. @riteshchandawar any thoughts?

@Racel
Copy link
Contributor

Racel commented Feb 7, 2017

@aparajit-pratap - I agree, we should not lead the user to the first overload. Is it not possible to just use similar logic to what is used for the dictionary? Checking with ModeLab about this...

@Racel
Copy link
Contributor

Racel commented Feb 7, 2017

@aparajit-pratap @yeexinc - Please check out line 273 of https://github.com/ekatzenstein/DynamoDictionary_React/blob/master/src/App.js for routing logic setup in dictionary

@Racel
Copy link
Contributor

Racel commented Feb 13, 2017

@aparajit-pratap @yeexinc - Just checking in on this? How is it going? And are we ready to merge?

@yeexinc
Copy link
Contributor Author

yeexinc commented Feb 14, 2017

@Racel - We were still looking into the issue with overloads.
May I know if there is a rule to determine which method requires parameters in the URL? I've thought of taking the first overload among the functions, or the overload with the least/most number of parameters as the "default" method which do not require parameters in the URL, but the Dynamo Dictionary does not seem to follow the pattern.
Any ideas? Or, is it possible to have all the methods with overloads to have parameters in their URL?
Thanks.

@Racel
Copy link
Contributor

Racel commented Feb 14, 2017

@yeexinc - I think the overloads are loaded alphabetically. So, the first overload alphabetically will not have the parameters in the URL.

See if that works...

@yeexinc
Copy link
Contributor Author

yeexinc commented Feb 15, 2017

@Racel - Checking the overloads alphabetically works for some cases, but not all. Take "Point.ByCoordinates" as an example, the overloads for this method in alphabetical order are Point.ByCoordinates(x,y) and Point.ByCoordinates(x,y,z). This will generate valid URLs, since only the subsequent overload contains parameters in its URL.
In the case of "SortIndexByValue" though, the overloads, in alphabetical order are SortIndexByValue(list) and SortIndexByValue(list, ascending). However, the parameters are appended in the first overload instead of the subsequent overload.

It would be good if there is a rule to decide which function requires parameters and which does not, for consistency.

@aparajit-pratap
Copy link
Contributor

@Racel I had written an email to Erick from Modelab to ask if they could consistently add parameters to all overloads in the DynamoDictionary website. Could you confirm with him if that's possible?

@yeexinc
Copy link
Contributor Author

yeexinc commented Feb 17, 2017

@aparajit-pratap - The current state of this PR will always direct the user to the first overload, with no parameters added, as adding parameters will take the user to a blank page if the URL is invalid. It can be merged if you think it is okay for the time being.

@aparajit-pratap
Copy link
Contributor

Thanks @yeexinc please cross-merge into RC1.2.3_master branch as well.

@yeexinc
Copy link
Contributor Author

yeexinc commented Feb 20, 2017

Thank you for the review @aparajit-pratap !

aparajit-pratap pushed a commit that referenced this pull request Feb 20, 2017
…1.2.3_master (#7620)

* Added Dynamo Dictionary Link to Context Menu Help Popup

* Redirect user to the node's page

* Updated codes based on previous review

(Note: operations to append parameters are not included in this commit)

* Reverted NodeHelpPrompt.xaml

* Reupdate NodeHelpPrompt.xaml

* Removed JsonIgnore for RC1.2.3
@yeexinc yeexinc deleted the branch-dictionary branch March 14, 2017 03:09
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.

None yet

3 participants