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

DYN-2149 DummyNode unresolved node messages are confusing #10051

Merged
merged 6 commits into from
Oct 16, 2019

Conversation

reddyashish
Copy link
Contributor

@reddyashish reddyashish commented Oct 11, 2019

Purpose

This PR is to improve the warning message shown on the unresolved dummy nodes.
Task: https://jira.autodesk.com/browse/DYN-2149

The description of the node is shown when the user hovers on the node. When the node is of type 'unresolved', a warning message is shown that specifies the function name.

Before this change, the message was:

previous

After this change,

Screen Shot 2019-10-11 at 2 48 16 AM

The assembly name is not stored in the object so instead we show the whole function name(along with the namespace).

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

@DynamoDS/dynamo

InputCount = inputCount;
OutputCount = outputCount;

string legacyName = "Unresolved";
Copy link
Contributor

@QilongTang QilongTang Oct 11, 2019

Choose a reason for hiding this comment

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

@mjkkirschner @aparajit-pratap I cant remember, do we localize node names?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just found out that we do not localize node names, so we should be fine here

@@ -96,11 +96,22 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
{
NodeModel node = null;

String typeName = null;
String functionName = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would usually recommend to use String.Empty because it is less likely to cause crashes. But I saw you have wrapped string null check lots of places which is also good.

@mjkkirschner
Copy link
Member

mjkkirschner commented Oct 11, 2019

@reddyashish - I think something we neglected to consider or discuss yesterday was DummyNodes which represent explicit NodeModel nodes - for example, a dropdown node - here the type and assembly information can actually be gathered from the $type correctly

  • I think we need to handle both these cases, and this means we need different constructors for dummyNodes - one where we use the function name gathered from FunctionSignature - this will only exist for zero touch nodes - and another constructor and message where the node Type and assembly are actually known.

Have you considered that other case and ensured it is not broken now?

@mjkkirschner mjkkirschner self-requested a review October 11, 2019 18:28
Copy link
Member

@mjkkirschner mjkkirschner left a comment

Choose a reason for hiding this comment

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

  1. let's improve the zero touch dummy node messaging - as you have done here
  2. let's keep the NodeModel dummy node messaging as it is - using type and assembly - as those will be known for NodeModel nodes.
  3. tests for both cases.

if (typeName.Contains("ZeroTouch"))
{
// This assemblyName does not usually contain version information...
if (typeName.Contains("ZeroTouch"))
Copy link
Member

Choose a reason for hiding this comment

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

can we be specific about this- it's possible anyone could make a nodeModel and name it ZeroTouch lets use our entire namespace and type name - including the assembly name would be fine as well for precision.

// This assemblyName does not usually contain version information...
if (typeName.Contains("ZeroTouch"))
{
// If it is a zero touch node, then get the whole function name including the namespace.
functionName = obj["FunctionSignature"].Value<string>().Split('@').FirstOrDefault().Trim();
Copy link
Member

Choose a reason for hiding this comment

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

do FunctionSignatures always have the @ token? What if it's not there, what happens?

@reddyashish
Copy link
Contributor Author

reddyashish commented Oct 15, 2019

Added the typename info for the node model node. Now the message for node model node looks like this:
Screen Shot 2019-10-15 at 12 04 36 AM

@mjkkirschner If the function signature has not parameters(no '@'), it just takes the complete name. Have tested this case.

@reddyashish
Copy link
Contributor Author

Also have checked for the complete namespace for xero-touch nodes. The assembly name is stored as DynamoCore in the type string. So was just checking for the namespace.

/// <summary>
/// Type name of the node.
/// </summary>
public string TypeName { get; private set; }
Copy link
Member

@mjkkirschner mjkkirschner Oct 15, 2019

Choose a reason for hiding this comment

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

any reason not to overload the LegacyNodeName - maybe note that this is property is only valid for NodeModel dummy nodes?

/// <summary>
/// Returns the node's function name
/// </summary>
public string FunctionName { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

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

any reason not to overload the LegacyNodeName - maybe note that this is property is only valid for ZeroTouch dummy nodes?

}
else
{
const string format = "Node of type '{0}' ({1}) cannot be resolved";
return string.Format(format, LegacyNodeName, LegacyAssembly);
Copy link
Member

Choose a reason for hiding this comment

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

is LegacyNodeName used anywhere anymore? If not maybe you want to obsolete it?

@mjkkirschner
Copy link
Member

@reddyashish it looks good, thanks for the hard work, just a few last comments.

@reddyashish
Copy link
Contributor Author

reddyashish commented Oct 16, 2019

Added more comments. The LegacyNodeName and LegacyFullName are being used in some other places so I din't remove or obsolete it.

@reddyashish reddyashish merged commit 52557ec into DynamoDS:master Oct 16, 2019
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.

3 participants