(feature)(webapp) add filter modify and similar questions (#213)

This commit is contained in:
williamhliu
2023-10-13 18:31:00 +08:00
committed by GitHub
parent ab19b18169
commit 767abc2b90
27 changed files with 799 additions and 795 deletions

View File

@@ -1,10 +1,11 @@
import { Spin } from 'antd';
import { CheckCircleFilled } from '@ant-design/icons';
import { Button, Spin } from 'antd';
import { CheckCircleFilled, ReloadOutlined } from '@ant-design/icons';
import { PREFIX_CLS } from '../../common/constants';
import { MsgDataType } from '../../common/type';
import ChatMsg from '../ChatMsg';
import WebPage from '../ChatMsg/WebPage';
import Loading from './Loading';
import React, { ReactNode } from 'react';
type Props = {
queryId?: number;
@@ -12,8 +13,11 @@ type Props = {
entitySwitchLoading: boolean;
chartIndex: number;
executeTip?: string;
executeItemNode?: ReactNode;
renderCustomExecuteNode?: boolean;
data?: MsgDataType;
triggerResize?: boolean;
onRefresh: () => void;
};
const ExecuteItem: React.FC<Props> = ({
@@ -22,12 +26,15 @@ const ExecuteItem: React.FC<Props> = ({
entitySwitchLoading,
chartIndex,
executeTip,
executeItemNode,
renderCustomExecuteNode,
data,
triggerResize,
onRefresh,
}) => {
const prefixCls = `${PREFIX_CLS}-item`;
const getNodeTip = (title: string, tip?: string) => {
const getNodeTip = (title: ReactNode, tip?: string) => {
return (
<>
<div className={`${prefixCls}-title-bar`}>
@@ -42,12 +49,19 @@ const ExecuteItem: React.FC<Props> = ({
);
};
const reloadNode = (
<Button className={`${prefixCls}-reload`} size="small" onClick={onRefresh}>
<ReloadOutlined />
</Button>
);
if (executeLoading) {
return getNodeTip('数据查询中');
}
if (executeTip) {
return getNodeTip('数据查询失败', executeTip);
return getNodeTip(<>{reloadNode}</>, executeTip);
}
if (!data) {
@@ -58,14 +72,19 @@ const ExecuteItem: React.FC<Props> = ({
<>
<div className={`${prefixCls}-title-bar`}>
<CheckCircleFilled className={`${prefixCls}-step-icon`} />
<div className={`${prefixCls}-step-title`}></div>
<div className={`${prefixCls}-step-title`}>
{reloadNode}
</div>
</div>
<div className={`${prefixCls}-content-container ${prefixCls}-last-node`}>
<div className={`${prefixCls}-content-container`}>
<Spin spinning={entitySwitchLoading}>
{data.queryAuthorization?.message && (
<div className={`${prefixCls}-auth-tip`}>{data.queryAuthorization.message}</div>
)}
{data?.queryMode === 'WEB_PAGE' ? (
{renderCustomExecuteNode && executeItemNode ? (
executeItemNode
) : data?.queryMode === 'WEB_PAGE' ? (
<WebPage id={queryId!} data={data} />
) : (
<ChatMsg