Commit 00afbc1a authored by 皮倩雯's avatar 皮倩雯

fix: '数据库初始化支持未使用过授权码的老数据库'

parent 8c77b278
Pipeline #72485 passed with stages
...@@ -16,7 +16,7 @@ import { GetLicenseDifference, InitEditDataBase, GetProductList } from '@/servic ...@@ -16,7 +16,7 @@ import { GetLicenseDifference, InitEditDataBase, GetProductList } from '@/servic
import New from '../../../assets/images/icons/new.png'; import New from '../../../assets/images/icons/new.png';
const AppendModal = props => { const AppendModal = props => {
const { callBackSubmit = () => {}, visible, onCancel, value, keepHistroy } = props; const { callBackSubmit = () => {}, visible, onCancel, value, keepHistroy, appendType } = props;
const [data, setData] = useState([]); const [data, setData] = useState([]);
const [allLength, setAllLength] = useState(''); const [allLength, setAllLength] = useState('');
const [flag, setFlag] = useState(); const [flag, setFlag] = useState();
...@@ -191,7 +191,17 @@ const AppendModal = props => { ...@@ -191,7 +191,17 @@ const AppendModal = props => {
if (allValue.length == 0) { if (allValue.length == 0) {
return <span style={{ color: 'red' }}>license下产品已全被初始化,无需再次追加!!!</span>; 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 ( return (
......
...@@ -35,6 +35,7 @@ import { ...@@ -35,6 +35,7 @@ import {
NewInitAddDataBase, NewInitAddDataBase,
InitEditDataBase, InitEditDataBase,
getDataBaseConfigNew, getDataBaseConfigNew,
UpgradeDataBase,
} from '@/services/database/api'; } from '@/services/database/api';
import { import {
CloseCircleOutlined, CloseCircleOutlined,
...@@ -122,6 +123,7 @@ const DatabaseInitialization = props => { ...@@ -122,6 +123,7 @@ const DatabaseInitialization = props => {
const [keepHistroy, setKeepHistroy] = useState([]); const [keepHistroy, setKeepHistroy] = useState([]);
const [historyVisible, setHistoryVisible] = useState(false); const [historyVisible, setHistoryVisible] = useState(false);
const [keepInitDetailVisible, setKeepInitDetailVisible] = useState(false); const [keepInitDetailVisible, setKeepInitDetailVisible] = useState(false);
const [appendType, setAppendType] = useState('no');
const key = CryptoJS.enc.Utf8.parse('1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'); //十六位十六进制数作为密钥 const key = CryptoJS.enc.Utf8.parse('1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'); //十六位十六进制数作为密钥
const iv = CryptoJS.enc.Utf8.parse('1234567890000000'); const iv = CryptoJS.enc.Utf8.parse('1234567890000000');
...@@ -754,7 +756,11 @@ const DatabaseInitialization = props => { ...@@ -754,7 +756,11 @@ const DatabaseInitialization = props => {
setInitVisible(true); setInitVisible(true);
doInitLog(); doInitLog();
let obj = form.getFieldsValue(); 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) { if (res.code === 0) {
GetDbChangeAppend(); GetDbChangeAppend();
setMsg('未检测到可用License'); setMsg('未检测到可用License');
...@@ -910,14 +916,21 @@ const DatabaseInitialization = props => { ...@@ -910,14 +916,21 @@ const DatabaseInitialization = props => {
setResult('检测到License,当前环境需要追加产品'); setResult('检测到License,当前环境需要追加产品');
setMsg('检测到License,当前环境需要追加产品'); setMsg('检测到License,当前环境需要追加产品');
setAppend(''); setAppend('');
setAppendType('no');
setAppendVisible(true); setAppendVisible(true);
console.log(form.getFieldsValue());
setDataValue(form.getFieldsValue()); setDataValue(form.getFieldsValue());
} else { } else {
setbeforeColor('red'); setbeforeColor('green');
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!'); setAppendType('yes');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!'); setResult('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setAppend('无需追加'); setMsg('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
// setbeforeColor('red');
// setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setAppend('无需追加');
} }
} }
} else { } else {
...@@ -929,6 +942,7 @@ const DatabaseInitialization = props => { ...@@ -929,6 +942,7 @@ const DatabaseInitialization = props => {
}; };
const Submit = () => { const Submit = () => {
setAppendType('no');
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
if (obj.ip && obj.userName && obj.password && obj.dbName) { if (obj.ip && obj.userName && obj.password && obj.dbName) {
GetProductList({ ...obj, password: Encrypt(obj.password) }).then(res => { GetProductList({ ...obj, password: Encrypt(obj.password) }).then(res => {
...@@ -950,7 +964,6 @@ const DatabaseInitialization = props => { ...@@ -950,7 +964,6 @@ const DatabaseInitialization = props => {
setData(arr); setData(arr);
} }
}); });
setCardLoading(true); setCardLoading(true);
} else { } else {
setbeforeColor('red'); setbeforeColor('red');
...@@ -971,14 +984,22 @@ const DatabaseInitialization = props => { ...@@ -971,14 +984,22 @@ const DatabaseInitialization = props => {
setResult('检测到License,当前环境需要追加产品'); setResult('检测到License,当前环境需要追加产品');
setMsg('检测到License,当前环境需要追加产品'); setMsg('检测到License,当前环境需要追加产品');
setAppend(''); setAppend('');
setAppendType('no');
setAppendVisible(true); setAppendVisible(true);
setDataValue(form.getFieldsValue()); setDataValue(form.getFieldsValue());
} else { } else {
setbeforeColor('red'); setbeforeColor('green');
setPassword(false); setAppendType('yes');
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! '); setResult('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!'); setMsg('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setAppend('无需追加'); setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
// setbeforeColor('red');
// setPassword(false);
// setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
// setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setAppend('无需追加');
// deleteInitDBLogNew(); // deleteInitDBLogNew();
} }
} else { } else {
...@@ -1020,12 +1041,20 @@ const DatabaseInitialization = props => { ...@@ -1020,12 +1041,20 @@ const DatabaseInitialization = props => {
setAppend(''); setAppend('');
setAppendVisible(true); setAppendVisible(true);
setDataValue(form.getFieldsValue()); setDataValue(form.getFieldsValue());
setAppendType('no');
} else { } else {
setbeforeColor('red'); setbeforeColor('green');
setPassword(false); setResult('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! '); setMsg('当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!'); setAppendType('yes');
setAppend('无需追加'); setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
// setbeforeColor('red');
// setPassword(false);
// setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
// setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
// setAppend('无需追加');
// deleteInitDBLogNew(); // deleteInitDBLogNew();
} }
} else { } else {
...@@ -1052,6 +1081,7 @@ const DatabaseInitialization = props => { ...@@ -1052,6 +1081,7 @@ const DatabaseInitialization = props => {
}; };
const save = () => { const save = () => {
setAppendType('no');
flagChange(); flagChange();
}; };
...@@ -1286,6 +1316,17 @@ const DatabaseInitialization = props => { ...@@ -1286,6 +1316,17 @@ const DatabaseInitialization = props => {
</span> </span>
</> </>
); );
case '当前数据库为非授权初始化数据库,可使用授权码升级到授权码模式':
return (
<>
<CheckCircleOutlined
style={{ color: 'green', marginLeft: '10px' }}
/>
<span style={{ color: 'rgb(24 144 255)', marginLeft: '5px' }}>
{result}
</span>
</>
);
default: default:
return ( return (
<> <>
...@@ -1718,6 +1759,7 @@ const DatabaseInitialization = props => { ...@@ -1718,6 +1759,7 @@ const DatabaseInitialization = props => {
onCancel={() => { onCancel={() => {
setAppendVisible(false); setAppendVisible(false);
}} }}
appendType={appendType}
value={dataValue} value={dataValue}
callBackSubmit={onOk} callBackSubmit={onOk}
keepHistroy={keepHistroy} keepHistroy={keepHistroy}
......
...@@ -238,3 +238,6 @@ export const NewInitAddDataBase = params => ...@@ -238,3 +238,6 @@ export const NewInitAddDataBase = params =>
// 获取追加产品 // 获取追加产品
export const GetLicenseDifference = params => export const GetLicenseDifference = params =>
post(`${PUBLISH_SERVICE}/DBManager/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