All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
static.console-fe.src.components.ImportDialog.ImportDialog.js Maven / Gradle / Ivy
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { isParentEdas } from '@/lib';
import { Balloon, Button, ConfigProvider, Dialog, Form, Icon, Select, Upload } from '@alifd/next';
import './index.scss';
const FormItem = Form.Item;
/**
* @deprecated
*/
@ConfigProvider.config
class ImportDialog extends React.Component {
static displayName = 'ImportDialog';
constructor(props) {
super(props);
this.formItemLayout = {
labelCol: {
fixedSpan: 4,
},
wrapperCol: {
span: 20,
},
};
this.defaultPolicy = 'abort';
this.state = {
visible: false,
serverId: '',
tenant: '',
policy: this.defaultPolicy,
policyLabel: '',
allPolicy: [],
};
}
componentDidMount() {
const { locale = {} } = this.props;
this.setState({
policyLabel: locale.terminate,
allPolicy: [
{ value: 'abort', label: locale.terminate },
{ value: 'skip', label: locale.skip },
{ value: 'overwrite', label: locale.overwrite },
],
});
}
openDialog(payload, callback) {
this.callback = callback;
this.setState({
visible: true,
serverId: payload.serverId,
tenant: payload.tenant,
});
}
closeDialog = () => {
this.setState({
visible: false,
});
};
setPolicy = (...value) => {
this.setState({
policyLabel: value[1].label,
policy: value[0],
});
};
formatter = res => {
if (res.code === 200) {
return {
code: '0',
retData: res,
};
} else {
return {
code: '1',
error: {
message: res.message,
},
retData: res,
};
}
};
render() {
const { locale = {} } = this.props;
let uploadLink = `/diamond-ops/batch/import/serverId/${this.state.serverId}/tenant/${this.state.tenant.id}?policy=${this.state.policy}`;
if (isParentEdas()) {
uploadLink = `/authgw/${window.edasprefix}${uploadLink}`;
}
const helpTip = (
Data ID{' '}
}
align="t"
style={{ marginRight: 5 }}
triggerType="hover"
>
{locale.zipFileFormat}
);
const footer = (
{
this.callback(args[0].retData, this.state.policyLabel);
this.closeDialog();
}}
onError={(...args) => {
this.callback(args[0].response.retData, this.state.policyLabel);
this.closeDialog();
}}
formatter={this.formatter}
headers={{ poweredBy: 'simpleMVC', projectName: 'nacos' }}
>
{locale.uploadFile}
);
return (
{locale.beSureExerciseCaution}
{helpTip}
);
}
}
export default ImportDialog;