generated from SwissLife-OSS/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Philippe Birbaum
committed
May 8, 2021
1 parent
5122320
commit c191904
Showing
22 changed files
with
492 additions
and
213 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/Tool/src/Boost.Abstractions/Navigation/IAppNavigationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Boost.Navigation | ||
{ | ||
public interface IAppNavigationService | ||
{ | ||
AppNavigation GetNavigation(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Tool/src/Boost.Abstractions/Navigation/MainNavigation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Boost.Navigation | ||
{ | ||
public class AppNavigation | ||
{ | ||
public string? Title { get; set; } = default!; | ||
|
||
public IEnumerable<MainNavigationItem> Items { get; set; } | ||
= new List<MainNavigationItem>(); | ||
} | ||
|
||
public class NavigationItem | ||
{ | ||
public string? Id { get; set; } = default!; | ||
|
||
public string Title { get; set; } = default!; | ||
|
||
public string Route { get; set; } = default!; | ||
|
||
public string? Icon { get; set; } = default!; | ||
|
||
public bool IsServer { get; set; } | ||
} | ||
|
||
public class MainNavigationItem : NavigationItem | ||
{ | ||
public IEnumerable<NavigationItem> Children { get; set; } | ||
= new List<NavigationItem>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/Tool/src/Boost.Core/Navigation/AppNavigationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text.Json; | ||
using Boost.Infrastructure; | ||
|
||
namespace Boost.Navigation | ||
{ | ||
public class AppNavigationService : IAppNavigationService | ||
{ | ||
private readonly IBoostCommandContext _commandContext; | ||
|
||
public AppNavigationService(IBoostCommandContext commandContext) | ||
{ | ||
_commandContext = commandContext; | ||
} | ||
|
||
public AppNavigation GetNavigation() | ||
{ | ||
Stream? stream = _commandContext.ToolAssembly | ||
.GetManifestResourceStream("Boost.Tool.AppNavigation.json"); | ||
|
||
if (stream is { }) | ||
{ | ||
using StreamReader reader = new StreamReader(stream); | ||
var json = reader.ReadToEnd(); | ||
AppNavigation? appNav = JsonSerializer.Deserialize<AppNavigation>(json)!; | ||
|
||
foreach (MainNavigationItem? item in appNav.Items) | ||
{ | ||
if (item.Id is null) | ||
{ | ||
item.Id = item.Route; | ||
} | ||
foreach (NavigationItem child in item.Children) | ||
{ | ||
if (child.Id is null) | ||
{ | ||
child.Id = $"{item.Id}.{child.Route}"; | ||
} | ||
} | ||
} | ||
|
||
return appNav; | ||
} | ||
|
||
throw new ApplicationException("Could not load app navigation"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ | ||
"Title": "Boost", | ||
"Items": [ | ||
{ | ||
"Title": "Workspace", | ||
"Icon": "mdi-folder-outline", | ||
"Route": "Workspace" | ||
}, | ||
{ | ||
"Title": "Git", | ||
"Icon": "mdi-git", | ||
"Route": "Git", | ||
"Children": [ | ||
{ | ||
"Title": "Current", | ||
"Route": "Git.Current" | ||
}, | ||
{ | ||
"Title": "All Local", | ||
"Route": "Git.Local" | ||
}, | ||
{ | ||
"Title": "Remote", | ||
"Route": "Git.Remote" | ||
}, | ||
{ | ||
"Title": "Indexing", | ||
"Route": "Git.Index" | ||
} | ||
] | ||
}, | ||
{ | ||
"Title": "Utils", | ||
"Icon": "mdi-hammer-screwdriver", | ||
"Route": "Utils", | ||
"Children": [ | ||
{ | ||
"Title": "Encoding & Guids", | ||
"Route": "Utils.Encoding" | ||
}, | ||
{ | ||
"Title": "Base64 to File", | ||
"Route": "Utils.Base64ToFile" | ||
}, | ||
{ | ||
"Title": "Security", | ||
"Route": "Utils.Security" | ||
} | ||
] | ||
}, | ||
{ | ||
"Title": "Security", | ||
"Icon": "mdi-lock-check", | ||
"Route": "Security", | ||
"Children": [ | ||
{ | ||
"Title": "Tokens", | ||
"Route": "Security.Tokens" | ||
}, | ||
{ | ||
"Title": "Authorize (OIDC)", | ||
"Route": "Security.Authorize" | ||
}, | ||
{ | ||
"Title": "Token requestor", | ||
"Route": "Security.TokenRequest" | ||
} | ||
] | ||
}, | ||
{ | ||
"Title": "Snapshooter", | ||
"Route": "Snapshooter", | ||
"Icon": "mdi-test-tube" | ||
}, | ||
{ | ||
"Title": "Settings", | ||
"Icon": "mdi-cog-outline", | ||
"Route": "Settings", | ||
"Children": [ | ||
{ | ||
"Title": "General", | ||
"Route": "Settings.General" | ||
}, | ||
{ | ||
"Title": "Security", | ||
"Route": "Settings.Security" | ||
} | ||
] | ||
}, | ||
{ | ||
"Title": "GraphQL", | ||
"Icon": "mdi-graphql", | ||
"IsServer": true, | ||
"Route": "graphql" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.