Skip to content

Commit 11f7207

Browse files
Disable dsoDelegateInactiveTimeout in request creation (#1860)
Signed-off-by: Julien Tinguely <[email protected]>
1 parent 9541cbc commit 11f7207

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

apps/common/frontend/utils/src/JsonEditor.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import { JSONObject } from './JsonType';
1212
interface JsonEditorProps {
1313
data: JSONObject;
1414
onChange: (updatedJson: JSONObject) => void;
15+
disabledKeys?: string[];
1516
}
1617

17-
export const JsonEditor: React.FC<JsonEditorProps> = ({ data, onChange }) => {
18+
export const JsonEditor: React.FC<JsonEditorProps> = ({ data, onChange, disabledKeys }) => {
1819
const handleValueChange = (key: string, rawInputValue: string) => {
1920
const value = rawInputValue === '' ? null : rawInputValue;
2021
const keys = key.split('.');
@@ -53,6 +54,7 @@ export const JsonEditor: React.FC<JsonEditorProps> = ({ data, onChange }) => {
5354
data-testid={nestedKey + '-value'}
5455
style={{ textAlign: 'right' }}
5556
onChange={e => handleValueChange(nestedKey, e.target.value)}
57+
disabled={disabledKeys?.includes(nestedKey)}
5658
/>
5759
}
5860
</TableCell>

apps/sv/frontend/src/__tests__/sv.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ describe('An SetConfig request', () => {
7575

7676
expect(await screen.findByText('numUnclaimedRewardsThreshold')).toBeDefined();
7777
expect(await screen.findByDisplayValue('10')).toBeDefined();
78+
expect(
79+
screen.getByTestId('dsoDelegateInactiveTimeout.microseconds-value').hasAttribute('disabled')
80+
).toBe(true);
7881
});
7982

8083
test(

apps/sv/frontend/src/components/votes/actions/SetDsoRulesConfig.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ const SetDsoRulesConfig: React.FC<{
154154
<Stack direction="column" mb={4} spacing={1}>
155155
<Typography variant="h6">Configuration</Typography>
156156
<FormControl sx={{ marginRight: '32px', flexGrow: '1' }}>
157-
<JsonEditor data={configuration} onChange={setDsoRulesConfigAction} />
157+
<JsonEditor
158+
data={configuration}
159+
onChange={setDsoRulesConfigAction}
160+
disabledKeys={['dsoDelegateInactiveTimeout.microseconds']}
161+
/>
158162
<FormControlLabel
159163
control={
160164
<Checkbox

0 commit comments

Comments
 (0)