Skip to content

Commit 3cc91e2

Browse files
authored
style(FR-2545): improve endpoint select layout and detail page button (#6623)
1 parent 4892c49 commit 3cc91e2

2 files changed

Lines changed: 53 additions & 53 deletions

File tree

react/src/components/Chat/ChatHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
217217
}}
218218
value={endpoint?.endpoint_id}
219219
popupMatchSelectWidth={false}
220-
showInfoButton
220+
showDetailPageButton
221221
/>
222222
)}
223223
{!isEmpty(models) && (

react/src/components/Chat/EndpointSelect.tsx

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from 'antd';
2222
import { BAIFlex, BAISelect } from 'backend.ai-ui';
2323
import * as _ from 'lodash-es';
24-
import { ExternalLinkIcon } from 'lucide-react';
24+
import { InfoIcon } from 'lucide-react';
2525
import React, { useDeferredValue, useEffect, useRef, useState } from 'react';
2626
import { useTranslation } from 'react-i18next';
2727
import { graphql, useLazyLoadQuery } from 'react-relay';
@@ -36,7 +36,7 @@ export interface EndpointSelectProps extends Omit<
3636
> {
3737
fetchKey?: string;
3838
lifecycleStageFilter?: LifecycleStage[];
39-
showInfoButton?: boolean;
39+
showDetailPageButton?: boolean;
4040
}
4141

4242
type LifecycleStage =
@@ -50,7 +50,7 @@ type LifecycleStage =
5050
const EndpointSelect: React.FC<EndpointSelectProps> = ({
5151
fetchKey,
5252
lifecycleStageFilter = ['ready', 'created'],
53-
showInfoButton,
53+
showDetailPageButton: showInfoButton,
5454
loading,
5555
...selectPropsWithoutLoading
5656
}) => {
@@ -192,59 +192,59 @@ const EndpointSelect: React.FC<EndpointSelectProps> = ({
192192
}, [isValueMatched]);
193193
return (
194194
<BAIFlex direction="row" gap="xs">
195-
<BAISelect
196-
ref={selectRef}
197-
placeholder={t('chatui.SelectEndpoint')}
198-
style={{
199-
minWidth: 100,
200-
fontWeight: 'normal',
201-
}}
202-
showSearch={{
203-
searchValue: searchStr,
204-
onSearch: (v) => {
205-
setSearchStr(v);
206-
},
207-
autoClearSearchValue: true,
208-
filterOption: false,
209-
}}
210-
// TODO: Need to make it work properly when autoClearSearchValue is not specified
211-
loading={searchStr !== deferredSearchStr || loading}
212-
options={selectOptions}
213-
{...selectPropsWithoutLoading}
214-
// override value and onChange
215-
labelInValue // use labelInValue to display the selected option label
216-
value={optimisticValueWithLabel}
217-
onChange={(v, option) => {
218-
setOptimisticValueWithLabel(v);
219-
setControllableValue(v.value, _.castArray(option)?.[0].endpoint);
220-
selectPropsWithoutLoading.onChange?.(v.value || '', option);
221-
}}
222-
endReached={() => {
223-
loadNext();
224-
}}
225-
open={controllableOpen}
226-
onOpenChange={setControllableOpen}
227-
notFoundContent={
228-
_.isUndefined(paginationData) ? (
229-
// For the first loading options
230-
<Skeleton.Input active size="small" block />
231-
) : undefined
232-
}
233-
footer={
234-
_.isNumber(endpoint_list?.total_count) &&
235-
endpoint_list.total_count > 0 ? (
236-
<TotalFooter
237-
loading={isLoadingNext}
238-
total={endpoint_list?.total_count}
239-
/>
240-
) : undefined
241-
}
242-
/>
243195
<Space.Compact>
196+
<BAISelect
197+
ref={selectRef}
198+
placeholder={t('chatui.SelectEndpoint')}
199+
style={{
200+
minWidth: 100,
201+
fontWeight: 'normal',
202+
}}
203+
showSearch={{
204+
searchValue: searchStr,
205+
onSearch: (v) => {
206+
setSearchStr(v);
207+
},
208+
autoClearSearchValue: true,
209+
filterOption: false,
210+
}}
211+
// TODO: Need to make it work properly when autoClearSearchValue is not specified
212+
loading={searchStr !== deferredSearchStr || loading}
213+
options={selectOptions}
214+
{...selectPropsWithoutLoading}
215+
// override value and onChange
216+
labelInValue // use labelInValue to display the selected option label
217+
value={optimisticValueWithLabel}
218+
onChange={(v, option) => {
219+
setOptimisticValueWithLabel(v);
220+
setControllableValue(v.value, _.castArray(option)?.[0].endpoint);
221+
selectPropsWithoutLoading.onChange?.(v.value || '', option);
222+
}}
223+
endReached={() => {
224+
loadNext();
225+
}}
226+
open={controllableOpen}
227+
onOpenChange={setControllableOpen}
228+
notFoundContent={
229+
_.isUndefined(paginationData) ? (
230+
// For the first loading options
231+
<Skeleton.Input active size="small" block />
232+
) : undefined
233+
}
234+
footer={
235+
_.isNumber(endpoint_list?.total_count) &&
236+
endpoint_list.total_count > 0 ? (
237+
<TotalFooter
238+
loading={isLoadingNext}
239+
total={endpoint_list?.total_count}
240+
/>
241+
) : undefined
242+
}
243+
/>
244244
{showInfoButton ? (
245245
<Tooltip title={t('general.NavigateToDetailPage')}>
246246
<Button
247-
icon={<ExternalLinkIcon />}
247+
icon={<InfoIcon />}
248248
disabled={!controllableValue}
249249
onClick={() => {
250250
webuiNavigate(`/serving/${controllableValue}`);

0 commit comments

Comments
 (0)