From 03d4521cc1b4bb1b3f672af20bd8e45bb15deae7 Mon Sep 17 00:00:00 2001 From: viogroza Date: Thu, 12 Dec 2024 12:01:34 +0200 Subject: [PATCH] Credentials: Type cache (24.12) [STUD-72720] Switch from Net5 to Net6 Add view models project Add view models and resources Update pipeline to build for Net6 Fix package id --- Activities/Activities.Credentials.sln | 10 +- .../Helpers/LocalResourceHelper.cs | 50 +++ .../Resources/ActivitiesMetadataWindows.json | 309 ++++++++++++++++++ .../Resources/Icons/CredentialsIcon.svg | 5 + ...h.Credentials.Activities.ViewModels.csproj | 37 +++ .../ViewModels/AddCredentialViewModel.cs | 35 ++ .../ViewModels/DeleteCredentialViewModel.cs | 24 ++ .../GetSecureCredentialViewModel.cs | 34 ++ .../ViewModels/RequestCredentialViewModel.cs | 33 ++ .../UiPath.Credentials.Activities.csproj | 6 +- .../UiPath.Credentials.Packages.csproj | 16 +- .../UiPath.Credentials.Tests.csproj | 4 +- Activities/Credentials/azure-pipelines.yml | 2 +- 13 files changed, 555 insertions(+), 10 deletions(-) create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Helpers/LocalResourceHelper.cs create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/Icons/CredentialsIcon.svg create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/UiPath.Credentials.Activities.ViewModels.csproj create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/AddCredentialViewModel.cs create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/DeleteCredentialViewModel.cs create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/GetSecureCredentialViewModel.cs create mode 100644 Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/RequestCredentialViewModel.cs diff --git a/Activities/Activities.Credentials.sln b/Activities/Activities.Credentials.sln index c84832a16..2abd54d88 100644 --- a/Activities/Activities.Credentials.sln +++ b/Activities/Activities.Credentials.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30621.155 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 d17.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UiPath.Credentials.Activities", "Credentials\UiPath.Credentials.Activities\UiPath.Credentials.Activities.csproj", "{ACB02213-A7C2-4BCA-ACE2-2BFAD6E0E54C}" EndProject @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Directory.build.targets = Directory.build.targets EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UiPath.Credentials.Activities.ViewModels", "Credentials\UiPath.Credentials.Activities.ViewModels\UiPath.Credentials.Activities.ViewModels.csproj", "{5BCCCFFB-D362-41DD-A59E-743447C7F66E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {0F10B8B3-0C6E-4CB7-ADA5-C0429D654974}.Debug|Any CPU.Build.0 = Debug|Any CPU {0F10B8B3-0C6E-4CB7-ADA5-C0429D654974}.Release|Any CPU.ActiveCfg = Release|Any CPU {0F10B8B3-0C6E-4CB7-ADA5-C0429D654974}.Release|Any CPU.Build.0 = Release|Any CPU + {5BCCCFFB-D362-41DD-A59E-743447C7F66E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BCCCFFB-D362-41DD-A59E-743447C7F66E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BCCCFFB-D362-41DD-A59E-743447C7F66E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BCCCFFB-D362-41DD-A59E-743447C7F66E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Helpers/LocalResourceHelper.cs b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Helpers/LocalResourceHelper.cs new file mode 100644 index 000000000..36d0947b9 --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Helpers/LocalResourceHelper.cs @@ -0,0 +1,50 @@ +using System.Activities.DesignViewModels; +using System.Activities; + +namespace UiPath.Activities.Credentials.ViewModels.Helpers +{ + //We need to reference System.Activities in order for the view models to work + internal static class LocalResourceHelper + { + public static object GetNormalizedLocalPath(string updatedPropertyName, string targetPropertyName, object value) + { + if (targetPropertyName.Equals(updatedPropertyName)) + { + var argument = value as InArgument; + return argument?.GetNormalizedPath(); + } + return value; + } + + public static InArgument GetNormalizedPath(this InArgument argument) + { + if (argument == null || argument.Expression == null || !argument.Expression.IsLiteral()) + { + return argument; + } + + string path = argument.Expression.ToString(); + return path.GetNormalizedPathInternal(); + } + + public static InArgument GetNormalizedPath(this DesignInArgument argument) + { + if (!argument.TryGetLiteralValue(out var value)) + { + return argument.Value; + } + + string path = (string)value; + return path.GetNormalizedPathInternal(); + } + + private static InArgument GetNormalizedPathInternal(this string path) + { + if (!string.IsNullOrWhiteSpace(path)) + { + path = path.Replace('\\', '/').Replace("//", "/"); + } + return path; + } + } +} diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json new file mode 100644 index 000000000..fe0649f10 --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json @@ -0,0 +1,309 @@ +{ + "activities": [ + { + "fullName": "UiPath.Credentials.Activities.AddCredential", + "shortName": "AddCredential", + "displayNameKey": "Activity_AddCredential_Property_AddCredentialDisplayName_Name", + "descriptionKey": "Activity_AddCredential_Property_AddCredentialDescription_Description", + "displayNameAliasKeys": [ + ], + "iconKey": "CredentialsIcon.svg", + "viewModelType": "UiPath.Activities.Credentials.ViewModels.AddCredentialViewModel", + "codedWorkflowSupport": false, + "properties": [ + { + "name": "Target", + "displayNameKey": "TargetDisplayName", + "tooltipKey": "TargetDescription", + "isRequired": true, + "isVisible": true, + "isPrincipal": true, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "Username", + "displayNameKey": "UsernameDisplayName", + "tooltipKey": "UsernameDescription", + "isRequired": true, + "isVisible": true, + "isPrincipal": true, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "CredentialType", + "displayNameKey": "Activity_AddCredential_Property_CredentialType_Name", + "tooltipKey": "Activity_AddCredential_Property_CredentialType_Description", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "Password", + "displayNameKey": "PasswordDisplayName", + "tooltipKey": "PasswordDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "PersistanceType", + "displayNameKey": "PersistanceTypeDisplayName", + "tooltipKey": "PersistanceTypeDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "PasswordSecureString", + "displayNameKey": "PasswordSecureStringDisplayName", + "tooltipKey": "PasswordSecureStringDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "Result", + "displayNameKey": "Result", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + } + ] + }, + { + "fullName": "UiPath.Credentials.Activities.DeleteCredential", + "shortName": "AddCredential", + "displayNameKey": "Activity_DeleteCredential_Property_DeleteCredentialDisplayName_Name", + "descriptionKey": "Activity_DeleteCredential_Property_DeleteCredentialDescription_Description", + "displayNameAliasKeys": [ + ], + "iconKey": "CredentialsIcon.svg", + "viewModelType": "UiPath.Activities.Credentials.ViewModels.DeleteCredentialViewModel", + "codedWorkflowSupport": false, + "properties": [ + { + "name": "Target", + "displayNameKey": "TargetDisplayName", + "tooltipKey": "TargetDescription", + "isRequired": true, + "isVisible": true, + "isPrincipal": true, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "Result", + "displayNameKey": "Result", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + } + ] + }, + { + "fullName": "UiPath.Credentials.Activities.GetSecureCredential", + "shortName": "AddCredential", + "displayNameKey": "Activity_GetSecureCredential_Property_GetSecureCredentialDisplayName_Name", + "descriptionKey": "Activity_GetSecureCredential_Property_GetSecureCredentialDescription_Description", + "displayNameAliasKeys": [ + ], + "iconKey": "CredentialsIcon.svg", + "viewModelType": "UiPath.Activities.Credentials.ViewModels.GetSecureCredentialViewModel", + "codedWorkflowSupport": false, + "properties": [ + { + "name": "Target", + "displayNameKey": "TargetDisplayName", + "tooltipKey": "TargetDescription", + "isRequired": true, + "isVisible": true, + "isPrincipal": true, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "CredentialType", + "displayNameKey": "Activity_AddCredential_Property_CredentialType_Name", + "tooltipKey": "Activity_AddCredential_Property_CredentialType_Description", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "PersistanceType", + "displayNameKey": "PersistanceTypeDisplayName", + "tooltipKey": "PersistanceTypeDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "Password", + "displayNameKey": "PasswordDisplayName", + "tooltipKey": "PasswordDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Outpu", + "displayNameKey": "Output" + } + }, + { + "name": "Result", + "displayNameKey": "Result", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + }, + { + "name": "Username", + "displayNameKey": "UsernameDisplayName", + "tooltipKey": "UsernameDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + } + ] + }, + { + "fullName": "UiPath.Credentials.Activities.RequestCredential", + "shortName": "AddCredential", + "displayNameKey": "Activity_RequestCredential_Property_RequestCredentialDisplayName_Name", + "descriptionKey": "Activity_RequestCredential_Property_RequestCredentialDescription_Description", + "displayNameAliasKeys": [ + ], + "iconKey": "CredentialsIcon.svg", + "viewModelType": "UiPath.Activities.Credentials.ViewModels.RequestCredentialViewModel", + "codedWorkflowSupport": false, + "properties": [ + { + "name": "Message", + "displayNameKey": "MessageDisplayName", + "tooltipKey": "MessageDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "Title", + "displayNameKey": "TitleDisplayName", + "tooltipKey": "TitleDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Input", + "displayNameKey": "Input" + } + }, + { + "name": "Password", + "displayNameKey": "PasswordDisplayName", + "tooltipKey": "PasswordDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + }, + { + "name": "Result", + "displayNameKey": "Result", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + }, + { + "name": "PasswordSecureString", + "displayNameKey": "PasswordSecureStringDisplayName", + "tooltipKey": "PasswordSecureStringDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + }, + { + "name": "Username", + "displayNameKey": "UsernameDisplayName", + "tooltipKey": "UsernameDescription", + "isRequired": false, + "isVisible": true, + "isPrincipal": false, + "category": { + "name": "Output", + "displayNameKey": "Output" + } + } + ] + } + ], + "defaultActivityNameBackgroundColor": "#00489D", + "defaultActivityColor": "#00489D", + "defaultActivityIconKey": "CredentialsIcon.svg", + "assemblyIconKey": "CredentialsIcon.svg", + "resourceManagerName": "UiPath.Credentials.Activities.Properties.UiPath.Credentials.Activities" +} diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/Icons/CredentialsIcon.svg b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/Icons/CredentialsIcon.svg new file mode 100644 index 000000000..ce429fa20 --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/Resources/Icons/CredentialsIcon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/UiPath.Credentials.Activities.ViewModels.csproj b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/UiPath.Credentials.Activities.ViewModels.csproj new file mode 100644 index 000000000..84bed7642 --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/UiPath.Credentials.Activities.ViewModels.csproj @@ -0,0 +1,37 @@ + + + + + net6.0;net6.0-windows + $(ProjectDir)..\..\Output\Activities\Credentials\ + VIEW_MODELS + UiPath.Credentials.Activities.ViewModels + UiPath.Activities.Credentials.ViewModels + + + + + + + + + + + + + + + + + + + + All + + + + + + + + diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/AddCredentialViewModel.cs b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/AddCredentialViewModel.cs new file mode 100644 index 000000000..af3fa82f6 --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/AddCredentialViewModel.cs @@ -0,0 +1,35 @@ +using CredentialManagement; +using System.Activities.DesignViewModels; +using System.Diagnostics.CodeAnalysis; +using System.Security; + +namespace UiPath.Activities.Credentials.ViewModels +{ + [ExcludeFromCodeCoverage] + internal class AddCredentialViewModel : DesignPropertiesViewModel + { + public DesignInArgument Target { get; set; } + public DesignInArgument Username { get; set; } + + public DesignProperty CredentialType { get; set; } + + public DesignInArgument Password { get; set; } + + public DesignProperty PersistanceType { get; set; } + + public DesignInArgument PasswordSecureString { get; set; } + + public DesignOutArgument Result { get; set; } + + public AddCredentialViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + PersistValuesChangedDuringInit(); + base.InitializeModel(); + } + } +} + diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/DeleteCredentialViewModel.cs b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/DeleteCredentialViewModel.cs new file mode 100644 index 000000000..27f20480d --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/DeleteCredentialViewModel.cs @@ -0,0 +1,24 @@ +using System.Activities.DesignViewModels; +using System.Diagnostics.CodeAnalysis; + +namespace UiPath.Activities.Credentials.ViewModels +{ + [ExcludeFromCodeCoverage] + internal class DeleteCredentialViewModel : DesignPropertiesViewModel + { + public DesignInArgument Target { get; set; } + + public DesignOutArgument Result { get; set; } + + public DeleteCredentialViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + PersistValuesChangedDuringInit(); + base.InitializeModel(); + } + } +} + diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/GetSecureCredentialViewModel.cs b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/GetSecureCredentialViewModel.cs new file mode 100644 index 000000000..241a56982 --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/GetSecureCredentialViewModel.cs @@ -0,0 +1,34 @@ +using CredentialManagement; +using System.Activities.DesignViewModels; +using System.Diagnostics.CodeAnalysis; +using System.Security; + +namespace UiPath.Activities.Credentials.ViewModels +{ + [ExcludeFromCodeCoverage] + internal class GetSecureCredentialViewModel : DesignPropertiesViewModel + { + public DesignInArgument Target { get; set; } + + public DesignProperty CredentialType { get; set; } + + public DesignProperty PersistanceType { get; set; } + + public DesignOutArgument Password { get; set; } + + public DesignOutArgument Result { get; set; } + + public DesignOutArgument Username { get; set; } + + public GetSecureCredentialViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + PersistValuesChangedDuringInit(); + base.InitializeModel(); + } + } +} + diff --git a/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/RequestCredentialViewModel.cs b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/RequestCredentialViewModel.cs new file mode 100644 index 000000000..679e486d1 --- /dev/null +++ b/Activities/Credentials/UiPath.Credentials.Activities.ViewModels/ViewModels/RequestCredentialViewModel.cs @@ -0,0 +1,33 @@ +using System.Activities.DesignViewModels; +using System.Diagnostics.CodeAnalysis; +using System.Security; + +namespace UiPath.Activities.Credentials.ViewModels +{ + [ExcludeFromCodeCoverage] + internal class RequestCredentialViewModel : DesignPropertiesViewModel + { + public DesignInArgument Message { get; set; } + + public DesignInArgument Title { get; set; } + + public DesignOutArgument Password { get; set; } + + public DesignOutArgument Result { get; set; } + + public DesignOutArgument PasswordSecureString { get; set; } + + public DesignOutArgument Username { get; set; } + + public RequestCredentialViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + PersistValuesChangedDuringInit(); + base.InitializeModel(); + } + } +} + diff --git a/Activities/Credentials/UiPath.Credentials.Activities/UiPath.Credentials.Activities.csproj b/Activities/Credentials/UiPath.Credentials.Activities/UiPath.Credentials.Activities.csproj index a85419466..16cf3ad17 100644 --- a/Activities/Credentials/UiPath.Credentials.Activities/UiPath.Credentials.Activities.csproj +++ b/Activities/Credentials/UiPath.Credentials.Activities/UiPath.Credentials.Activities.csproj @@ -3,10 +3,12 @@ - net461;net5.0-windows + net461;net6.0-windows ..\..\Output\Activities\Credentials\ false true + UiPath.Credentials.Activities.Implementation + false @@ -29,7 +31,7 @@ - + diff --git a/Activities/Credentials/UiPath.Credentials.Packages/UiPath.Credentials.Packages.csproj b/Activities/Credentials/UiPath.Credentials.Packages/UiPath.Credentials.Packages.csproj index 6b132e06b..33f87c60a 100644 --- a/Activities/Credentials/UiPath.Credentials.Packages/UiPath.Credentials.Packages.csproj +++ b/Activities/Credentials/UiPath.Credentials.Packages/UiPath.Credentials.Packages.csproj @@ -1,7 +1,7 @@  - net461;net5.0-windows + net461;net6.0-windows $(ProjectDir)..\..\Output\Activities\Credentials\ @@ -43,21 +43,31 @@ + + + + - + - + All + + + All + + + diff --git a/Activities/Credentials/UiPath.Credentials.Tests/UiPath.Credentials.Tests.csproj b/Activities/Credentials/UiPath.Credentials.Tests/UiPath.Credentials.Tests.csproj index e16046cd0..025ee4995 100644 --- a/Activities/Credentials/UiPath.Credentials.Tests/UiPath.Credentials.Tests.csproj +++ b/Activities/Credentials/UiPath.Credentials.Tests/UiPath.Credentials.Tests.csproj @@ -3,13 +3,13 @@ Any CPU {D8B0D0D4-494A-4F82-9C73-D2E99F4228AB} - net461;net5.0-windows + net461;net6.0-windows UiPath.Credentials.Tests UiPath.Credentials.Tests ..\..\OutputTests\Credentials\ - + diff --git a/Activities/Credentials/azure-pipelines.yml b/Activities/Credentials/azure-pipelines.yml index 1b37d6109..ed94d41d8 100644 --- a/Activities/Credentials/azure-pipelines.yml +++ b/Activities/Credentials/azure-pipelines.yml @@ -46,7 +46,7 @@ stages: buildPoolName: 'activities-build' testPoolName: 'activities-build' sonarKeyPrefix: 'CommunityActivities' - sdkBuild: true + sdkBuild: false enableCDStages: false hasQaPackages: false