Sfoglia il codice sorgente

🐛 (dashboard-v6): 项目列表隐藏删不掉的「删除」,去掉误调的 DELETE v2/channel

删除项目原来是从 ChannelTable 复制来没改的代码:调的是 DELETE /api/v2/channel/{项目 id},永远删不掉;
而 v2 的 ProjectController@destroy 是空方法,改调它也删不了。先隐藏这个菜单项,迁任务 / 项目到 v3 时
补上删除(软删要给 projects 加 deleted_at;子项目与任务怎么处理也要定)。同组件「设置」链接也指向
channel 的旧路由,一并留了 FIXME。

至此 dashboard-v6 里已没有任何 v2 channel 调用。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 1 giorno fa
parent
commit
fc0bab9a16
1 ha cambiato i file con 9 aggiunte e 58 eliminazioni
  1. 9 58
      dashboard-v6/src/components/task/ProjectTable.tsx

+ 9 - 58
dashboard-v6/src/components/task/ProjectTable.tsx

@@ -1,15 +1,11 @@
 import { type ActionType, ProTable } from "@ant-design/pro-components";
 import { type ActionType, ProTable } from "@ant-design/pro-components";
 import { useIntl } from "react-intl";
 import { useIntl } from "react-intl";
 import { Link } from "react-router";
 import { Link } from "react-router";
-import { Button, message, Modal, Popover } from "antd";
+import { Button, Popover } from "antd";
 import { Dropdown } from "antd";
 import { Dropdown } from "antd";
-import {
-  ExclamationCircleOutlined,
-  DeleteOutlined,
-  PlusOutlined,
-} from "@ant-design/icons";
+import { PlusOutlined } from "@ant-design/icons";
 
 
-import { delete_, get } from "../../request";
+import { get } from "../../request";
 import { PublicityValueEnum } from "../studio/table";
 import { PublicityValueEnum } from "../studio/table";
 
 
 import { useEffect, useRef, useState } from "react";
 import { useEffect, useRef, useState } from "react";
@@ -19,7 +15,6 @@ import { TransferOutLinedIcon } from "../../assets/icon";
 import type { IProjectData, IProjectListResponse } from "../../api/task";
 import type { IProjectData, IProjectListResponse } from "../../api/task";
 import ProjectCreate from "./ProjectCreate";
 import ProjectCreate from "./ProjectCreate";
 import ShareModal from "../share/ShareModal";
 import ShareModal from "../share/ShareModal";
-import type { IDeleteResponse } from "../../api/article";
 import { EResType } from "../share/utils";
 import { EResType } from "../share/utils";
 
 
 export interface IResNumberResponse {
 export interface IResNumberResponse {
@@ -48,45 +43,6 @@ const ProjectTableWidget = ({ studioName, disableChannels }: IWidget) => {
     ref.current?.reload();
     ref.current?.reload();
   }, [disableChannels]);
   }, [disableChannels]);
 
 
-  const showDeleteConfirm = (id: string, title: string) => {
-    Modal.confirm({
-      icon: <ExclamationCircleOutlined />,
-      title:
-        intl.formatMessage({
-          id: "message.delete.confirm",
-        }) +
-        intl.formatMessage({
-          id: "message.irrevocable",
-        }),
-
-      content: title,
-      okText: intl.formatMessage({
-        id: "buttons.delete",
-      }),
-      okType: "danger",
-      cancelText: intl.formatMessage({
-        id: "buttons.no",
-      }),
-      onOk() {
-        // FIXME: 从 ChannelTable 复制来没改——删项目却调了删 channel 的接口(id 是项目 id,永远删不掉)。
-        // 应调项目的删除接口;迁任务 / 项目到 v3 时一并修。
-        const url = `/api/v2/channel/${id}`;
-        console.log("delete api request", url);
-        return delete_<IDeleteResponse>(url)
-          .then((json) => {
-            console.info("api response", json);
-            if (json.ok) {
-              message.success("删除成功");
-              ref.current?.reload();
-            } else {
-              message.error(json.message);
-            }
-          })
-          .catch((e) => console.log("Oops errors!", e));
-      },
-    });
-  };
-
   const ref = useRef<ActionType | null>(null);
   const ref = useRef<ActionType | null>(null);
 
 
   return (
   return (
@@ -187,20 +143,13 @@ const ProjectTableWidget = ({ studioName, disableChannels }: IWidget) => {
                           id: "buttons.share",
                           id: "buttons.share",
                         }),
                         }),
                       },
                       },
-                      {
-                        key: "remove",
-                        label: intl.formatMessage({
-                          id: "buttons.delete",
-                        }),
-                        icon: <DeleteOutlined />,
-                        danger: true,
-                      },
+                      // FIXME: 删除项目暂时隐藏。原来从 ChannelTable 复制来没改,删项目调的是
+                      // DELETE /api/v2/channel/{项目 id},永远删不掉;而 v2 的 ProjectController@destroy
+                      // 是空方法,改调它也删不了。迁任务 / 项目到 v3 时补上删除(含软删除,projects
+                      // 表缺 deleted_at 列;子项目与任务怎么处理也要定),再把这一项加回来。
                     ],
                     ],
                     onClick: (e) => {
                     onClick: (e) => {
                       switch (e.key) {
                       switch (e.key) {
-                        case "remove":
-                          showDeleteConfirm(row.id, row.title);
-                          break;
                         case "share":
                         case "share":
                           setShareId(row.id);
                           setShareId(row.id);
                           setShareOpen(true);
                           setShareOpen(true);
@@ -211,6 +160,8 @@ const ProjectTableWidget = ({ studioName, disableChannels }: IWidget) => {
                     },
                     },
                   }}
                   }}
                 >
                 >
+                  {/* FIXME: 同样是从 ChannelTable 复制来没改——指向 channel 设置页的旧路由(v6 没有),
+                      应改成项目的设置页;迁任务 / 项目到 v3 时一并处理 */}
                   <Link to={`/studio/${studioName}/channel/${row.id}/setting`}>
                   <Link to={`/studio/${studioName}/channel/${row.id}/setting`}>
                     {intl.formatMessage({
                     {intl.formatMessage({
                       id: "buttons.setting",
                       id: "buttons.setting",