From 2ae44a71dda7ab37d3574930478cd64f2a26fde9 Mon Sep 17 00:00:00 2001 From: Dustin Jenkins Date: Thu, 31 Oct 2024 18:53:02 +0000 Subject: [PATCH] fix: create configurable tab labels --- org.opencadc.science-portal.properties | 24 ++- public/index.html | 140 ++++++++++-------- .../ApplicationConfiguration.java | 6 +- 3 files changed, 96 insertions(+), 74 deletions(-) diff --git a/org.opencadc.science-portal.properties b/org.opencadc.science-portal.properties index 3436760..8d80a76 100644 --- a/org.opencadc.science-portal.properties +++ b/org.opencadc.science-portal.properties @@ -4,19 +4,15 @@ org.opencadc.science-portal.sessions.resourceID = ivo://cadc.nrc.ca/skaha org.opencadc.science-portal.sessions.standard = vos://cadc.nrc.ca~vospace/CADC/std/Proc#sessions-1.0 org.opencadc.science-portal.themeName = canfar -# OIDC Client information -# org.opencadc.science-portal.oidc.clientID = science-portal-oidc-client -# org.opencadc.science-portal.oidc.clientSecret = science-portal-oidc-client-secretpwd +# Comma-delimited array of tab labels to display in the science portal. +# Defaults are "Public" and "Advanced" +org.opencadc.science-portal.tabLabels = Public, Advanced -# The token scopes to ask for. -# org.opencadc.science-portal.oidc.scope = openid profile offline_access +# OIDC properties (if using) +org.opencadc.science-portal.oidc.clientID = my-openid-client +org.opencadc.science-portal.oidc.clientSecret = my-openid-client-secret +org.opencadc.science-portal.oidc.callbackURI = https://example.com/callback +org.opencadc.science-portal.oidc.redirectURI = https://example.com/redirect +org.opencadc.science-portal.oidc.scope = openid profile email -# Where to redirect the user to after successful authentication. Also known as the redirect_uri in OpenID Connect. -# org.opencadc.science-portal.oidc.redirectURI = https://example.com/science-platform/oidc-callback - -# Where to send the user after acquiring a token. -# org.opencadc.science-portal.oidc.callbackURI = https://example.com/science-platform - -# Uncomment this line and change the text if a message needs to be displayed -# in the banner -# org.opencadc.science-portal.sessions.bannerText = Banner text from properties file \ No newline at end of file +org.opencadc.science-portal.tokenCache.url = redis://redis.example.com:6379 diff --git a/public/index.html b/public/index.html index 695d11c..86a317d 100644 --- a/public/index.html +++ b/public/index.html @@ -1,72 +1,96 @@ - - - - - - - - + + + + + + + - - - - + - - - - - + + - + + + + + + + + - React App - - - -
- + - + + + + + - launch_js.init() + + const tabLabelArray = ["Test Standard", "Test Advanced"]; + + window.runStartupTasks = () => { + // Set up controller for Science Portal Session Launch page + const launch_js = new cadc.web.science.portal.PortalApp({ + baseURL: window.location.origin, + sessionsResourceID: 'ivo://cadc.nrc.ca/skaha', + sessionsStandardID: 'vos://cadc.nrc.ca~vospace/CADC/std/Proc#sessions-1.0', + themeName: 'src', + tabLabels: tabLabelArray, + bannerText: '', + contentBase: 'dev', + headerURLs: { + "ivo://cadc.nrc.ca/groups": "#", + "ivo://cadc.nrc.ca/search": "#", + "ivo://cadc.nrc.ca/acctupdate": "#", + "ivo://cadc.nrc.ca/passchg": "#", + "ivo://cadc.nrc.ca/cred": "#" + } + }) + + launch_js.init() + } + + + + + + diff --git a/src/main/java/org/opencadc/scienceportal/ApplicationConfiguration.java b/src/main/java/org/opencadc/scienceportal/ApplicationConfiguration.java index 35d44d8..14ed83b 100644 --- a/src/main/java/org/opencadc/scienceportal/ApplicationConfiguration.java +++ b/src/main/java/org/opencadc/scienceportal/ApplicationConfiguration.java @@ -92,8 +92,10 @@ public String getTokenCacheURLString() { * @return String array, never null. */ public String[] getTabLabels() { - final String[] tabLabelArray = configuration.getStringArray(ConfigurationKey.TAB_LABELS.propertyName); - if (tabLabelArray == null || tabLabelArray.length == 0) { + final String[] tabLabelArray = Arrays.stream(configuration.getString(ConfigurationKey.TAB_LABELS.propertyName).split(",")) + .map(String::trim) + .toArray(String[]::new); + if (tabLabelArray.length == 0) { throw new IllegalStateException("Configuration property " + ConfigurationKey.TAB_LABELS.propertyName + " is missing" + this.filePath); }