Skip to content

Commit 048104a

Browse files
committed
fic eslint and fix icons version
1 parent b6985ef commit 048104a

File tree

13 files changed

+109
-99
lines changed

13 files changed

+109
-99
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"builder": "REACT_APP_VERSION=$npm_package_version react-app-rewired --max_old_space_size=4096 build",
1212
"test": "react-app-rewired test",
1313
"eject": "react-scripts eject",
14-
"build": "./dockerfile/build.sh simulator",
14+
"build": "cross-env ./dockerfile/build.sh simulator",
1515
"test-travis": "echo \"No test specified\"",
1616
"start:server": "node ./server/server.js",
1717
"storybook": "NODE_PATH=src/ start-storybook --port 9001",
@@ -33,7 +33,7 @@
3333
]
3434
},
3535
"dependencies": {
36-
"@ant-design/icons": "^5.3.6",
36+
"@ant-design/icons": "^5.3.7",
3737
"@apollo/client": "^3.10.1",
3838
"ansi-to-html": "^0.7.2",
3939
"apexcharts": "^3.37.0",

src/Routes/SidebarRight/AddPipeline/Wizard.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,15 @@ const Wizard = ({
143143

144144
const isLastStep = stepIdx === steps.length - 1;
145145

146-
const onPrevious = useCallback(() => setStepIdx(state => state - 1), [
147-
setStepIdx,
148-
]);
146+
const onPrevious = useCallback(
147+
() => setStepIdx(state => state - 1),
148+
[setStepIdx]
149+
);
149150

150-
const onNext = useCallback(() => setStepIdx(state => state + 1), [
151-
setStepIdx,
152-
]);
151+
const onNext = useCallback(
152+
() => setStepIdx(state => state + 1),
153+
[setStepIdx]
154+
);
153155

154156
useEffect(() => {
155157
setIsStreamingPipeline(
@@ -183,6 +185,7 @@ const Wizard = ({
183185

184186
return (
185187
<context.Provider
188+
// eslint-disable-next-line react/jsx-no-constructed-context-values
186189
value={{
187190
form,
188191
stepIdx,

src/Routes/SidebarRight/ErrorLogs/index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React, { useEffect, useState, useCallback, useMemo } from 'react';
2-
32
import { useLocation, useNavigate } from 'react-router-dom';
4-
// import { useErrorLogs } from 'hooks';
53
import { useErrorLogs } from 'hooks/graphql';
64
import { Table } from 'components';
75
import { JsonSwitch, Card } from 'components/common';
@@ -18,6 +16,13 @@ const expandedRowRender = record => (
1816

1917
const extractId = ({ id }) => id;
2018

19+
const expandIcon = ({ expanded, onExpand, record }) =>
20+
expanded ? (
21+
<DownOutlined onClick={e => onExpand(record, e)} />
22+
) : (
23+
<RightOutlined onClick={e => onExpand(record, e)} />
24+
);
25+
2126
const ErrorLogsTable = () => {
2227
const { dataSource, clearCounter } = useErrorLogs();
2328
const [errorLogsFilterList, setErrorLogsFilterList] = useState();
@@ -94,13 +99,7 @@ const ErrorLogsTable = () => {
9499
dataSource={errorLogsFilterList}
95100
expandable={{
96101
expandedRowRender,
97-
// eslint-disable-next-line react/prop-types
98-
expandIcon: ({ expanded, onExpand, record }) =>
99-
expanded ? (
100-
<DownOutlined onClick={e => onExpand(record, e)} />
101-
) : (
102-
<RightOutlined onClick={e => onExpand(record, e)} />
103-
),
102+
expandIcon,
104103
}}
105104
/>
106105
</>

src/Routes/Tables/Algorithms/Tabs/Builds/getColumns.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ const StartTime = startTime => (
1919
const Status = status => <BaseTag status={status}>{status}</BaseTag>;
2020

2121
const RenderProgress = (_, record) => {
22-
const failed = record.status === PIPELINE_STATUS.FAILED;
23-
const progress = (record.progress && parseInt(record.progress, 10)) || 0;
22+
const { status, progress } = record;
23+
const failed = status === PIPELINE_STATUS.FAILED;
24+
const progressBar = (progress && parseInt(progress, 10)) || 0;
2425
return (
2526
<Progress
26-
percent={progress}
27-
status={failed ? 'exception' : progress === 100 ? 'success' : 'active'}
27+
percent={progressBar}
28+
status={failed ? 'exception' : progressBar === 100 ? 'success' : 'active'}
2829
strokeColor={failed ? COLOR_TASK_STATUS.failed : undefined}
2930
/>
3031
);

src/Routes/Tables/Algorithms/Tabs/Builds/index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ const Builds = ({ builds, isOpenFirstLog }) => {
6666
<Tabs items={TabsItemsJson(record)} />
6767
</Card>
6868
);
69-
69+
const expandIcon = ({ expanded, onExpand, record }) =>
70+
expanded ? (
71+
<DownOutlined onClick={e => onExpand(record, e)} />
72+
) : (
73+
<RightOutlined onClick={e => onExpand(record, e)} />
74+
);
7075
return (
7176
<Table
7277
rowKey={record => record.buildId}
@@ -75,13 +80,7 @@ const Builds = ({ builds, isOpenFirstLog }) => {
7580
expandable={{
7681
defaultExpandedRowKeys: isOpenFirstLog ? [builds[0].buildId] : [],
7782
expandedRowRender,
78-
// eslint-disable-next-line react/prop-types
79-
expandIcon: ({ expanded, onExpand, record }) =>
80-
expanded ? (
81-
<DownOutlined onClick={e => onExpand(record, e)} />
82-
) : (
83-
<RightOutlined onClick={e => onExpand(record, e)} />
84-
),
83+
expandIcon,
8584
}}
8685
/>
8786
);

src/Routes/Tables/Algorithms/Tabs/Versions/VersionsTable.react.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ const rowKey = ({ version }) => version;
1515

1616
const VersionsTable = ({ currentVersion, onApply, onDelete, dataSource }) => {
1717
const columns = getVersionsColumns({ currentVersion, onApply, onDelete });
18-
18+
const expandIcon = ({ expanded, onExpand, record }) =>
19+
expanded ? (
20+
<DownOutlined onClick={e => onExpand(record, e)} />
21+
) : (
22+
<RightOutlined onClick={e => onExpand(record, e)} />
23+
);
1924
return (
2025
<Table
2126
rowKey={rowKey}
@@ -24,13 +29,7 @@ const VersionsTable = ({ currentVersion, onApply, onDelete, dataSource }) => {
2429
columns={columns}
2530
expandable={{
2631
expandedRowRender: record => expandedRowRender(record),
27-
// eslint-disable-next-line react/prop-types
28-
expandIcon: ({ expanded, onExpand, record }) =>
29-
expanded ? (
30-
<DownOutlined onClick={e => onExpand(record, e)} />
31-
) : (
32-
<RightOutlined onClick={e => onExpand(record, e)} />
33-
),
32+
expandIcon,
3433
}}
3534
/>
3635
);

src/Routes/Tables/Drivers/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ const DriversTable = () => {
4747
const filtered = useFilter(collection, ['podName', 'jobs']);
4848
const filterValue = useSelector(selectors.autoCompleteFilter);
4949

50+
const expandIcon = ({ expanded, onExpand, record }) =>
51+
expanded ? (
52+
<DownOutlined onClick={e => onExpand(record, e)} />
53+
) : (
54+
<RightOutlined onClick={e => onExpand(record, e)} />
55+
);
56+
5057
return (
5158
<Table
5259
rowKey={record => record.driverId}
5360
columns={driversTableColumns}
5461
dataSource={filtered}
5562
expandable={{
5663
expandedRowRender: ExpandedRow(collection, filterValue),
57-
58-
// eslint-disable-next-line react/prop-types
59-
expandIcon: ({ expanded, onExpand, record }) =>
60-
expanded ? (
61-
<DownOutlined onClick={e => onExpand(record, e)} />
62-
) : (
63-
<RightOutlined onClick={e => onExpand(record, e)} />
64-
),
64+
expandIcon,
6565
}}
6666
/>
6767
);

src/Routes/Tables/Jobs/GraphTab/NodeInputOutput/getColumns.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable react/destructuring-assignment */
2+
/* eslint-disable jsx-a11y/control-has-associated-label */
13
import React, { useMemo } from 'react';
24
import Moment from 'react-moment';
35
import { Ellipsis } from 'components/common';
@@ -31,6 +33,7 @@ export const TitleStatus = (
3133
{!isShowOneRow &&
3234
Object.keys(record).map(
3335
keyStatus =>
36+
// eslint-disable-next-line react/destructuring-assignment
3437
record[keyStatus] > 0 &&
3538
keyStatus !== TASK_STATUS.SUCCEED && (
3639
<BaseTag
@@ -50,14 +53,16 @@ export const TitleStatus = (
5053
)}
5154
</>
5255
);
53-
const Status = record => (
54-
<BaseTag
55-
status={record.status}
56-
colorMap={COLOR_TASK_STATUS}
57-
isError={record?.error}>
58-
{record.status}
59-
</BaseTag>
60-
);
56+
const Status = record => {
57+
const { status, error } = record;
58+
59+
return (
60+
<BaseTag status={status} colorMap={COLOR_TASK_STATUS} isError={error}>
61+
{status}
62+
</BaseTag>
63+
);
64+
};
65+
6166
const StartTime = startTime =>
6267
startTime ? (
6368
<Moment style={{ fontSize: '12px' }} format="DD/MM/YY HH:mm:ss">
@@ -68,19 +73,19 @@ const StartTime = startTime =>
6873
);
6974
const sortByStartTime = (a, b) => sorter(a.startTime, b.startTime);
7075

71-
const Duration = (_, record) =>
72-
record.startTime ? (
76+
const Duration = (_, record) => {
77+
const { startTime, endTime } = record;
78+
return startTime ? (
7379
<Ellipsis ellipsis length={20} style={{ fontSize: '12px' }}>
7480
{humanizeDuration(
75-
record.endTime
76-
? record.endTime - record.startTime
77-
: Date.now() - record.startTime,
81+
endTime ? endTime - startTime : Date.now() - startTime,
7882
{ maxDecimalPoints: 2 }
7983
)}
8084
</Ellipsis>
8185
) : (
8286
<Tag style={{ width: '4ch', textAlign: 'center' }}>-</Tag>
8387
);
88+
};
8489

8590
const Retries = retries => <Tag>{retries}</Tag>;
8691

src/Routes/Tables/Jobs/GraphTab/NodeInputOutput/index.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ const NodeInputOutput = ({
6666
[algorithm?.downloadFileExt, payload]
6767
);
6868

69-
const statusCount = useMemo(() => countByKey(dataSource, 'status'), [
70-
dataSource,
71-
]);
69+
const statusCount = useMemo(
70+
() => countByKey(dataSource, 'status'),
71+
[dataSource]
72+
);
7273

7374
const tableColumns = useMemo(() => {
7475
const cols = getColumns(
@@ -123,6 +124,20 @@ const NodeInputOutput = ({
123124
useEffect(() => {
124125
onFilterStatus(saveStatusArray);
125126
}, [dataSource]);
127+
128+
const expandedRowRender = record => (
129+
<Card>
130+
<JsonSwitch obj={removeNullUndefinedCleanDeep(record)} />
131+
</Card>
132+
);
133+
134+
const expandIcon = ({ expanded, onExpand, record }) =>
135+
expanded ? (
136+
<DownOutlined onClick={e => onExpand(record, e)} />
137+
) : (
138+
<RightOutlined onClick={e => onExpand(record, e)} />
139+
);
140+
126141
return (
127142
<>
128143
<FilterByStatusTable
@@ -149,24 +164,13 @@ const NodeInputOutput = ({
149164
expandable={
150165
!modeSelect && {
151166
defaultExpandAllRows: isShowOneRow,
152-
expandedRowRender: record => (
153-
<Card>
154-
<JsonSwitch obj={removeNullUndefinedCleanDeep(record)} />
155-
</Card>
156-
),
157-
// eslint-disable-next-line react/prop-types
158-
expandIcon: ({ expanded, onExpand, record }) =>
159-
expanded ? (
160-
<DownOutlined onClick={e => onExpand(record, e)} />
161-
) : (
162-
<RightOutlined onClick={e => onExpand(record, e)} />
163-
),
167+
expandedRowRender,
168+
expandIcon,
164169
}
165170
}
166171
onRow={record =>
167172
modeSelect && {
168173
onClick: () => {
169-
// eslint-disable-next-line react/prop-types
170174
const { taskId } = record;
171175
setCurrentTask(taskId);
172176
},

src/Routes/Tables/QueueOrderJobsV2/QueueOrderComponents/TypeRow.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import { TypeTable } from 'const';
33
import { StarTwoTone } from '@ant-design/icons';
44
import { Tooltip } from 'antd';
55

6-
export const TypeRow = obj =>
7-
obj.type === TypeTable.PREFERRED ? (
6+
export const TypeRow = obj => {
7+
const { type } = obj;
8+
type === TypeTable.PREFERRED ? (
89
<Tooltip title="Preferred">
910
<StarTwoTone style={{ fontSize: '19px' }} />
1011
</Tooltip>
1112
) : (
1213
''
1314
);
15+
};
1416

1517
export default TypeRow;

0 commit comments

Comments
 (0)