From 2dbb06f433964ccac13fd64ef512ed03142ed97b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 11 May 2021 16:34:25 +0200 Subject: ui: Move communication to REST API This change removes the socket.io websocket connection/client in favour of the OpenDC REST API. The socket.io websocket implementation was intended to be used for interactive and collaborative datacenter design and exploration. However, we do not support this functionality at the moment (collaborative design and exploration) and having the entire API run over this websocket connection is fragile and not standard practice. To improve maintainability, we therefore remove the websocket implementation in favour of the OpenDC REST API implementation using the fetch API. If we want to implement collaboration in the future, we will develop appropriate extensions in conjuction with the existing REST API. For this, we should look for standard and existing implementation of this functionality. --- opendc-web/opendc-web-ui/package.json | 1 - 1 file changed, 1 deletion(-) (limited to 'opendc-web/opendc-web-ui/package.json') diff --git a/opendc-web/opendc-web-ui/package.json b/opendc-web/opendc-web-ui/package.json index 0a29bcff..61099709 100644 --- a/opendc-web/opendc-web-ui/package.json +++ b/opendc-web/opendc-web-ui/package.json @@ -46,7 +46,6 @@ "redux-saga": "~1.1.3", "redux-thunk": "~2.3.0", "sass": "^1.32.12", - "socket.io-client": "~2.3.0", "svgsaver": "~0.9.0", "uuidv4": "~6.1.1" }, -- cgit v1.2.3 From 4397a959e806bf476be4c81bc804616adf58b969 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 12 May 2021 22:42:12 +0200 Subject: ui: Migrate from CRA to Next.js This change updates the web frontend to use Next.js instead of Create React App (CRA). Next.js enables the possibility of rendering pages on the server side (which reduces the time to first frame) and overall provides a better development experience. Future commits will try to futher optimize the implementation for Next.js. --- opendc-web/opendc-web-ui/package.json | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'opendc-web/opendc-web-ui/package.json') diff --git a/opendc-web/opendc-web-ui/package.json b/opendc-web/opendc-web-ui/package.json index 61099709..f6917398 100644 --- a/opendc-web/opendc-web-ui/package.json +++ b/opendc-web/opendc-web-ui/package.json @@ -16,7 +16,6 @@ "author": "Georgios Andreadis (https://gandreadis.com/)", "license": "MIT", "private": true, - "proxy": "http://localhost:8081", "dependencies": { "@sentry/react": "^5.30.0", "@sentry/tracing": "^5.30.0", @@ -27,6 +26,7 @@ "konva": "~7.2.5", "lint-staged": "~10.2.2", "mathjs": "~7.6.0", + "next": "^10.2.0", "prettier": "~2.0.5", "prop-types": "~15.7.2", "react": "~17.0.2", @@ -36,12 +36,10 @@ "react-hotkeys": "^2.0.0", "react-konva": "~17.0.2-0", "react-redux": "~7.2.0", - "react-router-dom": "~5.1.2", - "react-scripts": "~4.0.3", "reactstrap": "^8.9.0", "recharts": "~2.0.9", "redux": "~4.0.5", - "redux-localstorage": "~0.4.1", + "redux-localstorage": "^0.4.1", "redux-logger": "~3.0.6", "redux-saga": "~1.1.3", "redux-thunk": "~2.3.0", @@ -58,10 +56,9 @@ "scripts": { "format": "prettier --write src", "precommit": "lint-staged", - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test --env=jsdom", - "eject": "react-scripts eject" + "dev": "next dev", + "build": "next build", + "start": "next start" }, "browserslist": { "production": [ -- cgit v1.2.3 From a6865b86cc8d710374fc0b6cfcbd2b863f1942a9 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 16 May 2021 23:18:02 +0200 Subject: ui: Migrate to Auth0 as Identity Provider This change updates the frontend codebase to move away from the Google login and instead use Auth0 as generic Identity Provider. This allows users to login with other accounts as well. Since Auth0 has a free tier, users can experiment themselves with OpenDC locally without having to pay for the login functionality. The code has been written so that we should be able to migrate away from Auth0 once it is not a suitable Identity Provider for OpenDC anymore. --- opendc-web/opendc-web-ui/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'opendc-web/opendc-web-ui/package.json') diff --git a/opendc-web/opendc-web-ui/package.json b/opendc-web/opendc-web-ui/package.json index f6917398..9c41c2e2 100644 --- a/opendc-web/opendc-web-ui/package.json +++ b/opendc-web/opendc-web-ui/package.json @@ -17,6 +17,7 @@ "license": "MIT", "private": true, "dependencies": { + "@auth0/auth0-react": "^1.5.0", "@sentry/react": "^5.30.0", "@sentry/tracing": "^5.30.0", "approximate-number": "~2.0.0", @@ -32,14 +33,12 @@ "react": "~17.0.2", "react-dom": "~17.0.2", "react-fontawesome": "~1.7.1", - "react-google-login": "~5.1.14", "react-hotkeys": "^2.0.0", "react-konva": "~17.0.2-0", "react-redux": "~7.2.0", "reactstrap": "^8.9.0", "recharts": "~2.0.9", "redux": "~4.0.5", - "redux-localstorage": "^0.4.1", "redux-logger": "~3.0.6", "redux-saga": "~1.1.3", "redux-thunk": "~2.3.0", -- cgit v1.2.3 From 53623fad76274e39206b8e073e371775ea96946b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 17 May 2021 12:16:10 +0200 Subject: ui: Migrate to FontAwesome 5 React library This change updates the frontend to use the FontAwesome 5 React library that renders SVG icons as opposed to CSS icon fonts. This migration resolves a couple of issues we had with server-side rendering of the previous FontAwesome icons. --- opendc-web/opendc-web-ui/package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'opendc-web/opendc-web-ui/package.json') diff --git a/opendc-web/opendc-web-ui/package.json b/opendc-web/opendc-web-ui/package.json index 9c41c2e2..ccf87193 100644 --- a/opendc-web/opendc-web-ui/package.json +++ b/opendc-web/opendc-web-ui/package.json @@ -18,6 +18,10 @@ "private": true, "dependencies": { "@auth0/auth0-react": "^1.5.0", + "@fortawesome/fontawesome-svg-core": "^1.2.35", + "@fortawesome/free-brands-svg-icons": "^5.15.3", + "@fortawesome/free-solid-svg-icons": "^5.15.3", + "@fortawesome/react-fontawesome": "^0.1.14", "@sentry/react": "^5.30.0", "@sentry/tracing": "^5.30.0", "approximate-number": "~2.0.0", @@ -32,7 +36,6 @@ "prop-types": "~15.7.2", "react": "~17.0.2", "react-dom": "~17.0.2", - "react-fontawesome": "~1.7.1", "react-hotkeys": "^2.0.0", "react-konva": "~17.0.2-0", "react-redux": "~7.2.0", -- cgit v1.2.3 From ce95cfdf803043e66e2279d0f76c6bfc64e7864e Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 18 May 2021 11:18:11 +0200 Subject: ui: Fix frontend deployment scripts This change fixes the deployment scripts necessary for the frontend and ensures that runtime variables work again. --- opendc-web/opendc-web-ui/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'opendc-web/opendc-web-ui/package.json') diff --git a/opendc-web/opendc-web-ui/package.json b/opendc-web/opendc-web-ui/package.json index ccf87193..52dcf8bf 100644 --- a/opendc-web/opendc-web-ui/package.json +++ b/opendc-web/opendc-web-ui/package.json @@ -60,7 +60,8 @@ "precommit": "lint-staged", "dev": "next dev", "build": "next build", - "start": "next start" + "start": "next start", + "export": "next export -o build" }, "browserslist": { "production": [ -- cgit v1.2.3