Skip to content

Updated how links are opened for UI applications based on the newly added isPortalIntegrated flag #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const Config:Config = {
description: "Check the health status of services running in this venue.",
healthChecks: [],
healthCheckUrl: "",
isPortalIntegrated: true,
landingPageUrl: "/health-dashboard",
nativeRoute: true,
reportHealthStatus: false,
Expand All @@ -60,6 +61,7 @@ const Config:Config = {
description: "Documentation to help become familiar with the Unity platform.",
healthChecks: [],
healthCheckUrl: "",
isPortalIntegrated: true,
landingPageUrl: "https://unity-sds.gitbook.io/docs",
nativeRoute: true,
reportHealthStatus: false,
Expand Down
4 changes: 3 additions & 1 deletion src/components/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Pill } from "../../components/Pill";
import { Link } from "react-router-dom";

export type CardProps = {
alwaysOpenInNewWindow:boolean;
description:string;
route:string;
title:string;
Expand All @@ -11,6 +12,7 @@ export type CardProps = {
}

export const Card = ({
alwaysOpenInNewWindow,
description,
route,
title,
Expand All @@ -25,7 +27,7 @@ export const Card = ({
}

return (
<Link to={route}>
<Link to={alwaysOpenInNewWindow ? url : route} target={alwaysOpenInNewWindow ? "_blank" : "_self"}>
<span className="mdps-card">
<span className="header">
<span className="title">{title}</span>
Expand Down
12 changes: 9 additions & 3 deletions src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ export default function Navbar() {

}, [healthState]);

const getLinkUrl = (isPortalIntegrated:boolean, internalLinkUrl:string, externalLinkUrl:string) => {
return isPortalIntegrated ? internalLinkUrl : externalLinkUrl
}

const getLinkTarget = (isPortalIntegrated:boolean):string => {
return isPortalIntegrated ? "_self" : "_blank";
}

return (
<StellarNavbar mobileBreakpoint={800}>
Expand Down Expand Up @@ -95,7 +101,7 @@ export default function Navbar() {
<NavLink to="/"><MenuItem>Home</MenuItem></NavLink>
{
uiItems.map( (service, index) => {
return <NavLink to={service.route} key={index}>
return <NavLink to={ getLinkUrl(service.isPortalIntegrated, service.route, service.landingPageUrl) } target={ getLinkTarget(service.isPortalIntegrated) } key={index}>
<MenuItem>{service.componentName}</MenuItem>
</NavLink>
})
Expand Down Expand Up @@ -157,7 +163,7 @@ export default function Navbar() {
<NavLink to="/"><MenuItem>Home</MenuItem></NavLink>
{
uiItems.map( (service, index) => {
return <NavLink to={service.route} key={index}>
return <NavLink to={ getLinkUrl(service.isPortalIntegrated, service.route, service.landingPageUrl) } target={ getLinkTarget(service.isPortalIntegrated) } key={index}>
<MenuItem>{service.componentName}</MenuItem>
</NavLink>
})
Expand Down Expand Up @@ -228,7 +234,7 @@ export default function Navbar() {
<NavLink to="/" className="st-react-navbar-link"><IconHome />{' '}Home</NavLink>
{
uiItems.map( (service, index) => {
return <NavLink key={index} className="st-react-navbar-link" to={service.route}>{service.componentName}</NavLink>
return <NavLink to={ getLinkUrl(service.isPortalIntegrated, service.route, service.landingPageUrl) } target={ getLinkTarget(service.isPortalIntegrated)} className="st-react-navbar-link" key={index}>{service.componentName}</NavLink>
})
}
{
Expand Down
1 change: 1 addition & 0 deletions src/routes/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function Home() {
const appCards = uiItems.map( (item) => {
return (
<Card
alwaysOpenInNewWindow={!item.isPortalIntegrated}
description={item.description}
route={item.route}
title={item.componentName}
Expand Down
10 changes: 9 additions & 1 deletion src/state/slices/healthSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type Service = {
description:string;
healthChecks: Array<HealthCheck>;
healthCheckUrl:string;
isPortalIntegrated:boolean;
landingPageUrl:string;
nativeRoute:boolean;
reportHealthStatus:boolean;
Expand Down Expand Up @@ -88,11 +89,18 @@ const healthSlice = createSlice({
const data = Config.general.defaultRoutes;

// Add portal route for each application
action.payload.forEach( (service:Service) => {
action.payload.forEach( (service:Service, index:number) => {

service.nativeRoute = false;
service.route = "/applications/" + formatRoute(service.componentName);
service.reportHealthStatus = true;

if( !("isPortalIntegrated" in action.payload[index]) ) {
service.isPortalIntegrated = false;
}

data.push(service);

})

// sort services alphabetically by their componentName
Expand Down