From f4a4ab2eb55bb074ad5d608fbffa5da9b6172904 Mon Sep 17 00:00:00 2001
From: July <985492783@qq.com>
Date: Wed, 24 Jul 2024 14:30:33 +0800
Subject: [PATCH] fix beta publish (#12411)
---
.../components/NameSpaceList/NameSpaceList.js | 33 +++++++++++++++++--
.../src/components/NameSpaceList/show.js | 7 ++++
console-ui/src/constants.js | 2 ++
console-ui/src/index.js | 13 ++++++--
console-ui/src/locales/en-US.js | 3 ++
console-ui/src/locales/zh-CN.js | 3 ++
.../ConfigEditor/NewConfigEditor.js | 6 ++--
.../src/pages/SettingCenter/SettingCenter.js | 33 ++++++++++++++++---
console-ui/src/pages/SettingCenter/index.scss | 5 +--
console-ui/src/theme/index.scss | 5 ++-
.../src/main/resources/static/css/main.css | 8 ++---
console/src/main/resources/static/index.html | 4 +--
console/src/main/resources/static/js/main.js | 28 ++++++++--------
13 files changed, 117 insertions(+), 33 deletions(-)
create mode 100644 console-ui/src/components/NameSpaceList/show.js
diff --git a/console-ui/src/components/NameSpaceList/NameSpaceList.js b/console-ui/src/components/NameSpaceList/NameSpaceList.js
index 825337cfd..0b2355a49 100644
--- a/console-ui/src/components/NameSpaceList/NameSpaceList.js
+++ b/console-ui/src/components/NameSpaceList/NameSpaceList.js
@@ -16,10 +16,11 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { ConfigProvider, Dialog } from '@alifd/next';
+import { ConfigProvider, Dialog, Select } from '@alifd/next';
import { getParams, setParams, request } from '../../globalLib';
import './index.scss';
+import { NAME_SHOW } from '../../constants';
/**
* 命名空间列表
@@ -42,6 +43,7 @@ class NameSpaceList extends React.Component {
this.state = {
nownamespace: window.nownamespace || this._namespace || '',
namespaceList: window.namespaceList || [],
+ nameShow: localStorage.getItem(NAME_SHOW),
// namespaceShowName: window.namespaceShowName || this._namespaceShowName || '',
// _dingdingLink: "",
// _forumLink: ""
@@ -100,6 +102,11 @@ class NameSpaceList extends React.Component {
this.props.setNowNameSpace && this.props.setNowNameSpace(nsName, ns, nsDesc);
}
+ changeName(...value) {
+ let space = value[2];
+ this.changeNameSpace(space.namespace, space.namespaceShowName, space.namespaceDesc);
+ }
+
calleeParent(needclean = false) {
this.props.namespaceCallBack && this.props.namespaceCallBack(needclean);
}
@@ -166,7 +173,29 @@ class NameSpaceList extends React.Component {
}
rendernamespace(namespaceList) {
- const { nownamespace } = this.state; // 获得当前namespace
+ const { nownamespace, nameShow } = this.state; // 获得当前namespace
+ if (nameShow && nameShow === 'select') {
+ let de = {
+ value: nownamespace,
+ };
+ namespaceList.forEach(obj => {
+ obj.label = obj.namespaceShowName + ' ' + (obj.namespaceDesc ? obj.namespaceDesc : '');
+ obj.value = obj.namespace;
+ if (obj.value !== undefined && obj.value === de.value) {
+ de = obj;
+ }
+ });
+ return (
+
+ );
+ }
const namespacesBtn = namespaceList.map((obj, index) => {
return (
diff --git a/console-ui/src/components/NameSpaceList/show.js b/console-ui/src/components/NameSpaceList/show.js
new file mode 100644
index 000000000..19b97f8c5
--- /dev/null
+++ b/console-ui/src/components/NameSpaceList/show.js
@@ -0,0 +1,7 @@
+import { NAME_SHOW } from '../../constants';
+
+const changeNameShow = show => dispatch => {
+ localStorage.setItem(NAME_SHOW, show);
+};
+
+export default changeNameShow;
diff --git a/console-ui/src/constants.js b/console-ui/src/constants.js
index f9d7fdf57..7a57f68f1 100644
--- a/console-ui/src/constants.js
+++ b/console-ui/src/constants.js
@@ -47,4 +47,6 @@ export const LOGINPAGE_ENABLED = 'docsite_loginpage';
export const THEME = 'setting_theme';
+export const NAME_SHOW = 'setting_name_show';
+
export const SERVER_GUIDE = 'SERVER_GUIDE';
diff --git a/console-ui/src/index.js b/console-ui/src/index.js
index 3e2bdc97b..5dca23ff4 100644
--- a/console-ui/src/index.js
+++ b/console-ui/src/index.js
@@ -29,7 +29,7 @@ import { ConfigProvider, Loading } from '@alifd/next';
import './lib';
import Layout from './layouts/MainLayout';
-import { LANGUAGE_KEY, REDUX_DEVTOOLS, THEME } from './constants';
+import { LANGUAGE_KEY, NAME_SHOW, REDUX_DEVTOOLS, THEME } from './constants';
import Login from './pages/Login';
import Register from './pages/Register';
@@ -57,6 +57,7 @@ import reducers from './reducers';
import { changeLanguage } from './reducers/locale';
import { getState } from './reducers/base';
import changeTheme from './theme';
+import changeNameShow from './components/NameSpaceList/show';
import './index.scss';
import PropTypes from 'prop-types';
@@ -100,7 +101,12 @@ const MENU = [
{ path: '/settingCenter', component: SettingCenter },
];
-@connect(state => ({ ...state.locale, ...state.base }), { changeLanguage, getState, changeTheme })
+@connect(state => ({ ...state.locale, ...state.base }), {
+ changeLanguage,
+ getState,
+ changeTheme,
+ changeNameShow,
+})
class App extends React.Component {
static propTypes = {
locale: PropTypes.object,
@@ -109,6 +115,7 @@ class App extends React.Component {
loginPageEnabled: PropTypes.string,
consoleUiEnable: PropTypes.string,
changeTheme: PropTypes.func,
+ changeNameShow: PropTypes.func,
};
constructor(props) {
@@ -124,8 +131,10 @@ class App extends React.Component {
this.props.getState();
const language = localStorage.getItem(LANGUAGE_KEY);
const theme = localStorage.getItem(THEME);
+ const nameShow = localStorage.getItem(NAME_SHOW);
this.props.changeLanguage(language);
this.props.changeTheme(theme);
+ this.props.changeNameShow(nameShow);
}
get router() {
diff --git a/console-ui/src/locales/en-US.js b/console-ui/src/locales/en-US.js
index 21d0b2a0c..e6e98efaf 100644
--- a/console-ui/src/locales/en-US.js
+++ b/console-ui/src/locales/en-US.js
@@ -685,6 +685,9 @@ const I18N_CONF = {
settingTheme: 'Themes',
settingLight: 'light',
settingDark: 'dark',
+ settingShowSelect: 'select',
+ settingShowLabel: 'label',
+ settingShow: 'namespace select style',
settingLocale: 'Language',
settingSubmit: 'Apply',
},
diff --git a/console-ui/src/locales/zh-CN.js b/console-ui/src/locales/zh-CN.js
index bd3a529bc..2a8cb3b33 100644
--- a/console-ui/src/locales/zh-CN.js
+++ b/console-ui/src/locales/zh-CN.js
@@ -680,6 +680,9 @@ const I18N_CONF = {
settingTheme: '样式主题',
settingLight: '明亮',
settingDark: '深色',
+ settingShowSelect: '下拉框',
+ settingShowLabel: '标签',
+ settingShow: '命名空间样式',
settingLocale: '系统语言',
settingSubmit: '应用',
},
diff --git a/console-ui/src/pages/ConfigurationManagement/ConfigEditor/NewConfigEditor.js b/console-ui/src/pages/ConfigurationManagement/ConfigEditor/NewConfigEditor.js
index a8fdce74e..4455ae7f6 100644
--- a/console-ui/src/pages/ConfigurationManagement/ConfigEditor/NewConfigEditor.js
+++ b/console-ui/src/pages/ConfigurationManagement/ConfigEditor/NewConfigEditor.js
@@ -244,12 +244,14 @@ class ConfigEditor extends React.Component {
}
_publishConfig(beta = false) {
- const { betaIps, isNewConfig } = this.state;
+ const { betaIps, isNewConfig, isBeta } = this.state;
const headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
if (beta) {
headers.betaIps = betaIps;
}
- headers.casMd5 = this.state.casMd5;
+ if (!isBeta) {
+ headers.casMd5 = this.state.casMd5;
+ }
const form = { ...this.state.form, content: this.getCodeVal(), betaIps };
const payload = {};
Object.keys(form).forEach(key => {
diff --git a/console-ui/src/pages/SettingCenter/SettingCenter.js b/console-ui/src/pages/SettingCenter/SettingCenter.js
index a85e3256d..47654bd48 100644
--- a/console-ui/src/pages/SettingCenter/SettingCenter.js
+++ b/console-ui/src/pages/SettingCenter/SettingCenter.js
@@ -21,12 +21,13 @@ import { Button, ConfigProvider, Radio } from '@alifd/next';
import PageTitle from '../../components/PageTitle';
import { changeLanguage } from '@/reducers/locale';
import changeTheme from '../../theme';
+import changeNameShow from '../../components/NameSpaceList/show';
import { connect } from 'react-redux';
-import { LANGUAGE_KEY, THEME } from '../../constants';
+import { LANGUAGE_KEY, NAME_SHOW, THEME } from '../../constants';
const { Group: RadioGroup } = Radio;
-@connect(state => ({ ...state.locale }), { changeLanguage, changeTheme })
+@connect(state => ({ ...state.locale }), { changeLanguage, changeTheme, changeNameShow })
@ConfigProvider.config
class SettingCenter extends React.Component {
static displayName = 'SettingCenter';
@@ -35,14 +36,18 @@ class SettingCenter extends React.Component {
locale: PropTypes.object,
changeLanguage: PropTypes.func,
changeTheme: PropTypes.func,
+ changeNameShow: PropTypes.func,
};
constructor(props) {
super(props);
const defaultTheme = localStorage.getItem(THEME);
+ const defaultShow = localStorage.getItem(NAME_SHOW);
+ const defaultLanguage = localStorage.getItem(LANGUAGE_KEY);
this.state = {
theme: defaultTheme === 'dark' ? 'dark' : 'light',
- language: localStorage.getItem(LANGUAGE_KEY),
+ language: defaultLanguage === 'en-US' ? 'en-US' : 'zh-CN',
+ nameShow: defaultShow === 'select' ? 'select' : 'label',
};
}
@@ -58,12 +63,20 @@ class SettingCenter extends React.Component {
});
}
+ newNameShow(value) {
+ this.setState({
+ nameShow: value,
+ });
+ }
+
submit() {
- const { changeLanguage, changeTheme } = this.props;
+ const { changeLanguage, changeTheme, changeNameShow } = this.props;
const currentLanguage = this.state.language;
const currentTheme = this.state.theme;
+ const currentNameShow = this.state.nameShow;
changeLanguage(currentLanguage);
changeTheme(currentTheme);
+ changeNameShow(currentNameShow);
}
render() {
@@ -76,6 +89,10 @@ class SettingCenter extends React.Component {
{ value: 'en-US', label: 'English' },
{ value: 'zh-CN', label: '中文' },
];
+ const nameShowList = [
+ { value: 'select', label: locale.settingShowSelect },
+ { value: 'label', label: locale.settingShowLabel },
+ ];
return (
<>
@@ -97,6 +114,14 @@ class SettingCenter extends React.Component {
onChange={this.newLanguage.bind(this)}
/>
+