From e51450426e8c8d887f45c423c31d142ae2d78bca Mon Sep 17 00:00:00 2001 From: John Wu <76966357+jwu-fisker@users.noreply.github.com> Date: Fri, 30 Apr 2021 15:55:27 -0700 Subject: [PATCH] Merge Development to Main (#36) * Fix sign up form bug * Add run.sh to run setup and run web app * Output node version * Update readme with run.sh * Fix file upload form to handle ota_update service * Enable file upload form Enable error boundary to catch React errors (#7) Fix warning for link noreferrer Include authorization header with file upload * Remove default localhost settings (#8) * Remove default localhost settings Replace with deployment settings * Fix for upload data format * Fix test data for last commit * Fix json link format and remove localhost default settings (#10) * Remove default localhost settings Replace with deployment settings * Fix for upload data format * Fix test data for last commit * Fix link data format * Fix link json again (#12) Use id token instead of access token * nginx things * Web Worker Sign Out and Use Go API (#13) * Calculate checksum and send with file upload * Limit file upload and display rejected file error * Add sign in timeout * Check auth token structure before setting Clean up * Use web worker timer to sign out Remove checksum Point to Go ota update * Remove checksum dependency * Use compute auth service and fix static code analyzer warnings (#15) * Clean up formatting * Use new compute_auth service Implment SSO Implement token refresh Clean up unit tests * Fix unit tests * Fix auth test Fix warnings * Update default settings for compute_auth * Change main UI layout and add VINs to add and upload forms (#16) * Add new upload update package form Add new add vehicle form Add new side menu layout Add new toolbar layout Update and add unit tests * Enable add get and add vehicles * Integration issues with ota_update service * Update get vehicle JSON format * Fix related unit test Add release notes field * Add StatusContext to display error and status messages * Handle api error json (#18) * Handle api error json * Fix get vehicles error handling Update .env.template * Fix signout refresh (#20) * Merge to main (#17) * Fix sign up form bug * Add run.sh to run setup and run web app * Output node version * Update readme with run.sh * Fix file upload form to handle ota_update service * Enable file upload form Enable error boundary to catch React errors (#7) Fix warning for link noreferrer Include authorization header with file upload * Remove default localhost settings (#8) * Remove default localhost settings Replace with deployment settings * Fix for upload data format * Fix test data for last commit * Fix json link format and remove localhost default settings (#10) * Remove default localhost settings Replace with deployment settings * Fix for upload data format * Fix test data for last commit * Fix link data format * Fix link json again (#12) Use id token instead of access token * nginx things * Web Worker Sign Out and Use Go API (#13) * Calculate checksum and send with file upload * Limit file upload and display rejected file error * Add sign in timeout * Check auth token structure before setting Clean up * Use web worker timer to sign out Remove checksum Point to Go ota update * Remove checksum dependency * Use compute auth service and fix static code analyzer warnings (#15) * Clean up formatting * Use new compute_auth service Implment SSO Implement token refresh Clean up unit tests * Fix unit tests * Fix auth test Fix warnings * Update default settings for compute_auth * Change main UI layout and add VINs to add and upload forms (#16) * Add new upload update package form Add new add vehicle form Add new side menu layout Add new toolbar layout Update and add unit tests * Enable add get and add vehicles * Integration issues with ota_update service * Update get vehicle JSON format * Fix related unit test Add release notes field * Add StatusContext to display error and status messages * Handle api error json (#18) * Handle api error json * Fix get vehicles error handling Update .env.template Co-authored-by: Rafi Greenberg * Fix sign out and refresh * Check for bad json Co-authored-by: Rafi Greenberg * Add role checks (#21) * Add role checks * Remove moved Roles enum * Add package updates, car updates, and vehicle screens (#25) * Car table update (#27) * Add Datadog RUM (#28) * fix run.sh * Add updates by car screen and modal popup (#29) * CEC-180 Cache Control (#30) * Set cache expire to 1 day Add snapshot tests for new screens * Fix table pagniation random ids for snapshot tests * Auto reload on chunk load error * OTA Admin Portal => Admin Portal * CEC-179 Car download progress (#32) * Display download progress * Change default * Fix * Fix * Update readme * Update readme and defaults Fix Dockerfile * CEC-179 Car update progress build fix (#33) * Display download progress * Change default * Fix * Fix * Update readme * Update readme and defaults Fix Dockerfile * Fix build * Undo Docker changes (#34) Co-authored-by: Rafi Greenberg Co-authored-by: Roger Standridge --- .env.template | 6 +- README.md | 17 +- src/components/App/App.test.js | 14 +- .../App/__snapshots__/App.test.js.snap | 3874 ++++++++--------- src/components/CarUpdates/Deploy/index.jsx | 11 +- src/components/CarUpdates/Status/index.jsx | 30 +- src/components/Cars/List/index.jsx | 2 +- src/components/Contexts/FileUploadContext.jsx | 15 +- .../Contexts/FileUploadContext.test.jsx | 12 +- src/components/Contexts/UpdatesContext.jsx | 84 + .../Contexts/__mocks__/UpdatesContext.jsx | 2 + src/components/Layouts/SideMenu.jsx | 4 +- .../__snapshots__/SideMenu.test.jsx.snap | 4 +- .../Create/__snapshots__/Create.test.js.snap | 24 +- .../UpdatePackages/Create/index.jsx | 21 +- src/components/UpdatePackages/Edit/index.jsx | 2 +- src/components/UpdatePackages/List/index.jsx | 4 +- src/services/__mocks__/updates.js | 8 +- src/services/updates.js | 9 + 19 files changed, 2138 insertions(+), 2005 deletions(-) diff --git a/.env.template b/.env.template index 86292db..e3ba686 100644 --- a/.env.template +++ b/.env.template @@ -1,3 +1,3 @@ -REACT_APP_AUTH_SERVICE_URL = https://dev-auth.fiskerdps.com -REACT_APP_UPLOAD_SERVICE_URL = https://gw-dev.fiskerdps.com -REACT_APP_AUTH_CALLBACK_URL = https://dev-ota-admin.fiskerdps.com/ \ No newline at end of file +REACT_APP_AUTH_SERVICE_URL = http://localhost/compute_auth +REACT_APP_UPLOAD_SERVICE_URL = http://localhost/ota_update +REACT_APP_AUTH_CALLBACK_URL = http://localhost:3000 \ No newline at end of file diff --git a/README.md b/README.md index b97dc56..f9c3bd2 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,23 @@ # Fisker Admin Portal -Front-end web application for administarting OTA services +Front-end web application for administrating services # Setup -Run `./run.sh` from the terminal or +Running locally 1. Install Node 12 2. Run `npm install` -3. Setup environment variables listed in .env.template -4. Or copy .env.template to .env -5. Edit .env with the service urls for authentication and api services +3. Copy .env.template to .env and edit the service urls for authentication and api services +4. Run `./run.sh` from the terminal +5. Access portal at localhost:3000 + +Running Docker container + +1. Copy .env.template to .env and edit the service urls for authentication and api services +2. Build the image `docker build -t fiskerinc/portal .` +3. Start the container `docker run -p 3000:80 fiskerinc/portal` +4. Access portal at localhost:3000 ## Available Scripts diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index 7e442ed..f819255 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -59,12 +59,6 @@ describe("App", () => { await check("/package-upload", "span.MuiButton-label", "Sign In"); }); - it("Route /package-upload unauthenticated", async () => { - const container = await renderRoute("/package-upload"); - expect(container.querySelector("span.MuiButton-label").innerHTML).toEqual("Sign In"); - expect(container).toMatchSnapshot(); - }); - it("Route /vehicle-add unauthenticated", async () => { await check("/vehicle-add", "span.MuiButton-label", "Sign In"); }); @@ -105,7 +99,7 @@ describe("App", () => { it("Route /package-upload authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/package-upload", "h1", "Upload Update Package"); + await check("/package-upload", "h1", "Create Update Package"); }); it("Route /vehicle-add authenticated", async () => { @@ -115,17 +109,17 @@ describe("App", () => { it("Route /updates authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/updates", "h1", "Updates"); + await check("/updates", "h1", "Update Packages"); }); it("Route /update authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/update/1", "h1", "Update Package 1"); + await check("/update/1", "h1", "Edit Update Package 1"); }); it("Route /carupdate-deploy authenticated", async () => { setToken(TEST_AUTH_OBJECT); - await check("/carupdate-deploy/1", "h1", "[1] "); + await check("/carupdate-deploy/1", "h1", "Deploy [1]"); }); it("Route /carupdate-status authenticated", async () => { diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 9201060..e01a2c4 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -6,17 +6,17 @@ exports[`App Route / authenticated 1`] = ` data-testid="mocked-userprovider" >
- Create Updates + Create Packages

+
+
+
+
+ +
+ Fisker OTA Portal +
+ +
+
+ +
+
+
+
+
+
+

+ Deploy + [1] +

+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+