Commit f7b40587 authored by 涂伟's avatar 涂伟
parents 8ca1dcb8 00afbc1a
Pipeline #72528 passed with stages
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -16,7 +16,7 @@ import { GetLicenseDifference, InitEditDataBase, GetProductList } from '@/servic
import New from '../../../assets/images/icons/new.png';
const AppendModal = props => {
const { callBackSubmit = () => {}, visible, onCancel, value, keepHistroy } = props;
const { callBackSubmit = () => {}, visible, onCancel, value, keepHistroy, appendType } = props;
const [data, setData] = useState([]);
const [allLength, setAllLength] = useState('');
const [flag, setFlag] = useState();
......@@ -191,7 +191,17 @@ const AppendModal = props => {
if (allValue.length == 0) {
return <span style={{ color: 'red' }}>license下产品已全被初始化,无需再次追加!!!</span>;
}
return <span style={{ color: 'rgb(24 144 255)' }}>是否确认追加!</span>;
return (
<span style={{ color: 'rgb(24 144 255)' }}>
{appendType === 'yes' ? (
<div style={{ width: '150px' }}>
当前数据库为非授权初始化数据库,是否使用授权码升级到授权码模式?
</div>
) : (
'是否确认追加!'
)}
</span>
);
};
return (
......
......@@ -35,6 +35,7 @@ import {
NewInitAddDataBase,
InitEditDataBase,
getDataBaseConfigNew,
UpgradeDataBase,
} from '@/services/database/api';
import {
CloseCircleOutlined,
......@@ -122,6 +123,7 @@ const DatabaseInitialization = props => {
const [keepHistroy, setKeepHistroy] = useState([]);
const [historyVisible, setHistoryVisible] = useState(false);
const [keepInitDetailVisible, setKeepInitDetailVisible] = useState(false);
const [appendType, setAppendType] = useState('no');
const key = CryptoJS.enc.Utf8.parse('1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'); //十六位十六进制数作为密钥
const iv = CryptoJS.enc.Utf8.parse('1234567890000000');
......@@ -754,7 +756,11 @@ const DatabaseInitialization = props => {
setInitVisible(true);
doInitLog();
let obj = form.getFieldsValue();
InitEditDataBase({ ...obj, password: Encrypt(obj.password) }).then(res => {
InitEditDataBase({
...obj,
password: Encrypt(obj.password),
isOldDbToNewDb: appendType === 'yes' ? true : false,
}).then(res => {
if (res.code === 0) {
GetDbChangeAppend();
setMsg('未检测到可用License');
......@@ -910,14 +916,21 @@ const DatabaseInitialization = props => {
setResult('检测到License,当前环境需要追加产品');
setMsg('检测到License,当前环境需要追加产品');
setAppend('');
setAppendType('no');
setAppendVisible(true);
console.log(form.getFieldsValue());
setDataValue(form.getFieldsValue());
} else {
setbeforeColor('red');
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
setAppend('无需追加');
setbeforeColor('green');
setAppendType('yes');
setResult('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setMsg('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
// setbeforeColor('red');
// setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setAppend('无需追加');
}
}
} else {
......@@ -929,6 +942,7 @@ const DatabaseInitialization = props => {
};
const Submit = () => {
setAppendType('no');
let obj = form.getFieldsValue();
if (obj.ip && obj.userName && obj.password && obj.dbName) {
GetProductList({ ...obj, password: Encrypt(obj.password) }).then(res => {
......@@ -950,7 +964,6 @@ const DatabaseInitialization = props => {
setData(arr);
}
});
setCardLoading(true);
} else {
setbeforeColor('red');
......@@ -971,14 +984,22 @@ const DatabaseInitialization = props => {
setResult('检测到License,当前环境需要追加产品');
setMsg('检测到License,当前环境需要追加产品');
setAppend('');
setAppendType('no');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
} else {
setbeforeColor('red');
setPassword(false);
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
setAppend('无需追加');
setbeforeColor('green');
setAppendType('yes');
setResult('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setMsg('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
// setbeforeColor('red');
// setPassword(false);
// setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
// setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setAppend('无需追加');
// deleteInitDBLogNew();
}
} else {
......@@ -1020,12 +1041,20 @@ const DatabaseInitialization = props => {
setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
setAppendType('no');
} else {
setbeforeColor('red');
setPassword(false);
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
setAppend('无需追加');
setbeforeColor('green');
setResult('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setMsg('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setAppendType('yes');
setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
// setbeforeColor('red');
// setPassword(false);
// setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
// setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setAppend('无需追加');
// deleteInitDBLogNew();
}
} else {
......@@ -1052,6 +1081,7 @@ const DatabaseInitialization = props => {
};
const save = () => {
setAppendType('no');
flagChange();
};
......@@ -1286,6 +1316,17 @@ const DatabaseInitialization = props => {
</span>
</>
);
case '当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式':
return (
<>
<CheckCircleOutlined
style={{ color: 'green', marginLeft: '10px' }}
/>
<span style={{ color: 'rgb(24 144 255)', marginLeft: '5px' }}>
{result}
</span>
</>
);
default:
return (
<>
......@@ -1718,6 +1759,7 @@ const DatabaseInitialization = props => {
onCancel={() => {
setAppendVisible(false);
}}
appendType={appendType}
value={dataValue}
callBackSubmit={onOk}
keepHistroy={keepHistroy}
......
......@@ -238,3 +238,6 @@ export const NewInitAddDataBase = params =>
// 获取追加产品
export const GetLicenseDifference = params =>
post(`${PUBLISH_SERVICE}/DBManager/GetLicenseDifference`, params);
export const UpgradeDataBase = params =>
post(`${PUBLISH_SERVICE}/DBManager/UpgradeDataBase`, params);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment