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

DUI-126 shared files #3550

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public async Task Receive(string modelCardId)
var receiveOperationResults = await unitOfWork.Service
.Execute(
modelCard.AccountId.NotNull(), // POC: I hear -you are saying why we're passing them separately. Not sure pass the DUI3-> Connectors.DUI project dependency to the SDK-> Connector.Utils
new Uri(modelCard.ServerUrl.NotNull()),
modelCard.ProjectId.NotNull(),
modelCard.ProjectName.NotNull(),
modelCard.ModelName.NotNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ public async Task Send(string modelCardId)

var sendInfo = new SendInfo(
modelCard.AccountId.NotNull(),
new Uri(modelCard.ServerUrl.NotNull()),
modelCard.ProjectId.NotNull(),
modelCard.ModelId.NotNull(),
"ArcGIS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
"Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Connectors.Utils": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )",
"Speckle.Core": "[3.0.1-alpha.15, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
}
},
Expand All @@ -399,7 +399,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"speckle.converters.arcgis3": {
Expand Down Expand Up @@ -456,8 +456,8 @@
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@
"Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Connectors.Utils": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )",
"Speckle.Core": "[3.0.1-alpha.15, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
}
},
Expand All @@ -452,7 +452,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"speckle.converters.autocad2023": {
Expand Down Expand Up @@ -512,8 +512,8 @@
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public async Task Receive(string modelCardId)
var operationResults = await unitOfWork.Service
.Execute(
modelCard.AccountId.NotNull(), // POC: I hear -you are saying why we're passing them separately. Not sure pass the DUI3-> Connectors.DUI project dependency to the SDK-> Connector.Utils
new Uri(modelCard.ServerUrl.NotNull()),
modelCard.ProjectId.NotNull(),
modelCard.ProjectName.NotNull(),
modelCard.ModelName.NotNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ private async Task SendInternal(string modelCardId)

var sendInfo = new SendInfo(
modelCard.AccountId.NotNull(),
new Uri(modelCard.ServerUrl.NotNull()),
modelCard.ProjectId.NotNull(),
modelCard.ModelId.NotNull(),
_autocadSettings.HostAppInfo.Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@
"Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Connectors.Utils": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )",
"Speckle.Core": "[3.0.1-alpha.15, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
}
},
Expand All @@ -455,7 +455,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"speckle.converters.autocad2024": {
Expand Down Expand Up @@ -521,8 +521,8 @@
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
"Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Connectors.Utils": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )",
"Speckle.Core": "[3.0.1-alpha.15, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
}
},
Expand All @@ -463,7 +463,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"speckle.converters.common": {
Expand Down Expand Up @@ -518,8 +518,8 @@
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public async Task Send(string modelCardId)

var sendInfo = new SendInfo(
modelCard.AccountId.NotNull(),
new Uri(modelCard.ServerUrl.NotNull()),
modelCard.ProjectId.NotNull(),
modelCard.ModelId.NotNull(),
_revitSettings.HostSlug.NotNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public async Task Receive(string modelCardId)
HostObjectBuilderResult conversionResults = await unitOfWork.Service
.Execute(
modelCard.AccountId.NotNull(), // POC: I hear -you are saying why we're passing them separately. Not sure pass the DUI3-> Connectors.DUI project dependency to the SDK-> Connector.Utils
new Uri(modelCard.ServerUrl.NotNull()),
modelCard.ProjectId.NotNull(),
modelCard.ProjectName.NotNull(),
modelCard.ModelName.NotNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Speckle.Connectors.DUI.Settings;
using Speckle.Connectors.Utils;
using Speckle.Connectors.Utils.Caching;
using Speckle.Core.Transports;

namespace Speckle.Connectors.Rhino7.Bindings;

Expand Down Expand Up @@ -165,6 +166,7 @@ public async Task Send(string modelCardId)

var sendInfo = new SendInfo(
modelCard.AccountId.NotNull(),
new Uri(modelCard.ServerUrl.NotNull()),
modelCard.ProjectId.NotNull(),
modelCard.ModelId.NotNull(),
_rhinoSettings.HostAppInfo.Name
Expand All @@ -187,6 +189,10 @@ public async Task Send(string modelCardId)
{
Commands.SetModelError(modelCardId, e);
}
catch (TransportException e)
{
Commands.SetModelError(modelCardId, e.InnerException);
}
catch (OperationCanceledException)
{
// SWALLOW -> UI handles it immediately, so we do not need to handle anything
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
"Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Connectors.Utils": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )",
"Speckle.Core": "[3.0.1-alpha.15, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
}
},
Expand All @@ -460,7 +460,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"speckle.converters.common": {
Expand Down Expand Up @@ -512,8 +512,8 @@
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down
16 changes: 8 additions & 8 deletions DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
"Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Connectors.Utils": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )",
"Speckle.Core": "[3.0.1-alpha.15, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
}
},
Expand All @@ -435,7 +435,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
Expand All @@ -461,8 +461,8 @@
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down Expand Up @@ -865,7 +865,7 @@
"Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Connectors.Utils": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )",
"Speckle.Core": "[3.0.1-alpha.15, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
}
},
Expand All @@ -874,7 +874,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
Expand All @@ -896,8 +896,8 @@
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down
9 changes: 9 additions & 0 deletions DUI3-DX/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ public class ModelCard : DiscriminatedObject
/// Project id. FKA stream id.
/// </summary>
public string? ProjectId { get; set; }

/// <summary>
/// Account id that model card created with it initially.
/// </summary>
public string? AccountId { get; set; }

/// <summary>
/// Server that model card created on it initially.
/// </summary>
public string? ServerUrl { get; set; }

public List<CardSetting>? Settings { get; set; }
}
8 changes: 4 additions & 4 deletions DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
},
"Speckle.Core": {
"type": "Direct",
"requested": "[3.0.1-alpha.14, )",
"resolved": "3.0.1-alpha.14",
"contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==",
"requested": "[3.0.1-alpha.15, )",
"resolved": "3.0.1-alpha.15",
"contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
Expand Down Expand Up @@ -538,7 +538,7 @@
"dependencies": {
"Serilog.Extensions.Logging": "[7.0.0, )",
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Core": "[3.0.1-alpha.14, )"
"Speckle.Core": "[3.0.1-alpha.15, )"
}
},
"Serilog.Extensions.Logging": {
Expand Down
20 changes: 10 additions & 10 deletions DUI3-DX/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0"/>
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="6.0.0" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.1823.32"/>
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.1823.32" />
<PackageVersion Include="Esri.ArcGISPro.Extensions30" Version="3.2.0.49743" />
<PackageVersion Include="Speckle.Civil3D.API" Version="2024.0.0" />
<PackageVersion Include="CefSharp.Wpf" Version="92.0.260"/>
<PackageVersion Include="Revit.Async" Version="2.0.1" />
<PackageVersion Include="Speckle.Core" Version="3.0.1-alpha.14" />
<PackageVersion Include="CefSharp.Wpf" Version="92.0.260" />
<PackageVersion Include="Revit.Async" Version="2.0.1" />
<PackageVersion Include="Speckle.Core" Version="3.0.1-alpha.15" />
<PackageVersion Include="Speckle.Objects" Version="3.0.1-alpha.14" />
<PackageVersion Include="Speckle.AutoCAD.API" Version="2023.0.0" />
<PackageVersion Include="Speckle.Revit.API" Version="2023.0.0" />
<PackageVersion Include="RhinoCommon" Version="7.13.21348.13001" />
<PackageVersion Include="RhinoWindows" Version="7.13.21348.13001" />
<PackageVersion Include="System.Resources.Extensions" Version="7.0.0"/>
<PackageVersion Include="RhinoCommon" Version="7.13.21348.13001" />
<PackageVersion Include="RhinoWindows" Version="7.13.21348.13001" />
<PackageVersion Include="System.Resources.Extensions" Version="7.0.0" />
<GlobalPackageReference Include="PolySharp" Version="1.14.1" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<GlobalPackageReference Include="Speckle.InterfaceGenerator" Version="0.9.5" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static void AddConnectorUtils(this SpeckleContainerBuilder builder)
// send operation and dependencies
builder.AddSingleton<CancellationManager>();
builder.AddScoped<ReceiveOperation>();
builder.AddScoped<AccountService>();

//TODO: Logger will likely be removed from Core, we'll plan to figure out the config later...
var serilogLogger = SpeckleLog.Logger;
Expand Down
27 changes: 27 additions & 0 deletions DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/AccountService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Speckle.Core.Credentials;

namespace Speckle.Connectors.Utils.Operations;

public class AccountService
{
/// <summary>
/// Account to retrieve with its id, if not exist try to retrieve from matching serverUrl.
/// </summary>
/// <param name="accountId">Id of the account.</param>
/// <param name="serverUrl">Server url to search matching account.</param>
/// <returns></returns>
/// <exception cref="SpeckleAccountManagerException"> Throws if server url doesn't match with any account.</exception>
public Account GetAccountWithServerUrlFallback(string accountId, Uri serverUrl)
{
try
{
return AccountManager.GetAccount(accountId);
}
catch (SpeckleAccountManagerException)
{
var accounts = AccountManager.GetAccounts(serverUrl);
return accounts.First()
?? throw new SpeckleAccountManagerException($"No any account found that matches with server {serverUrl}");
}
}
}
Loading
Loading