Setup environment vars for staging and production (#99)

* CEC-371 Car ECU display (#79)

* Merge Development (#53)

* Use responsive iframe control for charts (#49)

* Use responsive iframe control to charts

* Move external Grafana link to Dashboard page

* Remove unused embedded style class

* Add button label

* added delete button to deploy packages

* Fix unit test warning
Remove unused route from test

* Fix styling of button

* minor fixes per pr review

Co-authored-by: jcw-fisker <jwatson@fiskerinc.com>
Co-authored-by: John Cotten Watson <83605808+jcw-fisker@users.noreply.github.com>

* Development Merge (#57)

* CEC-287 Car connection status (#59) (#60)

* Car connection status

* Formatting

* Merge Development (#64)

* Add connection status to vehicles page

* ConnectedIcon control

* Handle Style

* Development (#67)

* preliminary map for vehicles

* weird zoom bug

* passing react tests

* fixing warnings and updating snapshots

* update node environment to 14

* addressing comments by changing variable types and adding styles to home page title

* adding CODEOWNERS file

* fixing token error

* CEC-371 Update car ECUs display (#78)

* Clean up className styles
Update car status page to show update and ECUs

* Add update ecu version button
Show all ECUs on car status page
Only show car ecus for search

Co-authored-by: jcw-fisker <jwatson@fiskerinc.com>
Co-authored-by: John Cotten Watson <83605808+jcw-fisker@users.noreply.github.com>
Co-authored-by: Drew Taylor <69828061+drew-fisker@users.noreply.github.com>

* CEC-394 Car update log (#81)

* CEC-394 Car update status control

* Remove Datadog RUM
Remove package update components
Move control components into Controls folder
Add Car update status page

* Display update status log
Clean up unused update package code

* Remove console.logs

* no vars

* adding timestamp to vehicle popup

* modifying vehicle data query

* removing extraneous code

* removing console log

* Clean up SonarCloud warnings (#83)

* Clean up SonarCloud warnings

* Bogus security warning

* Fix another warning

* Fix unauthorized locations request

* Fix update progress control

* CEC-563 New manifest format (#88)

* Add ManifestCreateContext
Update create manifest page

* Finish UI changes and API integration

* Fixes

* Fix test

* Remove manifest ECU file version and type

* Fixes

* Add manifest ecu file type control

* Fix Sonar warnings

* Fix test

* Update codeowners

* Formatting

* CEC-553 Change file type to string (#90)

* CEC-553 File type uses string enum

* Fix test timeout

* Fix

* Clean up (#95)

* Clean up
Mock missing methods

* Smell

* Setup environment vars

* fix

* Load env file
Remove env var default values

* Dockerfile requires environment value
Do not need dev Dockerfile

* Github Actions pipeline + git flow (#100)

* test workflow

* oops

* latest slack action for custom message

* this works

Co-authored-by: jcw-fisker <jwatson@fiskerinc.com>
Co-authored-by: John Cotten Watson <83605808+jcw-fisker@users.noreply.github.com>
Co-authored-by: Drew Taylor <69828061+drew-fisker@users.noreply.github.com>
Co-authored-by: Drew Taylor <dtaylor@fiskerinc.com>
Co-authored-by: Rafi Greenberg <72412693+rafi-fisker@users.noreply.github.com>
This commit is contained in:
John Wu
2021-11-03 17:50:17 -07:00
committed by GitHub
parent ec3a31a15a
commit 16c3e2902b
21 changed files with 249 additions and 171 deletions

View File

@@ -1,5 +1,5 @@
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL || "https://gw-dev.fiskerdps.com/compute_auth";
const CALLBACK_URL = process.env.REACT_APP_AUTH_CALLBACK_URL || "";
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL;
const CALLBACK_URL = process.env.REACT_APP_AUTH_CALLBACK_URL;
let signInResponse = {};
let verifyResponse = {};
@@ -15,7 +15,13 @@ export default {
signIn: async (username, password) => logResponse(signInResponse),
verify: async (idToken) => logResponse(verifyResponse),
refresh: async (refreshToken) => logResponse(refreshResponse),
setSignInResponse: (value) => { signInResponse = value; },
setVerifyResponse: (value) => { verifyResponse = value; },
setRefreshResponse: (value) => { refreshResponse = value; },
}
setSignInResponse: (value) => {
signInResponse = value;
},
setVerifyResponse: (value) => {
verifyResponse = value;
},
setRefreshResponse: (value) => {
refreshResponse = value;
},
};

View File

@@ -1,37 +1,40 @@
import { fetchRespHandler } from "../utils/http";
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL || "https://gw-dev.fiskerdps.com/compute_auth";
const CALLBACK_URL = process.env.REACT_APP_AUTH_CALLBACK_URL || "https://dev-ota-admin.fiskerdps.com";
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL;
const CALLBACK_URL = process.env.REACT_APP_AUTH_CALLBACK_URL;
const auth = {
ssoAuthorize: () => `${AUTH_URL}/authorize?redirect=${CALLBACK_URL}`,
ssoLogout: () => `${AUTH_URL}/logout?redirect=${CALLBACK_URL}`,
signIn: (code) => fetch(`${AUTH_URL}/token`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
code,
redirect: CALLBACK_URL,
})
}).then(fetchRespHandler),
signIn: (code) =>
fetch(`${AUTH_URL}/token`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
code,
redirect: CALLBACK_URL,
}),
}).then(fetchRespHandler),
verify: (idToken) => fetch(`${AUTH_URL}/verify`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ token: idToken })
}).then(fetchRespHandler),
verify: (idToken) =>
fetch(`${AUTH_URL}/verify`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ token: idToken }),
}).then(fetchRespHandler),
refresh: (refreshToken) => fetch(`${AUTH_URL}/refresh`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ refresh_token: refreshToken })
}).then(fetchRespHandler),
refresh: (refreshToken) =>
fetch(`${AUTH_URL}/refresh`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ refresh_token: refreshToken }),
}).then(fetchRespHandler),
};
export default auth;

View File

@@ -4,9 +4,7 @@ import {
addQueryParams,
} from "../utils/http";
const API_ENDPOINT =
process.env.REACT_APP_UPLOAD_SERVICE_URL ||
"https://gw-dev.fiskerdps.com/ota_update";
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL;
const manifestsAPI = {
deleteManifest: async (manifest_id, token) =>

View File

@@ -1,49 +1,64 @@
import { getAuthHeaderOptions, fetchRespHandler, addQueryParams } from "../utils/http";
import {
getAuthHeaderOptions,
fetchRespHandler,
addQueryParams,
} from "../utils/http";
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL || "https://gw-dev.fiskerdps.com/ota_update";
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL;
const updatesAPI = {
createCarUpdates: async (data, token) => fetch(`${API_ENDPOINT}/carupdate`, {
method: "POST",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
body: JSON.stringify(data),
})
.then(fetchRespHandler),
createCarUpdates: async (data, token) =>
fetch(`${API_ENDPOINT}/carupdate`, {
method: "POST",
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
body: JSON.stringify(data),
}).then(fetchRespHandler),
getCarUpdateLog: async (query, token) => {
const u = addQueryParams(`${API_ENDPOINT}/carupdateslog`, query);
return fetch(u, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler);
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
}).then(fetchRespHandler);
},
getCarUpdateProgress: async (carupdateids, token) => {
const u = `${API_ENDPOINT}/carupdatesstatuses?carupdateids=${carupdateids}`;
return fetch(u, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler);
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
}).then(fetchRespHandler);
},
getCarUpdates: async (search, token) => {
const u = addQueryParams(`${API_ENDPOINT}/carupdates`, search);
return fetch(u, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler);
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
}).then(fetchRespHandler);
},
getVINUpdates: async (vin, token) => {
const u = addQueryParams(`${API_ENDPOINT}/carupdates`, { vin });
return fetch(u, {
method: "GET",
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
})
.then(fetchRespHandler);
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
}).then(fetchRespHandler);
},
};

View File

@@ -1,12 +1,12 @@
import axios from 'axios';
import axios from "axios";
const UPLOAD_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL || "https://gw-dev.fiskerdps.com/ota_update";
const UPLOAD_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL;
const fileField = "file";
export const getCancelToken = () => {
const token = axios.CancelToken;
return token.source();
}
};
export const uploadFile = (data, token, onProgress, cancelToken) => {
const form = new FormData();
@@ -14,18 +14,18 @@ export const uploadFile = (data, token, onProgress, cancelToken) => {
method: "POST",
headers: {
"Content-Type": "multipart/form-data",
"Authorization": `Bearer ${token}`,
Authorization: `Bearer ${token}`,
},
cancelToken,
};
if (onProgress) {
options = {
options = {
...options,
onUploadProgress: (event) => {
onProgress(event.loaded / event.total);
}
}
},
};
}
for (let key in data) {
@@ -34,7 +34,8 @@ export const uploadFile = (data, token, onProgress, cancelToken) => {
form.append(fileField, data[fileField]);
return axios.post(`${UPLOAD_ENDPOINT}/manifestfile`, form, options)
return axios
.post(`${UPLOAD_ENDPOINT}/manifestfile`, form, options)
.then((response) => response.data)
.catch((error) => {
if (typeof error.response.data === "string") {

View File

@@ -4,9 +4,7 @@ import {
addQueryParams,
} from "../utils/http";
const API_ENDPOINT =
process.env.REACT_APP_UPLOAD_SERVICE_URL ||
"https://gw-dev.fiskerdps.com/ota_update";
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL;
const vehiclesAPI = {
addVehicle: async (vehicle, token) =>