@@ -15,6 +15,8 @@ import {
15
15
DataListItem ,
16
16
DataListItemCells ,
17
17
DataListItemRow ,
18
+ Flex ,
19
+ FlexItem ,
18
20
Form ,
19
21
FormGroup ,
20
22
InputGroup ,
@@ -23,7 +25,6 @@ import {
23
25
ModalFooter ,
24
26
ModalHeader ,
25
27
ModalVariant ,
26
- Page ,
27
28
PageBreadcrumb ,
28
29
PageSection ,
29
30
TextInput ,
@@ -137,107 +138,109 @@ const EndpointsPage: React.FC = () => {
137
138
</ PageBreadcrumb >
138
139
139
140
< PageSection hasBodyWrapper = { false } >
140
- < Title headingLevel = "h1" size = "2xl" style = { { paddingTop : '10' } } >
141
- Custom Model Endpoints
142
- </ Title >
141
+ < Flex justifyContent = { { default : 'justifyContentSpaceBetween' } } >
142
+ < FlexItem >
143
+ < Title headingLevel = "h1" size = "2xl" style = { { paddingTop : '5' } } >
144
+ Custom Model Endpoints
145
+ </ Title >
146
+ </ FlexItem >
147
+ </ Flex >
143
148
< Content >
144
149
< br />
145
150
Manage your own customer model endpoints. If you have a custom model that is served by an endpoint, you can add it here. This will allow you
146
151
to use the custom model in the playground chat.
147
152
</ Content >
148
153
</ PageSection >
149
- < Page >
150
- < PageSection hasBodyWrapper = { false } >
151
- < div style = { { display : 'flex' , justifyContent : 'space-between' , alignItems : 'center' } } >
152
- < Title headingLevel = "h1" > Manage Endpoints</ Title >
153
- < Button onClick = { handleAddEndpoint } > Add Endpoint</ Button >
154
- </ div >
155
- < DataList aria-label = "Endpoints list" >
156
- { endpoints . map ( ( endpoint ) => (
157
- < DataListItem key = { endpoint . id } >
158
- < DataListItemRow wrapModifier = "breakWord" >
159
- < DataListItemCells
160
- dataListCells = { [
161
- < DataListCell key = "url" >
162
- < strong > URL:</ strong > { endpoint . url }
163
- </ DataListCell > ,
164
- < DataListCell key = "modelName" >
165
- < strong > Model Name:</ strong > { endpoint . modelName }
166
- </ DataListCell > ,
167
- < DataListCell key = "apiKey" >
168
- < strong > API Key:</ strong > { renderApiKey ( endpoint . apiKey , endpoint . isApiKeyVisible || false ) }
169
- < Button variant = "link" onClick = { ( ) => toggleApiKeyVisibility ( endpoint . id ) } >
170
- { endpoint . isApiKeyVisible ? < EyeSlashIcon /> : < EyeIcon /> }
171
- </ Button >
172
- </ DataListCell >
173
- ] }
174
- />
175
- < DataListAction aria-labelledby = "endpoint-actions" id = "endpoint-actions" aria-label = "Actions" >
176
- < Button variant = "primary" onClick = { ( ) => handleEditEndpoint ( endpoint ) } >
177
- Edit
178
- </ Button >
179
- < Button variant = "danger" onClick = { ( ) => handleDeleteEndpoint ( endpoint . id ) } >
180
- Delete
181
- </ Button >
182
- </ DataListAction >
183
- </ DataListItemRow >
184
- </ DataListItem >
185
- ) ) }
186
- </ DataList >
187
- </ PageSection >
188
- { isModalOpen && (
189
- < Modal
190
- variant = { ModalVariant . medium }
191
- title = { currentEndpoint ?. id ? 'Edit Endpoint' : 'Add Endpoint' }
192
- isOpen = { isModalOpen }
193
- onClose = { ( ) => handleModalToggle ( ) }
194
- aria-labelledby = "endpoint-modal-title"
195
- aria-describedby = "endpoint-body-variant"
196
- >
197
- < ModalHeader title = { currentEndpoint ?. id ? 'Edit Endpoint' : 'Add Endpoint' } labelId = "endpoint-modal-title" titleIconVariant = "info" />
198
- < ModalBody id = "endpoint-body-variant" >
199
- < Form >
200
- < FormGroup label = "URL" isRequired fieldId = "url" >
201
- < TextInput isRequired type = "text" id = "url" name = "url" value = { url } onChange = { ( _ , value ) => setUrl ( value ) } placeholder = "Enter URL" />
202
- </ FormGroup >
203
- < FormGroup label = "Model Name" isRequired fieldId = "modelName" >
154
+ < PageSection hasBodyWrapper = { false } >
155
+ < Flex justifyContent = { { default : 'justifyContentFlexEnd' } } alignItems = { { default : 'alignItemsFlexEnd' } } >
156
+ < FlexItem >
157
+ < Button onClick = { handleAddEndpoint } > Add Custom Endpoint</ Button >
158
+ </ FlexItem >
159
+ </ Flex >
160
+ < DataList aria-label = "Endpoints list" >
161
+ { endpoints . map ( ( endpoint ) => (
162
+ < DataListItem key = { endpoint . id } >
163
+ < DataListItemRow wrapModifier = "breakWord" >
164
+ < DataListItemCells
165
+ dataListCells = { [
166
+ < DataListCell key = "url" >
167
+ < strong > URL:</ strong > { endpoint . url }
168
+ </ DataListCell > ,
169
+ < DataListCell key = "modelName" >
170
+ < strong > Model Name:</ strong > { endpoint . modelName }
171
+ </ DataListCell > ,
172
+ < DataListCell key = "apiKey" >
173
+ < strong > API Key:</ strong > { renderApiKey ( endpoint . apiKey , endpoint . isApiKeyVisible || false ) }
174
+ < Button variant = "link" onClick = { ( ) => toggleApiKeyVisibility ( endpoint . id ) } >
175
+ { endpoint . isApiKeyVisible ? < EyeSlashIcon /> : < EyeIcon /> }
176
+ </ Button >
177
+ </ DataListCell >
178
+ ] }
179
+ />
180
+ < DataListAction aria-labelledby = "endpoint-actions" id = "endpoint-actions" aria-label = "Actions" >
181
+ < Button variant = "primary" onClick = { ( ) => handleEditEndpoint ( endpoint ) } >
182
+ Edit
183
+ </ Button >
184
+ < Button variant = "danger" onClick = { ( ) => handleDeleteEndpoint ( endpoint . id ) } >
185
+ Delete
186
+ </ Button >
187
+ </ DataListAction >
188
+ </ DataListItemRow >
189
+ </ DataListItem >
190
+ ) ) }
191
+ </ DataList >
192
+ </ PageSection >
193
+ { isModalOpen && (
194
+ < Modal
195
+ variant = { ModalVariant . medium }
196
+ title = { currentEndpoint ?. id ? 'Edit Endpoint' : 'Add Endpoint' }
197
+ isOpen = { isModalOpen }
198
+ onClose = { ( ) => handleModalToggle ( ) }
199
+ aria-labelledby = "endpoint-modal-title"
200
+ aria-describedby = "endpoint-body-variant"
201
+ >
202
+ < ModalHeader title = { currentEndpoint ?. id ? 'Edit Endpoint' : 'Add Endpoint' } labelId = "endpoint-modal-title" titleIconVariant = "info" />
203
+ < ModalBody id = "endpoint-body-variant" >
204
+ < Form >
205
+ < FormGroup label = "URL" isRequired fieldId = "url" >
206
+ < TextInput isRequired type = "text" id = "url" name = "url" value = { url } onChange = { ( _ , value ) => setUrl ( value ) } placeholder = "Enter URL" />
207
+ </ FormGroup >
208
+ < FormGroup label = "Model Name" isRequired fieldId = "modelName" >
209
+ < TextInput
210
+ isRequired
211
+ type = "text"
212
+ id = "modelName"
213
+ name = "modelName"
214
+ value = { modelName }
215
+ onChange = { ( _ , value ) => setModelName ( value ) }
216
+ placeholder = "Enter Model Name"
217
+ />
218
+ </ FormGroup >
219
+ < FormGroup label = "API Key" isRequired fieldId = "apiKey" >
220
+ < InputGroup >
204
221
< TextInput
205
222
isRequired
206
- type = "text "
207
- id = "modelName "
208
- name = "modelName "
209
- value = { modelName }
210
- onChange = { ( _ , value ) => setModelName ( value ) }
211
- placeholder = "Enter Model Name "
223
+ type = "password "
224
+ id = "apiKey "
225
+ name = "apiKey "
226
+ value = { apiKey }
227
+ onChange = { ( _ , value ) => setApiKey ( value ) }
228
+ placeholder = "Enter API Key "
212
229
/>
213
- </ FormGroup >
214
- < FormGroup label = "API Key" isRequired fieldId = "apiKey" >
215
- < InputGroup >
216
- < TextInput
217
- isRequired
218
- type = "password"
219
- id = "apiKey"
220
- name = "apiKey"
221
- value = { apiKey }
222
- onChange = { ( _ , value ) => setApiKey ( value ) }
223
- placeholder = "Enter API Key"
224
- />
225
- </ InputGroup >
226
- </ FormGroup >
227
- </ Form >
228
- </ ModalBody >
229
- < ModalFooter >
230
- < Button key = "save" variant = "primary" onClick = { handleSaveEndpoint } >
231
- Save
232
- </ Button >
233
- ,
234
- < Button key = "cancel" variant = "link" onClick = { handleModalToggle } >
235
- Cancel
236
- </ Button >
237
- </ ModalFooter >
238
- </ Modal >
239
- ) }
240
- </ Page >
230
+ </ InputGroup >
231
+ </ FormGroup >
232
+ </ Form >
233
+ </ ModalBody >
234
+ < ModalFooter >
235
+ < Button key = "save" variant = "primary" onClick = { handleSaveEndpoint } >
236
+ Save
237
+ </ Button >
238
+ < Button key = "cancel" variant = "link" onClick = { handleModalToggle } >
239
+ Cancel
240
+ </ Button >
241
+ </ ModalFooter >
242
+ </ Modal >
243
+ ) }
241
244
</ AppLayout >
242
245
) ;
243
246
} ;
0 commit comments