Skip to content

Commit

Permalink
Merge pull request #65 from at88mph/SP-3544
Browse files Browse the repository at this point in the history
Sp 3544
  • Loading branch information
at88mph authored Jun 13, 2024
2 parents f493866 + 3033cc9 commit 4597eff
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 40 deletions.
16 changes: 16 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG JAVA_VERSION=11

FROM gradle:7-jdk${JAVA_VERSION} as builder

RUN apt update \
&& apt install -y rsync xz-utils

ADD https://nodejs.org/dist/v18.18.0/node-v18.18.0-linux-x64.tar.xz /tmp/

RUN cd /tmp/ \
&& tar xvf node-v18.18.0-linux-x64.tar.xz \
&& rsync -arvc node-v18.18.0-linux-x64/* /usr/local/

FROM gradle:7-jdk${JAVA_VERSION}

COPY --from=builder /usr/local/ /usr/local/
17 changes: 7 additions & 10 deletions public/dev/js/science_portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
// Nothing happens if user is not authenticated, so no other page
// load information is done until this call comes back (see onAuthenticated event below)
// onAuthenticated event triggered if everything is OK.
portalCore.checkAuthentication(_selfPortalApp.isDev)
portalCore.checkAuthentication()
}

function attachListeners() {
Expand Down Expand Up @@ -224,7 +224,7 @@
portalSessions.loadPlatformUsage(_selfPortalApp.handlePlatformUsage)
}

function handleSessionActionError(e, request) {
function handleSessionActionError(_e, request) {
portalCore.setAjaxFail(portalCore.pageSections.sessionList, request)
}

Expand All @@ -247,11 +247,9 @@
}

function populateSessionList(sessionData) {
var $sessionListDiv = $("#sp_session_list")

if (JSON.stringify(sessionData) === "[]") {
// Pass list to the react app portion for rendering
var sessDataObj = {
const sessDataObj = {
"listType" : "empty",
"sessData" : []
}
Expand All @@ -260,13 +258,13 @@

// Build new list
// Assuming a list of sessions is provided, with connect url, name, type
var newSessionList = new Array()
const newSessionList = []
$(sessionData).each(function () {

var mapEntry = portalForm.getMapEntry(this.type)
// Check to see if there are any items in the sessionType_map that
// may override the defaults
var iconSrc= _selfPortalApp.baseURL + "/science-portal/images/"
var iconSrc = _selfPortalApp.baseURL + "/science-portal/images/"
if (mapEntry != null) {
if (typeof mapEntry.portal_icon != "undefined") {
iconSrc += mapEntry.portal_icon
Expand All @@ -281,7 +279,7 @@
}
}

var nextSessionItem = {
const nextSessionItem = {
"id" : this.id,
"name" : this.name,
"status": this.status,
Expand All @@ -308,11 +306,10 @@

// Add to the list
newSessionList.push(nextSessionItem)

})

// Pass list to the react app portion for rendering
var sessDataObj = {
const sessDataObj = {
"listType" : "list",
"sessData" : newSessionList
}
Expand Down
30 changes: 1 addition & 29 deletions public/dev/js/science_portal_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,7 @@

// ------------ Authentication functions ------------

function checkAuthentication(isDev) {
// From cadc.user.js. Listens for when user logs in
// _selfPortalCore.userManager.subscribe(cadc.web.events.onUserLoad,
// function (_event, data) {
// // Check to see if user is logged in or not
// if (typeof(data.error) !== "undefined") {
function checkAuthentication() {
fetch(baseURL + cadc.web.science.portal.core.userInfoEndpoint)
.then((response) => {
if (!response.ok) {
Expand All @@ -377,29 +372,6 @@
}).catch((error) => {
console.warn(error)
})
// hideModal()
// var userState = {
// loginHandler : portalLogin.handleLoginRequest
// }
// _rApp.setNotAuthenticated(userState)
// } else {
// // Don't directly access react app from here so this
// // function can be connected to the portalLogin
// // cadc.web.science.portal.login.events.onAuthenticateOK event as well.
// // That event is fired after the login form is submitted.
// setAuthenticated()
// }
// })

// if (isDev === true) {
// _selfPortalCore.userManager.user = {name: "dev user"}
// setAuthenticated()
// } else {
// // Call the whoami endpoint to get the user details
// // if they are not logged in, same event is thrown, return payload
// // needs to be checked
// _selfPortalCore.userManager.loadCurrent()
// }
}

function setAuthenticated() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.reg.Standards;
import ca.nrc.cadc.reg.client.RegistryClient;
import ca.nrc.cadc.util.StringUtil;
import org.opencadc.scienceportal.ApplicationConfiguration;
import org.opencadc.scienceportal.SciencePortalAuthGetAction;

Expand All @@ -82,7 +83,13 @@ public class GetAction extends SciencePortalAuthGetAction {

@Override
protected String getEndpoint() {
return GetAction.SESSION_ENDPOINT;
final String path = this.syncInput.getPath();
if (StringUtil.hasText(path)) {
final String trimPath = path.trim();
return GetAction.SESSION_ENDPOINT + (trimPath.startsWith("/") ? path : "/" + path);
} else {
return GetAction.SESSION_ENDPOINT;
}
}

@Override
Expand Down

0 comments on commit 4597eff

Please sign in to comment.