From 74694ede6e1a66ca41b53212da99e696e5ebc78f Mon Sep 17 00:00:00 2001 From: keran <213539@qq.com> Date: Tue, 30 Jul 2019 13:56:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D#1583?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/console-fe/src/locales/en-US.js | 2 + .../static/console-fe/src/locales/zh-CN.js | 2 + .../ConfigurationManagement.js | 41 +++++++++---------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/console/src/main/resources/static/console-fe/src/locales/en-US.js b/console/src/main/resources/static/console-fe/src/locales/en-US.js index acc8e2982..a4094c9ed 100644 --- a/console/src/main/resources/static/console-fe/src/locales/en-US.js +++ b/console/src/main/resources/static/console-fe/src/locales/en-US.js @@ -291,6 +291,8 @@ const I18N_CONF = { target: 'Target:', selectNamespace: 'Select Namespace', selectedEntry: '| Selected Entry', + cloneSelectedAlertTitle: 'Clone config', + cloneSelectedAlertContent: 'please select the configuration to clone', }, NewConfig: { newListingMain: 'Create Configuration', diff --git a/console/src/main/resources/static/console-fe/src/locales/zh-CN.js b/console/src/main/resources/static/console-fe/src/locales/zh-CN.js index df9bf0e09..f82313fab 100644 --- a/console/src/main/resources/static/console-fe/src/locales/zh-CN.js +++ b/console/src/main/resources/static/console-fe/src/locales/zh-CN.js @@ -289,6 +289,8 @@ const I18N_CONF = { target: '目标空间:', selectNamespace: '请选择命名空间', selectedEntry: '| 选中的条目', + cloneSelectedAlertTitle: '配置克隆', + cloneSelectedAlertContent: '请选择要克隆的配置', }, NewConfig: { newListingMain: '新建配置', diff --git a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js index fb3f245cc..8eefaf87b 100644 --- a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js +++ b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js @@ -100,6 +100,10 @@ class ConfigurationManagement extends React.Component { contentList: [], isAdvancedQuery: false, isCheckAll: false, + rowSelection: { + onChange: this.configDataTableOnChange.bind(this), + selectedRowKeys: [], + }, }; const obj = { dataId: this.dataId || '', @@ -250,6 +254,10 @@ class ConfigurationManagement extends React.Component { }); } this.getData(); + configsTableSelected.clear(); + const { rowSelection } = this.state; + rowSelection.selectedRowKeys = []; + this.setState({ rowSelection }); } getData(pageNo = 1, clearSelect = true) { @@ -704,8 +712,8 @@ class ConfigurationManagement extends React.Component { self.field.setValue('cloneTargetSpace', undefined); if (configsTableSelected.size === 0) { Dialog.alert({ - title: locale.exportSelectedAlertTitle, - content: locale.exportSelectedAlertContent, + title: locale.cloneSelectedAlertTitle, + content: locale.cloneSelectedAlertContent, }); return; } @@ -1024,22 +1032,14 @@ class ConfigurationManagement extends React.Component { }); } - configsTableOnSelect(selected, record, records) { - if (selected) { - configsTableSelected.set(record.id, record); - } else { - configsTableSelected.delete(record.id); - } - } - - configsTableOnSelectAll(selected, records) { - if (selected) { - records.forEach((record, i) => { - configsTableSelected.set(record.id, record); - }); - } else { - configsTableSelected.clear(); - } + configDataTableOnChange(ids, records) { + const { rowSelection } = this.state; + rowSelection.selectedRowKeys = ids; + this.setState({ rowSelection }); + configsTableSelected.clear(); + ids.forEach((id, i) => { + configsTableSelected.set(id, id); + }); } render() { @@ -1239,10 +1239,7 @@ class ConfigurationManagement extends React.Component { fixedHeader maxBodyHeight={400} ref={'dataTable'} - rowSelection={{ - onSelect: this.configsTableOnSelect, - onSelectAll: this.configsTableOnSelectAll, - }} + rowSelection={this.state.rowSelection} >