summaryrefslogtreecommitdiff
path: root/frontend/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-10-28 11:38:11 +0100
committerGitHub <noreply@github.com>2020-10-28 11:38:11 +0100
commitbb03ab6a934eaf29cea86e877c4b2024f068dd1c (patch)
tree761afe2c0f26a44d75cb12f87c31c1ecc08105f9 /frontend/src
parent38fc6fa35ca4545a6068aaa759359c271c9f5197 (diff)
parentb2cb04229766457c9eb784d1911192bceea3a032 (diff)
Merge pull request #51 from atlarge-research/build/migration
Migrate opendc.org to OpenDC v2
Diffstat (limited to 'frontend/src')
-rw-r--r--frontend/src/api/routes/token-signin.js11
-rw-r--r--frontend/src/api/socket.js6
-rw-r--r--frontend/src/components/home/ModelingSection.js2
-rw-r--r--frontend/src/components/home/SimulationSection.js2
4 files changed, 14 insertions, 7 deletions
diff --git a/frontend/src/api/routes/token-signin.js b/frontend/src/api/routes/token-signin.js
index 7553d043..d6cff570 100644
--- a/frontend/src/api/routes/token-signin.js
+++ b/frontend/src/api/routes/token-signin.js
@@ -1,5 +1,10 @@
export function performTokenSignIn(token) {
- return new Promise((resolve) => {
- window['jQuery'].post('/tokensignin', { idtoken: token }, (data) => resolve(data))
- })
+ const apiUrl = process.env.REACT_APP_API_BASE_URL || ''
+
+ return fetch(`${apiUrl}/tokensignin`, {
+ method: 'POST',
+ body: new URLSearchParams({
+ idtoken: token,
+ }),
+ }).then((res) => res.json())
}
diff --git a/frontend/src/api/socket.js b/frontend/src/api/socket.js
index 96034021..1c432167 100644
--- a/frontend/src/api/socket.js
+++ b/frontend/src/api/socket.js
@@ -6,9 +6,11 @@ let requestIdCounter = 0
const callbacks = {}
export function setupSocketConnection(onConnect) {
- const apiUrl = process.env.REACT_APP_API_URL || window.location.hostname + ':' + window.location.port
+ const apiUrl =
+ process.env.REACT_APP_API_BASE_URL ||
+ `${window.location.protocol}//${window.location.hostname}:${window.location.port}`
- socket = io.connect(window.location.protocol + '//' + apiUrl)
+ socket = io.connect(apiUrl)
socket.on('connect', onConnect)
socket.on('response', onSocketResponse)
}
diff --git a/frontend/src/components/home/ModelingSection.js b/frontend/src/components/home/ModelingSection.js
index 60d372f2..643dca65 100644
--- a/frontend/src/components/home/ModelingSection.js
+++ b/frontend/src/components/home/ModelingSection.js
@@ -5,7 +5,7 @@ const ModelingSection = () => (
<ScreenshotSection
name="modeling"
title="Datacenter Modeling"
- imageUrl="https://github.com/atlarge-research/opendc/raw/master/images/opendc-frontend-construction.PNG"
+ imageUrl="/img/screenshot-construction.png"
caption="Building a datacenter in OpenDC"
imageIsRight={true}
>
diff --git a/frontend/src/components/home/SimulationSection.js b/frontend/src/components/home/SimulationSection.js
index 9852cbb8..e7a02068 100644
--- a/frontend/src/components/home/SimulationSection.js
+++ b/frontend/src/components/home/SimulationSection.js
@@ -5,7 +5,7 @@ const ModelingSection = () => (
<ScreenshotSection
name="simulation"
title="Datacenter Simulation"
- imageUrl="https://github.com/atlarge-research/opendc/raw/master/images/opendc-frontend-simulation-zoom.PNG"
+ imageUrl="/img/screenshot-simulation-zoom.png"
caption="Running an experiment in OpenDC"
imageIsRight={false}
>