修改导出的流程(先弹窗确认),未修改完

This commit is contained in:
keran 2019-05-19 22:30:00 +08:00
parent ad3a6953cb
commit e16a3406e4
3 changed files with 51 additions and 14 deletions

View File

@ -225,6 +225,8 @@ const I18N_CONF = {
operation: 'Operation',
export: 'Export query results',
import: 'Import',
importSucc: 'Import success',
uploadBtn: 'Upload File',
},
NewConfig: {
newListingMain: 'Create Configuration',

View File

@ -224,6 +224,8 @@ const I18N_CONF = {
operation: '操作',
export: '导出查询结果',
import: '导入配置',
importSucc: '导入成功',
uploadBtn: '上传文件',
},
NewConfig: {
newListingMain: '新建配置',

View File

@ -669,24 +669,60 @@ class ConfigurationManagement extends React.Component {
}
exportData() {
let url = 'v1/cs/configs?export=true&group=' + this.group + '&appName=' + this.appName;
let url =
'v1/cs/configs?export=true&group=' +
this.group +
'&tenant=' +
getParams('namespace') +
'&appName=' +
this.appName +
'&ids=';
window.location.href = url;
}
render() {
importData() {
const { locale = {} } = this.props;
const self = this;
const uploadProps = {
accept: 'application/zip',
onStart(file) {
console.log('onStart', file, file.name);
},
action: 'v1/cs/configs?import=true&namespace=' + getParams('namespace'),
onSuccess(ret) {
console.log('onSuccess', ret);
Dialog.show({
title: locale.importSucc,
content: <div>{locale.importSucc}</div>,
});
self.getData();
},
onError(err) {
console.log('onError', err);
},
};
Dialog.confirm({
title: locale.import,
footer: false,
content: (
<div>
<div>目标空间:</div>
<div>相同配制:</div>
<div>
<Upload
name={'file'}
component={'button'}
className={'next-btn next-medium next-btn-primary'}
style={{ marginRight: 10 }}
data-spm-click={'gostr=/aliyun;locaid=configsImport'}
{...uploadProps}
>
{locale.uploadBtn}
</Upload>
</div>
</div>
),
});
}
render() {
const { locale = {} } = this.props;
return (
<div>
<BatchHandle ref={ref => (this.batchHandle = ref)} />
@ -821,17 +857,14 @@ class ConfigurationManagement extends React.Component {
</Button>
</Form.Item>
<Form.Item label={''}>
<Upload
name={'file'}
component={'button'}
className={'next-btn next-medium next-btn-primary'}
<Button
type={'primary'}
style={{ marginRight: 10 }}
data-spm-click={'gostr=/aliyun;locaid=configsImport'}
action={'v1/cs/configs?import=true'}
{...uploadProps}
onClick={this.importData.bind(this)}
data-spm-click={'gostr=/aliyun;locaid=configsExport'}
>
{locale.import}
</Upload>
</Button>
</Form.Item>
<br />
<Form.Item