Skip to content

Commit 12cb2ab

Browse files
authored
refactor collapse usage (appium#2128)
1 parent 5538c15 commit 12cb2ab

File tree

3 files changed

+71
-54
lines changed

3 files changed

+71
-54
lines changed

app/common/renderer/components/Inspector/Commands.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ const Commands = (props) => {
142142
</Col>
143143
))}
144144
</Row>
145-
<Collapse>
146-
{_.toPairs(COMMAND_DEFINITIONS).map(([commandGroup, commands]) => (
147-
<Collapse.Panel header={t(commandGroup)} key={commandGroup}>
145+
<Collapse
146+
items={_.toPairs(COMMAND_DEFINITIONS).map(([commandGroup, commands]) => ({
147+
key: commandGroup,
148+
label: t(commandGroup),
149+
children: (
148150
<Row>
149151
{_.toPairs(commands).map(
150152
([commandName, command], index) =>
@@ -167,9 +169,9 @@ const Commands = (props) => {
167169
),
168170
)}
169171
</Row>
170-
</Collapse.Panel>
171-
))}
172-
</Collapse>
172+
),
173+
}))}
174+
/>
173175
</Space>
174176
{!!pendingCommand && (
175177
<Modal

app/common/renderer/components/Inspector/SavedGestures.jsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,21 @@ const SavedGestures = (props) => {
175175
<p>
176176
<i>{t('unableToUploadGestureFiles')}</i>
177177
</p>
178-
<Collapse ghost defaultActiveKey={Object.keys(gestureUploadErrors)}>
179-
{Object.keys(gestureUploadErrors).map((errorFile) => (
180-
<Collapse.Panel header={<b>{errorFile}</b>} key={errorFile}>
178+
<Collapse
179+
ghost
180+
defaultActiveKey={Object.keys(gestureUploadErrors)}
181+
items={Object.keys(gestureUploadErrors).map((errorFile) => ({
182+
key: errorFile,
183+
label: <b>{errorFile}</b>,
184+
children: (
181185
<ol>
182186
{gestureUploadErrors[errorFile].map((error, index) => (
183187
<li key={errorFile + index.toString()}>{error}</li>
184188
))}
185189
</ol>
186-
</Collapse.Panel>
187-
))}
188-
</Collapse>
190+
),
191+
}))}
192+
/>
189193
</Modal>
190194
);
191195

app/common/renderer/components/Session/AdvancedServerParams.jsx

Lines changed: 53 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,59 @@ const AdvancedServerParams = ({server, setServerParam, serverType, t}) => (
77
<Row gutter={8}>
88
<Col className={styles.advancedSettingsContainerCol}>
99
<div className={styles.advancedSettingsContainer}>
10-
<Collapse bordered={true}>
11-
<Collapse.Panel header={t('Advanced Settings')}>
12-
<Row>
13-
{serverType !== 'lambdatest' && (
14-
<Col span={7}>
15-
<Form.Item>
16-
<Checkbox
17-
checked={!!server.advanced.allowUnauthorized}
18-
onChange={(e) =>
19-
setServerParam('allowUnauthorized', e.target.checked, SERVER_TYPES.ADVANCED)
20-
}
21-
>
22-
{t('allowUnauthorizedCerts')}
23-
</Checkbox>
24-
</Form.Item>
25-
</Col>
26-
)}
27-
<Col span={5} align="right">
28-
<Form.Item>
29-
<Checkbox
30-
checked={!!server.advanced.useProxy}
31-
onChange={(e) =>
32-
setServerParam('useProxy', e.target.checked, SERVER_TYPES.ADVANCED)
33-
}
34-
>
35-
{t('Use Proxy')}
36-
</Checkbox>
37-
</Form.Item>
38-
</Col>
39-
<Col span={8}>
40-
<Form.Item>
41-
<Input
42-
disabled={!server.advanced.useProxy}
43-
onChange={(e) => setServerParam('proxy', e.target.value, SERVER_TYPES.ADVANCED)}
44-
placeholder={t('Proxy URL')}
45-
value={server.advanced.proxy}
46-
/>
47-
</Form.Item>
48-
</Col>
49-
</Row>
50-
</Collapse.Panel>
51-
</Collapse>
10+
<Collapse
11+
items={[
12+
{
13+
label: t('Advanced Settings'),
14+
children: (
15+
<Row>
16+
{serverType !== 'lambdatest' && (
17+
<Col span={7}>
18+
<Form.Item>
19+
<Checkbox
20+
checked={!!server.advanced.allowUnauthorized}
21+
onChange={(e) =>
22+
setServerParam(
23+
'allowUnauthorized',
24+
e.target.checked,
25+
SERVER_TYPES.ADVANCED,
26+
)
27+
}
28+
>
29+
{t('allowUnauthorizedCerts')}
30+
</Checkbox>
31+
</Form.Item>
32+
</Col>
33+
)}
34+
<Col span={5} align="right">
35+
<Form.Item>
36+
<Checkbox
37+
checked={!!server.advanced.useProxy}
38+
onChange={(e) =>
39+
setServerParam('useProxy', e.target.checked, SERVER_TYPES.ADVANCED)
40+
}
41+
>
42+
{t('Use Proxy')}
43+
</Checkbox>
44+
</Form.Item>
45+
</Col>
46+
<Col span={8}>
47+
<Form.Item>
48+
<Input
49+
disabled={!server.advanced.useProxy}
50+
onChange={(e) =>
51+
setServerParam('proxy', e.target.value, SERVER_TYPES.ADVANCED)
52+
}
53+
placeholder={t('Proxy URL')}
54+
value={server.advanced.proxy}
55+
/>
56+
</Form.Item>
57+
</Col>
58+
</Row>
59+
),
60+
},
61+
]}
62+
/>
5263
</div>
5364
</Col>
5465
</Row>

0 commit comments

Comments
 (0)