Skip to content

Commit e820ff6

Browse files
committed
[type:improve] export import dropdown optimize
1 parent a26ae03 commit e820ff6

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

src/components/GlobalHeader/index.js

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@
1616
*/
1717

1818
import React, { PureComponent } from "react";
19-
import {
20-
Button,
21-
Dropdown,
22-
Form,
23-
Icon,
24-
Input,
25-
Menu,
26-
message,
27-
Modal,
28-
} from "antd";
19+
import { Button, Dropdown, Form, Icon, Input, Menu, Modal } from "antd";
2920
import { connect } from "dva";
3021
import { withRouter } from "dva/router";
3122
import ImportModal from "./ImportModal";
@@ -299,6 +290,13 @@ class GlobalHeader extends PureComponent {
299290
<Icon type="form" />{" "}
300291
{getIntlContent("SHENYU.GLOBALHEADER.CHANGE.PASSWORD")}
301292
</Menu.Item>
293+
<Menu.Item key="0" onClick={onLogout}>
294+
<Icon type="logout" /> {getIntlContent("SHENYU.GLOBALHEADER.LOGOUT")}
295+
</Menu.Item>
296+
</Menu>
297+
);
298+
const importMenu = (
299+
<Menu>
302300
{this.checkAuth("system:manager:exportConfig") && (
303301
<Menu.Item key="2" onClick={this.exportConfigClick}>
304302
<Icon type="export" /> {getIntlContent("SHENYU.COMMON.EXPORT")}
@@ -309,9 +307,6 @@ class GlobalHeader extends PureComponent {
309307
<Icon type="import" /> {getIntlContent("SHENYU.COMMON.IMPORT")}
310308
</Menu.Item>
311309
)}
312-
<Menu.Item key="0" onClick={onLogout}>
313-
<Icon type="logout" /> {getIntlContent("SHENYU.GLOBALHEADER.LOGOUT")}
314-
</Menu.Item>
315310
</Menu>
316311
);
317312
return (
@@ -354,18 +349,15 @@ class GlobalHeader extends PureComponent {
354349
</Dropdown>
355350
</div>
356351
)}
357-
{this.checkAuth("system:manager:importConfig") && (
352+
{(this.checkAuth("system:manager:importConfig") ||
353+
this.checkAuth("system:manager:exportConfig")) && (
358354
<div className={styles.item}>
359-
<Button onClick={this.importConfigClick}>
360-
<Icon type="import" /> {getIntlContent("SHENYU.COMMON.IMPORT")}
361-
</Button>
362-
</div>
363-
)}
364-
{this.checkAuth("system:manager:exportConfig") && (
365-
<div className={styles.item}>
366-
<Button onClick={this.exportConfigClick}>
367-
<Icon type="export" /> {getIntlContent("SHENYU.COMMON.EXPORT")}
368-
</Button>
355+
<Dropdown overlay={importMenu}>
356+
<Button>
357+
<Icon type="import" />{" "}
358+
{getIntlContent("SHENYU.COMMON.IMPORT_EXPORT")}
359+
</Button>
360+
</Dropdown>
369361
</div>
370362
)}
371363
<div className={styles.item}>

src/locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@
403403
"SHENYU.DOCUMENT.TAG.TABLE.CREATETIME": "Create Time",
404404
"SHENYU.DOCUMENT.TAG.TABLE.MODIFYTIME": "Modify Time",
405405
"SHENYU.COMMON.REQUIRED": "Required",
406+
"SHENYU.COMMON.IMPORT_EXPORT": "Import/Export configs",
406407
"SHENYU.COMMON.EXPORT": "Export Configs",
407408
"SHENYU.COMMON.IMPORT": "Import Configs",
408409
"SHENYU.COMMON.IMPORT.RESULT": "Import Result",

src/locales/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@
408408
"SHENYU.DOCUMENT.TAG.TABLE.CREATETIME": "创建时间",
409409
"SHENYU.DOCUMENT.TAG.TABLE.MODIFYTIME": "修改时间",
410410
"SHENYU.COMMON.REQUIRED": "必填",
411+
"SHENYU.COMMON.IMPORT_EXPORT": "导入配置/导出配置",
411412
"SHENYU.COMMON.EXPORT": "导出所有配置",
412413
"SHENYU.COMMON.IMPORT": "导入配置",
413414
"SHENYU.COMMON.IMPORT.RESULT": "导入结果",

0 commit comments

Comments
 (0)