From 361b49fd7c13f91741a760d373598a7b379bad1e Mon Sep 17 00:00:00 2001 From: Michael Kirschner Date: Mon, 23 Oct 2023 16:22:56 -0400 Subject: [PATCH 1/4] Restsharp109 (#14503) passed here: https://master-5.jenkins.autodesk.com/job/Dynamo/job/DynamoSelfServe/job/pullRequestValidation/11526/ merging --- src/DynamoCore/DynamoCore.csproj | 14 +++++++------- src/DynamoCoreWpf/DynamoCoreWpf.csproj | 4 ++-- .../Search/NodeAutoCompleteSearchViewModel.cs | 18 ++++++------------ src/DynamoPackages/DynamoPackages.csproj | 6 +++--- src/DynamoPackages/PackageDirectoryBuilder.cs | 5 ++--- .../PackageDetailsViewExtension.csproj | 4 ++-- .../NodeDocumentationMarkdownGenerator.csproj | 4 ++-- test/DynamoCoreTests/DynamoCoreTests.csproj | 7 +++++-- .../DynamoCoreWpfTests.csproj | 7 +++++-- .../PackageManagerTests.csproj | 7 +++++-- 10 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/DynamoCore/DynamoCore.csproj b/src/DynamoCore/DynamoCore.csproj index 34640c5ef89..1566c3a7c08 100644 --- a/src/DynamoCore/DynamoCore.csproj +++ b/src/DynamoCore/DynamoCore.csproj @@ -1,4 +1,4 @@ - + @@ -27,11 +27,11 @@ + - - + @@ -122,10 +122,10 @@ - - - - + + + + diff --git a/src/DynamoCoreWpf/DynamoCoreWpf.csproj b/src/DynamoCoreWpf/DynamoCoreWpf.csproj index 3e1741d6465..b260e126a29 100644 --- a/src/DynamoCoreWpf/DynamoCoreWpf.csproj +++ b/src/DynamoCoreWpf/DynamoCoreWpf.csproj @@ -132,10 +132,10 @@ - + - + diff --git a/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs index b89fe9ef7d3..d73a098fb5d 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs @@ -432,25 +432,19 @@ private MLNodeAutoCompletionResponse GetMLNodeAutocompleteResults(string request MLNodeAutoCompletionResponse results = null; var authProvider = dynamoViewModel.Model.AuthenticationManager.AuthProvider; - if (authProvider is IOAuth2AuthProvider oauth2AuthProvider) + if (authProvider is IOAuth2AuthProvider oauth2AuthProvider && authProvider is IOAuth2AccessTokenProvider tokenprovider) { try { - // TODO: We need to implement something like GetToken() on the IOAuth2AuthProvider interface which will be used by all auth providers. - // For now, we are mocking the RestSharpRequest object to set the IDSDK token and then update the header in actual RestRequest with that token. - // LoginRequest() is also not available on RevitOAuth2Provider, so using the SignRequest() which will show the sign-in page when the user is logged out. - RestRequest restSharpRequest = new RestRequest(); - RestClient restSharpClient = new RestClient(); - oauth2AuthProvider.SignRequest(ref restSharpRequest, restSharpClient); - var uri = DynamoUtilities.PathHelper.getServiceBackendAddress(this, nodeAutocompleteMLEndpoint); var client = new RestClient(uri); - var request = new RestRequest(Method.POST); + var request = new RestRequest(string.Empty,Method.Post); - request.AddHeader("Authorization", restSharpRequest.Parameters.FirstOrDefault(n => n.Name.Equals("Authorization")).Value.ToString()); - request = request.AddJsonBody(requestJSON) as RestRequest; + request.AddHeader("Authorization",tokenprovider.GetAccessToken()); + request = request.AddJsonBody(requestJSON); request.RequestFormat = DataFormat.Json; - RestResponse response = client.Execute(request) as RestResponse; + RestResponse response = client.Execute(request); + //TODO maybe worth moving to system.text json in phases? results = JsonConvert.DeserializeObject(response.Content); } catch (Exception ex) diff --git a/src/DynamoPackages/DynamoPackages.csproj b/src/DynamoPackages/DynamoPackages.csproj index e50a6e87407..a51e55c5446 100644 --- a/src/DynamoPackages/DynamoPackages.csproj +++ b/src/DynamoPackages/DynamoPackages.csproj @@ -1,4 +1,4 @@ - + @@ -30,9 +30,9 @@ - + - + diff --git a/src/DynamoPackages/PackageDirectoryBuilder.cs b/src/DynamoPackages/PackageDirectoryBuilder.cs index e5d2b75f2b8..ed8ef09e683 100644 --- a/src/DynamoPackages/PackageDirectoryBuilder.cs +++ b/src/DynamoPackages/PackageDirectoryBuilder.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text.Json; using Dynamo.PackageManager.Interfaces; using Dynamo.Utilities; -using RestSharp.Serialization.Json; namespace Dynamo.PackageManager { @@ -127,8 +127,7 @@ private void WritePackageHeader(Package package, IDirectoryInfo rootDir) var pkgHeader = PackageUploadBuilder.NewRequestBody(package); // build the package header json, which will be stored with the pkg - var jsSer = new JsonSerializer(); - var pkgHeaderStr = jsSer.Serialize(pkgHeader); + var pkgHeaderStr = JsonSerializer.Serialize(pkgHeader); // write the pkg header to the root directory of the pkg var headerPath = Path.Combine(rootDir.FullName, PackageJsonName); diff --git a/src/PackageDetailsViewExtension/PackageDetailsViewExtension.csproj b/src/PackageDetailsViewExtension/PackageDetailsViewExtension.csproj index e0db6072434..e28629ad5f1 100644 --- a/src/PackageDetailsViewExtension/PackageDetailsViewExtension.csproj +++ b/src/PackageDetailsViewExtension/PackageDetailsViewExtension.csproj @@ -14,9 +14,9 @@ false - + - + diff --git a/src/Tools/NodeDocumentationMarkdownGenerator/NodeDocumentationMarkdownGenerator.csproj b/src/Tools/NodeDocumentationMarkdownGenerator/NodeDocumentationMarkdownGenerator.csproj index f44a75da413..9f040f147b8 100644 --- a/src/Tools/NodeDocumentationMarkdownGenerator/NodeDocumentationMarkdownGenerator.csproj +++ b/src/Tools/NodeDocumentationMarkdownGenerator/NodeDocumentationMarkdownGenerator.csproj @@ -12,12 +12,12 @@ + - - + diff --git a/test/DynamoCoreTests/DynamoCoreTests.csproj b/test/DynamoCoreTests/DynamoCoreTests.csproj index 02fe36efa41..219eed1e37c 100644 --- a/test/DynamoCoreTests/DynamoCoreTests.csproj +++ b/test/DynamoCoreTests/DynamoCoreTests.csproj @@ -31,7 +31,7 @@ - + all compile; build; native; contentfiles; analyzers; buildtransitive @@ -42,7 +42,10 @@ - + + all + compile; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj b/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj index 70c2f4dd8b1..beb3024c022 100644 --- a/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj +++ b/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj @@ -26,13 +26,16 @@ - + all compile; build; native; contentfiles; analyzers; buildtransitive - + + all + compile; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/Libraries/PackageManagerTests/PackageManagerTests.csproj b/test/Libraries/PackageManagerTests/PackageManagerTests.csproj index 2b2599ad402..6d9824b3af3 100644 --- a/test/Libraries/PackageManagerTests/PackageManagerTests.csproj +++ b/test/Libraries/PackageManagerTests/PackageManagerTests.csproj @@ -14,10 +14,13 @@ - + + all + compile; build; native; contentfiles; analyzers; buildtransitive + - + all compile; build; native; contentfiles; analyzers; buildtransitive From bdc6ba421665807ff2adb89e70edbe8677ff1bf6 Mon Sep 17 00:00:00 2001 From: jesusalvino <96534278+jesusalvino@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:34:43 -0500 Subject: [PATCH 2/4] Dyn-5473 workspace toolbar (#14483) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Dealing with the Workspace Tabs, Window Threshold and Toolbar buttons * Renaming method * Refactoring and adding comments * Dealing the NaN and adding comments * Set the whole width space to deal with the controls properly --------- Co-authored-by: Jesus Alfredo Alviño --- .../Controls/ShortcutToolbar.xaml | 11 ++- .../ViewModels/Core/DynamoViewModel.cs | 11 ++- .../ViewModels/Core/DynamoViewModelEvents.cs | 9 +++ .../Core/ShortcutToolbarViewModel.cs | 33 ++++++++ .../Views/Core/DynamoView.xaml.cs | 78 +++++++++++++++++++ .../ViewExtensions/ViewExtensionTests.cs | 1 + 6 files changed, 138 insertions(+), 5 deletions(-) diff --git a/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml b/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml index 991fbddf586..5cb110c3de7 100644 --- a/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml +++ b/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml @@ -137,15 +137,17 @@ + IsMainMenu="True" + Name="RightMenu"> -