Browse Source

Merge pull request #2276 from visuddhinanda/development

Development
visuddhinanda 1 year ago
parent
commit
308391149e

+ 1 - 1
dashboard-v4/dashboard/src/components/article/TypeArticleReaderToolbar.tsx

@@ -95,7 +95,7 @@ const TypeArticleReaderToolbarWidget = ({
                 {
                   label: intl.formatMessage({
                     id: "buttons.open.in.new.tab",
-                  }),
+                  },{item:''}),
                   key: "open_in_tab",
                   icon: <TabIcon />,
                 },

+ 22 - 18
dashboard-v4/dashboard/src/components/channel/ChannelSelectWithToken.tsx

@@ -22,16 +22,18 @@ const ChannelSelectWithToken = ({ channelsId, type, onChange }: IWidget) => {
         allowClear={true}
         label={false}
         placeholder={"选择一个channel"}
-        onChange={(value: string) => {
-          console.debug(value);
-          setChannel(value);
-          let output = value;
-          if (value) {
-            if (power) {
-              output += "@" + power;
+        fieldProps={{
+          onChange(value, option) {
+            console.debug(value);
+            setChannel(value);
+            let output = value;
+            if (value) {
+              if (power) {
+                output += "@" + power;
+              }
             }
-          }
-          onChange && onChange(output);
+            onChange && onChange(output);
+          },
         }}
         request={async ({ keyWords }) => {
           if (!channelsId) {
@@ -70,16 +72,18 @@ const ChannelSelectWithToken = ({ channelsId, type, onChange }: IWidget) => {
         allowClear={true}
         label={false}
         placeholder={"选择访问权限"}
-        onChange={(value: string) => {
-          console.debug(value);
-          setPower(value);
-          let output = channel;
-          if (channel) {
-            if (value) {
-              output += "@" + value;
+        fieldProps={{
+          onChange(value, option) {
+            console.debug(value);
+            setPower(value);
+            let output = channel;
+            if (channel) {
+              if (value) {
+                output += "@" + value;
+              }
             }
-          }
-          onChange && onChange(output);
+            onChange && onChange(output);
+          },
         }}
       />
     </Space>

+ 6 - 3
dashboard-v4/dashboard/src/components/discussion/DiscussionDrawer.tsx

@@ -55,9 +55,12 @@ const DiscussionDrawerWidget = ({
         extra={
           <Space>
             <Link to={`/discussion/show/${resType}/${resId}`} target="_blank">
-              {intl.formatMessage({
-                id: "buttons.open.in.new.tab",
-              })}
+              {intl.formatMessage(
+                {
+                  id: "buttons.open.in.new.tab",
+                },
+                { item: "" }
+              )}
             </Link>
             {drawerWidth === drawerMinWidth ? (
               <Button

+ 1 - 1
dashboard-v4/dashboard/src/components/general/NissayaCard.tsx

@@ -159,7 +159,7 @@ const NissayaCardWidget = ({
           <Link to={`/nissaya/ending/${term?.word}`} target="_blank">
             {intl.formatMessage({
               id: "buttons.open.in.new.tab",
-            })}
+            },{item:''})}
           </Link>
           <Button
             type="link"

+ 10 - 4
dashboard-v4/dashboard/src/components/task/Description.tsx

@@ -1,5 +1,5 @@
 import { useEffect, useState } from "react";
-import { Button, message, Space } from "antd";
+import { Button, message, Space, Typography } from "antd";
 import { EditOutlined, CheckOutlined } from "@ant-design/icons";
 
 import { ITaskData, ITaskResponse, ITaskUpdateRequest } from "../api/task";
@@ -8,6 +8,8 @@ import MDEditor from "@uiw/react-md-editor";
 import "../article/article.css";
 import { patch } from "../../request";
 import DiscussionDrawer from "../discussion/DiscussionDrawer";
+import { useIntl } from "react-intl";
+const { Text } = Typography;
 
 interface IWidget {
   task?: ITaskData;
@@ -15,6 +17,8 @@ interface IWidget {
   onDiscussion?: () => void;
 }
 const Description = ({ task, onChange, onDiscussion }: IWidget) => {
+  const intl = useIntl();
+
   const [mode, setMode] = useState<"read" | "edit">("read");
   const [content, setContent] = useState(task?.description);
   const [loading, setLoading] = useState(false);
@@ -36,7 +40,9 @@ const Description = ({ task, onChange, onDiscussion }: IWidget) => {
           padding: 8,
         }}
       >
-        <span></span>
+        <span>
+          <Text strong>任务描述</Text>
+        </span>
         <span>
           {mode === "read" ? (
             <Space>
@@ -50,7 +56,7 @@ const Description = ({ task, onChange, onDiscussion }: IWidget) => {
                   }
                 }}
               >
-                讨论
+                {intl.formatMessage({ id: "buttons.discussion" })}
               </Button>
               <Button
                 key={2}
@@ -59,7 +65,7 @@ const Description = ({ task, onChange, onDiscussion }: IWidget) => {
                 icon={<EditOutlined />}
                 onClick={() => setMode("edit")}
               >
-                编辑
+                {intl.formatMessage({ id: "buttons.edit" })}
               </Button>
             </Space>
           ) : (

+ 7 - 5
dashboard-v4/dashboard/src/components/task/TaskEditButton.tsx

@@ -39,29 +39,31 @@ const TaskEditButton = ({ task, onChange, onPreTask }: IWidget) => {
   const mainMenuItems: MenuProps["items"] = [
     {
       key: "milestone",
-      label: task?.is_milestone ? "取消里程碑" : "设为里程碑",
+      label: task?.is_milestone
+        ? intl.formatMessage({ id: "buttons.remove.milestone" })
+        : intl.formatMessage({ id: "buttons.set.milestone" }),
       icon: <CodeSandboxOutlined />,
     },
     {
       key: "pre-task",
-      label: "设置前置任务",
+      label: intl.formatMessage({ id: "buttons.task.add.pre-task" }),
       icon: <ArrowLeftOutlined />,
     },
     {
       key: "next-task",
-      label: "设置后置任务",
+      label: intl.formatMessage({ id: "buttons.task.add.next-task" }),
       icon: <ArrowRightOutlined />,
     },
     {
       type: "divider",
     },
     {
-      label: "历史记录",
+      label: intl.formatMessage({ id: "buttons.timeline" }),
       key: "timeline",
       icon: <FieldTimeOutlined />,
     },
     {
-      label: "删除",
+      label: intl.formatMessage({ id: "buttons.delete" }),
       key: "delete",
       icon: <DeleteOutlined />,
       danger: true,

+ 6 - 3
dashboard-v4/dashboard/src/components/task/TaskEditDrawer.tsx

@@ -60,9 +60,12 @@ const TaskEditDrawer = ({
               window.open(fullUrl(`/article/task/${taskId}`), "_blank");
             }}
           >
-            {intl.formatMessage({
-              id: "buttons.open.in.new.tab",
-            })}
+            {intl.formatMessage(
+              {
+                id: "buttons.open.in.new.tab",
+              },
+              { item: intl.formatMessage({ id: "labels.task" }) }
+            )}
           </Button>
         }
       >

+ 3 - 1
dashboard-v4/dashboard/src/components/task/TaskReader.tsx

@@ -164,7 +164,9 @@ const TaskReader = ({ taskId, onChange, onDiscussion }: IWidget) => {
           <TimeShow updatedAt={task?.updated_at} />
           <Like resId={task?.id} resType="task" />
         </Space>
-        <Space>
+        <Space
+          style={{ display: task?.type === "workflow" ? "none" : "unset" }}
+        >
           <Text type="secondary" key={"2"}>
             执行人
           </Text>

+ 19 - 3
dashboard-v4/dashboard/src/components/task/TaskStatusButton.tsx

@@ -7,7 +7,11 @@ import {
   PopconfirmProps,
 } from "antd";
 import { useIntl } from "react-intl";
-import { CheckOutlined, LoadingOutlined } from "@ant-design/icons";
+import {
+  CheckOutlined,
+  LoadingOutlined,
+  DownOutlined,
+} from "@ant-design/icons";
 
 import {
   ITaskData,
@@ -195,8 +199,20 @@ const TaskStatusButton = ({
       okText="Yes"
       cancelText="No"
     >
-      <Dropdown.Button type={buttonType} trigger={["click"]} menu={menuProps}>
-        {loading ? <LoadingOutlined /> : <CheckOutlined />}
+      <Dropdown.Button
+        disabled={task?.type === "workflow"}
+        type={buttonType}
+        trigger={["click"]}
+        icon={<DownOutlined />}
+        menu={menuProps}
+      >
+        {loading ? (
+          <LoadingOutlined />
+        ) : newStatus === "done" ? (
+          <CheckOutlined />
+        ) : (
+          <></>
+        )}
         {buttonText}
       </Dropdown.Button>
     </Popconfirm>

+ 6 - 3
dashboard-v4/dashboard/src/components/template/Article.tsx

@@ -106,9 +106,12 @@ export const ArticleCtl = ({
 
   const OpenLink = (
     <Link to={articleLink} target="_blank">
-      {intl.formatMessage({
-        id: "buttons.open.in.new.tab",
-      })}
+      {intl.formatMessage(
+        {
+          id: "buttons.open.in.new.tab",
+        },
+        { item: "" }
+      )}
     </Link>
   );
   switch (style) {

+ 6 - 3
dashboard-v4/dashboard/src/components/template/Quote.tsx

@@ -41,9 +41,12 @@ const QuoteCtl = ({
             分栏打开
           </Button>,
           <Button type="link" size="small" icon={<SearchOutlined />}>
-            {intl.formatMessage({
-              id: "buttons.open.in.new.tab",
-            })}
+            {intl.formatMessage(
+              {
+                id: "buttons.open.in.new.tab",
+              },
+              { item: "" }
+            )}
           </Button>,
           <Button type="link" size="small" icon={<CopyOutlined />}>
             复制引用

+ 5 - 1
dashboard-v4/dashboard/src/locales/en-US/buttons.ts

@@ -82,7 +82,7 @@ const items = {
   "buttons.relate": "relate",
   "buttons.convert": "convert",
   "buttons.copy.tpl": "copy template",
-  "buttons.open.in.new.tab": "Open in New Tab",
+  "buttons.open.in.new.tab": "Open {item} in New Tab",
   "buttons.add_to_anthology": "Add to Anthology",
   "buttons.open.in.studio": "Open in Studio",
   "buttons.admin": "admin",
@@ -101,6 +101,10 @@ const items = {
   "buttons.task.status.change.to.restarted": "重做",
   "buttons.task.status.change.to.requested_restart": "请求重做",
   "buttons.access-token.get": "access token",
+  "buttons.task.add.pre-task": "pre task",
+  "buttons.task.add.next-task": "next task",
+  "buttons.remove.milestone": "remove milestone",
+  "buttons.set.milestone": "set as milestone",
 };
 
 export default items;

+ 5 - 1
dashboard-v4/dashboard/src/locales/zh-Hans/buttons.ts

@@ -82,7 +82,7 @@ const items = {
   "buttons.relate": "关联",
   "buttons.convert": "转换",
   "buttons.copy.tpl": "复制模版",
-  "buttons.open.in.new.tab": "在新标签页中打开",
+  "buttons.open.in.new.tab": "在新标签页中打开{item}",
   "buttons.add_to_anthology": "添加到文集",
   "buttons.open.in.studio": "在Studio中打开",
   "buttons.admin": "后台管理",
@@ -102,6 +102,10 @@ const items = {
   "buttons.task.status.change.to.restarted": "重做",
   "buttons.task.status.change.to.requested_restart": "请求重做",
   "buttons.access-token.get": "获取访问口令",
+  "buttons.task.add.pre-task": "添加前置任务",
+  "buttons.task.add.next-task": "添加后置任务",
+  "buttons.remove.milestone": "移除里程碑",
+  "buttons.set.milestone": "设置为里程碑",
 };
 
 export default items;