Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit be6099e

Browse files
authored
format all files (#197)
* prettier --config .prettierrc --write "src/**/*.jsx" * update snapshots
1 parent 166d231 commit be6099e

File tree

77 files changed

+1842
-1306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1842
-1306
lines changed

src/__tests__/__snapshots__/storybook.test.ts.snap

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ Array [
282282
>
283283
Show all (
284284
3
285-
)
285+
)
286+
286287
</button>
287288
</div>
288289
</div>,
@@ -292,7 +293,8 @@ Array [
292293
<div
293294
className="w-100 text-warning row"
294295
>
295-
Some files or folders need to be renamed, because their name is invalid or you have not the permission to overwrite them
296+
Some files or folders need to be renamed, because their name is invalid or you have not the permission to overwrite them
297+
296298
</div>
297299
<div
298300
className="w-100 justify-content-between row"
@@ -522,7 +524,8 @@ exports[`Storyshots Footer default 1`] = `
522524
src="github.svg"
523525
/>
524526
</a>
525-
is made with &lt;3 by
527+
528+
is made with &lt;3 by
526529
</span>
527530
<div
528531
className="d-flex justify-content-around"

src/__tests__/storybook.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import initStoryshots from '@storybook/addon-storyshots';
2-
initStoryshots();
1+
import initStoryshots from "@storybook/addon-storyshots";
2+
initStoryshots();

src/assets/images/icons/reactSvgIcons/SymbolFile.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ export function FileEarmarkImageIcon(props: React.SVGProps<SVGSVGElement>) {
8383
fillRule="evenodd"
8484
d="M12 16a2 2 0 002-2V4.5L9.5 0H4a2 2 0 00-2 2v12a2 2 0 002 2h8zM3 2a1 1 0 011-1h5.5v2A1.5 1.5 0 0011 4.5h2V10l-2.083-2.083a.5.5 0 00-.76.063L8 11 5.835 9.7a.5.5 0 00-.611.076L3 12V2z"
8585
/>
86-
<path fillRule="evenodd" d="M6.502 7a1.5 1.5 0 100-3 1.5 1.5 0 000 3z" />
86+
<path
87+
fillRule="evenodd"
88+
d="M6.502 7a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"
89+
/>
8790
</svg>
8891
);
8992
}
@@ -199,8 +202,6 @@ export function FileEarmarkBinaryIcon(props: React.SVGProps<SVGSVGElement>) {
199202
);
200203
}
201204

202-
203-
204205
//--------------------------------------------------------------------\\
205206
//--------------------------------------------------------------------\\
206207
//--------------------------------------------------------------------\\
@@ -224,4 +225,4 @@ export function FolderIcon(props: React.SVGProps<SVGSVGElement>) {
224225
/>
225226
</svg>
226227
);
227-
}
228+
}

src/background/api/api.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@ export const userPath: string = "/v1/users";
88
export const filesystemPath: string = "/v1/filesystem/";
99

1010
enum DataIntegrity {
11-
STABLE = "bg-success",
12-
POSSIBLE_RISK = "bg-warning",
13-
UNSTABLE = "bg-danger"
11+
STABLE = "bg-success",
12+
POSSIBLE_RISK = "bg-warning",
13+
UNSTABLE = "bg-danger"
1414
}
1515

1616
interface SystemHealthData {
17-
uptimeInSeconds: number;
18-
userCount: number;
19-
dataIntegrity: string;
20-
deployment: string;
21-
usedStorageInBytes: number;
22-
version: string;
17+
uptimeInSeconds: number;
18+
userCount: number;
19+
dataIntegrity: string;
20+
deployment: string;
21+
usedStorageInBytes: number;
22+
version: string;
2323
}
2424

2525
function callBackendHealth(): Promise<SystemHealthData> {
26-
return new Promise((resolve, reject) => {
27-
Axios.get(`${hostname}/health`)
28-
.then((data) => {
29-
resolve(data.data);
30-
})
31-
.catch((error) => {
32-
reject(error);
33-
});
34-
});
26+
return new Promise((resolve, reject) => {
27+
Axios.get(`${hostname}/health`)
28+
.then((data) => {
29+
resolve(data.data);
30+
})
31+
.catch((error) => {
32+
reject(error);
33+
});
34+
});
3535
}
3636

3737
export { callBackendHealth, DataIntegrity };

src/background/api/auth.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
import Axios, {AxiosResponse} from "axios";
1+
import Axios, { AxiosResponse } from "axios";
22

3-
import {hostname, userPath} from "./api";
3+
import { hostname, userPath } from "./api";
44

5-
import {UserState} from "../redux/actions/userTypes";
5+
import { UserState } from "../redux/actions/userTypes";
66
import store from "../redux/store";
7-
import {addAccessToken, addRefreshToken, checkedCookies, removeTokens} from "../redux/actions/tokens";
8-
import {AccessToken, CookieStatus} from "../redux/actions/tokenTypes";
9-
import {deleteCookie, getCookie, setCookie} from "../methods/cookies";
10-
import {updateUser} from "../redux/actions/user";
11-
import {hashPassword} from "../methods/passwords";
7+
import {
8+
addAccessToken,
9+
addRefreshToken,
10+
checkedCookies,
11+
removeTokens
12+
} from "../redux/actions/tokens";
13+
import { AccessToken, CookieStatus } from "../redux/actions/tokenTypes";
14+
import { deleteCookie, getCookie, setCookie } from "../methods/cookies";
15+
import { updateUser } from "../redux/actions/user";
16+
import { hashPassword } from "../methods/passwords";
1217

1318
// reference: https://daveceddia.com/access-redux-store-outside-react/
1419

@@ -34,7 +39,6 @@ export const checkForCookie = () => {
3439
store.dispatch(addRefreshToken(refreshTokenCookieValue));
3540
store.dispatch(checkedCookies(CookieStatus.LOADING));
3641
getAccessTokenWithRefreshToken();
37-
3842
};
3943

4044
export const loginWithUsernameAndPassword = async (
@@ -51,7 +55,10 @@ export const loginWithUsernameAndPassword = async (
5155
}
5256
};
5357

54-
return Axios.get<BackendLoginData>(hostname + userPath + "/login", config)
58+
return Axios.get<BackendLoginData>(
59+
hostname + userPath + "/login",
60+
config
61+
)
5562
.then((data: AxiosResponse<BackendLoginData>) => {
5663
console.log(data.data);
5764
store.dispatch(addRefreshToken(data.data.tokenValue));
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
export interface UsersSet {
2-
groups: string[];
3-
id: number;
4-
username: string;
2+
groups: string[];
3+
id: number;
4+
username: string;
55
}
66

77
export interface PermissionSet {
8-
editableForGroups: string[];
9-
editableForUsers: UsersSet[];
10-
visibleForGroups: string[];
11-
visibleForUsers: UsersSet[];
8+
editableForGroups: string[];
9+
editableForUsers: UsersSet[];
10+
visibleForGroups: string[];
11+
visibleForUsers: UsersSet[];
1212
}
1313

1414
export interface User {
15-
userId: number;
16-
username: string;
17-
groups: string[];
15+
userId: number;
16+
username: string;
17+
groups: string[];
1818
}
1919

2020
export interface FsEntity {
21-
owner: User;
22-
lastUpdatedBy: User;
23-
fileSystemId: number;
24-
lastUpdated: number;
25-
name: string;
26-
path: string;
27-
shared: boolean;
28-
size: number;
29-
type: string;
30-
mimeType:string;
21+
owner: User;
22+
lastUpdatedBy: User;
23+
fileSystemId: number;
24+
lastUpdated: number;
25+
name: string;
26+
path: string;
27+
shared: boolean;
28+
size: number;
29+
type: string;
30+
mimeType: string;
3131
}

src/background/api/registration.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import Axios, {AxiosError, AxiosResponse} from "axios";
2-
import {hostname, userPath} from "./api";
3-
import {hashPassword} from "../methods/passwords";
1+
import Axios, { AxiosError, AxiosResponse } from "axios";
2+
import { hostname, userPath } from "./api";
3+
import { hashPassword } from "../methods/passwords";
44

55
export interface IRegisterServerResponse {
6-
httpStatus: number,
7-
httpMessage: string
8-
outputMessage?: string
6+
httpStatus: number;
7+
httpMessage: string;
8+
outputMessage?: string;
99
}
1010

11-
export const registerNewUser = async (username: string, password: string, passwordConfirmation: string): Promise<IRegisterServerResponse> => {
12-
13-
if (password !== passwordConfirmation){
11+
export const registerNewUser = async (
12+
username: string,
13+
password: string,
14+
passwordConfirmation: string
15+
): Promise<IRegisterServerResponse> => {
16+
if (password !== passwordConfirmation) {
1417
throw new Error("Password did not match passwordConfirmation");
1518
}
1619
let hashedPassword = await hashPassword(password);
@@ -20,29 +23,28 @@ export const registerNewUser = async (username: string, password: string, passwo
2023
username: username,
2124
password: hashedPassword,
2225
confirmationPassword: hashedPassword
23-
}
24-
26+
};
2527

26-
return Axios.post(hostname + userPath + '/register', newUser)
28+
return Axios.post(hostname + userPath + "/register", newUser)
2729
.then((data: AxiosResponse<object>) => {
28-
console.log(data)
30+
console.log(data);
2931
const response: IRegisterServerResponse = {
3032
httpStatus: data.status,
3133
httpMessage: data.statusText
32-
}
34+
};
3335
if (data.status === 201) {
34-
response.outputMessage = "User was successfully created."
36+
response.outputMessage = "User was successfully created.";
3537
}
3638
resolve(response);
3739
})
3840
.catch((error: AxiosError) => {
39-
console.log(error.response)
41+
console.log(error.response);
4042
const response: IRegisterServerResponse = {
4143
httpStatus: error.response!.status,
4244
httpMessage: error.response!.statusText,
4345
outputMessage: error.response!.data.message
44-
}
46+
};
4547
reject(response);
46-
})
47-
})
48-
}
48+
});
49+
});
50+
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export function notMinStrLength(text: string, minAnz: number): boolean {
2-
return text.length < minAnz;
2+
return text.length < minAnz;
33
}
44

55
export function biggerMaxStrLength(text: string, maxAnz: number): boolean {
6-
return text.length > maxAnz;
6+
return text.length > maxAnz;
77
}

src/background/methods/cookies.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
export function getCookie(cname:string) {
1+
export function getCookie(cname: string) {
22
let name = cname + "=";
33
let decodedCookie = decodeURIComponent(document.cookie);
4-
let ca = decodedCookie.split(';');
5-
for(let i = 0; i <ca.length; i++) {
4+
let ca = decodedCookie.split(";");
5+
for (let i = 0; i < ca.length; i++) {
66
let c = ca[i];
7-
while (c.charAt(0) === ' ') {
7+
while (c.charAt(0) === " ") {
88
c = c.substring(1);
99
}
1010
if (c.indexOf(name) === 0) {
@@ -14,15 +14,14 @@ export function getCookie(cname:string) {
1414
return "";
1515
}
1616

17-
18-
export function setCookie(cname:string, cvalue:string, exdays:number) {
17+
export function setCookie(cname: string, cvalue: string, exdays: number) {
1918
let d = new Date();
20-
d.setTime(d.getTime() + (exdays*24*60*60*1000));
21-
let expires = "expires="+ d.toUTCString();
19+
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
20+
let expires = "expires=" + d.toUTCString();
2221
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
2322
}
2423

25-
26-
export function deleteCookie(cname:string){
27-
document.cookie = cname+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
24+
export function deleteCookie(cname: string) {
25+
document.cookie =
26+
cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
2827
}
Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
export function formatBytes(bytes:number, decimals:number = 2):string {
2-
if (bytes === 0) return '0 Bytes';
1+
export function formatBytes(bytes: number, decimals: number = 2): string {
2+
if (bytes === 0) return "0 Bytes";
33

4-
const k:number = 1024;
5-
const dm:number = decimals < 0 ? 0 : decimals;
6-
const sizes:string[] = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
4+
const k: number = 1024;
5+
const dm: number = decimals < 0 ? 0 : decimals;
6+
const sizes: string[] = [
7+
"Bytes",
8+
"KB",
9+
"MB",
10+
"GB",
11+
"TB",
12+
"PB",
13+
"EB",
14+
"ZB",
15+
"YB"
16+
];
717

8-
const i:number = Math.floor(Math.log(bytes) / Math.log(k));
18+
const i: number = Math.floor(Math.log(bytes) / Math.log(k));
919

10-
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
11-
}
20+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
21+
}

0 commit comments

Comments
 (0)