Skip to content

Commit 35bdbea

Browse files
authored
Merge pull request #1352 from chhsiao1981/PACS-refactoring
refactoring the whole PACS UI.
2 parents 2ba589c + 200f442 commit 35bdbea

Some content is hidden

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

41 files changed

+2327
-1387
lines changed

biome.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.1.2/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.1.3/schema.json",
33
"files": {
4-
"include": [
4+
"includes": [
55
"src/**",
66
"tests/**",
77
"package.json",
@@ -11,10 +11,14 @@
1111
"tsconfig*.json",
1212
"testing/*.mjs"
1313
],
14-
"ignore": ["package-lock.json", "pfdcm/generated"]
14+
"experimentalScannerIgnores": ["package-lock.json", "pfdcm/generated"]
1515
},
16-
"organizeImports": {
17-
"enabled": true
16+
"assist": {
17+
"actions": {
18+
"source": {
19+
"organizeImports": "on"
20+
}
21+
}
1822
},
1923
"formatter": {
2024
"indentWidth": 2,

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,13 @@
8787
"react-dropzone": "^14.2.3",
8888
"react-error-boundary": "^4.0.13",
8989
"react-force-graph-2d": "^1.25.5",
90+
"react-reducer-utils": "^5.1.2",
9091
"react-redux": "^9.1.2",
9192
"react-resizable-panels": "^2.1.4",
9293
"react-responsive": "^10.0.0",
9394
"react-router": "^6.26.2",
9495
"react-router-dom": "^6.26.2",
95-
"react-use-websocket": "^4.8.1",
96+
"react-use-websocket": "^4.13.0",
9697
"redux-saga": "^1.3.0",
9798
"rusha": "^0.8.14",
9899
"sanitize-html": "^2.13.0",
@@ -105,7 +106,7 @@
105106
"yaml": "^2.8.0"
106107
},
107108
"devDependencies": {
108-
"@biomejs/biome": "^1.9.4",
109+
"@biomejs/biome": "^2.1.4",
109110
"@faker-js/faker": "^9.0.1",
110111
"@playwright/test": "^1.46.1",
111112
"@redux-devtools/extension": "^3.3.0",

pnpm-lock.yaml

Lines changed: 60 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/api.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface CallAPI<T> {
1717
filename?: string;
1818
filetext?: string;
1919
apiroot?: string;
20+
isJson?: boolean;
2021
}
2122

2223
interface ApiParams {
@@ -28,6 +29,7 @@ interface ApiParams {
2829
filename?: string;
2930
filetext?: string;
3031
apiroot?: string;
32+
isJson?: boolean;
3133
}
3234

3335
export interface ApiResult<T> {
@@ -86,6 +88,7 @@ const callApi = async <T>(
8688
filename,
8789
filetext: paramsFiletext,
8890
apiroot: paramsAPIRoot,
91+
isJson,
8992
}: ApiParams,
9093
): Promise<ApiResult<T>> => {
9194
const { API_ROOT: CONFIG_API_ROOT } = config;
@@ -97,6 +100,8 @@ const callApi = async <T>(
97100
API_ROOT = API_ROOT.slice(0, API_ROOT.length - 1);
98101
}
99102

103+
console.info("api.api: API_ROOT:", API_ROOT, "paramsAPIRoot:", paramsAPIRoot);
104+
100105
let theEndpoint = endpoint;
101106
if (!theEndpoint.includes(API_ROOT)) {
102107
theEndpoint = `${API_ROOT}${endpoint}`;
@@ -117,7 +122,7 @@ const callApi = async <T>(
117122
Authorization: `Token ${token}`,
118123
};
119124

120-
let body: string | undefined = undefined;
125+
let body: string | undefined;
121126
if (params) {
122127
const paramsStr = queryToString(params);
123128
headers["Content-Type"] = "application/x-www-form-urlencoded";
@@ -135,7 +140,7 @@ const callApi = async <T>(
135140
body,
136141
};
137142

138-
return await fetchCore<T>(theEndpoint, options);
143+
return await fetchCore<T>(theEndpoint, options, isJson);
139144
};
140145

141146
const postFile = async <T>(
@@ -204,8 +209,18 @@ const fetchCore = async <T>(
204209
};
205210

206211
export default <T>(callAPI: CallAPI<T>): Promise<ApiResult<T>> => {
207-
const { endpoint, method, query, params, filename, filetext, json, headers } =
208-
callAPI;
212+
const {
213+
endpoint,
214+
method,
215+
query,
216+
params,
217+
filename,
218+
filetext,
219+
json,
220+
headers,
221+
apiroot,
222+
isJson,
223+
} = callAPI;
209224

210225
return callApi<T>(endpoint, {
211226
method,
@@ -215,5 +230,7 @@ export default <T>(callAPI: CallAPI<T>): Promise<ApiResult<T>> => {
215230
filetext,
216231
json,
217232
headers,
233+
apiroot,
234+
isJson,
218235
});
219236
};

src/api/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const STATUS_OK = 200;
2+
export const STATUS_OK_CREATE = 201;
3+
export const STATUS_OK_EMPTY = 204;

0 commit comments

Comments
 (0)