Skip to content

Commit 234ef0b

Browse files
committed
Fix modals for 4.22
1 parent e20c430 commit 234ef0b

10 files changed

Lines changed: 355 additions & 438 deletions

locales/en/plugin__lightspeed-console-plugin.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"Cancelled": "Cancelled",
1616
"Changes you made may not be saved.": "Changes you made may not be saved.",
1717
"Clear chat": "Clear chat",
18-
"Close": "Close",
1918
"Collapse": "Collapse",
2019
"Compressed in {{seconds}} seconds": "Compressed in {{seconds}} seconds",
2120
"Compressing history...": "Compressing history...",
@@ -115,7 +114,7 @@
115114
"The following output was generated when running <2>{{name}}</2> with arguments <5>{{argsFormatted}}</5>.": "The following output was generated when running <2>{{name}}</2> with arguments <5>{{argsFormatted}}</5>.",
116115
"The following output was generated when running <2>{{name}}</2> with no arguments.": "The following output was generated when running <2>{{name}}</2> with no arguments.",
117116
"The OpenShift Lightspeed service is not yet ready to receive requests. If this message persists, please check the OLSConfig.": "The OpenShift Lightspeed service is not yet ready to receive requests. If this message persists, please check the OLSConfig.",
118-
"The tool <1>{{name}}</1> was requested with arguments <3>{{argsFormatted}}</3> but was rejected.": "The tool <1>{{name}}</1> was requested with arguments <3>{{argsFormatted}}</3> but was rejected.",
117+
"The tool <1>{{name}}</1> was requested with arguments <4>{{argsFormatted}}</4> but was rejected.": "The tool <1>{{name}}</1> was requested with arguments <4>{{argsFormatted}}</4> but was rejected.",
119118
"The tool <1>{{name}}</1> was requested with no arguments but was rejected.": "The tool <1>{{name}}</1> was requested with no arguments but was rejected.",
120119
"Tool call rejected": "Tool call rejected",
121120
"Tool output": "Tool output",

package-lock.json

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

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"react": "18.3.1",
3737
"react-dom": "18.3.1",
3838
"react-i18next": "16.5.8",
39-
"react-modal": "^3.16.3",
4039
"react-redux": "9.2.0",
4140
"react-router": "7.13.1",
4241
"style-loader": "^4.0.0",

src/components/AttachEventsModal.tsx

Lines changed: 59 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import {
1414
FormGroup,
1515
HelperText,
1616
HelperTextItem,
17+
Modal,
18+
ModalBody,
19+
ModalHeader,
1720
Slider,
1821
SliderOnChangeEvent,
1922
Spinner,
@@ -28,7 +31,6 @@ import {
2831
} from '../redux-actions';
2932
import { State } from '../redux-reducers';
3033
import CopyAction from './CopyAction';
31-
import Modal from './Modal';
3234

3335
const DEFAULT_MAX_EVENTS = 10;
3436

@@ -128,60 +130,63 @@ const AttachEventsModal: React.FC<Props> = ({ isOpen, kind, name, namespace, onC
128130
);
129131

130132
return (
131-
<Modal isOpen={isOpen} onClose={onClose} title={t('Configure events attachment')}>
132-
<Content component="p">
133-
{t(
134-
'You can specify the most recent number of events from this resource to include as an attachment for detailed troubleshooting and analysis.',
135-
)}
136-
</Content>
137-
<Form>
138-
{isLoading && <Spinner size="md" />}
139-
{!isLoading &&
140-
(events.length === 0 ? (
141-
<HelperText>
142-
<HelperTextItem>{t('No events')}</HelperTextItem>
143-
</HelperText>
144-
) : (
145-
<>
146-
<FormGroup label={t('Most recent {{numEvents}} events', { numEvents })}>
147-
<Slider
148-
max={events.length}
149-
min={1}
150-
onChange={onInputNumEventsChange}
151-
showTicks={events.length <= 40}
152-
value={numEvents}
153-
/>
154-
</FormGroup>
155-
<CodeBlock
156-
actions={
157-
<>
158-
<CodeBlockAction />
159-
<CodeBlockAction>
160-
<CopyAction value={yaml} />
161-
</CodeBlockAction>
162-
</>
163-
}
164-
className="ols-plugin__code-block ols-plugin__code-block--preview"
165-
>
166-
<CodeBlockCode
167-
className="ols-plugin__code-block-code"
168-
style={{ whiteSpace: 'pre' }}
133+
<Modal isOpen={isOpen} onClose={onClose} variant="small">
134+
<ModalHeader title={t('Configure events attachment')} />
135+
<ModalBody>
136+
<Content component="p">
137+
{t(
138+
'You can specify the most recent number of events from this resource to include as an attachment for detailed troubleshooting and analysis.',
139+
)}
140+
</Content>
141+
<Form>
142+
{isLoading && <Spinner size="md" />}
143+
{!isLoading &&
144+
(events.length === 0 ? (
145+
<HelperText>
146+
<HelperTextItem>{t('No events')}</HelperTextItem>
147+
</HelperText>
148+
) : (
149+
<>
150+
<FormGroup label={t('Most recent {{numEvents}} events', { numEvents })}>
151+
<Slider
152+
max={events.length}
153+
min={1}
154+
onChange={onInputNumEventsChange}
155+
showTicks={events.length <= 40}
156+
value={numEvents}
157+
/>
158+
</FormGroup>
159+
<CodeBlock
160+
actions={
161+
<>
162+
<CodeBlockAction />
163+
<CodeBlockAction>
164+
<CopyAction value={yaml} />
165+
</CodeBlockAction>
166+
</>
167+
}
168+
className="ols-plugin__code-block ols-plugin__code-block--preview"
169169
>
170-
{yaml}
171-
</CodeBlockCode>
172-
</CodeBlock>
173-
</>
174-
))}
175-
{error && <Error title={t('Failed to load events')}>{error}</Error>}
176-
<ActionGroup>
177-
<Button isDisabled={numEvents < 1} onClick={onSubmit} type="submit" variant="primary">
178-
{t('Attach')}
179-
</Button>
180-
<Button onClick={onClose} type="button" variant="link">
181-
{t('Cancel')}
182-
</Button>
183-
</ActionGroup>
184-
</Form>
170+
<CodeBlockCode
171+
className="ols-plugin__code-block-code"
172+
style={{ whiteSpace: 'pre' }}
173+
>
174+
{yaml}
175+
</CodeBlockCode>
176+
</CodeBlock>
177+
</>
178+
))}
179+
{error && <Error title={t('Failed to load events')}>{error}</Error>}
180+
<ActionGroup>
181+
<Button isDisabled={numEvents < 1} onClick={onSubmit} type="submit" variant="primary">
182+
{t('Attach')}
183+
</Button>
184+
<Button onClick={onClose} type="button" variant="link">
185+
{t('Cancel')}
186+
</Button>
187+
</ActionGroup>
188+
</Form>
189+
</ModalBody>
185190
</Modal>
186191
);
187192
};

0 commit comments

Comments
 (0)