Skip to content

Commit

Permalink
Revert "6893: DYN-6956 symbol nodes should not show in HomeWorkspace …
Browse files Browse the repository at this point in the history
…context." (#15214)
  • Loading branch information
mjkkirschner authored May 14, 2024
1 parent e32ec31 commit a3b1e1e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ class LoadedTypeItem
public string itemType { get; set; }
public string description { get; set; }
public string keywords { get; set; }
/// <summary>
/// controls if a type is shown in the library in the homeworkspace context.
/// </summary>
public bool hiddenInWorkspaceContext { get; set; }
}

class LoadedTypeData<T> where T : LoadedTypeItem
Expand All @@ -45,9 +41,6 @@ class NodeItemDataProvider : ResourceProviderBase
{
protected NodeSearchModel model;
private IconResourceProvider iconProvider;
readonly string[] typesToHideInHomeWorkspaces = {
typeof(Graph.Nodes.CustomNodes.Symbol).ToString(),
typeof(Graph.Nodes.CustomNodes.Output).ToString() };
/// <summary>
/// Constructor
/// </summary>
Expand Down Expand Up @@ -176,12 +169,8 @@ public static string GetFullyQualifiedName(NodeSearchElement element)
description = element.Description,
keywords = element.SearchKeywords.Any()
? element.SearchKeywords.Where(s => !string.IsNullOrEmpty(s)).Aggregate((x, y) => string.Format("{0}, {1}", x, y))
: string.Empty,
: string.Empty
};
if (typesToHideInHomeWorkspaces.Contains(element.CreationName))
{
item.hiddenInWorkspaceContext = true;
}

//If this element is not a custom node then we are done. The icon url for custom node is different
if (!element.ElementType.HasFlag(ElementTypes.CustomNode)) return item;
Expand Down
8 changes: 0 additions & 8 deletions src/LibraryViewExtensionWebView2/LibraryViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -753,13 +753,5 @@ public static async Task<string> ExecuteScriptFunctionAsync(WebView2 webView2, s
script += ");";
return await webView2.ExecuteScriptAsync(script);
}
/// <summary>
/// Gives the library UI information on Dynamo's current context.
/// </summary>
/// <param name="type"></param>
internal void UpdateContext(string type)
{
ExecuteScriptFunctionAsync(browser,"libController.setHostContext", type);
}
}
}
18 changes: 2 additions & 16 deletions src/LibraryViewExtensionWebView2/ViewExtension.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Windows;
using Dynamo.Graph.Workspaces;
using Dynamo.Models;
using Dynamo.ViewModels;
using Dynamo.Wpf.Extensions;
Expand Down Expand Up @@ -38,17 +37,7 @@ public void Loaded(ViewLoadedParams viewLoadedParams)
controller = new LibraryViewController(viewLoadedParams.DynamoWindow, viewLoadedParams.CommandExecutive, customization);
(viewLoadedParams.DynamoWindow.DataContext as DynamoViewModel).PropertyChanged += handleDynamoViewPropertyChanges;
}
viewParams.CurrentWorkspaceChanged += ViewParams_CurrentWorkspaceChanged;
}

private void ViewParams_CurrentWorkspaceChanged(IWorkspaceModel workspace)
{
var type = workspace switch
{
HomeWorkspaceModel _ => "home",
CustomNodeWorkspaceModel _ => "custom"
};
controller.UpdateContext(type);

}

//hide browser directly when startpage is shown to deal with air space problem.
Expand Down Expand Up @@ -89,10 +78,7 @@ protected void Dispose(bool disposing)
{
(viewParams.DynamoWindow.DataContext as DynamoViewModel).PropertyChanged -= handleDynamoViewPropertyChanges;
}
if (viewParams != null)
{
viewParams.CurrentWorkspaceChanged -= ViewParams_CurrentWorkspaceChanged;
}


customization = null;
controller = null;
Expand Down
4 changes: 2 additions & 2 deletions src/LibraryViewExtensionWebView2/web/library/librarie.min.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions src/LibraryViewExtensionWebView2/web/library/library.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@
}, replaceImageDelayTime);
}


function refreshLibraryView(libraryController) {
window.chrome.webview.postMessage("RefreshLibrary");
}
Expand All @@ -195,9 +194,6 @@

refreshLibraryView(libController);

//initial state
libController.setHostContext("home")

var searchCallback = null;
function completeSearch(searchLoadedTypes){
searchCallback(JSON.parse(searchLoadedTypes));
Expand Down

0 comments on commit a3b1e1e

Please sign in to comment.