Skip to content

Commit 83ada81

Browse files
authored
Merge pull request #78 from unity-sds/develop
Merging `develop` to `main`
2 parents 18a3966 + 72e5ae1 commit 83ada81

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

src/Config.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const Config:Config = {
4747
description: "Check the health status of services running in this venue.",
4848
healthChecks: [],
4949
healthCheckUrl: "",
50+
isPortalIntegrated: true,
5051
landingPageUrl: "/health-dashboard",
5152
nativeRoute: true,
5253
reportHealthStatus: false,
@@ -60,6 +61,7 @@ const Config:Config = {
6061
description: "Documentation to help become familiar with the Unity platform.",
6162
healthChecks: [],
6263
healthCheckUrl: "",
64+
isPortalIntegrated: true,
6365
landingPageUrl: "https://unity-sds.gitbook.io/docs",
6466
nativeRoute: true,
6567
reportHealthStatus: false,

src/components/Card/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Pill } from "../../components/Pill";
33
import { Link } from "react-router-dom";
44

55
export type CardProps = {
6+
alwaysOpenInNewWindow:boolean;
67
description:string;
78
route:string;
89
title:string;
@@ -11,6 +12,7 @@ export type CardProps = {
1112
}
1213

1314
export const Card = ({
15+
alwaysOpenInNewWindow,
1416
description,
1517
route,
1618
title,
@@ -25,7 +27,7 @@ export const Card = ({
2527
}
2628

2729
return (
28-
<Link to={route}>
30+
<Link to={alwaysOpenInNewWindow ? url : route} target={alwaysOpenInNewWindow ? "_blank" : "_self"}>
2931
<span className="mdps-card">
3032
<span className="header">
3133
<span className="title">{title}</span>

src/components/Navbar/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ export default function Navbar() {
6161

6262
}, [healthState]);
6363

64+
const getLinkUrl = (isPortalIntegrated:boolean, internalLinkUrl:string, externalLinkUrl:string) => {
65+
return isPortalIntegrated ? internalLinkUrl : externalLinkUrl
66+
}
6467

68+
const getLinkTarget = (isPortalIntegrated:boolean):string => {
69+
return isPortalIntegrated ? "_self" : "_blank";
70+
}
6571

6672
return (
6773
<StellarNavbar mobileBreakpoint={800}>
@@ -95,7 +101,7 @@ export default function Navbar() {
95101
<NavLink to="/"><MenuItem>Home</MenuItem></NavLink>
96102
{
97103
uiItems.map( (service, index) => {
98-
return <NavLink to={service.route} key={index}>
104+
return <NavLink to={ getLinkUrl(service.isPortalIntegrated, service.route, service.landingPageUrl) } target={ getLinkTarget(service.isPortalIntegrated) } key={index}>
99105
<MenuItem>{service.componentName}</MenuItem>
100106
</NavLink>
101107
})
@@ -157,7 +163,7 @@ export default function Navbar() {
157163
<NavLink to="/"><MenuItem>Home</MenuItem></NavLink>
158164
{
159165
uiItems.map( (service, index) => {
160-
return <NavLink to={service.route} key={index}>
166+
return <NavLink to={ getLinkUrl(service.isPortalIntegrated, service.route, service.landingPageUrl) } target={ getLinkTarget(service.isPortalIntegrated) } key={index}>
161167
<MenuItem>{service.componentName}</MenuItem>
162168
</NavLink>
163169
})
@@ -228,7 +234,7 @@ export default function Navbar() {
228234
<NavLink to="/" className="st-react-navbar-link"><IconHome />{' '}Home</NavLink>
229235
{
230236
uiItems.map( (service, index) => {
231-
return <NavLink key={index} className="st-react-navbar-link" to={service.route}>{service.componentName}</NavLink>
237+
return <NavLink to={ getLinkUrl(service.isPortalIntegrated, service.route, service.landingPageUrl) } target={ getLinkTarget(service.isPortalIntegrated)} className="st-react-navbar-link" key={index}>{service.componentName}</NavLink>
232238
})
233239
}
234240
{

src/routes/home/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function Home() {
1414
const appCards = uiItems.map( (item) => {
1515
return (
1616
<Card
17+
alwaysOpenInNewWindow={!item.isPortalIntegrated}
1718
description={item.description}
1819
route={item.route}
1920
title={item.componentName}

src/state/slices/healthSlice.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export type Service = {
2121
description:string;
2222
healthChecks: Array<HealthCheck>;
2323
healthCheckUrl:string;
24+
isPortalIntegrated:boolean;
2425
landingPageUrl:string;
2526
nativeRoute:boolean;
2627
reportHealthStatus:boolean;
@@ -88,11 +89,18 @@ const healthSlice = createSlice({
8889
const data = Config.general.defaultRoutes;
8990

9091
// Add portal route for each application
91-
action.payload.forEach( (service:Service) => {
92+
action.payload.forEach( (service:Service, index:number) => {
93+
9294
service.nativeRoute = false;
9395
service.route = "/applications/" + formatRoute(service.componentName);
9496
service.reportHealthStatus = true;
97+
98+
if( !("isPortalIntegrated" in action.payload[index]) ) {
99+
service.isPortalIntegrated = false;
100+
}
101+
95102
data.push(service);
103+
96104
})
97105

98106
// sort services alphabetically by their componentName

0 commit comments

Comments
 (0)