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

Split Port Views and ViewModels #12062

Merged
merged 23 commits into from
Oct 6, 2021
Merged

Conversation

saintentropy
Copy link
Contributor

@saintentropy saintentropy commented Sep 24, 2021

Purpose

The purpose of this PR is to split up the Port View and ViewModels. As the difference between In Ports and Out Ports has grown in UX and Code complexity, it is putting a high burden on implementation and a net drag on memory and performance of the Workspace View. This PR allows the port views to be implemented and styled independently. This PR should maintain feature capability with existing 2.13 WIP. This does introduce a 10% gain in start up time and similar for memory allocation.

Declarations

Check these if you believe they are true

  • The codebase 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.
  • This PR modifies some build requirements and the readme is updated

Reviewers

@mjkkirschner @OliverEGreen @QilongTang

FYIs

@SHKnudsen

@saintentropy
Copy link
Contributor Author

@QilongTang I will fix the merge conflict but I think the IsProxy should be a property on the model and not a wrapper class.

# Conflicts:
#	src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs
#	src/DynamoCoreWpf/ViewModels/Core/PortViewModel.cs
src/DynamoCoreWpf/ViewModels/Core/PortViewModel.cs Outdated Show resolved Hide resolved
Comment on lines -332 to -352
public bool SetConnectorsVisibility
{
get => areConnectorsHidden;
set
{
areConnectorsHidden = value;
RaisePropertyChanged(nameof(SetConnectorsVisibility));
}
}

/// <summary>
/// Enables or disables the Hide Wires button on the node output port context menu.
/// </summary>
public bool HideWiresButtonEnabled
{
get => hideWiresButtonEnabled;
set
{
hideWiresButtonEnabled = value;
RaisePropertyChanged(nameof(HideWiresButtonEnabled));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

And these.

@@ -549,7 +549,7 @@ public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationMode
internal void SetGroupInputPorts()
{
InPorts.Clear();
List<ProxyPortViewModel> newPortViewModels;
List<PortViewModel> newPortViewModels;
Copy link
Member

Choose a reason for hiding this comment

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

Can you sum this up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What are you asking here @mjkkirschner

Copy link
Member

Choose a reason for hiding this comment

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

sorry @saintentropy - why did you make all these changes related to proxy type.

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 instead of additional type, @saintentropy is using a property on PortViewModel to indicate if it is a proxy.. Given there is no new property in ProxyPortViewModel yet, this should be OK. But in the future if we need to store additional info, this may not scale. But I am fine with it for now, How about you @mjkkirschner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjkkirschner @QilongTang I maid the change as the purpose of the new wrapper class ProxyPortViewModel was just to provide a type check and did not have a different feature set. Because there are now essentially two base classes for ports it seemed to make more sense to add the proxy status as a property (for the is proxy check) and keep the classes a bit simpler in the code.

if (_port.Connectors.Count < 1 || _node.WorkspaceViewModel.Connectors.Count < 1) return false;

// Attempting to get a relevant ConnectorViewModel via matching NodeModel GUID
ConnectorViewModel connectorViewModel = _node.WorkspaceViewModel.Connectors
Copy link
Member

Choose a reason for hiding this comment

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

too bad theres no map of connectors.

return connectorViewModel.IsCollapsed;
}

public DelegateCommand MouseLeftButtonDownOnContextCommand
Copy link
Member

Choose a reason for hiding this comment

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

same questions as in inport

private bool areConnectorsHidden;
private string showHideWiresButtonContent = "";
private bool hideWiresButtonEnabled;
protected static SolidColorBrush portBorderBrushColor = new SolidColorBrush(Color.FromArgb(255, 204, 204, 204));
Copy link
Member

Choose a reason for hiding this comment

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

appears some of these are repeated in the other new classes...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are other colors but they are specific for inputs not dup

Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

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

LGTM, the regressions should be fixed on master already

@mjkkirschner
Copy link
Member

seems there is still a conflict

@QilongTang
Copy link
Contributor

@saintentropy There is one regression on this PR, once it's fixed, should be good to go

DynamoCoreWpfTests.ListAtLevelInteractionTests.KeepListStructureUpdatesPortViewCorrectly

@QilongTang
Copy link
Contributor

QilongTang commented Oct 6, 2021

Oops, there is also merge conflicts to address again

@saintentropy saintentropy merged commit e3ff415 into DynamoDS:master Oct 6, 2021
@OliverEGreen OliverEGreen mentioned this pull request Oct 25, 2021
8 tasks
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.

6 participants