Skip to content

Commit ed95878

Browse files
committed
➕ configurable server class added
1 parent 442c636 commit ed95878

File tree

8 files changed

+121
-21
lines changed

8 files changed

+121
-21
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ The jwl.config file is a simple JSON structure. It can be placed in (and will be
2323
- roaming application data (<code>%USERPROFILE%\AppData\Roaming</code>)
2424
- jwl's "installation" folder
2525

26+
### "ServerClass" setting
27+
28+
Available values are:
29+
- VanillaJira
30+
- TempoTimeSheetsPlugin
31+
- ICTimePlugin (not implemented yet)
32+
2633
As for the CLI worklogger binary, there are command-line options available as well. Any partial options supplied via CLI will override their respective jwl.config counterparts with the highest priority.
2734

2835
## The input CSV structure

jira-worklogger.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,7 @@ Global
8787
GlobalSection(SolutionProperties) = preSolution
8888
HideSolutionNode = FALSE
8989
EndGlobalSection
90+
GlobalSection(ExtensibilityGlobals) = postSolution
91+
SolutionGuid = {A21C6F0A-CD59-4195-97E5-2922C831398F}
92+
EndGlobalSection
9093
EndGlobal
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
{
2-
"UseVerboseFeedback": false,
3-
"JiraServer": {
4-
"MaxConnectionsPerServer": 4,
5-
"UseProxy": false,
6-
"SkipSslCertificateCheck": false
7-
},
8-
"CsvOptions": {
9-
"FieldDelimiter": ","
10-
}
11-
}
1+
{
2+
"UseVerboseFeedback": false,
3+
"JiraServer": {
4+
"ServerClass": "VanillaJira",
5+
"MaxConnectionsPerServer": 4,
6+
"UseProxy": false,
7+
"SkipSslCertificateCheck": false
8+
},
9+
"CsvOptions": {
10+
"FieldDelimiter": ","
11+
}
12+
}

jwl.core/jwl - Backup.core.csproj

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<OutputType>Library</OutputType>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<Product>...</Product>
8+
<Authors>Peter Hraško</Authors>
9+
<Company>Open source community</Company>
10+
<Copyright>Practically copyleft</Copyright>
11+
<NoWarn>1701;1702;AD0001;NETSDK1182</NoWarn>
12+
<RootNamespace>jwl.core</RootNamespace>
13+
<AssemblyName>jwl.core</AssemblyName>
14+
<PackageId>NoP77svk.jwl.core</PackageId>
15+
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
16+
</PropertyGroup>
17+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
18+
<DebugType>none</DebugType>
19+
<DebugSymbols>false</DebugSymbols>
20+
</PropertyGroup>
21+
<ItemGroup>
22+
<PackageReference Include="AutoMapper" Version="12.0.1" />
23+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
24+
<PrivateAssets>all</PrivateAssets>
25+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
26+
</PackageReference>
27+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
28+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
29+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
30+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
31+
<PackageReference Include="NoP77svk.Linq" Version="2023.3.1" />
32+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
33+
<PrivateAssets>all</PrivateAssets>
34+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
35+
</PackageReference>
36+
<Compile Include="..\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
37+
</ItemGroup>
38+
<ItemGroup>
39+
<ProjectReference Include="..\jwl.jira\jwl.jira.csproj" />
40+
<ProjectReference Include="..\jwl.inputs\jwl.inputs.csproj" />
41+
</ItemGroup>
42+
43+
<Target Name="PostClean" AfterTargets="Clean">
44+
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
45+
<!-- obj -->
46+
<RemoveDir Directories="$(BaseOutputPath)" />
47+
<!-- bin -->
48+
</Target>
49+
50+
<ItemGroup>
51+
<CommonAssetFiles Include="./_assets/**/*" CopyToOutputDirectory="PreserveNewest" />
52+
<CommonAssetFiles Include="../_assets/**/*" CopyToOutputDirectory="PreserveNewest" />
53+
<CommonAssetFiles Include="../*.md" CopyToOutputDirectory="PreserveNewest" />
54+
</ItemGroup>
55+
56+
<ItemGroup>
57+
<None Update="_assets\jwl.config">
58+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
59+
</None>
60+
</ItemGroup>
61+
62+
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
63+
<Copy SourceFiles="@(CommonAssetFiles)" DestinationFolder="$(OutDir)/%(RecursiveDir)" SkipUnchangedFiles="true" />
64+
</Target>
65+
66+
<Target Name="CopyCustomContentOnPublish" AfterTargets="Publish">
67+
<Copy SourceFiles="@(CommonAssetFiles)" DestinationFolder="$(PublishDir)/%(RecursiveDir)" SkipUnchangedFiles="true" />
68+
</Target>
69+
</Project>

jwl.core/jwl.core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
</Target>
4949

5050
<ItemGroup>
51+
<CommonAssetFiles Include="./_assets/**/*" CopyToOutputDirectory="PreserveNewest" />
5152
<CommonAssetFiles Include="../_assets/**/*" CopyToOutputDirectory="PreserveNewest" />
5253
<CommonAssetFiles Include="../*.md" CopyToOutputDirectory="PreserveNewest" />
5354
</ItemGroup>

jwl.jira/JiraServerClass.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace jwl.jira;
2+
3+
public enum JiraServerClass
4+
{
5+
VanillaJira = 0,
6+
TempoTimeSheetsPlugin = 1,
7+
ICTimePlugin = 2
8+
}

jwl.jira/ServerApiFactory.cs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,29 @@
22

33
public static class ServerApiFactory
44
{
5-
public enum ServerClass
6-
{
7-
VanillaJira = 0,
8-
TempoTimeSheetsPlugin = 1,
9-
ICTimePlugin = 2
10-
}
11-
12-
public static IJiraServerApi CreateApi(HttpClient httpClient, string userName, ServerClass serverClass)
5+
public static IJiraServerApi CreateApi(HttpClient httpClient, string userName, JiraServerClass serverClass)
136
{
147
return serverClass switch
158
{
16-
ServerClass.VanillaJira => new VanillaJiraServerApi(httpClient, userName),
17-
ServerClass.TempoTimeSheetsPlugin => new JiraWithTempoPluginApi(httpClient, userName),
9+
JiraServerClass.VanillaJira => new VanillaJiraServerApi(httpClient, userName),
10+
JiraServerClass.TempoTimeSheetsPlugin => new JiraWithTempoPluginApi(httpClient, userName),
1811
_ => throw new NotImplementedException($"Jira server class {nameof(serverClass)} not yet implemented")
1912
};
2013
}
14+
15+
public static JiraServerClass? DecodeServerClass(string? serverClass)
16+
{
17+
JiraServerClass? result;
18+
19+
if (string.IsNullOrEmpty(serverClass))
20+
result = null;
21+
else if (int.TryParse(serverClass, out int serverClassIntId))
22+
result = (JiraServerClass)serverClassIntId;
23+
else if (Enum.TryParse(serverClass, true, out JiraServerClass serverClassEnumId))
24+
result = serverClassEnumId;
25+
else
26+
throw new ArgumentOutOfRangeException(nameof(serverClass), serverClass, "Invalid server class configured");
27+
28+
return result;
29+
}
2130
}

jwl.jira/ServerConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ namespace jwl.jira;
33

44
public class ServerConfig
55
{
6+
public string? ServerClass { get; init; }
7+
public JiraServerClass ServerClassId => ServerApiFactory.DecodeServerClass(ServerClass) ?? JiraServerClass.VanillaJira;
68
public string? BaseUrl { get; init; }
79
public bool? UseProxy { get; init; }
810
public int? MaxConnectionsPerServer { get; init; }

0 commit comments

Comments
 (0)