From 832cce176ca9c1dd183388b90710de971c0a67c1 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Thu, 18 Aug 2022 09:41:40 +0800 Subject: [PATCH] refactor: remove the basic role display from the overview page 1. remove the basic role display from the overview page: because the api removed the base role information[1] 2. fix the title i18n [1] I461ae3f8979377ae22ec851bf3315e509b22cfbd Change-Id: Ib0e1ed51010c68dac64159a6154e65399f46a14d --- src/locales/en.json | 3 +- src/locales/zh.json | 3 +- .../Overview/components/ProjectInfo.jsx | 75 ++----------------- .../containers/Credentials/actions/Create.jsx | 1 - src/stores/root.js | 11 +-- 5 files changed, 13 insertions(+), 80 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 9a21be46..4706f59e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -226,7 +226,6 @@ "BareMetal Parameters": "BareMetal Parameters", "Base Config": "Base Config", "Base Info": "Base Info", - "Base Role": "Base Role", "Basic Parameters": "Basic Parameters", "Batch Allocate": "Batch Allocate", "Belarus": "Belarus", @@ -239,6 +238,7 @@ "Bind Device": "Bind Device", "Bind Device Type": "Bind Device Type", "Bind Resource": "Bind Resource", + "Bind Resource Name": "Bind Resource Name", "Binding": "Binding", "Binding Groups": "Binding Groups", "Binding Instance": "Binding Instance", @@ -1049,6 +1049,7 @@ "HealthMonitor Type": "HealthMonitor Type", "Healthy": "Healthy", "Heartbeat Timestamp": "Heartbeat Timestamp", + "Hello, {name}": "Hello, {name}", "Heterogeneous Computing": "Heterogeneous Computing", "Hidden": "Hidden", "Hide Advanced Options": "Hide Advanced Options", diff --git a/src/locales/zh.json b/src/locales/zh.json index 90208fe2..fb1fb607 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -226,7 +226,6 @@ "BareMetal Parameters": "裸机参数", "Base Config": "基础配置", "Base Info": "基本信息", - "Base Role": "基础角色", "Basic Parameters": "基本参数", "Batch Allocate": "批量申请", "Belarus": "白俄罗斯", @@ -239,6 +238,7 @@ "Bind Device": "绑定设备", "Bind Device Type": "绑定设备类型", "Bind Resource": "绑定资源", + "Bind Resource Name": "绑定资源名称", "Binding": "绑定", "Binding Groups": "绑定的用户组", "Binding Instance": "绑定云主机", @@ -1049,6 +1049,7 @@ "HealthMonitor Type": "健康检查类型", "Healthy": "健康", "Heartbeat Timestamp": "心跳时间戳", + "Hello, {name}": "您好,{name}", "Heterogeneous Computing": "异构计算", "Hidden": "隐藏", "Hide Advanced Options": "隐藏高级选项", diff --git a/src/pages/base/containers/Overview/components/ProjectInfo.jsx b/src/pages/base/containers/Overview/components/ProjectInfo.jsx index 97a5eb43..b1436480 100644 --- a/src/pages/base/containers/Overview/components/ProjectInfo.jsx +++ b/src/pages/base/containers/Overview/components/ProjectInfo.jsx @@ -13,33 +13,11 @@ // limitations under the License. import React, { Component } from 'react'; -import { Card, Descriptions, Button } from 'antd'; +import { Card, Descriptions } from 'antd'; import { inject, observer } from 'mobx-react'; -import { UpOutlined, DownOutlined } from '@ant-design/icons'; import styles from '../style.less'; export class ProjectInfo extends Component { - constructor(props) { - super(props); - this.state = { - collapsed: true, - }; - } - - onCollapsedCallback = () => {}; - - handleDetailInfo = () => { - const { collapsed } = this.state; - this.setState( - { - collapsed: !collapsed, - }, - () => { - this.onCollapsedCallback(!collapsed); - } - ); - }; - get rootStore() { return this.props.rootStore || {}; } @@ -49,14 +27,9 @@ export class ProjectInfo extends Component { return user || {}; } - get showRoles() { - const { roles = [], baseRoles = [] } = this.rootStore; - return roles.filter((it) => baseRoles.indexOf(it.name) === -1); - } - - get baseRoles() { - const { roles = [], baseRoles = [] } = this.rootStore; - return roles.filter((it) => baseRoles.indexOf(it.name) !== -1); + get roles() { + const { roles = [] } = this.rootStore; + return roles; } renderAccount() { @@ -71,14 +44,14 @@ export class ProjectInfo extends Component { ); } - renderShowRole() { + renderRoles() { return ( - {this.showRoles.map((item) => item.name).join(', ')} + {this.roles.map((item) => item.name).join(', ')} ); } @@ -95,36 +68,6 @@ export class ProjectInfo extends Component { ); } - renderBaseRole() { - const { collapsed } = this.state; - if (collapsed) { - return null; - } - - return ( - - {this.baseRoles.map((item) => item.name).join(', ')} - - ); - } - - renderButton() { - const { collapsed } = this.state; - const icon = collapsed ? : ; - return ( -