From 90b8c3cf8070352c5249ec3de1a861e03540ecc1 Mon Sep 17 00:00:00 2001 From: Ryan Kilpadi <47367209+rkilpadi@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:21:48 -0400 Subject: [PATCH] Add option for private PCUI deployment (#251) * Move ApiGateway from HTTP to REST * Configure routing for new stage 'pcui' * Add VpcEndpointId parameter to conditionally make PCUI API private --- api/PclusterApiHandler.py | 2 +- app.py | 1 + frontend/next.config.js | 3 +- frontend/public/favicon.ico | Bin 15406 -> 0 bytes frontend/src/components/ErrorBoundary.tsx | 2 +- frontend/src/components/NoMatch.tsx | 2 +- frontend/src/components/SideBar.tsx | 2 +- frontend/src/components/TopBar.tsx | 6 +- frontend/src/http/executeRequest.tsx | 2 +- .../src/old-pages/Configure/Queues/Queues.tsx | 4 +- frontend/src/pages/_app.tsx | 7 +- frontend/src/pages/_document.tsx | 2 +- frontend/src/pages/index.tsx | 2 +- infrastructure/parallelcluster-ui.yaml | 168 ++++++++++++++---- 14 files changed, 154 insertions(+), 49 deletions(-) delete mode 100644 frontend/public/favicon.ico diff --git a/api/PclusterApiHandler.py b/api/PclusterApiHandler.py index cb885d9b..737c81e9 100644 --- a/api/PclusterApiHandler.py +++ b/api/PclusterApiHandler.py @@ -657,7 +657,7 @@ def login(): id_token = code_resp.json().get("id_token") refresh_token = code_resp.json().get("refresh_token", None) - resp = redirect("/index.html", code=302) + resp = redirect("/pcui/index.html", code=302) resp.set_cookie("accessToken", access_token, httponly=True, secure=True, samesite="Lax") resp.set_cookie("idToken", id_token, httponly=True, secure=True, samesite="Lax") if refresh_token is not None: diff --git a/app.py b/app.py index 0ce904b1..17e38e46 100644 --- a/app.py +++ b/app.py @@ -69,6 +69,7 @@ def default(self, obj): def run(): app = utils.build_flask_app(__name__) + app.config["APPLICATION_ROOT"] = '/pcui' app.json_encoder = PClusterJSONEncoder app.url_map.converters["regex"] = RegexConverter CSRF(app, CognitoFingerprintGenerator(CLIENT_ID, CLIENT_SECRET, USER_POOL_ID)) diff --git a/frontend/next.config.js b/frontend/next.config.js index 4482fd6a..e796ecad 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -11,6 +11,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + basePath: '/pcui', experimental: { images: { unoptimized: true, @@ -47,4 +48,4 @@ const withTM = require("next-transpile-modules")([ "@cloudscape-design/design-tokens" ]); -module.exports = withTM(nextConfig); \ No newline at end of file +module.exports = withTM(nextConfig); diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico deleted file mode 100644 index 8435131c2201cb9fced41d7d9cfe8c587694ac9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15406 zcmeHN32>Fw75=j)CO`;T2}@WK0wiRS?1-|2&9DZ-9zcjnSkpitDj4=HKnMh}R&?6h zYHh3Csa2=bnWAI09i^7(YVBgJTg6(dqB;G(^YTC5p7$UL$@FFB&Y$=HcRBamv)%I@ z!w4{fjOb_s&lKa%V8h5a3?n7Q@;kk+VVuRg?CiGhX@+q=&M?x^2SYHz@*WS@fA@B@iQ4;XYoA`beklX1PD%2e4@hwH`;xff5$iXT_whB~ zlE{4*E${F9Ok(TKNxyARNw3|%(m6wq{Zj_s-Xi_0ACkWH&!C_E9+IoiI?c)b4yimK z#u@v*Tr240zwP?>25(JT_>4ICM_ntv=G)R|=W{mewMz2ZFG;}ZPwo20ZvDRYPg!|b zd7Xf9#+lD_T=d;P(=mw~zlP_7`rURd{!gB8&g8WZV4jC1X8Y52^K%aYIQszb#&Ilv z$J9S9eRiCer1f9c?@2fZSN%M`!x^S7s+WX~kLr1O?CVBn0$V^|PkVmyo7+tm~z$JcRYn!QOw~X7f8Yrf|7F{N?baJCzqoM<>b@ z`A?r1x$jkNX$$Lg|McxSlV)1@;O+YGYhg$Js{W4gMa=e}XsqFB4}+>s%E-Cv+FG@w zmv55D{TC(h)JHz8AK3Dd3|@0W#!OozLo4^m;8l$>bop+{ytPu&7HyY^Lw~{<+s6*{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L=CHydM=?j`@O=)Wu@%QqnRQ6hP$m#}U5 zB_*gK+$O=eBRig3_xWwfr7&0Es;QrIh { } private redirectToHomepage = () => { - window.location.href = '/' + window.location.href = '/pcui' } public static getDerivedStateFromError(_: Error): State { diff --git a/frontend/src/components/NoMatch.tsx b/frontend/src/components/NoMatch.tsx index 598743c7..e75e4c34 100644 --- a/frontend/src/components/NoMatch.tsx +++ b/frontend/src/components/NoMatch.tsx @@ -38,7 +38,7 @@ export function NoMatch() {

{t('noMatch.links')}

  • - {t('noMatch.home')} + {t('noMatch.home')}
diff --git a/frontend/src/components/SideBar.tsx b/frontend/src/components/SideBar.tsx index 1c7376b9..b4a6ae60 100644 --- a/frontend/src/components/SideBar.tsx +++ b/frontend/src/components/SideBar.tsx @@ -41,7 +41,7 @@ export default function SideBar() { { type: 'link', text: t('global.menu.viewLicense'), - href: '/license.txt', + href: '/pcui/license.txt', external: true, }, ] diff --git a/frontend/src/components/TopBar.tsx b/frontend/src/components/TopBar.tsx index 93e991f4..144ab011 100644 --- a/frontend/src/components/TopBar.tsx +++ b/frontend/src/components/TopBar.tsx @@ -135,7 +135,7 @@ export default function Topbar() { { id: 'signout', text: t('global.topBar.signOut'), - href: '/logout', + href: '/pcui/logout', }, ], [t], @@ -146,9 +146,9 @@ export default function Topbar() { { window.editor = window.ace.edit('editor') - window.ace.config.set('basePath', '/third-party/ace-1.4.13/') + window.ace.config.set('basePath', '/pcui/third-party/ace-1.4.13/') window.ace.config.set('loadWorkerFromBlob', false) window.ace.config.set('showFoldWidgets', false) window.ace.config.set('showPrintMargin', false) @@ -75,7 +75,10 @@ function App({Component, pageProps}: AppProps) {
-