Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: receive request for URL and broadcast url change (#1753)
## Description: as the title says ## Is this change user facing? YES ## References (if applicable): <!-- Add relevant Github Issues, Discord threads, or other helpful information. --> --------- Co-authored-by: Tedi Mitiku <tedi.m52@gmail.com>
- Loading branch information
1 parent
5c4c86d
commit 9b3ef55
Showing
11 changed files
with
73 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
import { isDefined } from "../utils"; | ||
|
||
export const KURTOSIS_EM_DEFAULT_HOST = process.env.REACT_APP_KURTOSIS_DEFAULT_HOST || "localhost"; | ||
// Configurable: | ||
export const KURTOSIS_CLOUD_PROTOCOL = "https"; | ||
export const KURTOSIS_CLOUD_HOST = "cloud.kurtosis.com"; | ||
export const KURTOSIS_CLOUD_CONNECT_PAGE = "connect"; | ||
|
||
// Cloud | ||
export const KURTOSIS_CLOUD_UI_URL = | ||
process.env.REACT_APP_KURTOSIS_CLOUD_UI_URL || `${KURTOSIS_CLOUD_PROTOCOL}://${KURTOSIS_CLOUD_HOST}`; | ||
export const KURTOSIS_CLOUD_CONNECT_URL = `${KURTOSIS_CLOUD_PROTOCOL}://${KURTOSIS_CLOUD_HOST}/${KURTOSIS_CLOUD_CONNECT_PAGE}`; | ||
export const KURTOSIS_PACKAGE_INDEXER_URL = | ||
process.env.REACT_APP_KURTOSIS_PACKAGE_INDEXER_URL || `${KURTOSIS_CLOUD_PROTOCOL}://${KURTOSIS_CLOUD_HOST}:9770`; | ||
|
||
// EM API | ||
export const KURTOSIS_EM_DEFAULT_HOST = process.env.REACT_APP_KURTOSIS_DEFAULT_HOST || "localhost"; | ||
export const KURTOSIS_DEFAULT_EM_API_PORT = isDefined(process.env.REACT_APP_KURTOSIS_DEFAULT_EM_API_PORT) | ||
? parseInt(process.env.REACT_APP_KURTOSIS_DEFAULT_EM_API_PORT) | ||
: 8081; | ||
|
||
export const KURTOSIS_EM_API_DEFAULT_URL = | ||
process.env.REACT_APP_KURTOSIS_DEFAULT_URL || `http://${KURTOSIS_EM_DEFAULT_HOST}:${KURTOSIS_DEFAULT_EM_API_PORT}`; | ||
|
||
export const KURTOSIS_CLOUD_HOST = "cloud.kurtosis.com"; | ||
export const KURTOSIS_CLOUD_CONNECT_PAGE = "connect"; | ||
export const KURTOSIS_CLOUD_UI_URL = process.env.REACT_APP_KURTOSIS_CLOUD_UI_URL || `https://${KURTOSIS_CLOUD_HOST}`; | ||
|
||
export const KURTOSIS_CLOUD_CONNECT_URL = `https://${KURTOSIS_CLOUD_HOST}/${KURTOSIS_CLOUD_CONNECT_PAGE}`; | ||
|
||
export const KURTOSIS_PACKAGE_INDEXER_URL = | ||
process.env.REACT_APP_KURTOSIS_PACKAGE_INDEXER_URL || `https://${KURTOSIS_CLOUD_HOST}:9770`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
enclave-manager/web/src/components/LocationBroadcaster.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useEffect } from "react"; | ||
import { useLocation } from "react-router-dom"; | ||
|
||
export const LocationBroadcaster = () => { | ||
const location = useLocation(); | ||
|
||
useEffect(() => { | ||
const message = { message: "em-ui-location-pathname", value: location.pathname }; | ||
console.log("Broadcasting message to parent", message); | ||
// eslint-disable-next-line no-restricted-globals | ||
parent.postMessage(message, "*"); | ||
}, [location.pathname]); | ||
|
||
return <></>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useEffect } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { useKurtosisClient } from "../client/enclaveManager/KurtosisClientContext"; | ||
|
||
export const LocationListener = () => { | ||
const client = useKurtosisClient(); | ||
const navigate = useNavigate(); | ||
|
||
useEffect(() => { | ||
if (client.getCloudUrl()) { | ||
console.log(client.getParentRequestedRoute()); | ||
const route = client.getParentRequestedRoute(); | ||
if (route) navigate(route); | ||
} | ||
}, [client.getCloudUrl()]); | ||
|
||
return <></>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"files": { | ||
"main.js": "./static/js/main.079973fb.js", | ||
"main.js": "./static/js/main.bb9ebbb3.js", | ||
"index.html": "./index.html", | ||
"main.079973fb.js.map": "./static/js/main.079973fb.js.map" | ||
"main.bb9ebbb3.js.map": "./static/js/main.bb9ebbb3.js.map" | ||
}, | ||
"entrypoints": [ | ||
"static/js/main.079973fb.js" | ||
"static/js/main.bb9ebbb3.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Kurtosis Enclave Manager"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.079973fb.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Kurtosis Enclave Manager"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.bb9ebbb3.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> |
6 changes: 3 additions & 3 deletions
6
.../server/webapp/static/js/main.079973fb.js → .../server/webapp/static/js/main.bb9ebbb3.js
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ver/webapp/static/js/main.079973fb.js.map → ...ver/webapp/static/js/main.bb9ebbb3.js.map
Large diffs are not rendered by default.
Oops, something went wrong.