Skip to content

Wrap left-over builtins into DS class for categorization and autocomplete - #7819

Merged
aparajit-pratap merged 16 commits into
DynamoDS:LibraryReorgfrom
aparajit-pratap:LibraryReorg
Apr 28, 2017
Merged

aparajit-pratap merged 16 commits into
DynamoDS:LibraryReorgfrom
aparajit-pratap:LibraryReorg

Conversation

@aparajit-pratap

@aparajit-pratap aparajit-pratap commented Apr 25, 2017 •

Copy link
Copy Markdown
Contributor

Purpose

This PR addresses https://jira.autodesk.com/browse/DYN-648 for wrapping left-over builtins from #7612 into a DS class so that they can be grouped together with the rest of the List class methods and be invoked from autocomplete using "List.".

A new "BuiltIns.ds" file is being imported into the VM that contains a DS class called List deriving from the DSCore.List FFI class. This class wraps calls to the remaining DS implemented built-in methods that could not be ported over to ZT nodes. As a result these builtin methods can now be invoked in CBN's as member functions of the List class together with the existing methods on the base DSCore.List class.

The existing Builtin methods are made internal so that they can no longer be invoked globally.

Declarations

  • 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.
    image

  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@sharadkjaiswal

FYIs

@benglin @ke-yu

@sharadkjaiswal sharadkjaiswal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good stuff @aparajit-pratap this looks good. But I was wondering if we can have a concept of static class and allow derivation from static FFI class only.

@@ -0,0 +1,64 @@
class List extends DSCore.List

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't this file import("DSCore.dll") ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That is already imported in the sequence of importing preloaded libraries but we can have the import statement here just in case the sequence is not followed.

Comment thread src/Engine/ProtoCore/ClassTable.cs Outdated
}
}

public bool IsFfiDerivedDsClass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am wondering if we really need this special property. What if we say that a DS class can be imported from FFI class only if the FFI class is marked static or all its method and properties are static? So we may think of having a property called IsStaticClass.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So you're proposing implementing a concept of static class in DS?

Where(x => !CoreUtils.StartsWithSingleUnderscore(x.Name)
&& x.Name != DSDefinitions.Keyword.PointerReserved).
&& x.Name != DSDefinitions.Keyword.PointerReserved
&& !x.HasDSDerivedClass).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So we are not returning class nodes from FFI if it has derived class? I don't think we need to do this, you can use the attribute to hide the base class in library and autocompletion.

@aparajit-pratap aparajit-pratap Apr 25, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If I hide the base class using IsVisibleInLibrary(false) autocomplete will hide the members too. I need to do this only to prevent DSCore.List class appearing in autocomplete.

@aparajit-pratap

Copy link
Copy Markdown
Contributor Author

@sharadkjaiswal I have addressed the review comments as discussed, please take a look.

  • Added checks to allow only derivation of static FFI classes
  • Removed IsFFIDerivedDSClass and HasDSDerivedCLass properties

Thanks!

{
HiddenInLibrary = true;
}
else if (attr is IsVisibleInDynamoLibraryAttribute)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

attr.Visible can be false.

@aparajit-pratap
aparajit-pratap merged commit b9390f4 into DynamoDS:LibraryReorg Apr 28, 2017
sharadkjaiswal added a commit that referenced this pull request Jul 3, 2017
* Recategorizing built-in methods (#7612)

* Recategorize built-in methods

* Added methods for List.cs, Math.cs and ImportExport.cs

* Updated Math.MapTo

* Updated List.cs

* Icons and test cases

- built-in methods are hidden from user's search
- test cases moved to DSCoreNodesImages.resx
- minor refinement to some methods
- added test cases for List.cs and Math.cs

* Set copy local in DynamoCoreWpfTests to false

* Updated methods and test cases

- Implementation for SetUnion, SetIntersection and SetDifference are the
same as built-in methods
- Edited ImportExport.ImportFromCSV to reuse the implementation from
built-in
- Added test cases for ImportExport.ImportFromCSV and fixed other test
cases
- Consolidated List.Contains with List.ContainsItem
- Consolidated NormalizeDepth(list, rank) with NormalizeDepth(list)
- Hid some of the built-in methods
- Public methods and private helper methods are grouped using regions
- Overload of List.Flatten is renamed as FlattenCompletely

* Fixes for built in method test cases

* Hide SortIndexByValue overload from builtin

* Edited List, Math and ImportExport functions

- consolidated CSV.ReadFromFile with ImportExport.ImportFromCSV
- renamed ImportFromCSV to ImportCSV
- moved CSV.WriteToFile to ImportExport.ExportCSV
- fixed some of the list functions
- reused builtin implememtations for Math.Map and Math.MapTo
- moved test cases for CSV functions to ImportExport

* migrations for csv.writetofile

replacement of CSV.WriteToFile to ImportExport.ExportCSV

* migrations for builtin nodes

* Renamed FlattenCompletely and removed GetValues

* updated icon for list.flatten

* Update List.Flatten test case and revert migration for File.ExportToCSV

* Consolidate Display nodes for re-categorization

* Add one test case for migrating the very old ByGeometryColor node

* LibraryViewExtension project for hosted library UI (#7756)

* LibraryViewExtension project for hosted library UI

* Serve library view with local data

* Enable Node creation and console log (#7775)

* Cleanup the solution file

* Details view  implementation over Dynamo canvas (#7780)

* Details view  implementation over Dynamo canvas

* Fix visibility of details view

* DetailsView integration (#7788)

* Add missing resources.

* Tabview to show library view and package list view

* Provide Javascript hookup to update active package (#7791)

* Fix a typo

* Method to load installed packages in JSON format (#7789)

* installed packages in json format

* updated method to obtain installed pkg

* removed getInstalledPackagesJSON()

* reverted change to library.html

* reverted previous changes

* Re-fix a typo

* Implement Install Package method on controller (#7793)

* Update the bundle for latest updates in the UI. (#7794)

* Consolidate some nodes from Logic and Formula to Math (#7757)

* move some methods from Logic and Formula to Math

* add entries to migration xml

* add migration testcase

* Remove List.Flatten overload (#7772)

* remove list.flatten overload

* Updated Dynamo.All.Sln

* add migration test case

* Update resources and js code from library.js and PMUI (#7796)

* Recategorize "ColorRange2D" nodes into "ColorRange" (#7763)

* Rename "ColorRange2D" to "ColorRange"

* Add migration test case for ColorRange nodes

* Install integration and style update (#7797)

* Fix the issue that one json string may be invalid (#7802)

* Library reorg (#7803)

* Added 15 more packages to the list.

* updated files to show packages.

* Consolidate all file paths nodes under Import/Export category (#7776)

* move nodes from file to importexport

* add a migration testcase

* change category name on ui to Import/Export

* revert the slash

* change namespace back to DSCore

* rename namespace back to DSCore.IO

* update loadedtypes.json

* Cleanup LibraryReorg branch and remove PMUI code (#7804)

* Update the library UI to recategorize two nodes

* Consolidate all Directory related nodes to Import/Export Category (#7761)

* consolidate directory nodes and rename importexport class

* updated DirectoryFromPath and added migrations

* change namespace from DSCore.IO to ImportExport

* rename namespace and move directory methods to files.cs

* add migration test cases

* add directory.frompath and update nodemigrationtests

* resolve conflicts

* updated files

* Update layoutSpecs and loadedTypes for ColorRange nodes

* add nodes to loadedtype (#7806)

* update layoutspecs and loadedtypes

* Consolidate Excel nodes under Import/Export category (#7809)

* recategorize excel methods

* added migration and test case

* migration for all excel.write node

* move excel and csv methods to dsoffice

* remove unnecessary attribute

* add migration for DSCore.IO.File.ExportToCSV

* Implement custom resource handlers (#7817)

* add migration for csv.readfromfile

* remove csv.readfromfile icons

* Implement resource provider for runtime loadedTypes JSON data (#7826)

* Implement resource provider for runtime loadedTypes JSON data

* Add search keywords to LoadedTypes

* Remove empty keywords

* Tooltip implementation for library items (#7822)

* Tooltip implementation for library items

* Update librarie.min.js to include latest changes

* Update LayoutSpecs.json and js to support sections (#7833)

* Recategorize two GeometryColor nodes

* Add ImportExport.CAD nodes under library (#7832)

* Add ImportExport.CAD nodes under library

* Restore lost changes

* add test case for builtin migration (#7830)

* Wrap left-over builtins into DS class for categorization and autocomplete (#7819)

* wrap builtins into DS class for categorization and autocomplete

* code cleanup

* code cleanup

* address review comments

* addressed review comments

* add checks for only static FFI classes to be derived from DS class

* code cleanup

* code cleanup

* added migration, tests

* revert changes to loadedtypes json file

* updated layout spec json file

* add test cases for static class and fix some tests

* fixed prototest

* Re-recategorize ColorRange nodes (#7840)

* updated layoutSpecs.json (#7841)

* Refactor the code so the LibraryViewController.cs can be tested (#7834)

* Refactor the code so the LibraryViewController.cs can be tested
Move methods to seperate class EventController, so this class
can be used for mock testing.
Derived class object LibraryViewController
needs parameters which cannot be mocked.

* Add moq test for LibraryViewController

* To address the review comments from PR #7834
- Modify AssemblySharedInfo.cs to update CopyRight information of assmblies to 2017
- Remove constructor LibraryViewController()
- Revert changes  to Dynamo.All.sln realted to visual studio version
- Add AssemblySharedInfo.cs to ViewExtensionLibraryTests so the assembly version is set to
get the standard versioning

* Modify the output path in ViewExtensionLibraryTests.csproj to match the properties from props

* Add files related to commit -c03544f

* Revert changs to AssemblySharedInfo.cs
Modify AssemblySharedInfo.tt to update CopyRight information from 2016 to 2017

* Update librarie.js and other resources (#7842)

* Revise category icons for library

* add parameters for overloads

* removed redundant path

* merging new LibUI changes to Dynamo side

* Implement IconResourceProvider to get icons for library items (#7869)

* Implement IconResourceProvider to get icons for library items

* remove methods and fields that are not required

* Use category as read from customization xml

* address review comments

* Add unit tests for ResourceProviders (#7879)

* Add unit tests for RespurceProviders

* Rename ViewExtensionLibraryTests to LibraryResourceProviderTests

- Update json file
- Address review comments

* Ensure that CopyLocal=False for Dynamo binaries (#7881)

* Fix Icon resources for library items (#7880)

- Rename BuiltIns.ds to BuiltIn.ds so that the icons for nodes from
BuiltIn.ds could be resolved from BuiltIn.customization.dll

* Update librarie.js and integrate the new API

* Update library minimized javascript file to latest

* Fix for DYN-870, removed Keys section from Organize group (#7895)

* Remove unused LibraryViewExtension font resources (#7893)

* Add description (#7904)

* Prevent loading LibraryViewExtension in test mode to prevent NUnit crash (#7906)

* wrap builtins into DS class for categorization and autocomplete

* code cleanup

* code cleanup

* address review comments

* addressed review comments

* add checks for only static FFI classes to be derived from DS class

* code cleanup

* code cleanup

* added migration, tests

* revert changes to loadedtypes json file

* updated layout spec json file

* add test cases for static class and fix some tests

* fixed prototest

* disable library view extension in test mode

* update core UI test to run when test mode is set to true and LibraryViewExtension is loaded

* Integrate ImportLibrary UI (#7905)

* Make it possible to use an external search function

* Update library minimized javascript file to latest

* Fix the build error in one test module

* Disable right-click on LibraryView (#7913)

* DYN-862: Implement event notification for libraryDataUpdated (#7896)

* Implement event notification for libraryDataUpdated

* update documentation

* Event Observer

* More testc ases

* Don't use old results when throttle re-fires

* Address review comments

* Addressing review comments

* Add node icon for Label.ByPointAndString

* Addressing more review comments

* fix failing excel tests (#7932)

* Fixed failing tests on LibraryReorg branch  (#7939)

* fix failing excel tests

* fixed tests

* changed comments

* Implement IServiceManager interface (#7949)

* build fix, update csproj (#7950)

* Add List.Equals overload to List BuiltIn class (#7954)

* fix failing excel tests

* fixed tests

* changed comments

* added builtin overload for List.Equals

* Remove SearchView and LibrarySearchView WPF views and related tests (#7956)

* fix failing excel tests

* fixed tests

* changed comments

* added builtin overload for List.Equals

* remove SearchView and LibrarySearchView WPF views

* restore deleted comments

* Remove v0.0.1 from resource path (#7961)

* Fixed merge issues

* Create DynamoVisualProgramming.DynamoCoreNodes.nuspec

* Include assembly name in fully qualified name (#7971)

* Include assembly name in fully qualified name

* Create ZeroTouchSearchElement.cs

* LibraryViewCustomization Service implementation (#7963)

* LibraryViewCustomization Service implementation

* Address review comments

* Address more review comments

* Provides support for default icon when resource not found (#7975)

* Provides support for default icon when resource not found

* Include concurrency test

* Update librarie.js minified and resources (#8004)

* Update library resources and categorization (#8010)

* Update library resource and categorization

* Remove ImportExportTests as its already moved to DSOfficeTests

* update librarie.min.js

* Implement Resource registration and app shutdown notification mechanism (#8014)

* Implement Resource registration and app shutdown notification mechanism

* Update LibraryViewExtension.Dispose implementation

* Address review comments

* Update DSCoreNodes.Migrations.xml

removed unnecessary migration path for ExportCSV node
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