Преглед изворни кода

Merge pull request #2285 from visuddhinanda/development

Development
visuddhinanda пре 11 месеци
родитељ
комит
f2d360137e

+ 1 - 0
dashboard-v4/dashboard/src/components/auth/User.tsx

@@ -8,6 +8,7 @@ export interface IUser {
   nickName: string;
   userName: string;
   avatar?: string;
+  roles?: string[];
 }
 
 interface IWidget {

+ 2 - 1
dashboard-v4/dashboard/src/components/task/ProjectClone.tsx

@@ -87,11 +87,12 @@ const ProjectClone = ({ trigger, studioName, projectId }: IWidget) => {
       }}
     >
       <Alert
+        key={1}
         message={message}
         type="error"
         style={{ display: message ? "unset" : "none" }}
       />
-      <ProForm.Group>
+      <ProForm.Group key={2}>
         <ProFormText
           width="md"
           name="title"

+ 2 - 0
dashboard-v4/dashboard/src/components/task/ProjectList.tsx

@@ -145,6 +145,7 @@ const ProjectListWidget = ({
                 })}
               </Button>,
               <ProjectClone
+                key="clone"
                 projectId={row.id}
                 studioName={studioName}
                 trigger={
@@ -156,6 +157,7 @@ const ProjectListWidget = ({
                 }
               />,
               <ShareModal
+                key="share"
                 trigger={
                   <Button type="link" size="small">
                     {intl.formatMessage({

+ 2 - 8
dashboard-v4/dashboard/src/components/task/TaskList.tsx

@@ -108,20 +108,14 @@ const TaskList = ({
   const [currFilter, setCurrFilter] = useState(filters);
 
   console.info("render");
-  const getChildren = (
-    record: ITaskData,
-    findIn: ITaskData[]
-  ): ITaskData[] | undefined => {
+  const getChildren = (record: ITaskData, findIn: ITaskData[]): ITaskData[] => {
     const children = findIn
       .filter((item) => item.parent_id === record.id)
       .map((item) => {
         return { ...item, children: getChildren(item, findIn) };
       });
 
-    if (children.length > 0) {
-      return children;
-    }
-    return undefined;
+    return children;
   };
 
   useEffect(() => {

+ 13 - 4
dashboard-v4/dashboard/src/components/task/TaskStatus.tsx

@@ -1,4 +1,4 @@
-import { Progress, Tag } from "antd";
+import { Progress, Tag, Tooltip } from "antd";
 import { ITaskData, ITaskResponse } from "../api/task";
 import { useIntl } from "react-intl";
 import { useEffect, useState } from "react";
@@ -52,6 +52,7 @@ const TaskStatus = ({ task }: IWidget) => {
       color = "warning";
       break;
   }
+
   return (
     <>
       <Tag color={color}>
@@ -61,9 +62,17 @@ const TaskStatus = ({ task }: IWidget) => {
         })}
       </Tag>
       {task?.status === "running" ? (
-        <div style={{ display: "inline-block", width: 80 }}>
-          <Progress percent={progress} size="small" showInfo={false} />
-        </div>
+        progress && progress > 0 ? (
+          <div style={{ display: "inline-block", width: 80 }}>
+            <Tooltip title={`${progress}%`}>
+              <Progress percent={progress} size="small" showInfo={false} />
+            </Tooltip>
+          </div>
+        ) : task?.executor?.roles?.includes("ai") ? (
+          <>任务排队中</>
+        ) : (
+          <></>
+        )
       ) : (
         <></>
       )}