Browse Source

版本管理修改

master
wenlele 2 years ago
parent
commit
76792a8616
  1. 4
      code/web/client/src/layout/components/header/index.jsx
  2. 154
      code/web/client/src/sections/auth/containers/login.jsx
  3. 109
      code/web/client/src/sections/edition/containers/administer.jsx

4
code/web/client/src/layout/components/header/index.jsx

@ -16,7 +16,9 @@ const Header = (props) => {
// if (socket) { // if (socket) {
// socket.disconnect(); // socket.disconnect();
// } // }
history.push(`/signin`); history.push(`/signin`)
localStorage.setItem('fs_iot_auth_selected_sider', JSON.stringify(['gateway']))
localStorage.setItem('fs_iot_auth_open_sider', JSON.stringify(['edgeGateway']))
} }
}} }}
style={{ style={{

154
code/web/client/src/sections/auth/containers/login.jsx

@ -8,90 +8,90 @@ import { IconLock, IconUser } from '@douyinfe/semi-icons';
import '../style.less' import '../style.less'
const Login = props => { const Login = props => {
const { dispatch, user, error, actions, apiRoot, isRequesting } = props const { dispatch, user, error, actions, apiRoot, isRequesting } = props
const form = useRef(); const form = useRef();
useEffect(() => { useEffect(() => {
if (error) { if (error) {
Toast.error(error); Toast.error(error);
form.current.setValue('password', '') form.current.setValue('password', '')
} }
}, [error]) }, [error])
useEffect(() => { useEffect(() => {
if (user && user.authorized) { if (user && user.authorized) {
dispatch(push('/edgeGateway/gateway')); dispatch(push('/edgeGateway/gateway'));
// localStorage.setItem('fs_iot_auth_selected_sider', JSON.stringify([])) localStorage.setItem('fs_iot_auth_selected_sider', JSON.stringify(['gateway']))
// localStorage.setItem('fs_iot_auth_open_sider', JSON.stringify([])) localStorage.setItem('fs_iot_auth_open_sider', JSON.stringify(['edgeGateway']))
} }
}, [user]) }, [user])
return ( return (
<div style={{ <div style={{
height: '100vh', height: '100vh',
backgroundImage: "url('/assets/images/background/loginBackground.png')", backgroundImage: "url('/assets/images/background/loginBackground.png')",
backgroundSize: 'cover', backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
position: 'relative',
}}>
<div style={{
width: 446,
height: 348,
padding: '45px 60px',
backgroundImage: "url('/assets/images/background/loginbg.png')",
backgroundSize: '100% 100%',
backgroundRepeat: 'no-repeat', backgroundRepeat: 'no-repeat',
position: 'relative', position: 'absolute',
}}> top: '33.89%',
<div style={{ right: '16.43%',
width: 446, }}>
height: 348, <div style={{ width: 113, height: 24, marginTop: 3, marginLeft: 5 }}>
padding: '45px 60px', <img src="/assets/images/background/user_login.png" alt="" style={{ width: '100%', height: '100%' }} />
backgroundImage: "url('/assets/images/background/loginbg.png')",
backgroundSize: '100% 100%',
backgroundRepeat: 'no-repeat',
position: 'absolute',
top: '33.89%',
right: '16.43%',
}}>
<div style={{ width: 113, height: 24, marginTop: 3, marginLeft: 5 }}>
<img src="/assets/images/background/user_login.png" alt="" style={{ width: '100%', height: '100%' }} />
</div>
<Form
onSubmit={values => {
dispatch(login(values.username, values.password)).then(res => {
const data = res.payload.user
// dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token }))
})
}}
getFormApi={formApi => form.current = formApi}
>
<Form.Input
className='inputbgc'
field='username'
noLabel={true}
label='用户名'
placeholder='请输入账号'
prefix={<IconUser style={{ color: '#1859C1', marginRight: 14, marginLeft: 8 }} />}
style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40, marginTop: 26 }}
/>
<Form.Input
field='password'
noLabel={true}
mode="password"
autoComplete=""
placeholder='请输入密码'
label='密码'
prefix={<IconLock style={{ color: '#1859C1', marginRight: 14, marginLeft: 8 }} />}
style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40 }}
/>
<Button htmlType='submit' block theme="solid" style={{ marginTop: 17, height: 40, backgroundColor: '#1859C1' }}>立即登录</Button>
</Form>
</div> </div>
</div> <Form
); onSubmit={values => {
dispatch(login(values.username, values.password)).then(res => {
const data = res.payload.user
// dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token }))
})
}}
getFormApi={formApi => form.current = formApi}
>
<Form.Input
className='inputbgc'
field='username'
noLabel={true}
label='用户名'
placeholder='请输入账号'
prefix={<IconUser style={{ color: '#1859C1', marginRight: 14, marginLeft: 8 }} />}
style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40, marginTop: 26 }}
/>
<Form.Input
field='password'
noLabel={true}
mode="password"
autoComplete=""
placeholder='请输入密码'
label='密码'
prefix={<IconLock style={{ color: '#1859C1', marginRight: 14, marginLeft: 8 }} />}
style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40 }}
/>
<Button htmlType='submit' block theme="solid" style={{ marginTop: 17, height: 40, backgroundColor: '#1859C1' }}>立即登录</Button>
</Form>
</div>
</div>
);
} }
function mapStateToProps(state) { function mapStateToProps (state) {
const { auth, global } = state; const { auth, global } = state;
return { return {
user: auth.user, user: auth.user,
error: auth.error, error: auth.error,
actions: global.actions, actions: global.actions,
apiRoot: global.apiRoot, apiRoot: global.apiRoot,
isRequesting: auth.isRequesting isRequesting: auth.isRequesting
} }
} }
export default connect(mapStateToProps)(Login); export default connect(mapStateToProps)(Login);

109
code/web/client/src/sections/edition/containers/administer.jsx

@ -5,6 +5,7 @@ import { push } from 'react-router-redux';
import { Form, Button, Table, Pagination, Modal } from '@douyinfe/semi-ui'; import { Form, Button, Table, Pagination, Modal } from '@douyinfe/semi-ui';
import { IconLock, IconUser } from '@douyinfe/semi-icons'; import { IconLock, IconUser } from '@douyinfe/semi-icons';
import { useState } from 'react'; import { useState } from 'react';
import moment from "moment";
const EditionManage = props => { const EditionManage = props => {
const { dispatch, user, error, actions, apiRoot, isRequesting } = props const { dispatch, user, error, actions, apiRoot, isRequesting } = props
@ -141,11 +142,13 @@ const EditionManage = props => {
</div> </div>
</div> </div>
</div> </div>
<div style={{ width: "100%", <div style={{
background: "#FFFFFF", width: "100%",
borderRadius: 3, background: "#FFFFFF",
padding: "8px 20px", borderRadius: 3,
marginTop: 20, }}> padding: "8px 20px",
marginTop: 20,
}}>
<Table <Table
columns={columns} columns={columns}
dataSource={versionList} dataSource={versionList}
@ -185,19 +188,15 @@ const EditionManage = props => {
onOk={() => { onOk={() => {
api.current.validate().then(r => { api.current.validate().then(r => {
console.log(r); console.log(r);
dispatch(edition.postVersion({ build: 0, for (let key in r) {
createdAt: "2022-12-12 10:00:00", if (['major', 'minor', 'patch', 'build'].includes(key)) {
desc: "fix温度修正", r[key] = Number(r[key])
// id: 1, }
imageBase: "registry.cn-hangzhou.aliyuncs.com/fs-cloud/fs-edge", }
imageVersion: "3.22-12-30", dispatch(edition.postVersion({ ...r, createdAt: moment().format("YYYY-MM-DD HH:MM:SS") })).then(res => {
major: 0,
minor: 2,
patch: 1,
type: "beta"})).then(res => {
if (res.success) { if (res.success) {
// requestData() requestData()
// setaddVersion(false) setaddVersion(false)
} }
}) })
}) })
@ -209,22 +208,80 @@ const EditionManage = props => {
getFormApi={(formApi) => (api.current = formApi)} getFormApi={(formApi) => (api.current = formApi)}
layout="horizontal" layout="horizontal"
labelAlign="right" labelAlign="right"
labelWidth="90px" labelWidth="114px"
style={{ display: 'flex', flexDirection: 'column' }} style={{ display: 'flex', flexDirection: 'column' }}
> >
<Form.Input field='major' label='主版本号:' labelPosition="left" placeholder='请输入主版本号' style={{ width: 200, marginBottom: 10 }} /> <Form.Input
<Form.Input field='minor' label='次版本号:' labelPosition="left" placeholder='请输入次版本号' style={{ width: 200, marginBottom: 10 }} /> field='major'
<Form.Input field='patch' label='补丁版本号:' labelPosition="left" placeholder='请输入补丁版本号' style={{ width: 200, marginBottom: 10 }} /> label='主版本号:'
<Form.Input field='build' label='构建号:' labelPosition="left" placeholder='请输入构建号' style={{ width: 200, marginBottom: 10 }} /> labelPosition="left"
<Form.Select field="type" label='Type:' labelPosition="left" placeholder='请选择类型' style={{ width: 200, marginBottom: 10 }}> hideButtons={true}
placeholder='请输入主版本号'
style={{ width: 200, marginBottom: 10 }}
rules={[{ required: true, message: "请输入主版本号" }, { pattern: "^[0-9]+$", message: "只能输入数字" },]}
/>
<Form.Input
field='minor'
label='次版本号:'
labelPosition="left"
hideButtons={true}
placeholder='请输入次版本号'
style={{ width: 200, marginBottom: 10 }}
rules={[{ required: true, message: "请输入次版本号" }, { pattern: "^[0-9]+$", message: "只能输入数字" },]}
/>
<Form.Input
field='patch'
label='补丁版本号:'
labelPosition="left"
hideButtons={true}
placeholder='请输入补丁版本号'
style={{ width: 200, marginBottom: 10 }}
rules={[{ required: true, message: "请输入补丁版本号" }, { pattern: "^[0-9]+$", message: "只能输入数字" },]}
/>
<Form.Input
field='build' label='构建号:'
labelPosition="left"
hideButtons={true}
placeholder='请输入构建号'
style={{ width: 200, marginBottom: 10 }}
rules={[{ required: true, message: "请输入构建号" }, { pattern: "^[0-9]+$", message: "只能输入数字" },]}
/>
<Form.Select
field="type"
label='Type:'
labelPosition="left"
placeholder='请选择类型'
style={{ width: 200, marginBottom: 10 }}
rules={[{ required: true, message: "请选择类型" }]}
>
<Form.Select.Option value="beta">beta</Form.Select.Option> <Form.Select.Option value="beta">beta</Form.Select.Option>
<Form.Select.Option value="alpha">alpha</Form.Select.Option> <Form.Select.Option value="alpha">alpha</Form.Select.Option>
<Form.Select.Option value="release">release</Form.Select.Option> <Form.Select.Option value="release">release</Form.Select.Option>
<Form.Select.Option value="LTS">LTS</Form.Select.Option> <Form.Select.Option value="LTS">LTS</Form.Select.Option>
</Form.Select> </Form.Select>
<Form.Input field='imageBase' label='基础镜像地址:' labelPosition="left" placeholder='请输入基础镜像地址' style={{ width: 460, marginBottom: 10 }} /> <Form.Input
<Form.Input field='tmageVersion' label='镜像版本:' labelPosition="left" placeholder='请输入镜像版本' style={{ width: 200, marginBottom: 10 }} /> field='imageBase'
<Form.TextArea field='desc' label='描述:' labelPosition="left" placeholder='请输入描述' style={{ width: 460 }} /> label='基础镜像地址:'
labelPosition="left"
placeholder='请输入基础镜像地址'
style={{ width: 440, marginBottom: 10 }}
rules={[{ required: true, message: "请输入基础镜像地址" }]}
/>
<Form.Input
field='imageVersion'
label='镜像版本:'
labelPosition="left"
placeholder='请输入镜像版本'
style={{ width: 200, marginBottom: 10 }}
rules={[{ required: true, message: "请输入镜像版本" }]}
/>
<Form.TextArea
field='desc'
label='描述:'
labelPosition="left"
placeholder='请输入描述'
style={{ width: 440 }}
/>
</Form> </Form>
</Modal> </Modal>

Loading…
Cancel
Save