Skip to content

Commit

Permalink
add ui project
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Oct 14, 2024
1 parent 7a3c176 commit beb7dcb
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 3 deletions.
10 changes: 10 additions & 0 deletions HICPlugin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Common", "RDMP\Tests.
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "InterfaceToJira", "InterfaceToJira\InterfaceToJira.shproj", "{63CD3E00-4745-481C-B31E-E432B7812BE9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiraPlugin.UI", "JiraPlugin.UI\JiraPlugin.UI.csproj", "{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -158,6 +160,14 @@ Global
{CB282875-B9CE-4E31-8B52-0356855501E9}.Release|Any CPU.Build.0 = Release|Any CPU
{CB282875-B9CE-4E31-8B52-0356855501E9}.Release|x86.ActiveCfg = Release|Any CPU
{CB282875-B9CE-4E31-8B52-0356855501E9}.Release|x86.Build.0 = Release|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Debug|x86.ActiveCfg = Debug|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Debug|x86.Build.0 = Debug|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Release|Any CPU.Build.0 = Release|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Release|x86.ActiveCfg = Release|Any CPU
{C7EE8C32-5FF1-4D6E-85CC-03BBC5BF501B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 1 addition & 3 deletions InterfaceToJira/RestApiClient2/JiraClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ public JiraClient(JiraAccount account)
{
Authenticator = new HttpBasicAuthenticator(account.User, account.Password)
});
var x = new JiraAPIClient(account);
var y = x.GetAllProjectAssets();//.ForEach(project => { })
throw new Exception(y.ToString());
//var x = new JiraAPIClient(account);
}

private static string ToCommaSeparatedString(IEnumerable<string> strings) => strings != null ? string.Join(",", strings) : string.Empty;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using InterfaceToJira.RestApiClient2.JiraModel;
using JiraPlugin.UI.JiraUI;
using Rdmp.Core.CommandExecution;
using Rdmp.Core.CommandExecution.AtomicCommands;
using Rdmp.Core.DataExport.Data;
using Rdmp.UI.ExtractionUIs.JoinsAndLookups;
using Rdmp.UI.ItemActivation;
namespace JiraPlugin.UI.CommandExecution.AtomicCommands;

public class ExecuteCommandLinkProjectToJiraAsset: BasicCommandExecution, IAtomicCommand
{
private IActivateItems _activator;
private Project _project;
public ExecuteCommandLinkProjectToJiraAsset(IBasicActivateItems activator, Project project) {
_activator = activator as IActivateItems;
_project = project;
}

public override void Execute()
{
base.Execute();
_activator.Activate<LinkProjectToJiraAssetUI, Project>(_project);
}
}
27 changes: 27 additions & 0 deletions JiraPlugin.UI/CommandExecution/JiraPluginMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using JiraPlugin.UI.CommandExecution.AtomicCommands;
using Rdmp.Core;
using Rdmp.Core.CommandExecution;
using Rdmp.Core.CommandExecution.AtomicCommands;
using Rdmp.Core.DataExport.Data;

namespace JiraPlugin.UI.CommandExecution;

public class JiraPluginMenu : PluginUserInterface
{
readonly IBasicActivateItems _activator;

public JiraPluginMenu(IBasicActivateItems itemActivator) : base(itemActivator)
{
_activator = itemActivator;
}

public override IEnumerable<IAtomicCommand> GetAdditionalRightClickMenuItems(object o)
{
if (_activator != null && o is Project)
{
return new[] { new ExecuteCommandLinkProjectToJiraAsset(_activator,(Project)o) };
}

return base.GetAdditionalRightClickMenuItems(o);
}
}
19 changes: 19 additions & 0 deletions JiraPlugin.UI/JiraPlugin.UI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JiraPlugin\JiraPlugin.csproj" />
<ProjectReference Include="..\RDMP\Rdmp.Core\Rdmp.Core.csproj" />
<ProjectReference Include="..\RDMP\Rdmp.UI\Rdmp.UI.csproj" />
</ItemGroup>

</Project>
111 changes: 111 additions & 0 deletions JiraPlugin.UI/JiraUI/LinkProjectToJiraAssetUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions JiraPlugin.UI/JiraUI/LinkProjectToJiraAssetUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using Rdmp.UI.TestsAndSetup.ServicePropogation;
using Rdmp.UI;
using System.ComponentModel;
using Rdmp.Core.DataExport.Data;
using Rdmp.Core.Curation.Data;
using Rdmp.UI.ItemActivation;
using InterfaceToJira.RestApiClient2;
using HIC.Common.InterfaceToJira.JIRA.RestApiClient2;
using HIC.Common.InterfaceToJira;

namespace JiraPlugin.UI.JiraUI;

public partial class LinkProjectToJiraAssetUI : LinkProjectToJiraAssetUI_Design
{
private Project _project;
private TicketingSystemConfiguration _ticketingSystemConfiguration;
private JiraAPIClient _client;
public LinkProjectToJiraAssetUI()
{
InitializeComponent();
}

public override void SetDatabaseObject(IActivateItems activator, Project databaseObject)
{
_project = databaseObject;
var jiraAccounts = activator.RepositoryLocator.CatalogueRepository.GetAllObjectsWhere<TicketingSystemConfiguration>("Type", "JiraPlugin.JIRATicketingSystem");
if (!jiraAccounts.Any())
{
//error out
lblError.Text = "No Jira Ticketing systems found. Please create one before attempting to link to Jira assets.";
lblError.Visible = true;
return;
}
cbJiraConfiguration.Items.Clear();
cbJiraConfiguration.Items.AddRange(jiraAccounts);
cbJiraConfiguration.Enabled = true;

}

public override string GetTabName() => $"Link Project to Jira Asset";

private void cbJiraConfiguration_SelectedIndexChanged(object sender, EventArgs e)
{
_ticketingSystemConfiguration = (TicketingSystemConfiguration)cbJiraConfiguration.Items[cbJiraConfiguration.SelectedIndex];
//var jiraAccount = new JiraAccount(new HIC.Common.InterfaceToJira.JiraApiConfiguration()
//{
// ServerUrl = _ticketingSystemConfiguration.Url,
// User = _ticketingSystemConfiguration.DataAccessCredentials.Username,
// Password = _ticketingSystemConfiguration.DataAccessCredentials.GetDecryptedPassword(),
//});
//_client = new JiraAPIClient(jiraAccount);
_client ??= new JiraAPIClient(new JiraAccount(new JiraApiConfiguration
{
ServerUrl = _ticketingSystemConfiguration.Url,
User = _ticketingSystemConfiguration.DataAccessCredentials.Username,
Password = _ticketingSystemConfiguration.DataAccessCredentials.GetDecryptedPassword(),
ApiUrl = _ticketingSystemConfiguration.Url
}));
var projects = _client.GetAllProjectAssets();
cbAssets.Items.Clear();
cbAssets.Items.Add(projects);
cbAssets.Enabled = true;
}
}


//[TypeDescriptionProvider(typeof(AbstractControlDescriptionProvider<LinkProjectToJiraAssetUI_Design, UserControl>))]
//public abstract class LinkProjectToJiraAssetUI_Design : RDMPSingleDatabaseObjectControl<Project>
//{
//}
Loading

0 comments on commit beb7dcb

Please sign in to comment.