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

Dynamo Package Dependency View Extension #9787

Merged
merged 27 commits into from
Jun 18, 2019

Conversation

QilongTang
Copy link
Contributor

@QilongTang QilongTang commented Jun 10, 2019

Please Note:

  1. Before submitting the PR, please review How to Contribute to Dynamo
  2. Dynamo Team will meet 1x a month to review PRs found on Github (Issues will be handled separately)
  3. PRs will be reviewed from oldest to newest
  4. If a reviewed PR requires changes by the owner, the owner of the PR has 30 days to respond. If the PR has seen no activity by the next session, it will be either closed by the team or depending on its utility will be taken over by someone on the team
  5. PRs should use either Dynamo's default PR template or one of these other template options in order to be considered for review.
  6. PRs that do not have one of the Dynamo PR templates completely filled out with all declarations satisfied will not be reviewed by the Dynamo team.
  7. PRs made to the DynamoRevit repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after a LGTM label is added to the PR.

Purpose

image

Dynamo Package Dependency View Extension using DataGrid.

This PR:

  1. Adds a view extension managed by Dynamo Team to the Dynamo.all.sln so it will always be built with Dynamo with every new commit.
  2. Such view extension displays graph package dependencies when there are packages logged in dyn not installed locally (no exact package name and version match)
  3. Packages are marked grey when they are installed and red when they are not
  4. There is currently a dummy download button beneath the dependency table, I created so we could show people mock-ups.

image

GraphDependencyMissing

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

FYIs

@QilongTang QilongTang added the WIP label Jun 10, 2019
@QilongTang
Copy link
Contributor Author

I found adding extension project inside Dynamo repo is such a pain 👎 Localization resources seems a must-have and now getting this error which I have never encountered myself. Had no clue comparing with other view extensions and stackoverflow, will continue to look at the error

@mjkkirschner
Copy link
Member

this is getting cool.

1. Using ready param instead of data context
2. Exposed workspace cleared event for extension to watch for and clear dependency data
@aparajit-pratap
Copy link
Contributor

aparajit-pratap commented Jun 14, 2019

@QilongTang you might have missed moving Notifications project to the new Extensions folder. It is also an extension (view extension).

@QilongTang
Copy link
Contributor Author

QilongTang commented Jun 14, 2019

@aparajit-pratap It is moved already, see my picture shot in PR discription

@QilongTang QilongTang added the PTAL Please Take A Look 👀 label Jun 17, 2019
currentWorkspace = p.CurrentWorkspaceModel as WorkspaceModel;
p.CurrentWorkspaceChanged += OnWorkspaceChanged;
p.CurrentWorkspaceCleared += OnWorkspaceCleared;
currentWorkspace.PropertyChanged += OnWorkspacePropertyChanged;
Copy link
Member

Choose a reason for hiding this comment

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

you need to unsubscribe this event handler.

Copy link
Member

Choose a reason for hiding this comment

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

I see how this could always be the same workspace - but I think for safety's sake we should unsub this when the workspace changes and re sub it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, I removed because this is causing crashes sometimes (I think I showed you).. Let me add it back and test

{
DependencyRegen(obj as WorkspaceModel);
currentWorkspace = obj as WorkspaceModel;
currentWorkspace.PropertyChanged += OnWorkspacePropertyChanged;
Copy link
Member

Choose a reason for hiding this comment

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

I think here we should unsubscribe the old workspace before subscribing the new one - even if they are usually the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added back

@mjkkirschner
Copy link
Member

mjkkirschner commented Jun 18, 2019

@QilongTang one more UI point - the text editing cursor should not be shown over users hover over the entries in the list - this implies they can edit the field, which they cant. I would look at a textBlock instead of a text box with readonly set. Or if you prefer set the hover cursor manually.

Of course we can improve this in another PR.

https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.textblock?view=netframework-4.8

@QilongTang
Copy link
Contributor Author

@mjkkirschner Please check the latest commit, addressed

@@ -38,6 +38,7 @@ internal void OnWorkspaceCleared(IWorkspaceModel obj)
{
if (obj is WorkspaceModel)
{
currentWorkspace.PropertyChanged -= OnWorkspacePropertyChanged;
Copy link
Member

Choose a reason for hiding this comment

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

this seems like an odd place to do this -couldn't the workspace be cleared for some other reason... and if you clear the workspace but then don't add the the subscription back then you're not watching the workspace any longer...

I would have imagined this would be done in the onCurrentWorkspaceChanged handler - you cache the current workspace, unsubscribe the handler, then get the new current workspace and then subscribe?

Does that not work?

@mjkkirschner
Copy link
Member

mjkkirschner commented Jun 18, 2019

@QilongTang I think the logic for workspace event subscription is not correct. I know it's not straight forward because the workspace removed is rarely triggered, and the workspaceCleared is triggered at unexpected times but even with that it mind it seems odd...

How do you want to proceed with tests, as a followup?

@QilongTang
Copy link
Contributor Author

@mjkkirschner Yes, I would like to address tests as follow up and we should really manual test this together

@mjkkirschner
Copy link
Member

LGTM

@mjkkirschner mjkkirschner added LGTM Looks good to me and removed PTAL Please Take A Look 👀 labels Jun 18, 2019
@scottmitchell
Copy link
Collaborator

@QilongTang This is awesome!

continue;
}
}
// TODO: Not ideal! O(N * M) complexicty, would like LoadedPackageDependencies to be a dictionary or something with constant package name search time
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point. I think we could improve these properties/objects a lot. What if we removed LoadedPackageDependencies and just added an IsLoaded property to the PackageDependencyInfo type?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there are a few reasons that it might make sense to split PackageDependencyInfo into two classes: PackageInfo and PackageDependency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@scottmitchell We have to also not only deal with loaded but also higher version which are compatible and other cases, like lower version exist but not sure if they should satisfy.. Any case, there are some aspects to think more here

@QilongTang
Copy link
Contributor Author

@mjkkirschner @reddyashish Three UI recorded tests to be fixed but is more related to the view injection API behavior, merging

@QilongTang QilongTang merged commit 43e501e into master Jun 18, 2019
@QilongTang QilongTang deleted the PackageDependencyViewExtension branch June 18, 2019 06:05
mjkkirschner pushed a commit that referenced this pull request Aug 3, 2019
* Initial Commit

* Update csproj to use project config imports

* Add Data bind

* Workspace Open with package info

* adjust styling and make cells read only

* adjust styling

* reduce package cell width

* Code clean Up

1. Using ready param instead of data context
2. Exposed workspace cleared event for extension to watch for and clear dependency data

* Add Property watch for Package Dependencies

* use name of

* Some UI tunning

* Styling changes

* Using View injection API

* grid styling

* Highlight packages not installed

* Add Download Button and view injection Menu Item

* Some comments missing

* code clean up

* Address Comments

* UI Adjustment

* Update unsubscribe logic

* More comments

* Fix Unit Tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM Looks good to me
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants