Skip to content

Commit

Permalink
Merge pull request #1449 from goodrain/V6.1
Browse files Browse the repository at this point in the history
feat: v6.1.0 release
  • Loading branch information
zzzhangqi authored Dec 31, 2024
2 parents b22ed07 + 23e79d7 commit 2b32753
Show file tree
Hide file tree
Showing 163 changed files with 9,812 additions and 6,763 deletions.
10 changes: 5 additions & 5 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ export default {
routes: routerConfig,
proxy: {
'/console': {
target: 'http://127.0.0.1:8000/',
target: 'http://127.0.0.1:8080/',
changeOrigin: true
},
'/data': {
target: 'http://127.0.0.1:8000/',
target: 'http://127.0.0.1:8080/',
changeOrigin: true
},
'/openapi/v1': {
target: 'http://127.0.0.1:8000/',
target: 'http://127.0.0.1:8080/',
changeOrigin: true
},
'/enterprise-server':{
target:'http://127.0.0.1:8000/',
target:'http://127.0.0.1:8080/',
changeOrigin: true
},
}
};
};
25 changes: 21 additions & 4 deletions config/router.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,28 @@ export default [
// Enterprise view layout
{
path: '/',
redirect: '/enterprise/auto'
redirect: '/redirect'
},
{
path: '/enterprise/:eid/personal',
component: '../layouts/PersonalSpace',
name: 'PersonalSpace',
path: '/redirect',
component: '../layouts/Auto',
name: 'Auto',
authority: ['admin', 'user'],
},
// 邀请
{
path: '/invite/:InviteId',
component: '../layouts/Invite',
name: 'Invite',
authority: ['admin', 'user'],
},
// 企业
{
path: '/enterprise/:eid',
component: '../layouts/EnterpriseLayout',
name: 'EnterprisePage',
authority: ['admin', 'user'],
Routes: ['./routes/AdminRoute.js'],
routes: [
{
path: '/enterprise/:eid/index',
Expand Down Expand Up @@ -654,6 +663,14 @@ export default [
{
path: '/account/center/accesstoken',
component: './Account/Center/AccesstokenView'
},
{
path: '/account/center/img',
component: './Account/Center/ImgView'
},
{
path: '/account/center/personal',
component: './Account/Center/PersonalView'
}
]
},
Expand Down
1 change: 1 addition & 0 deletions public/images/code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/default_Avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions routes/AdminRoute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { connect } from 'dva';
import React, { Component } from 'react'
import Exception from '../src/components/Exception'
import apiconfig from '../config/api.config'

@connect(({ user }) => ({
currentUser: user.currentUser
}))
export default class PrivateRoute extends Component {
constructor(props) {
super(props);
}
render() {
const { route } = this.props;
const { currentUser } = this.props;
return (
<>
{
currentUser?.is_enterprise_admin
?
this.props.children
:
<Exception actions type={404} />
}
</>
)
}
}

216 changes: 116 additions & 100 deletions src/components/AddOrEditImageRegistry/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Form, Input, Modal, Select, Skeleton, Button, Spin, notification } from 'antd';
import { connect } from 'dva';
import React, { PureComponent } from 'react';
import { formatMessage, FormattedMessage } from 'umi-plugin-locale';
import { formatMessage, FormattedMessage } from 'umi-plugin-locale';
import globalUtil from '../../utils/global';
import cookie from '../../utils/cookie';
import roleUtil from '../../utils/role';
Expand Down Expand Up @@ -32,19 +32,19 @@ class ConfirmModal extends PureComponent {
dispatch({
type: 'global/checkHubLink',
payload: {
regionName: clusters[0].region_name,
domain: values.domain,
username: values.username,
password: values.password
regionName: clusters[0].region_name,
domain: values.domain,
username: values.username,
password: values.password
},
callback: res => {
if(res){
this.setState({
checking: false,
checkLoading: false
})
onOk(values);
}
if (res) {
this.setState({
checking: false,
checkLoading: false
})
onOk(values);
}
},
handleError: res => {
this.setState({
Expand All @@ -64,11 +64,11 @@ class ConfirmModal extends PureComponent {
// 如果是,删除末尾的斜杠
values.domain = values.domain.slice(0, -1);
}
if(values.domain){
this.handleCheckImageHub(values);
} else {
// if (values.domain) {
// this.handleCheckImageHub(values);
// } else {
onOk(values);
}
// }
}
});
};
Expand All @@ -88,20 +88,20 @@ class ConfirmModal extends PureComponent {
let regEmpty = /^\s*$/g;
let regNoHttp = /^(?!.*(?:https?)).*$/;
if (value && !reg.test(value)) {
callback(formatMessage({id:'placeholder.reg_Chinese'}));
callback(formatMessage({ id: 'placeholder.reg_Chinese' }));
} else if (value && regEmpty.test(value)) {
callback(formatMessage({id:'placeholder.regEmpty'}));
} else {
callback(formatMessage({ id: 'placeholder.regEmpty' }));
} else {
callback();
}
}
}
validateSecret = (rule, value, callback) => {
const { imageList } = this.props
// 只允许输入小写字母正则
let reg = /^[a-z]+$/g;
if(imageList.some(item => item.secret_id === value)){
if (imageList.some(item => item.secret_id === value)) {
callback(formatMessage({ id: 'placeholder.warehouse_exist' }));
} else if((value && !reg.test(value))){
} else if ((value && !reg.test(value))) {
callback(formatMessage({ id: 'placeholder.lowercase' }));
} else {
callback();
Expand Down Expand Up @@ -150,85 +150,101 @@ class ConfirmModal extends PureComponent {
</div>
}
>

<Form onSubmit={this.handleSubmit}>
<Spin
spinning={checkLoading}
tip="正在检测..."
>
{!data &&
<FormItem {...is_language} label={formatMessage({id:'confirmModal.common.image.lable.name'})}>
{getFieldDecorator('secret_id', {
initialValue: data && data.secret_id || '',
rules: [
{
required: true,
message: formatMessage({id:'placeholder.warehouse_name'}),
},
{
validator: this.validateSecret
},
{
max: 32,
message: formatMessage({id:'placeholder.max32'}),
}
],
getValueFromEvent: event => {return event.target.value.replace(/(^\s*)|(\s*$)/g, '');},
})(<Input placeholder={formatMessage({id:'placeholder.warehouse_name'})} />)}
</FormItem>
}
{!data &&
<FormItem {...is_language} label={formatMessage({id:'confirmModal.common.image.lable.domain'})}>
{getFieldDecorator('domain', {
initialValue: data && data.domain || '',
rules: [
{
required: true,
message: formatMessage({id:'placeholder.git_url_domain'}),
},
{
max: 255,
message: formatMessage({id:'placeholder.max255'}),
},
{
pattern: /^(?!http:\/\/|https:\/\/)/,
message: formatMessage({ id: 'placeholder.warehouse_address.ban' }),
}
],
getValueFromEvent: event => {return event.target.value.replace(/(^\s*)|(\s*$)/g, '');},
})(<Input placeholder={formatMessage({id:'placeholder.git_url_domain'})} />)}
</FormItem>
}
<FormItem {...is_language} label={formatMessage({id:'confirmModal.common.image.lable.username'})}>
{getFieldDecorator('username', {
initialValue: data && data.username || '',
rules: [
{
required: true,
message: formatMessage({id:'placeholder.userName'}),
},
{
max: 255,
message: formatMessage({id:'placeholder.max255'}),
}
]
})(<Input placeholder={formatMessage({id:'placeholder.userName'})} />)}
</FormItem>
<FormItem {...is_language} label={formatMessage({id:'confirmModal.common.image.lable.password'})}>
{getFieldDecorator('password', {
initialValue: data && data.password || '',
rules: [
{
required: true,
message: formatMessage({id:'placeholder.password_1'}),
},
{
max: 255,
message: formatMessage({id:'placeholder.max255'}),
}
]
})(<Input placeholder={formatMessage({id:'placeholder.password_1'})} type="password" />)}
</FormItem>
<Spin
spinning={checkLoading}
tip="正在检测..."
>
<FormItem {...is_language} label={formatMessage({ id: 'versionUpdata_6_1.hub_type' })}>
{getFieldDecorator('hub_type', {
initialValue: data && data.hub_type || 'Docker',
rules: [
{
required: true,
message: formatMessage({ id: 'placeholder.warehouse_name' }),
},
]
})(<Select placeholder={formatMessage({ id: 'placeholder.warehouse_name' })} disabled={!!data}>
<Option value="Docker">Docker Registry</Option>
<Option value="Harbor">Harbor</Option>
{/* <Option value="Volcano">{formatMessage({ id: 'versionUpdata_6_1.volcano' })}</Option>
<Option value="Aliyun">{formatMessage({ id: 'versionUpdata_6_1.aliyun' })}</Option> */}
</Select>)}
</FormItem>
{!data &&
<FormItem {...is_language} label={formatMessage({ id: 'confirmModal.common.image.lable.name' })}>
{getFieldDecorator('secret_id', {
initialValue: data && data.secret_id || '',
rules: [
{
required: true,
message: formatMessage({ id: 'placeholder.warehouse_name' }),
},
{
validator: this.validateSecret
},
{
max: 32,
message: formatMessage({ id: 'placeholder.max32' }),
}
],
getValueFromEvent: event => { return event.target.value.replace(/(^\s*)|(\s*$)/g, ''); },
})(<Input placeholder={formatMessage({ id: 'placeholder.warehouse_name' })} disabled={!!data}/>)}
</FormItem>
}
{!data &&
<FormItem {...is_language} label={formatMessage({ id: 'confirmModal.common.image.lable.domain' })}>
{getFieldDecorator('domain', {
initialValue: data && data.domain || '',
rules: [
{
required: true,
message: formatMessage({ id: 'placeholder.git_url_domain' }),
},
{
max: 255,
message: formatMessage({ id: 'placeholder.max255' }),
},
{
pattern: /^(http:\/\/|https:\/\/)/,
message: formatMessage({ id: 'placeholder.warehouse_address.Ban' }),
}
],
getValueFromEvent: event => { return event.target.value.replace(/(^\s*)|(\s*$)/g, ''); },
})(<Input placeholder={formatMessage({ id: 'placeholder.git_url_domain' })} />)}
</FormItem>
}
<FormItem {...is_language} label={formatMessage({ id: 'confirmModal.common.image.lable.username' })}>
{getFieldDecorator('username', {
initialValue: data && data.username || '',
rules: [
{
required: true,
message: formatMessage({ id: 'placeholder.userName' }),
},
{
max: 255,
message: formatMessage({ id: 'placeholder.max255' }),
}
]
})(<Input placeholder={formatMessage({ id: 'placeholder.userName' })} />)}
</FormItem>
<FormItem {...is_language} label={formatMessage({ id: 'confirmModal.common.image.lable.password' })}>
{getFieldDecorator('password', {
initialValue: data && data.password || '',
rules: [
{
required: true,
message: formatMessage({ id: 'placeholder.password_1' }),
},
{
max: 255,
message: formatMessage({ id: 'placeholder.max255' }),
}
]
})(<Input placeholder={formatMessage({ id: 'placeholder.password_1' })} type="password" />)}
</FormItem>
</Spin>
</Form>
</Modal>
Expand Down
1 change: 0 additions & 1 deletion src/components/AppCreateConfigFile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import EnvironmentVariable from '../../components/EnvironmentVariable';
import NoPermTip from '../../components/NoPermTip';
import Port from '../../components/Port';
import ViewRelationInfo from '../../components/ViewRelationInfo';
import CustomFooter from "../../layouts/CustomFooter";
import {
addMnt,
batchAddRelationedApp,
Expand Down
1 change: 0 additions & 1 deletion src/components/AppCreateConfigPort/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import EnvironmentVariable from '../../components/EnvironmentVariable';
import NoPermTip from '../../components/NoPermTip';
import Port from '../../components/Port';
import ViewRelationInfo from '../../components/ViewRelationInfo';
import CustomFooter from "../../layouts/CustomFooter";
import {
addMnt,
batchAddRelationedApp,
Expand Down
Loading

0 comments on commit 2b32753

Please sign in to comment.