diff --git a/config/config.js b/config/config.js index 14c006a8f..9b7efa429 100644 --- a/config/config.js +++ b/config/config.js @@ -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 }, } -}; +}; \ No newline at end of file diff --git a/config/router.config.js b/config/router.config.js index 20a3fb8f5..dec29c901 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -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', @@ -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' } ] }, diff --git a/public/images/code.svg b/public/images/code.svg new file mode 100644 index 000000000..799d8ecf6 --- /dev/null +++ b/public/images/code.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/default_Avatar.png b/public/images/default_Avatar.png new file mode 100644 index 000000000..a4675e615 Binary files /dev/null and b/public/images/default_Avatar.png differ diff --git a/routes/AdminRoute.js b/routes/AdminRoute.js new file mode 100644 index 000000000..940b483e1 --- /dev/null +++ b/routes/AdminRoute.js @@ -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 + : + + } + + ) + } +} + diff --git a/src/components/AddOrEditImageRegistry/index.js b/src/components/AddOrEditImageRegistry/index.js index 9eacb1fb4..a18ab97e3 100644 --- a/src/components/AddOrEditImageRegistry/index.js +++ b/src/components/AddOrEditImageRegistry/index.js @@ -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'; @@ -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({ @@ -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); - } + // } } }); }; @@ -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(); @@ -150,85 +150,101 @@ class ConfirmModal extends PureComponent { } > - +
- - {!data && - - {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, '');}, - })()} - - } - {!data && - - {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, '');}, - })()} - - } - - {getFieldDecorator('username', { - initialValue: data && data.username || '', - rules: [ - { - required: true, - message: formatMessage({id:'placeholder.userName'}), - }, - { - max: 255, - message: formatMessage({id:'placeholder.max255'}), - } - ] - })()} - - - {getFieldDecorator('password', { - initialValue: data && data.password || '', - rules: [ - { - required: true, - message: formatMessage({id:'placeholder.password_1'}), - }, - { - max: 255, - message: formatMessage({id:'placeholder.max255'}), - } - ] - })()} - + + + {getFieldDecorator('hub_type', { + initialValue: data && data.hub_type || 'Docker', + rules: [ + { + required: true, + message: formatMessage({ id: 'placeholder.warehouse_name' }), + }, + ] + })()} + + {!data && + + {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, ''); }, + })()} + + } + {!data && + + {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, ''); }, + })()} + + } + + {getFieldDecorator('username', { + initialValue: data && data.username || '', + rules: [ + { + required: true, + message: formatMessage({ id: 'placeholder.userName' }), + }, + { + max: 255, + message: formatMessage({ id: 'placeholder.max255' }), + } + ] + })()} + + + {getFieldDecorator('password', { + initialValue: data && data.password || '', + rules: [ + { + required: true, + message: formatMessage({ id: 'placeholder.password_1' }), + }, + { + max: 255, + message: formatMessage({ id: 'placeholder.max255' }), + } + ] + })()} + diff --git a/src/components/AppCreateConfigFile/index.js b/src/components/AppCreateConfigFile/index.js index 92fd07ac8..d96d10cde 100644 --- a/src/components/AppCreateConfigFile/index.js +++ b/src/components/AppCreateConfigFile/index.js @@ -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, diff --git a/src/components/AppCreateConfigPort/index.js b/src/components/AppCreateConfigPort/index.js index 417a13803..b0ccb921d 100644 --- a/src/components/AppCreateConfigPort/index.js +++ b/src/components/AppCreateConfigPort/index.js @@ -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, diff --git a/src/components/AppCreateSetting/index.js b/src/components/AppCreateSetting/index.js index eccc7ee7f..fea5e3f09 100644 --- a/src/components/AppCreateSetting/index.js +++ b/src/components/AppCreateSetting/index.js @@ -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, @@ -1026,7 +1025,6 @@ export default class Index extends PureComponent { /> - ); } diff --git a/src/components/AppInstanceList/index.js b/src/components/AppInstanceList/index.js index 9a72c6ef5..5737a54b5 100644 --- a/src/components/AppInstanceList/index.js +++ b/src/components/AppInstanceList/index.js @@ -1,10 +1,10 @@ /* eslint-disable react/sort-comp */ /* eslint-disable no-unused-expressions */ -import { List } from 'antd'; +import { List, Progress } from 'antd'; import React, { PureComponent } from 'react'; import WaterWave from '../Charts/WaterWave'; import style from './index.less'; -import { formatMessage, FormattedMessage } from 'umi-plugin-locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-locale'; class InstanceList extends PureComponent { constructor(arg) { @@ -20,67 +20,70 @@ class InstanceList extends PureComponent { }); } } - componentDidMount() {} + componentDidMount() { } showName = podName => { - const arr =podName && podName.split('-') - const num = arr[arr.length -1]; - return `${formatMessage({id:'componentOverview.body.Expansion.InstanceList.example'},{num:num})}` ; - + const arr = podName && podName.split('-') + const num = arr[arr.length - 1]; + return `${formatMessage({ id: 'componentOverview.body.Expansion.InstanceList.example' }, { num: num })}`; + }; - getContainerMem = containers => { + getContainerMem = (containers, type) => { const { method } = this.props let memRate = 0; - if(method === 'vm'){ + if (method === 'vm') { containers && - containers.map(c => { - if (c.container_name === "compute") { - memRate = c.usage_rate; - } - }); - }else{ + containers.map(c => { + if (c.container_name === "compute") { + memRate = c.usage_rate; + } + }); + } else { containers && - containers.map(c => { - if (c.container_name === this.props.k8s_component_name) { - memRate = c.usage_rate; - } - }); + containers.map(c => { + if (c.container_name === this.props.k8s_component_name) { + memRate = c.usage_rate; + } + }); + } + if(type){ + return memRate } - return memRate; + return memRate + '%'; }; getMemorySum = containers => { let memorySum = 0; containers && containers.map(c => { - memorySum += c.memory_usage; + memorySum += c.memory_usage; }); return memorySum.toFixed(2); }; render() { + const { list } = this.state const statusObj = { - Running: formatMessage({id:'componentOverview.body.Expansion.InstanceList.normal'}), - Pending: formatMessage({id:'componentOverview.body.Expansion.InstanceList.starting'}), - Succeeded: formatMessage({id:'componentOverview.body.Expansion.InstanceList.successfully'}), - Failed: formatMessage({id:'componentOverview.body.Expansion.InstanceList.failed'}), - Unknown: formatMessage({id:'componentOverview.body.Expansion.InstanceList.unknown'}) + Running: formatMessage({ id: 'componentOverview.body.Expansion.InstanceList.normal' }), + Pending: formatMessage({ id: 'componentOverview.body.Expansion.InstanceList.starting' }), + Succeeded: formatMessage({ id: 'componentOverview.body.Expansion.InstanceList.successfully' }), + Failed: formatMessage({ id: 'componentOverview.body.Expansion.InstanceList.failed' }), + Unknown: formatMessage({ id: 'componentOverview.body.Expansion.InstanceList.unknown' }) }; return ( - ( - - } - percent={this.getContainerMem(item.container)} - memorySum={this.getMemorySum(item.container)} - /> -
{this.showName(item.pod_name)}
-
{statusObj[item.pod_status]}
-
- )} - /> + <> + {(list||[]).map((item) => { + console.log(item, 'item') + return <> +
+

{this.showName(item.pod_name)}

+

{this.getContainerMem(item.container)}

+

运行内存

+
+ +
+
+ + })} + + ); } } diff --git a/src/components/AppInstanceList/index.less b/src/components/AppInstanceList/index.less index 1ee1f15d1..389bbf859 100644 --- a/src/components/AppInstanceList/index.less +++ b/src/components/AppInstanceList/index.less @@ -1,6 +1,30 @@ -.cen { - text-align: center; - div { - text-align: center; +.card { + width: 120px; + height: 120px; + border: 1px solid #e3e3e3; + border-radius: 6px; + padding: 12px; + margin: 12px 24px; + h1 { + font-size: @rbd-content-size; + color: #161616aa; + line-height: @rbd-content-line-height; + margin-bottom: 0; } -} + + h2 { + font-size: @rbd-title-big-size; + color: @rbd-title-big-color; + line-height: @rbd-title-big-line-height; + margin-bottom: 0; + + } + h3 { + font-size: @rbd-content-size; + line-height: @rbd-content-line-height; + color: #161616aa; + + margin-bottom: 0; + + } +} \ No newline at end of file diff --git a/src/components/ClusterMgtList/index.js b/src/components/ClusterMgtList/index.js index ddf9b3c61..6c83e4fad 100644 --- a/src/components/ClusterMgtList/index.js +++ b/src/components/ClusterMgtList/index.js @@ -49,6 +49,9 @@ class Index extends Component { showUpdateKubernetes: false, showUpdateKubernetesTasks: false, isShowAddNodeModal: false, + pageSize: 10, + total: 0, + current: 1 } } //节点状态 @@ -143,6 +146,13 @@ class Index extends Component { } } + total = (total) => `共 ${total} 条`; + pageChange = (current, pageSize) => { + this.setState({ + pageSize, + current + }) + } render() { const { nodeList, rowClusterInfo, showInfo, form, eventId } = this.props const { selectArr, isShowAddNodeModal } = this.state @@ -285,6 +295,17 @@ class Index extends Component { sm: { span: 16 } } }; + const pagination = { + total: nodeList.length || 0, + current: this.state.current, + pageSize: this.state.pageSize, + showQuickJumper: true, + showSizeChanger: true, + showTotal: this.total, + onChange: this.pageChange, + onShowSizeChange :this.pageChange, + hideOnSinglePage: nodeList.length <= 10 + }; return ( <> index} dataSource={nodeList} - pagination={nodeList && nodeList.length > 10 ? true : false} + pagination={pagination} onRow={this.onClickRow} rowClassName={styles.rowStyle} /> diff --git a/src/components/CodeCustomForm/index.js b/src/components/CodeCustomForm/index.js index 4e4a40aea..6b9ed5602 100644 --- a/src/components/CodeCustomForm/index.js +++ b/src/components/CodeCustomForm/index.js @@ -61,13 +61,14 @@ export default class Index extends PureComponent { } componentDidMount() { const { handleType, groupId } = this.props; + const group_id = globalUtil.getGroupID() if (handleType && handleType === 'Service') { this.fetchComponentNames(Number(groupId)); } const isService = handleType && handleType === 'Service'; - if (!!isService) { + if (!!isService || group_id) { this.setState({ - creatComPermission: role.queryPermissionsInfo(this.props.currentTeamPermissionsInfo?.team, 'app_overview', `app_${globalUtil.getAppID()}`) + creatComPermission: role.queryPermissionsInfo(this.props.currentTeamPermissionsInfo?.team, 'app_overview', `app_${globalUtil.getAppID() || group_id}`) }) } } @@ -329,30 +330,22 @@ export default class Index extends PureComponent { ); // const serverType = getFieldValue("server_type"); const isService = handleType && handleType === 'Service'; + const group_id = globalUtil.getGroupID() return (
{getFieldDecorator('group_id', { - initialValue: isService ? Number(groupId) : data.group_id, + initialValue: isService ? Number(groupId) : data.group_id || Number(group_id), rules: [{ required: true, message: formatMessage({ id: 'placeholder.appName' }) }] })( )} - {handleType && - handleType === 'Service' ? null : showCreateGroups ? ( - - ) : null} {getFieldDecorator('service_cname', { @@ -492,7 +481,7 @@ export default class Index extends PureComponent { false ) : !handleType && ( - + + {/* */} {getFieldDecorator('service_cname', { @@ -470,7 +474,7 @@ export default class Index extends PureComponent { } }} > - + diff --git a/src/components/CodeYamlForm/index.js b/src/components/CodeYamlForm/index.js index 37ce83fbb..5c375f934 100644 --- a/src/components/CodeYamlForm/index.js +++ b/src/components/CodeYamlForm/index.js @@ -51,11 +51,15 @@ export default class Index extends PureComponent { componentWillMount() { this.loop = false; this.statusloop = false; - const { currentTeamPermissionsInfo, dispatch } = this.props; - // roleUtil.canCreateComponent(currentTeamPermissionsInfo, dispatch); } componentDidMount() { this.handleJarWarUpload() + const group_id = globalUtil.getGroupID() + if(group_id){ + this.setState({ + creatComPermission: role.queryPermissionsInfo(this.props.currentTeamPermissionsInfo?.team, 'app_overview', `app_${globalUtil.getAppID() || group_id}`) + }) + } } componentWillUnmount() { this.loop = false; @@ -249,6 +253,7 @@ export default class Index extends PureComponent { span: 15 } }; + const group_id = globalUtil.getGroupID() return ( <> @@ -256,6 +261,7 @@ export default class Index extends PureComponent { {getFieldDecorator('group_id', { + initialValue: Number(group_id), rules: [ { required: true, @@ -271,18 +277,14 @@ export default class Index extends PureComponent { } getPopupContainer={triggerNode => triggerNode.parentNode} placeholder={formatMessage({ id: 'placeholder.appName' })} - style={{ - display: 'inline-block', - width: 276, - marginRight: 10 - }} + disabled={group_id} > {(groups || []).map(group => ( ))} )} - + {/* */} - + diff --git a/src/components/CommandMarketForm/index.js b/src/components/CommandMarketForm/index.js index 31272009a..fa9f2337c 100644 --- a/src/components/CommandMarketForm/index.js +++ b/src/components/CommandMarketForm/index.js @@ -7,6 +7,7 @@ import React, { Fragment, PureComponent } from 'react'; import { formatMessage, FormattedMessage } from 'umi-plugin-locale'; import AddGroup from '../../components/AddOrEditGroup'; import ShowRegionKey from '../../components/ShowRegionKey'; +import globalUtil from '../../utils/global'; import role from '@/utils/newRole'; import cookie from '../../utils/cookie'; @@ -56,6 +57,12 @@ export default class Index extends PureComponent { creatComPermission: {} }; } + componentDidMount(){ + const group_id = globalUtil.getGroupID() + if(group_id){ + this.handleChange(group_id) + } + } onAddGroup = () => { this.setState({ addGroup: true }); }; @@ -230,26 +237,18 @@ export default class Index extends PureComponent { const is_language = language ? formItemLayout : en_formItemLayout; const showCreateGroups = showCreateGroup === void 0 ? true : showCreateGroup; const isService = handleType && handleType === 'Service'; + const group_id = globalUtil.getGroupID() return ( {getFieldDecorator('group_id', { - initialValue: isService ? Number(groupId) : data.group_id, + initialValue: isService ? Number(groupId) : data.group_id || Number(group_id), rules: [{ required: true, message: formatMessage({ id: 'placeholder.appName' }) }] })( )} - {handleType && - handleType === 'Service' ? null : showCreateGroups ? ( - - ) : null} {getFieldDecorator('command', { initialValue: data.docker_cmd || '', - rules: [{ required: true, message: '请填写命令' }] + rules: [{ required: true, message: formatMessage({ id: 'versionUpdata_6_1.command' })}] })( -