Skip to content

Commit b35458e

Browse files
authored
Updated documentation urls and introduced version based approach to open release version specific doc links (#306)
1 parent 4171a9f commit b35458e

6 files changed

Lines changed: 214 additions & 100 deletions

File tree

apps/root/public/runtime-config.js

Lines changed: 78 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,64 @@
88

99
const fqdn = "kind.internal";
1010

11+
// common documentation URLs
12+
const documentationUrls = [
13+
{ src: "/dashboard", dest: "/user_guide/monitor_deployments/index.html" },
14+
{ src: "/applications/deployments", dest: "/user_guide/package_software/deployments.html" },
15+
{ src: "/applications/deployment/*", dest: "/user_guide/package_software/deployment_details.html" },
16+
{ src: "/applications/deployment/*/cluster/*", dest: "/user_guide/package_software/deployment_details.html" },
17+
{ src: "/applications/deployments/setup-deployment", dest: "/user_guide/package_software/setup_deploy.html" },
18+
{ src: "/applications/packages", dest: "/user_guide/package_software/deploy_packages.html" },
19+
{ src: "/applications/packages/create", dest: "/user_guide/package_software/add_deploy_pack.html" },
20+
{ src: "/applications/packages/import", dest: "/user_guide/package_software/import_deployment.html" },
21+
{ src: "/applications/package/*", dest: "/user_guide/package_software/deploy_pack_details.html" },
22+
{ src: "/applications/packages/edit/*/*/*", dest: "/user_guide/package_software/edit_deploy_pack.html" },
23+
{ src: "/applications/packages/clone/*/*/*", dest: "/user_guide/package_software/clone_applications.html" },
24+
{ src: "/applications/applications/apps", dest: "/user_guide/package_software/applications.html" },
25+
{ src: "/applications/applications/add", dest: "/user_guide/package_software/add_applications.html" },
26+
{ src: "/applications/applications/edit/*/*/*", dest: "/user_guide/package_software/edit_application.html" },
27+
{ src: "/applications/application/*/*/*", dest: "/user_guide/package_software/app_details.html" },
28+
{ src: "/applications/applications/extensions", dest: "/user_guide/package_software/extensions/deploy_extension_package.html" },
29+
{ src: "/applications/applications/registries", dest: "/user_guide/package_software/registry.html" },
30+
{ src: "/infrastructure/host/*", dest: "/user_guide/set_up_edge_infra/active_host_details.html" },
31+
{ src: "/infrastructure/host/*/edit", dest: "/user_guide/set_up_edge_infra/edit_host.html" },
32+
{ src: "/infrastructure/regions/new", dest: "/user_guide/set_up_edge_infra/location/add_region.html" },
33+
{ src: "/infrastructure/regions/*", dest: "/user_guide/set_up_edge_infra/location/view_region_detail.html" },
34+
{ src: "/infrastructure/regions/*/sites/new", dest: "/user_guide/set_up_edge_infra/location/add_site.html" },
35+
{ src: "/admin/os-profiles", dest: "/shared/shared_os_profile.html" },
36+
];
37+
38+
const v3_0_docs = [
39+
{ src: "/admin/ssh-keys", dest: "/user_guide/additional_howtos/configure_ssh_public_keys.html" },
40+
{ src: "/infrastructure/clusters", dest: "/user_guide/set_up_edge_infra/clusters_main.html" },
41+
{ src: "/infrastructure/clusters/create", dest: "/user_guide/set_up_edge_infra/create_clusters.html" },
42+
{ src: "/infrastructure/cluster/*", dest: "/user_guide/set_up_edge_infra/cluster_details.html" },
43+
{ src: "/infrastructure/cluster/*/edit", dest: "/user_guide/set_up_edge_infra/edit_clusters.html" },
44+
{ src: "/infrastructure/hosts", dest: "/user_guide/set_up_edge_infra/provisioned_hosts_main.html" },
45+
{ src: "/infrastructure/locations", dest: "/user_guide/set_up_edge_infra/location_main.html" },
46+
{ src: "/infrastructure/hosts/provision", dest: "/user_guide/set_up_edge_infra/provision_host.html" },
47+
{ src: "/admin/alerts", dest: "/user_guide/additional_howtos/alerting.html" },
48+
{ src: "/admin/alert-definitions", dest: "/user_guide/additional_howtos/alerts_config.html" },
49+
{ src: "/admin/cluster-templates", dest: "/user_guide/additional_howtos/set_up_a_cluster_template.html" },
50+
{ src: "/admin/cluster-templates/*/*/view", dest: "/user_guide/additional_howtos/view_cluster_template.html" },
51+
{ src: "/admin/about", dest: "/user_guide/additional_howtos/index.html" }
52+
];
53+
54+
const v3_1_docs = [
55+
{ src: "/admin/ssh-keys", dest: "/user_guide/advanced_functionality/configure_ssh_public_keys.html" },
56+
{ src: "/infrastructure/clusters", dest: "/user_guide/set_up_edge_infra/clusters/index.html" },
57+
{ src: "/infrastructure/clusters/create", dest: "/user_guide/set_up_edge_infra/clusters/create_clusters.html" },
58+
{ src: "/infrastructure/cluster/*", dest: "/user_guide/set_up_edge_infra/clusters/cluster_details.html" },
59+
{ src: "/infrastructure/cluster/*/edit", dest: "/user_guide/set_up_edge_infra/clusters/edit_clusters.html" },
60+
{ src: "/infrastructure/hosts", dest: "/user_guide/set_up_edge_infra/edge_node_states/index.html" },
61+
{ src: "/infrastructure/locations", dest: "/user_guide/set_up_edge_infra/location/index.html" },
62+
{ src: "/infrastructure/hosts/provision", dest: "/user_guide/set_up_edge_infra/edge_node_onboard/onboarding_actions/provision_host.html" },//verify
63+
{ src: "/admin/alerts", dest: "/user_guide/monitor_deployments/alerts_view.html" },
64+
{ src: "/admin/alert-definitions", dest: "/user_guide/advanced_functionality/alerts_config.html" },
65+
{ src: "/admin/cluster-templates", dest: "/user_guide/advanced_functionality/set_up_a_cluster_template.html" },
66+
{ src: "/admin/cluster-templates/*/*/view", dest: "/user_guide/advanced_functionality/view_cluster_template.html" },
67+
{ src: "/admin/about", dest: "/user_guide/administration/index.html" }];
68+
1169
window.__RUNTIME_CONFIG__ = {
1270
AUTH: "true",
1371
KC_URL: `https://keycloak.${fqdn}`,
@@ -16,50 +74,26 @@ window.__RUNTIME_CONFIG__ = {
1674
SESSION_TIMEOUT: 0,
1775
OBSERVABILITY_URL: `https://observability-ui.${fqdn}`,
1876
DOCUMENTATION_URL: "https://docs.openedgeplatform.intel.com/edge-manage-docs/main",
19-
DOCUMENTATION: [
20-
{ src: "/dashboard", dest: "/user_guide/monitor_deployments/index.html" },
21-
{ src: "/admin/ssh-keys", dest: "/user_guide/additional_howtos/configure_ssh_public_keys.html" },
22-
{ src: "/applications/deployments", dest: "/user_guide/package_software/deployments.html" },
23-
{ src: "/applications/deployment/*", dest: "/user_guide/package_software/deployment_details.html" },
24-
{ src: "/applications/deployment/*/cluster/*", dest: "/user_guide/package_software/deployment_details.html" },
25-
{ src: "/applications/setup-deployment", dest: "/user_guide/package_software/setup_deploy.html" },
26-
{ src: "/applications/packages", dest: "/user_guide/package_software/deploy_packages.html" },
27-
{ src: "/applications/packages/create", dest: "/user_guide/package_software/add_deploy_pack.html" },
28-
{ src: "/applications/packages/import", dest: "/user_guide/package_software/import_deployment.html" },
29-
{ src: "/applications/package/*", dest: "/user_guide/package_software/deploy_pack_details.html" },
30-
{ src: "/applications/packages/edit/*", dest: "/user_guide/package_software/edit_deploy_pack.html" },
31-
{ src: "/applications/packages/clone/*", dest: "/user_guide/package_software/clone_applications.html" },
32-
{ src: "/applications/applications/apps", dest: "/user_guide/package_software/applications.html" },
33-
{ src: "/applications/applications/add", dest: "/user_guide/package_software/add_applications.html" },
34-
{ src: "/applications/application/*", dest: "/user_guide/package_software/app_details.html" },
35-
{ src: "/applications/applications/edit/*", dest: "/user_guide/package_software/edit_application.html" },
36-
{ src: "/applications/applications/extensions", dest: "/user_guide/package_software/extensions/deploy_extension_package.html" },
37-
{ src: "/applications/applications/registries", dest: "/user_guide/package_software/registry.html" },
38-
{ src: "/infrastructure/clusters", dest: "/user_guide/set_up_edge_infra/clusters_main.html" },
39-
{ src: "/infrastructure/clusters/create", dest: "/user_guide/set_up_edge_infra/create_clusters.html" },
40-
{ src: "/infrastructure/cluster/*", dest: "/user_guide/set_up_edge_infra/cluster_details.html" },
41-
{ src: "/infrastructure/cluster/*/edit", dest: "/user_guide/set_up_edge_infra/edit_clusters.html" },
42-
{ src: "/infrastructure/hosts", dest: "/user_guide/set_up_edge_infra/provisioned_hosts_main.html" },
43-
{ src: "/infrastructure/host/*", dest: "/user_guide/set_up_edge_infra/active_host_details.html" },
44-
{ src: "/infrastructure/host/*/edit", dest: "/user_guide/set_up_edge_infra/edit_host.html" },
45-
{ src: "/infrastructure/unassigned-hosts", dest: "/user_guide/set_up_edge_infra/configured_hosts_main.html" },
46-
{ src: "/infrastructure/unconfigured-hosts", dest: "/user_guide/set_up_edge_infra/onboarded_hosts.html" },
47-
{ src: "/infrastructure/unconfigured-host/*", dest: "/user_guide/set_up_edge_infra/onboard_host_details.html" },
48-
{ src: "/infrastructure/unconfigured-host/configure", dest: "/user_guide/set_up_edge_infra/configure_host.html" },
49-
{ src: "/infrastructure/registered-hosts", dest: "/user_guide/set_up_edge_infra/registered_hosts.html" },
50-
{ src: "/infrastructure/deauthorized-hosts", dest: "/user_guide/set_up_edge_infra/deauthorize_host.html" },
51-
{ src: "/infrastructure/locations", dest: "/user_guide/set_up_edge_infra/location_main.html" },
52-
{ src: "/infrastructure/regions/new", dest: "/user_guide/set_up_edge_infra/location/add_region.html" },
53-
{ src: "/infrastructure/regions/*", dest: "/user_guide/set_up_edge_infra/location/view_region_detail.html" },
54-
{ src: "/infrastructure/hosts/set-up-provisioning", dest: "/user_guide/set_up_edge_infra/provision_host.html" },
55-
{ src: "/infrastructure/regions/*/sites/new", dest: "/user_guide/set_up_edge_infra/location/add_site.html" },
56-
{ src: "/admin/alerts", dest: "/user_guide/additional_howtos/alerting.html" },
57-
{ src: "/admin/alert-definitions", dest: "/user_guide/additional_howtos/alerts_config.html" },
58-
{ src: "/admin/cluster-templates", dest: "/user_guide/additional_howtos/set_up_a_cluster_template.html" },
59-
{ src: "/admin/cluster-templates/*/view", dest: "/user_guide/additional_howtos/view_cluster_template.html" },
60-
{ src: "/admin/os-profiles", dest: "/shared/shared_os_profile.html" },
61-
{ src: "/admin/about", dest: "/user_guide/additional_howtos/index.html" },
62-
],
77+
DOCUMENTATION: {
78+
"3.0": [// 3.0 documentation URLs
79+
...documentationUrls,
80+
...v3_0_docs
81+
],
82+
"3.1": [// 3.1 documentation URLs
83+
...documentationUrls,
84+
...v3_1_docs
85+
],
86+
/*
87+
- Keep "main" up to date with the latest release documentation
88+
- "main" serves as a fallback when a specific version key is not found
89+
- Only add new version keys when documentation URLs actually change
90+
- For releases with no doc changes, they will automatically use "main" (latest)
91+
*/
92+
"main": [
93+
...documentationUrls,
94+
...v3_1_docs //latest release which has doc changes
95+
]
96+
},
6397
MFE: {
6498
APP_ORCH: "true",
6599
INFRA: "true",

library/components/atomic-design/templates/Header/Header.cy.tsx

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,20 @@ const runtimeConfig: IRuntimeConfig = {
2727
},
2828
API: {},
2929
VERSIONS: { v: undefined, orchestrator: "v3.1.0-dev-f478801" },
30-
DOCUMENTATION: [],
30+
DOCUMENTATION: {
31+
"3.1": [
32+
{
33+
src: "/dashboard",
34+
dest: "/docs/content/dev_guide/monitor_deployments/monitor_deployment.html",
35+
},
36+
],
37+
main: [
38+
{
39+
src: "/dashboard",
40+
dest: "/docs/content/dev_guide/monitor_deployments/monitor_deployment.html",
41+
},
42+
],
43+
},
3144
};
3245

3346
window.__RUNTIME_CONFIG__ = runtimeConfig;
@@ -72,12 +85,20 @@ describe("<Header/>", () => {
7285
it("correctly displays the documentation link", () => {
7386
const cfg: IRuntimeConfig = {
7487
DOCUMENTATION_URL: "https://test.com/",
75-
DOCUMENTATION: [
76-
{
77-
src: "/dashboard",
78-
dest: "/docs/content/dev_guide/monitor_deployments/monitor_deployment.html",
79-
},
80-
],
88+
DOCUMENTATION: {
89+
"3.1": [
90+
{
91+
src: "/dashboard",
92+
dest: "/docs/content/dev_guide/monitor_deployments/monitor_deployment.html",
93+
},
94+
],
95+
main: [
96+
{
97+
src: "/dashboard",
98+
dest: "/docs/content/dev_guide/monitor_deployments/monitor_deployment.html",
99+
},
100+
],
101+
},
81102
AUTH: "false",
82103
KC_URL: "",
83104
KC_REALM: "",

library/components/atomic-design/templates/Header/docMapper.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const getDocsForUrl = (url: string) => {
5151
// ...in documentationUrl but concatenated with `/main`
5252
const docHost = "https://docs.openedgeplatform.intel.com/edge-manage-docs";
5353
const urlParts = url.substring(1).split("/");
54-
let docVersion;
54+
let docVersion = "main";
5555
if (
5656
window.__RUNTIME_CONFIG__?.VERSIONS.orchestrator &&
5757
RuntimeConfig.getComponentVersion("orchestrator")
@@ -61,7 +61,7 @@ export const getDocsForUrl = (url: string) => {
6161
);
6262
}
6363
let docsUrl = stripTrailingSlash(RuntimeConfig.documentationUrl);
64-
let docsMapper = RuntimeConfig.documentation;
64+
let docsMapper = RuntimeConfig.documentation(docVersion);
6565
// looking for matches part (url segment) by part
6666
// takes browser url, e.g. /test/aa/bb/cc and test against mapper values, segment by segment
6767
// if values from the same segment index from url and mapper key are different we dont grab this mapping
@@ -123,6 +123,7 @@ export const getDocsForUrl = (url: string) => {
123123
}
124124
// default option
125125
const defaultDocsAddress =
126-
RuntimeConfig.documentation[0]?.dest ?? `${window.location.origin}/docs`;
126+
RuntimeConfig.documentation(docVersion)[0]?.dest ??
127+
`${window.location.origin}/docs`;
127128
return `${docsUrl}${defaultDocsAddress}`;
128129
};

library/components/atomic-design/templates/Header/docsMapper.cy.tsx

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,20 @@ const createTestConfig = (
5959
): IRuntimeConfig => ({
6060
DOCUMENTATION_URL:
6161
"https://docs.openedgeplatform.intel.com/edge-manage-docs/main",
62-
DOCUMENTATION: [
63-
{
64-
src: "/dashboard",
65-
dest: "/user_guide/monitor_deployments/index.html",
66-
},
67-
],
62+
DOCUMENTATION: {
63+
"3.1": [
64+
{
65+
src: "/dashboard",
66+
dest: "/user_guide/monitor_deployments/index.html",
67+
},
68+
],
69+
main: [
70+
{
71+
src: "/dashboard",
72+
dest: "/user_guide/monitor_deployments/index.html",
73+
},
74+
],
75+
},
6876
AUTH: "false",
6977
KC_URL: "",
7078
KC_REALM: "",
@@ -84,40 +92,42 @@ describe("test mapping url to docs link", () => {
8492
beforeEach(() => {
8593
const cfg: IRuntimeConfig = {
8694
DOCUMENTATION_URL: "https://test.com/",
87-
DOCUMENTATION: [
88-
{
89-
src: "/dashboard",
90-
dest: "/docs/content/dev_guide/monitor_deployments/monitor_deployment.html",
91-
},
92-
{
93-
src: "/applications/deployment/*",
94-
dest: "/docs/content/dev_guide/package_software/deployment_details.html",
95-
},
96-
{
97-
src: "/applications/deployment/*/cluster/*",
98-
dest: "/docs/content/dev_guide/package_software/deployment_details_2.html",
99-
},
100-
{
101-
src: "/infrastructure/unconfigured-host/*",
102-
dest: "/docs/content/dev_guide/set_up_edge_infra/onboard_host_details.html",
103-
},
104-
{
105-
src: "/infrastructure/unconfigured-host/configure",
106-
dest: "/docs/content/dev_guide/set_up_edge_infra/configure_host.html",
107-
},
108-
{
109-
src: "/infrastructure/regions/new",
110-
dest: "/docs/content/dev_guide/set_up_edge_infra/location/add_region.html",
111-
},
112-
{
113-
src: "/infrastructure/regions/*",
114-
dest: "/docs/content/dev_guide/set_up_edge_infra/location/view_region_detail.html",
115-
},
116-
{
117-
src: "/infrastructure/regions/*/sites/new",
118-
dest: "/docs/content/dev_guide/set_up_edge_infra/location/add_site.html",
119-
},
120-
],
95+
DOCUMENTATION: {
96+
"3.1": [
97+
{
98+
src: "/dashboard",
99+
dest: "/docs/content/dev_guide/monitor_deployments/monitor_deployment.html",
100+
},
101+
{
102+
src: "/applications/deployment/*",
103+
dest: "/docs/content/dev_guide/package_software/deployment_details.html",
104+
},
105+
{
106+
src: "/applications/deployment/*/cluster/*",
107+
dest: "/docs/content/dev_guide/package_software/deployment_details_2.html",
108+
},
109+
{
110+
src: "/infrastructure/unconfigured-host/*",
111+
dest: "/docs/content/dev_guide/set_up_edge_infra/onboard_host_details.html",
112+
},
113+
{
114+
src: "/infrastructure/unconfigured-host/configure",
115+
dest: "/docs/content/dev_guide/set_up_edge_infra/configure_host.html",
116+
},
117+
{
118+
src: "/infrastructure/regions/new",
119+
dest: "/docs/content/dev_guide/set_up_edge_infra/location/add_region.html",
120+
},
121+
{
122+
src: "/infrastructure/regions/*",
123+
dest: "/docs/content/dev_guide/set_up_edge_infra/location/view_region_detail.html",
124+
},
125+
{
126+
src: "/infrastructure/regions/*/sites/new",
127+
dest: "/docs/content/dev_guide/set_up_edge_infra/location/add_site.html",
128+
},
129+
],
130+
},
121131
AUTH: "false",
122132
KC_URL: "",
123133
KC_REALM: "",
@@ -145,7 +155,10 @@ describe("test no mapping", () => {
145155
it("default link", () => {
146156
const cfg: IRuntimeConfig = {
147157
DOCUMENTATION_URL: "",
148-
DOCUMENTATION: [],
158+
DOCUMENTATION: {
159+
"3.1": [],
160+
main: [],
161+
},
149162
AUTH: "false",
150163
KC_URL: "",
151164
KC_REALM: "",
@@ -178,6 +191,20 @@ describe("doc URL tests for orchestrator versions", () => {
178191

179192
it("Should construct URL with release version 3.0", () => {
180193
window.__RUNTIME_CONFIG__ = createTestConfig({
194+
DOCUMENTATION: {
195+
"3.0": [
196+
{
197+
src: "/dashboard",
198+
dest: "/user_guide/monitor_deployments/index.html",
199+
},
200+
],
201+
main: [
202+
{
203+
src: "/dashboard",
204+
dest: "/user_guide/monitor_deployments/index.html",
205+
},
206+
],
207+
},
181208
VERSIONS: {
182209
orchestrator: "v3.0.0-dev-f478801",
183210
},

library/utils/runtime-config/runtime-config.cy.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const runtimeConfig: IRuntimeConfig = {
1515
SESSION_TIMEOUT: 1000,
1616
TITLE: "test-title",
1717
DOCUMENTATION_URL: "doc-link",
18-
DOCUMENTATION: [{ src: "src", dest: "dest" }],
18+
DOCUMENTATION: {
19+
main: [{ src: "src", dest: "dest" }],
20+
"3.1": [{ src: "src", dest: "dest" }],
21+
},
1922
API: {
2023
CATALOG: "CATALOG",
2124
ADM: "ADM",
@@ -77,7 +80,28 @@ describe("RuntimeConfig", () => {
7780
});
7881

7982
it("should return the documentation mappings", () => {
80-
expect(RuntimeConfig.documentation).to.deep.equal([
83+
// Update the test config to use version-based structure
84+
const configWithVersionedDocs: IRuntimeConfig = {
85+
...runtimeConfig,
86+
DOCUMENTATION: {
87+
main: [{ src: "src", dest: "dest" }],
88+
"3.1": [{ src: "src", dest: "dest" }],
89+
},
90+
};
91+
window.__RUNTIME_CONFIG__ = configWithVersionedDocs;
92+
93+
// Test the method with a version parameter
94+
expect(RuntimeConfig.documentation("main")).to.deep.equal([
95+
{ src: "src", dest: "dest" },
96+
]);
97+
98+
// Test with version "3.1"
99+
expect(RuntimeConfig.documentation("3.1")).to.deep.equal([
100+
{ src: "src", dest: "dest" },
101+
]);
102+
103+
// Test with non-existent version (should fallback to "main")
104+
expect(RuntimeConfig.documentation("9.9")).to.deep.equal([
81105
{ src: "src", dest: "dest" },
82106
]);
83107
});

0 commit comments

Comments
 (0)