|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | 3 | import React, { useState, useEffect } from 'react'; |
4 | | -import { Page, PageBreadcrumb, PageSection } from '@patternfly/react-core/dist/dynamic/components/Page'; |
5 | | -import { |
6 | | - DataList, |
7 | | - DataListItem, |
8 | | - DataListItemRow, |
9 | | - DataListItemCells, |
10 | | - DataListCell, |
11 | | - DataListAction |
12 | | -} from '@patternfly/react-core/dist/dynamic/components/DataList'; |
13 | | -import { Button } from '@patternfly/react-core/dist/dynamic/components/Button'; |
14 | | -import { ModalVariant } from '@patternfly/react-core/dist/dynamic/components/Modal'; |
15 | | -import { Breadcrumb, BreadcrumbItem, Content } from '@patternfly/react-core/components/'; |
16 | | -import { Modal } from '@patternfly/react-core/deprecated'; |
17 | | -import { Form, FormGroup } from '@patternfly/react-core/dist/dynamic/components/Form'; |
18 | | -import { TextInput } from '@patternfly/react-core/dist/dynamic/components/TextInput'; |
19 | | -import { Title } from '@patternfly/react-core/dist/dynamic/components/Title'; |
20 | | -import { InputGroup } from '@patternfly/react-core/dist/dynamic/components/InputGroup'; |
21 | | -import EyeIcon from '@patternfly/react-icons/dist/dynamic/icons/eye-icon'; |
22 | | -import EyeSlashIcon from '@patternfly/react-icons/dist/dynamic/icons/eye-slash-icon'; |
23 | 4 | import { v4 as uuidv4 } from 'uuid'; |
24 | 5 | import { AppLayout } from '@/components/AppLayout'; |
25 | 6 | import { Endpoint } from '@/types'; |
| 7 | +import { Breadcrumb, BreadcrumbItem, Button, Content, DataList, DataListAction, DataListCell, DataListItem, DataListItemCells, DataListItemRow, Form, FormGroup, InputGroup, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, Page, PageBreadcrumb, PageSection, TextInput, Title } from '@patternfly/react-core'; |
| 8 | +import { EyeSlashIcon, EyeIcon } from '@patternfly/react-icons'; |
26 | 9 |
|
27 | 10 | interface ExtendedEndpoint extends Endpoint { |
28 | 11 | isApiKeyVisible?: boolean; |
@@ -118,7 +101,7 @@ const EndpointsPage: React.FC = () => { |
118 | 101 | return isApiKeyVisible ? apiKey : '********'; |
119 | 102 | }; |
120 | 103 |
|
121 | | - useEffect(() => {}, [url]); |
| 104 | + useEffect(() => { }, [url]); |
122 | 105 |
|
123 | 106 | return ( |
124 | 107 | <AppLayout> |
@@ -180,49 +163,56 @@ const EndpointsPage: React.FC = () => { |
180 | 163 | </PageSection> |
181 | 164 | {isModalOpen && ( |
182 | 165 | <Modal |
| 166 | + variant={ModalVariant.medium} |
183 | 167 | title={currentEndpoint?.id ? 'Edit Endpoint' : 'Add Endpoint'} |
184 | 168 | isOpen={isModalOpen} |
185 | | - onClose={handleModalToggle} |
186 | | - variant={ModalVariant.medium} |
187 | | - actions={[ |
| 169 | + onClose={() => handleModalToggle()} |
| 170 | + aria-labelledby="endpoint-modal-title" |
| 171 | + aria-describedby="endpoint-body-variant" |
| 172 | + > |
| 173 | + <ModalHeader title={currentEndpoint?.id ? 'Edit Endpoint' : 'Add Endpoint'} labelId="endpoint-modal-title" titleIconVariant="info" /> |
| 174 | + <ModalBody id="endpoint-body-variant"> |
| 175 | + |
| 176 | + <Form> |
| 177 | + <FormGroup label="URL" isRequired fieldId="url"> |
| 178 | + <TextInput isRequired type="text" id="url" name="url" value={url} onChange={(_, value) => setUrl(value)} placeholder="Enter URL" /> |
| 179 | + </FormGroup> |
| 180 | + <FormGroup label="Model Name" isRequired fieldId="modelName"> |
| 181 | + <TextInput |
| 182 | + isRequired |
| 183 | + type="text" |
| 184 | + id="modelName" |
| 185 | + name="modelName" |
| 186 | + value={modelName} |
| 187 | + onChange={(_, value) => setModelName(value)} |
| 188 | + placeholder="Enter Model Name" |
| 189 | + /> |
| 190 | + </FormGroup> |
| 191 | + <FormGroup label="API Key" isRequired fieldId="apiKey"> |
| 192 | + <InputGroup> |
| 193 | + <TextInput |
| 194 | + isRequired |
| 195 | + type="password" |
| 196 | + id="apiKey" |
| 197 | + name="apiKey" |
| 198 | + value={apiKey} |
| 199 | + onChange={(_, value) => setApiKey(value)} |
| 200 | + placeholder="Enter API Key" |
| 201 | + /> |
| 202 | + </InputGroup> |
| 203 | + </FormGroup> |
| 204 | + </Form> |
| 205 | + </ModalBody> |
| 206 | + <ModalFooter> |
188 | 207 | <Button key="save" variant="primary" onClick={handleSaveEndpoint}> |
189 | 208 | Save |
190 | 209 | </Button>, |
191 | 210 | <Button key="cancel" variant="link" onClick={handleModalToggle}> |
192 | 211 | Cancel |
193 | 212 | </Button> |
194 | | - ]} |
195 | | - > |
196 | | - <Form> |
197 | | - <FormGroup label="URL" isRequired fieldId="url"> |
198 | | - <TextInput isRequired type="text" id="url" name="url" value={url} onChange={(_, value) => setUrl(value)} placeholder="Enter URL" /> |
199 | | - </FormGroup> |
200 | | - <FormGroup label="Model Name" isRequired fieldId="modelName"> |
201 | | - <TextInput |
202 | | - isRequired |
203 | | - type="text" |
204 | | - id="modelName" |
205 | | - name="modelName" |
206 | | - value={modelName} |
207 | | - onChange={(_, value) => setModelName(value)} |
208 | | - placeholder="Enter Model Name" |
209 | | - /> |
210 | | - </FormGroup> |
211 | | - <FormGroup label="API Key" isRequired fieldId="apiKey"> |
212 | | - <InputGroup> |
213 | | - <TextInput |
214 | | - isRequired |
215 | | - type="password" |
216 | | - id="apiKey" |
217 | | - name="apiKey" |
218 | | - value={apiKey} |
219 | | - onChange={(_, value) => setApiKey(value)} |
220 | | - placeholder="Enter API Key" |
221 | | - /> |
222 | | - </InputGroup> |
223 | | - </FormGroup> |
224 | | - </Form> |
| 213 | + </ModalFooter> |
225 | 214 | </Modal> |
| 215 | + |
226 | 216 | )} |
227 | 217 | </Page> |
228 | 218 | </AppLayout> |
|
0 commit comments