Skip to content

Commit e60f7b5

Browse files
committed
Load external modules once and added documentation
1 parent 25020af commit e60f7b5

File tree

4 files changed

+53
-39
lines changed

4 files changed

+53
-39
lines changed

docs/articles/launcher/Launcher.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Launcher
2+
3+
## Sorting
4+
5+
To sort your modules in the launcher, you can use the `SortIndex` property within the `appsettings.json`. This property allows you to define the order of modules by assigning them an index value. Modules with lower index values will appear before those with higher values.
6+
7+
````json
8+
{
9+
"Shell": {
10+
"SortIndex": {
11+
"moduleA-route": 10,
12+
"moduleB-route": 20,
13+
"moduleC-route": 15
14+
}
15+
}
16+
}
17+
````
18+
19+
## External Modules
20+
21+
To define external modules in the launcher configuration, you can use the `ExternalModules` property within the `appsettings.json`. This allows you to specify
22+
modules that should be loaded from external sources rather than being bundled with your application.
23+
24+
External modules are integrated with the `<embed>` tag; the external web-page must support being embedded in an iframe.
25+
26+
````json
27+
{
28+
"Shell": {
29+
"SortIndex": {
30+
"example": 10
31+
},
32+
"ExternalModules": [
33+
{
34+
"Route": "example",
35+
"Title": "Example",
36+
"Url": "http://www.example.com",
37+
"Icon": "globe"
38+
}
39+
]
40+
}
41+
}
42+
````

docs/migrations/v8_to_v10.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,7 @@ The `ProductFileEntity` has been removed from the data model as it was not utili
4444

4545
## Removal of Modules-Analytics
4646

47-
The analytics module was doing nothing and the web module was replaced by supporting external modules in `Launcher`. Its now supported to embed external web-pages into the shell.
48-
Extend your `appsettings.json` by the following:
49-
50-
````json
51-
"Shell": {
52-
"SortIndex": {
53-
...
54-
},
55-
"ExternalModules": [
56-
{
57-
"Route": "example",
58-
"Title": "Example",
59-
"Url": "http://www.example.com",
60-
"Icon": "globe"
61-
}
62-
]
63-
}
64-
````
47+
The analytics module was doing nothing and the web module was replaced by supporting external modules in `Launcher`. Its now supported to embed external web-pages into the shell. Refer to the [Launcher](/docs/articles/launcher/Launcher.md) documentation for more information.
6548

6649
## Rarely used features removed
6750

src/Moryx.Launcher/Pages/External.cshtml.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/Moryx.Launcher/ShellNavigator.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class ShellNavigator : IShellNavigator
2323
private readonly IConfiguration _configuration;
2424
private readonly ILogger _logger;
2525
private readonly MoryxAccessManagementClient _client;
26+
private readonly IReadOnlyList<ExternalModuleItem> _externalModules;
2627

2728
public EndpointDataSource EndpointsDataSource { get; }
2829
public PageLoader PageLoader { get; }
@@ -47,6 +48,8 @@ public ShellNavigator(
4748
logger.CreateLogger($"{nameof(ShellNavigator)}:{nameof(MoryxAccessManagementClient)}")
4849
);
4950
}
51+
52+
_externalModules = LoadExternalModules();
5053
}
5154

5255
/// <inheritdoc />
@@ -77,13 +80,7 @@ public async Task<IReadOnlyList<ModuleItem>> GetModuleItems(HttpContext context)
7780
var modules = compiledPageActionDescriptors.Select(CreateWebModuleItem)
7881
.Where(m => m != null).ToList<ModuleItem>();
7982

80-
// Load external modules
81-
var externalModuleConfigs = _configuration.GetSection("Shell:ExternalModules").Get<ExternalModuleConfig[]>();
82-
if (externalModuleConfigs != null)
83-
{
84-
var externalModules = externalModuleConfigs.Select(CreateExternalModuleItem).ToList();
85-
modules.AddRange(externalModules);
86-
}
83+
modules.AddRange(_externalModules);
8784

8885
// Rudimentary sorting
8986
var index = 0;
@@ -97,6 +94,12 @@ public async Task<IReadOnlyList<ModuleItem>> GetModuleItems(HttpContext context)
9794
return modules;
9895
}
9996

97+
private ExternalModuleItem[] LoadExternalModules()
98+
{
99+
var externalModuleConfigs = _configuration.GetSection("Shell:ExternalModules").Get<ExternalModuleConfig[]>();
100+
return externalModuleConfigs?.Select(CreateExternalModuleItem).ToArray() ?? [];
101+
}
102+
100103
private static ExternalModuleItem CreateExternalModuleItem(ExternalModuleConfig externalModuleConfig)
101104
{
102105
return new ExternalModuleItem

0 commit comments

Comments
 (0)