Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace optimize #514

Merged
merged 5 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 16 additions & 27 deletions src/components/GlobalHeader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@
*/

import React, { PureComponent } from "react";
import {
Button,
Dropdown,
Form,
Icon,
Input,
Menu,
message,
Modal,
} from "antd";
import { Button, Dropdown, Form, Icon, Input, Menu, Modal } from "antd";
import { connect } from "dva";
import { withRouter } from "dva/router";
import ImportModal from "./ImportModal";
Expand Down Expand Up @@ -169,9 +160,6 @@ class GlobalHeader extends PureComponent {
type: "global/saveCurrentNamespaceId",
payload: namespaceId,
});
if (namespaceId !== defaultNamespaceId) {
message.warn(getIntlContent("SHENYU.NAMESPACE.ALERTNAMESPACEID.CHANGED"));
}
// Fetch plugins for the new namespace
dispatch({
type: "global/fetchPlugins",
Expand Down Expand Up @@ -302,6 +290,13 @@ class GlobalHeader extends PureComponent {
<Icon type="form" />{" "}
{getIntlContent("SHENYU.GLOBALHEADER.CHANGE.PASSWORD")}
</Menu.Item>
<Menu.Item key="0" onClick={onLogout}>
<Icon type="logout" /> {getIntlContent("SHENYU.GLOBALHEADER.LOGOUT")}
</Menu.Item>
</Menu>
);
const importMenu = (
<Menu>
{this.checkAuth("system:manager:exportConfig") && (
<Menu.Item key="2" onClick={this.exportConfigClick}>
<Icon type="export" /> {getIntlContent("SHENYU.COMMON.EXPORT")}
Expand All @@ -312,9 +307,6 @@ class GlobalHeader extends PureComponent {
<Icon type="import" /> {getIntlContent("SHENYU.COMMON.IMPORT")}
</Menu.Item>
)}
<Menu.Item key="0" onClick={onLogout}>
<Icon type="logout" /> {getIntlContent("SHENYU.GLOBALHEADER.LOGOUT")}
</Menu.Item>
</Menu>
);
return (
Expand Down Expand Up @@ -357,18 +349,15 @@ class GlobalHeader extends PureComponent {
</Dropdown>
</div>
)}
{this.checkAuth("system:manager:importConfig") && (
<div className={styles.item}>
<Button onClick={this.importConfigClick}>
<Icon type="import" /> {getIntlContent("SHENYU.COMMON.IMPORT")}
</Button>
</div>
)}
{this.checkAuth("system:manager:exportConfig") && (
{(this.checkAuth("system:manager:importConfig") ||
this.checkAuth("system:manager:exportConfig")) && (
<div className={styles.item}>
<Button onClick={this.exportConfigClick}>
<Icon type="export" /> {getIntlContent("SHENYU.COMMON.EXPORT")}
</Button>
<Dropdown overlay={importMenu}>
<Button>
<Icon type="import" />{" "}
{getIntlContent("SHENYU.COMMON.IMPORT_EXPORT")}
</Button>
</Dropdown>
</div>
)}
<div className={styles.item}>
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@
"SHENYU.DOCUMENT.TAG.TABLE.CREATETIME": "Create Time",
"SHENYU.DOCUMENT.TAG.TABLE.MODIFYTIME": "Modify Time",
"SHENYU.COMMON.REQUIRED": "Required",
"SHENYU.COMMON.IMPORT_EXPORT": "Import/Export configs",
"SHENYU.COMMON.EXPORT": "Export Configs",
"SHENYU.COMMON.IMPORT": "Import Configs",
"SHENYU.COMMON.IMPORT.RESULT": "Import Result",
Expand Down Expand Up @@ -473,6 +474,5 @@
"SHENYU.NAMESPACE.INPUTDESC":"description",
"SHENYU.NAMESPACE.INPUTNAMESPACEID":"namespaceId",
"SHENYU.NAMESPACE.ALERTNAMESPACEID":"Automatically generated namespaceId",
"SHENYU.NAMESPACE.ALERTNAMESPACEID.CHANGED":"Namespace development in progress",
"SHENYU.MENU.SYSTEM.MANAGMENT.NAMESPACEPLUGIN":"Plugin"
}
2 changes: 1 addition & 1 deletion src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@
"SHENYU.DOCUMENT.TAG.TABLE.CREATETIME": "创建时间",
"SHENYU.DOCUMENT.TAG.TABLE.MODIFYTIME": "修改时间",
"SHENYU.COMMON.REQUIRED": "必填",
"SHENYU.COMMON.IMPORT_EXPORT": "导入配置/导出配置",
"SHENYU.COMMON.EXPORT": "导出所有配置",
"SHENYU.COMMON.IMPORT": "导入配置",
"SHENYU.COMMON.IMPORT.RESULT": "导入结果",
Expand Down Expand Up @@ -479,6 +480,5 @@
"SHENYU.NAMESPACE.INPUTDESC":"请输入命名空间描述",
"SHENYU.NAMESPACE.INPUTNAMESPACEID":"请输入namespaceId",
"SHENYU.NAMESPACE.ALERTNAMESPACEID":"系统自动生成namespaceId",
"SHENYU.NAMESPACE.ALERTNAMESPACEID.CHANGED":"命名空间开发中",
"SHENYU.MENU.SYSTEM.MANAGMENT.NAMESPACEPLUGIN":"插件管理"
}
2 changes: 1 addition & 1 deletion src/routes/Plugin/Common/RuleCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class RuleCopy extends Component {
</Menu>
}
>
<Button>
<Button style={{ marginBottom: 20 }}>
<a
className="ant-dropdown-link"
style={{ fontWeight: "bold" }}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Plugin/Common/SelectorCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class SelectorCopy extends Component {
</Menu>
}
>
<Button>
<Button style={{ marginBottom: 20 }}>
<a
className="ant-dropdown-link"
style={{ fontWeight: "bold" }}
Expand Down
10 changes: 9 additions & 1 deletion src/routes/System/PluginHandle/AddModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ class AddPluginHandle extends Component {
],
initialValue: pluginId,
})(
<Select placeholder={getIntlContent("SHENYU.PLUGIN.PLUGIN.NAME")}>
<Select
placeholder={getIntlContent("SHENYU.PLUGIN.PLUGIN.NAME")}
showSearch
filterOption={(input, option) =>
option.props.children
.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
}
>
{pluginDropDownList.map((item, i) => {
return (
<Option key={i} value={item.id}>
Expand Down
Loading