From db63c2c219ac11a10d952f587bde77d65bfc305f Mon Sep 17 00:00:00 2001 From: JzoNg Date: Wed, 14 Aug 2024 18:40:11 +0800 Subject: [PATCH] new style of status --- .../workflow/run/assets/highlight.svg | 9 ++++ .../components/workflow/run/output-panel.tsx | 5 +- .../workflow/run/status-container.tsx | 30 ++++++++++++ web/app/components/workflow/run/status.tsx | 46 +++++++++---------- 4 files changed, 62 insertions(+), 28 deletions(-) create mode 100644 web/app/components/workflow/run/assets/highlight.svg create mode 100644 web/app/components/workflow/run/status-container.tsx diff --git a/web/app/components/workflow/run/assets/highlight.svg b/web/app/components/workflow/run/assets/highlight.svg new file mode 100644 index 0000000000..720ae25891 --- /dev/null +++ b/web/app/components/workflow/run/assets/highlight.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web/app/components/workflow/run/output-panel.tsx b/web/app/components/workflow/run/output-panel.tsx index 3860ecc58e..48a3806aeb 100644 --- a/web/app/components/workflow/run/output-panel.tsx +++ b/web/app/components/workflow/run/output-panel.tsx @@ -4,6 +4,7 @@ import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/ import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import { Markdown } from '@/app/components/base/markdown' import LoadingAnim from '@/app/components/base/chat/chat/loading-anim' +import StatusContainer from '@/app/components/workflow/run/status-container' type OutputPanelProps = { isRunning?: boolean @@ -27,9 +28,7 @@ const OutputPanel: FC = ({ )} {!isRunning && error && (
-
-
{error}
-
+ {error}
)} {!isRunning && !outputs && ( diff --git a/web/app/components/workflow/run/status-container.tsx b/web/app/components/workflow/run/status-container.tsx new file mode 100644 index 0000000000..bce3a1f505 --- /dev/null +++ b/web/app/components/workflow/run/status-container.tsx @@ -0,0 +1,30 @@ +'use client' +import type { FC } from 'react' +import cn from '@/utils/classnames' + +type Props = { + status: string + children?: React.ReactNode +} + +const StatusContainer: FC = ({ + status, + children, +}) => { + return ( +
+
+ {children} +
+ ) +} + +export default StatusContainer diff --git a/web/app/components/workflow/run/status.tsx b/web/app/components/workflow/run/status.tsx index 02b2ab50ed..53abccb6af 100644 --- a/web/app/components/workflow/run/status.tsx +++ b/web/app/components/workflow/run/status.tsx @@ -3,6 +3,7 @@ import type { FC } from 'react' import { useTranslation } from 'react-i18next' import cn from '@/utils/classnames' import Indicator from '@/app/components/header/indicator' +import StatusContainer from '@/app/components/workflow/run/status-container' type ResultProps = { status: string @@ -20,29 +21,24 @@ const StatusPanel: FC = ({ const { t } = useTranslation() return ( -
+
-
{t('runLog.resultPanel.status')}
+
{t('runLog.resultPanel.status')}
{status === 'running' && ( - Running + <> + + Running + )} {status === 'succeeded' && ( <> @@ -65,10 +61,10 @@ const StatusPanel: FC = ({
-
{t('runLog.resultPanel.time')}
-
+
{t('runLog.resultPanel.time')}
+
{status === 'running' && ( -
+
)} {status !== 'running' && ( {`${time?.toFixed(3)}s`} @@ -76,10 +72,10 @@ const StatusPanel: FC = ({
-
{t('runLog.resultPanel.tokens')}
-
+
{t('runLog.resultPanel.tokens')}
+
{status === 'running' && ( -
+
)} {status !== 'running' && ( {`${tokens || 0} Tokens`} @@ -89,11 +85,11 @@ const StatusPanel: FC = ({
{status === 'failed' && error && ( <> -
-
{error}
+
+
{error}
)} -
+ ) }