Skip to content

Commit

Permalink
[ISSUE #11847] Feature: add console-ui publish config cas (#11927)
Browse files Browse the repository at this point in the history
* 修复openApi publishConfigCas失效

* 修复openApi publishConfigCas失效

* fix unit test

* add publish cas
  • Loading branch information
985492783 authored Apr 8, 2024
1 parent 8af8519 commit d4126ba
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions console-ui/src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ const I18N_CONF = {
dialogCurrentArea: 'Current Value',
dialogOriginalArea: 'Original Value',
publishFailed403: 'Publish failed. No operation permission',
publishCasFailed: 'Publish failed. Changes configuration conflict',
namespace: 'Namespace',
},
EditorNameSpace: {
Expand Down
1 change: 1 addition & 0 deletions console-ui/src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ const I18N_CONF = {
dialogCurrentArea: '当前值',
dialogOriginalArea: '原始值',
publishFailed403: '发布失败,请检查是否有权限',
publishCasFailed: '发布失败,配置修改冲突',
namespace: '命名空间',
},
EditorNameSpace: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ConfigEditor extends React.Component {
isNewConfig: true,
betaPublishSuccess: false,
betaIps: '',
casMd5: '',
tabActiveKey: '',
form: {
dataId: '', // 配置 ID
Expand Down Expand Up @@ -248,6 +249,7 @@ class ConfigEditor extends React.Component {
if (beta) {
headers.betaIps = betaIps;
}
headers.casMd5 = this.state.casMd5;
const form = { ...this.state.form, content: this.getCodeVal(), betaIps };
const payload = {};
Object.keys(form).forEach(key => {
Expand Down Expand Up @@ -281,6 +283,14 @@ class ConfigEditor extends React.Component {
Dialog.alert({
content: this.props.locale.publishFailed403,
});
} else if (
error.status &&
error.status === 500 &&
error.data.includes('Cas publish fail')
) {
Dialog.alert({
content: this.props.locale.publishCasFailed,
});
}
}
);
Expand Down Expand Up @@ -389,13 +399,14 @@ class ConfigEditor extends React.Component {
return request.get('v1/cs/configs', { params }).then(res => {
const form = beta ? res.data : res;
if (!form) return false;
const { type, content, configTags, betaIps } = form;
const { type, content, configTags, betaIps, md5 } = form;
this.setState({ betaIps });
this.changeForm({ ...form, config_tags: configTags ? configTags.split(',') : [] });
this.initMoacoEditor(type, content);
this.codeVal = content;
this.setState({
tagDataSource: this.state.form.config_tags,
casMd5: md5,
});
return res;
});
Expand Down
4 changes: 2 additions & 2 deletions console/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="stylesheet" type="text/css" href="console-ui/public/css/icon.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/font-awesome.css">
<!-- 第三方css结束 -->
<link href="./css/main.css?aaab5fd5630d74e778ed" rel="stylesheet"></head>
<link href="./css/main.css?3136b296dca60e1980ec" rel="stylesheet"></head>

<body>
<div id="root" style="overflow:hidden"></div>
Expand All @@ -56,6 +56,6 @@
<script src="console-ui/public/js/merge.js"></script>
<script src="console-ui/public/js/loader.js"></script>
<!-- 第三方js结束 -->
<script type="text/javascript" src="./js/main.js?aaab5fd5630d74e778ed"></script></body>
<script type="text/javascript" src="./js/main.js?3136b296dca60e1980ec"></script></body>

</html>
6 changes: 3 additions & 3 deletions console/src/main/resources/static/js/main.js

Large diffs are not rendered by default.

0 comments on commit d4126ba

Please sign in to comment.