fix beta publish (#12411)

This commit is contained in:
July 2024-07-24 14:30:33 +08:00 committed by GitHub
parent 7e577811a7
commit f4a4ab2eb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 117 additions and 33 deletions

View File

@ -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 (
<Select
style={{ width: 200 }}
size="medium"
dataSource={namespaceList}
value={de}
onChange={this.changeName.bind(this)}
showSearch
/>
);
}
const namespacesBtn = namespaceList.map((obj, index) => {
return (
<div key={index} style={{ cursor: 'pointer' }}>

View File

@ -0,0 +1,7 @@
import { NAME_SHOW } from '../../constants';
const changeNameShow = show => dispatch => {
localStorage.setItem(NAME_SHOW, show);
};
export default changeNameShow;

View File

@ -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';

View File

@ -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() {

View File

@ -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',
},

View File

@ -680,6 +680,9 @@ const I18N_CONF = {
settingTheme: '样式主题',
settingLight: '明亮',
settingDark: '深色',
settingShowSelect: '下拉框',
settingShowLabel: '标签',
settingShow: '命名空间样式',
settingLocale: '系统语言',
settingSubmit: '应用',
},

View File

@ -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;
}
if (!isBeta) {
headers.casMd5 = this.state.casMd5;
}
const form = { ...this.state.form, content: this.getCodeVal(), betaIps };
const payload = {};
Object.keys(form).forEach(key => {

View File

@ -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 (
<>
<PageTitle title={locale.settingTitle} />
@ -97,6 +114,14 @@ class SettingCenter extends React.Component {
onChange={this.newLanguage.bind(this)}
/>
</div>
<div className="setting-checkbox">
<div className="setting-span">{locale.settingShow}</div>
<RadioGroup
dataSource={nameShowList}
value={this.state.nameShow}
onChange={this.newNameShow.bind(this)}
/>
</div>
</div>
<Button type="primary" onClick={this.submit.bind(this)}>
{locale.settingSubmit}

View File

@ -26,12 +26,13 @@
}
.text-box {
height: 140px;
width: 100%;
flex-wrap: wrap;
display: flex;
}
.setting-checkbox {
flex: 1;
flex: 0 0 50%;
height: 100px;
box-sizing: border-box;
}

View File

@ -36,6 +36,9 @@ $dark-input-color: #585858;
//contain
.dark {
filter: grayscale(.25);
.login-header {
color: $dark-color-deep;
}
//侧边栏背景
.next-shell-navigation.next-shell-mini.next-shell-aside, .next-menu-item:not(.next-disabled).next-focused {
background-color: $dark-menu-bac !important;

File diff suppressed because one or more lines are too long

View File

@ -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?ae6bcb8479aa5e5c3c24" rel="stylesheet"></head>
<link href="./css/main.css?0c44b904d360f744c82e" rel="stylesheet"></head>
<body>
<div id="root" style="overflow:hidden"></div>
@ -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?ae6bcb8479aa5e5c3c24"></script></body>
<script type="text/javascript" src="./js/main.js?0c44b904d360f744c82e"></script></body>
</html>

File diff suppressed because one or more lines are too long