Skip to content

Commit

Permalink
93 fix error message when server not available (#103)
Browse files Browse the repository at this point in the history
* [Fix] #93, offline message improvement

* [Task] #93, removed background in status module when no data is present

* [Task] #61, add cut class to map for styling

* [Fix] #93 fix tests, be more specific on url, and let test fail non silently when csrf is not found
  • Loading branch information
Type-Style authored Aug 15, 2024
1 parent 50d8c1d commit 0de8b24
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/client/components/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Map({ entries }: { entries: Models.IEntry[] }) {
<ul>
<li>datapoints: {entries.length - statusData.ignoredEntries}<i>({statusData.ignoredEntries})</i></li>
<li>Ø upload: {statusData.uploadMean}s </li>
<li>Ø speed: GPS: {statusData.speedGPSMean}km/h Calc: {statusData.speedCalcMean == "NaN" ? " - " : statusData.speedCalcMean }km/h </li>
<li>Ø speed: GPS: {statusData.speedGPSMean}km/h Calc: {statusData.speedCalcMean == "NaN" ? " - " : statusData.speedCalcMean}km/h </li>
<li></li>
</ul>
)
Expand Down
4 changes: 4 additions & 0 deletions src/client/css/start.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
position: relative;
z-index: 0;

&.emptyData::after {
content: none;
}

&::after {
content: "";
position: absolute;
Expand Down
4 changes: 2 additions & 2 deletions src/client/pages/Start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ function Start() {
</Button>
</div>

<div className="grid-item map"><Map entries={entries} /></div>
<div className="grid-item map cut"><Map entries={entries} /></div>
<div className="grid-item theme"><ModeSwitcher /></div>
<div className="grid-item status cut-after"><Status entries={entries} /></div>
<div className={`grid-item status ${entries.length ? "cut-after" : 'emptyData'}`}><Status entries={entries} /></div>
<div className="grid-item images">
<div className="image">image1</div>
<div className="image">image2</div>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Login', () => {
try {
response = await axios({
method: "post",
url: "/login/csrf",
url: "http://localhost:80/login/csrf",
headers: {
"content-type": "application/x-www-form-urlencoded",
"x-requested-with": "XMLHttpRequest"
Expand All @@ -34,6 +34,7 @@ describe('Login', () => {
serverStatus = response.status;
} catch (error) {
console.error(error);
throw Error("fail");
}


Expand Down Expand Up @@ -79,7 +80,8 @@ describe('Login', () => {

it('test invalid credentials to return error', async () => {
try {
userDataWithToken.csrfToken = csrfToken
userDataWithToken.csrfToken = csrfToken;
console.log("csrfToken %o", userDataWithToken.csrfToken);
await axios.post('http://localhost:80/login', qs.stringify(userDataWithToken));
} catch (error) {
const axiosError = error as AxiosError;
Expand Down

0 comments on commit 0de8b24

Please sign in to comment.