From 4b12bed3f783187607e5f5e7e9cf3bcd59549047 Mon Sep 17 00:00:00 2001 From: Yixin Sun <43978285+piccaSun@users.noreply.github.com> Date: Fri, 4 Aug 2023 23:35:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(mis-web):=20=E7=AE=A1=E7=90=86=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=94=A8=E6=88=B7=E7=A9=BA=E9=97=B4=E4=B8=8B=E5=88=86?= =?UTF-8?q?=E5=8C=BA=E4=BF=A1=E6=81=AF=E4=B8=AD=E8=AE=A1=E9=87=8F=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=20(#780)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 问题 管理系统下用户空间的分区信息中没有显示正确的计量方式的文字描述字符串 ![image](https://github.com/PKUHPC/SCOW/assets/43978285/0a166bc5-dfb9-4a06-a5e0-b078fe74523a) 此PR修改为与作业价格表中的计量方式显示一致,修改为计量方式文字及icon说明的形式 ### 修改后 ![image](https://github.com/PKUHPC/SCOW/assets/43978285/f0ac2b69-3926-4d28-b1ec-613dbf7df4ae) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/233512c9-8efa-4ac6-b6d7-fbeeb079b9dc) --- .changeset/soft-beers-unite.md | 5 ++ .../AmonutStrategyDescriptionsItem.tsx | 63 +++++++++++++++++++ .../src/components/JobBillingTable.tsx | 20 ++++-- .../job/ManageJobBillingTable.tsx | 33 ++-------- 4 files changed, 88 insertions(+), 33 deletions(-) create mode 100644 .changeset/soft-beers-unite.md create mode 100644 apps/mis-web/src/components/AmonutStrategyDescriptionsItem.tsx diff --git a/.changeset/soft-beers-unite.md b/.changeset/soft-beers-unite.md new file mode 100644 index 0000000000..0a60a6c1c9 --- /dev/null +++ b/.changeset/soft-beers-unite.md @@ -0,0 +1,5 @@ +--- +"@scow/mis-web": patch +--- + +修改管理系统用户空间集群分区的计量方式显示,修改为与作业价格表中显示方式一致 diff --git a/apps/mis-web/src/components/AmonutStrategyDescriptionsItem.tsx b/apps/mis-web/src/components/AmonutStrategyDescriptionsItem.tsx new file mode 100644 index 0000000000..6c7a4d5c21 --- /dev/null +++ b/apps/mis-web/src/components/AmonutStrategyDescriptionsItem.tsx @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2022 Peking University and Peking University Institute for Computing and Digital Economy + * SCOW is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +import { QuestionCircleOutlined } from "@ant-design/icons"; +import { Popover, Space } from "antd"; +import React from "react"; +import { AmountStrategyAlgorithmDescriptions, + AmountStrategyDescription, AmountStrategyDescriptions, AmountStrategyText } from "src/models/job"; + + +interface Props { + isColContent?: boolean; + amount?: string; + isColTitle?: boolean; +} + +export const AmountStrategyDescriptionsItem: React.FC = ({ + amount, isColTitle, isColContent, +}) => { + + if (isColContent && amount) { + return ( + + {AmountStrategyDescriptions[amount]} + + + + + ); + } + if (isColTitle) { + return ( + + {AmountStrategyText} + +

+ {Object.entries(AmountStrategyDescriptions) + .map((value) =>

{`${value[1]}(${value[0]})`}

)} +

+ {"细节请查阅文档"} + + )} + > + +
+
+ ); + } +}; diff --git a/apps/mis-web/src/components/JobBillingTable.tsx b/apps/mis-web/src/components/JobBillingTable.tsx index e1a67f38de..f4087c9daa 100644 --- a/apps/mis-web/src/components/JobBillingTable.tsx +++ b/apps/mis-web/src/components/JobBillingTable.tsx @@ -12,9 +12,10 @@ import { Table } from "antd"; import { ColumnsType } from "antd/es/table"; -import { AmountStrategyText } from "src/models/job"; import { publicConfig } from "src/utils/config"; +import { AmountStrategyDescriptionsItem } from "./AmonutStrategyDescriptionsItem"; + export interface JobBillingTableItem { index: number; @@ -92,9 +93,20 @@ export const JobBillingTable: React.FC = ({ data, loading }) => { { dataIndex: "price", title: "单价(元)", key: "index", render: (_, r) => ({ children: r.priceItem?.price ?? "未定义", }) }, - { dataIndex: "amount", title: AmountStrategyText, key: "index", render: (_, r) => ({ - children: r.priceItem?.amount ?? "未定义", - }) }, + { + dataIndex: "amount", + title: ( + + ), + key: "index", + render: (_, r) => ({ + children: ( + r.priceItem?.amount ? ( + + ) : "未定义" + ), + }), + }, { dataIndex: "comment", title: "说明", key: "index", render: (_, r) => ({ children: r.comment, props: { rowSpan: r.partitionItemIndex === 0 ? r.qosCount : 0 }, diff --git a/apps/mis-web/src/pageComponents/job/ManageJobBillingTable.tsx b/apps/mis-web/src/pageComponents/job/ManageJobBillingTable.tsx index e79f3d2714..2afb1c8072 100644 --- a/apps/mis-web/src/pageComponents/job/ManageJobBillingTable.tsx +++ b/apps/mis-web/src/pageComponents/job/ManageJobBillingTable.tsx @@ -16,6 +16,7 @@ import { Money } from "@scow/protos/build/common/money"; import { App, Form, Input, InputNumber, Modal, Popover, Select, Space, Table, Tooltip } from "antd"; import React, { useState } from "react"; import { api } from "src/apis"; +import { AmountStrategyDescriptionsItem } from "src/components/AmonutStrategyDescriptionsItem"; import { CommonModalProps, ModalLink } from "src/components/ModalLink"; import { AmountStrategy, AmountStrategyAlgorithmDescriptions, AmountStrategyDescription, @@ -71,12 +72,7 @@ export const ManageJobBillingTable: React.FC = ({ data, loading, tenant, dataIndex={["priceItem", "amountStrategy"]} render={(value) => { return ( - - {AmountStrategyDescriptions[value]} - - - - + ); }} /> @@ -114,35 +110,14 @@ export const ManageJobBillingTable: React.FC = ({ data, loading, tenant, - {AmountStrategyText} - -

- {Object.entries(AmountStrategyDescriptions) - .map((value) =>

{`${value[1]}(${value[0]})`}

)} -

- {"细节请查阅文档"} - - )} - > - -
- + )} dataIndex={["priceItem", "amountStrategy"]} render={(value) => { return ( value ? ( - - {AmountStrategyDescriptions[value]} - - - - + ) : undefined ); }}