fix: configuration export

This commit is contained in:
LoadChange 2020-02-06 12:05:25 +08:00 committed by Asa
parent b6988b7516
commit abc6a44088
4 changed files with 39 additions and 16 deletions

View File

@ -23,8 +23,8 @@ cssLoader.use.push({
loader: '@alifd/next-theme-loader', loader: '@alifd/next-theme-loader',
options: { options: {
modifyVars: { modifyVars: {
'$icon-font-path':'"/nacos/console-fe/public/icons/icon-font"', '$icon-font-path':'"/console-fe/public/icons/icon-font"',
'$font-custom-path': '"/nacos/console-fe/public/fonts/"' '$font-custom-path': '"/console-fe/public/fonts/"'
} }
} }
}) })

View File

@ -675,28 +675,51 @@ class ConfigurationManagement extends React.Component {
}); });
} }
openUri(url, params) {
window.open(
[
url,
Object.keys(params)
.map(key => `${key}=${params[key]}`)
.join('&'),
].join('?')
);
}
exportData() { exportData() {
const url = `v1/cs/configs?export=true&group=${this.group}&tenant=${getParams( const { group, appName, dataId, openUri } = this;
'namespace' const { accessToken = '' } = JSON.parse(localStorage.token || '{}');
)}&appName=${this.appName}&ids=&dataId=${this.dataId}`; openUri('v1/cs/configs', {
window.location.href = url; export: 'true',
tenant: getParams('namespace'),
group,
appName,
dataId,
ids: '',
accessToken,
});
} }
exportSelectedData() { exportSelectedData() {
const ids = [];
const { locale = {} } = this.props; const { locale = {} } = this.props;
if (configsTableSelected.size === 0) { const { accessToken = '' } = JSON.parse(localStorage.token || '{}');
if (!configsTableSelected.size) {
Dialog.alert({ Dialog.alert({
title: locale.exportSelectedAlertTitle, title: locale.exportSelectedAlertTitle,
content: locale.exportSelectedAlertContent, content: locale.exportSelectedAlertContent,
}); });
} else { return;
let idsStr = '';
configsTableSelected.forEach((value, key, map) => {
idsStr = `${idsStr + key},`;
});
let url = `v1/cs/configs?export=true&group=&tenant=&appName=&ids=${idsStr}`;
window.location.href = url;
} }
configsTableSelected.forEach((value, key, map) => ids.push(key));
this.openUri('v1/cs/configs', {
export: 'true',
tenant: '',
group: '',
appName: '',
ids: ids.join(','),
accessToken,
});
} }
multipleSelectionDeletion() { multipleSelectionDeletion() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long