diff --git a/web/app/components/app/log-annotation/index.tsx b/web/app/components/app/log-annotation/index.tsx index 852e57035c..e2e6c14090 100644 --- a/web/app/components/app/log-annotation/index.tsx +++ b/web/app/components/app/log-annotation/index.tsx @@ -37,7 +37,7 @@ const LogAnnotation: FC = ({ } return ( -
+
{appDetail.mode !== 'workflow' && ( = ({ queryParams, setQueryParams }: IFilterProps) => { const { t } = useTranslation() return ( -
+
- { - setQueryParams({ ...queryParams, status: item.value as string }) - } - } + { + setQueryParams({ ...queryParams, status: item.value as string }) + }} + onClear={() => setQueryParams({ ...queryParams, status: 'all' })} items={[{ value: 'all', name: 'All' }, { value: 'succeeded', name: 'Success' }, { value: 'failed', name: 'Fail' }, @@ -33,21 +29,17 @@ const Filter: FC = ({ queryParams, setQueryParams }: IFilterProps) ]} />
-
-
-
- { - setQueryParams({ ...queryParams, keyword: e.target.value }) - }} - /> -
+ { + setQueryParams({ ...queryParams, keyword: e.target.value }) + }} + onClear={() => setQueryParams({ ...queryParams, keyword: '' })} + />
) } diff --git a/web/app/components/app/workflow-log/index.tsx b/web/app/components/app/workflow-log/index.tsx index 303c2069b2..b7f0d6e3bd 100644 --- a/web/app/components/app/workflow-log/index.tsx +++ b/web/app/components/app/workflow-log/index.tsx @@ -73,8 +73,8 @@ const Logs: FC = ({ appDetail }) => { return (
-

{t('appLog.workflowTitle')}

-

{t('appLog.workflowSubtitle')}

+

{t('appLog.workflowTitle')}

+

{t('appLog.workflowSubtitle')}

{/* workflow log */} diff --git a/web/app/components/app/workflow-log/list.tsx b/web/app/components/app/workflow-log/list.tsx index f4707dce59..07fe874263 100644 --- a/web/app/components/app/workflow-log/list.tsx +++ b/web/app/components/app/workflow-log/list.tsx @@ -77,7 +77,7 @@ const WorkflowAppLogList: FC = ({ logs, appDetail, onRefresh }) => { return (
- +
diff --git a/web/app/components/base/chip/index.tsx b/web/app/components/base/chip/index.tsx new file mode 100644 index 0000000000..40af8645a7 --- /dev/null +++ b/web/app/components/base/chip/index.tsx @@ -0,0 +1,102 @@ +import type { FC } from 'react' +import { useMemo, useState } from 'react' +import { RiArrowDownSLine, RiCheckLine, RiCloseCircleFill, RiFilter3Line } from '@remixicon/react' +import cn from '@/utils/classnames' +import { + PortalToFollowElem, + PortalToFollowElemContent, + PortalToFollowElemTrigger, +} from '@/app/components/base/portal-to-follow-elem' + +export type Item = { + value: number | string + name: string +} & Record + +type Props = { + className?: string + value: number | string + items: Item[] + onSelect: (item: any) => void + onClear: () => void +} +const Chip: FC = ({ + className, + value, + items, + onSelect, + onClear, +}) => { + const [open, setOpen] = useState(false) + + const triggerContent = useMemo(() => { + return items.find(item => item.value === value)?.name || '' + }, [items, value]) + + return ( + +
+ setOpen(v => !v)} + className='block' + > +
+
+ +
+
+
+ {triggerContent} +
+ {/* {value.length > 1 && ( +
{`+${value.length - 1}`}
+ )} */} +
+ {!value && } + {!!value && ( +
{ + e.stopPropagation() + onClear() + }}> + +
+ )} +
+
+ +
+
+ {items.map(item => ( +
{ + onSelect(item) + setOpen(false) + }} + > +
{item.name}
+ {value === item.value && } +
+ ))} +
+
+
+
+
+ + ) +} + +export default Chip