Merge pull request 'issue-优化' (#295) from caishi/forgeplus-react:gitlink_server into gitlink_server

This commit is contained in:
xxq250 2021-11-29 17:42:15 +08:00
commit efb918e21d
12 changed files with 111 additions and 148 deletions

View File

@ -171,10 +171,10 @@ function About(props, ref) {
<div className="noOperation">DevOps开启功能暂未对项目创建者以外的角色开放可以联系项目创建者进行开启开启后便可查看构建信息</div>:""
}
<a href={"https://forum.trustie.net/forums/3110/detail"} target="_blank" style={{ color: "#5091FF"}}>
了解什么是DevOps
了解什么是引擎
</a>
<a href={"https://forum.trustie.net/forums/3080/detail"} target="_blank" style={{ color: "#5091FF"}}>
如何使用DevOps
如何使用引擎Engine功能
</a>
{
AuthorLogin === CurrentLogin ?

View File

@ -2,84 +2,82 @@ import React, { useState , forwardRef, useEffect } from 'react';
import { Form , Modal , Input , Radio } from 'antd';
import Axios from 'axios';
import CheckProfile from '../Component/ProfileModal/Profile';
function AddProjectModal(props){
const { getFieldDecorator, validateFields , setFieldsValue } = props && props.form;
const [ visible , setVisible ] = useState(false);
export default Form.create()(
forwardRef((props)=>{
const { getFieldDecorator, validateFields , setFieldsValue } = props && props.form;
const [ visible , setVisible ] = useState(false);
useEffect(()=>{
if(!visible){
setFieldsValue({
code:undefined,
role:"developer"
})
}
},[visible])
function onOk() {
validateFields((error,values)=>{
if(!error){
const url = `/applied_projects.json`;
Axios.post(url,{
applied_project:{
...values
}
}).then(result=>{
if(result && result.data){
setVisible(false);
props.showNotification("申请加入项目成功,等待审核!");
}
}).catch(error=>{})
}
useEffect(()=>{
if(!visible){
setFieldsValue({
code:undefined,
role:"developer"
})
}
function checkValue(rule, value, callback){
if(!value){
callback();
},[visible])
function onOk() {
validateFields((error,values)=>{
if(!error){
const url = `/applied_projects.json`;
Axios.post(url,{
applied_project:{
...values
}
}).then(result=>{
if(result && result.data){
setVisible(false);
props.showNotification("申请加入项目成功,等待审核!");
}
}).catch(error=>{})
}
})
}
function checkValue(rule, value, callback){
if(!value){
callback("请输入6位数的邀请码");
}else{
if(value.length < 6 || value.length > 6){
callback("请输入6位数的邀请码");
}
callback();
}
}
}
return(
<React.Fragment>
<Modal
title="加入项目"
width="480px"
visible={visible}
centered={true}
onOk={onOk}
onCancel={()=>setVisible(false)}
>
<Form layout={'inline'} className="inviteForm">
<Form.Item label="项目邀请码">
{getFieldDecorator("code",{
rules:[
{required:true,message:"请输入6位项目邀请码"},
{validator:checkValue}
]
})(
<Input placeholder="请输入6位项目邀请码" autoComplete={"off"} maxLength="6" style={{width:"300px"}}/>
)}
</Form.Item>
<Form.Item label="选择角色">
{getFieldDecorator("role",{
rules:[{required:true,message:"请选择角色"}]
})(
<Radio.Group defaultValue={"developer"}>
<Radio value="manager">管理员</Radio>
<Radio value="developer">开发者</Radio>
<Radio value="reporter">报告者</Radio>
</Radio.Group>
)}
</Form.Item>
</Form>
</Modal>
<CheckProfile {...props} sureFunc={()=>setVisible(true)}>加入项目</CheckProfile>
</React.Fragment>
)
})
)
return(
<React.Fragment>
<Modal
title="加入项目"
width="480px"
visible={visible}
centered={true}
onOk={onOk}
onCancel={()=>setVisible(false)}
>
<Form layout={'inline'} className="inviteForm">
<Form.Item label="项目邀请码">
{getFieldDecorator("code",{
rules:[
{required:true,message:" "},
{validator:checkValue}
]
})(
<Input placeholder="请输入6位项目邀请码" autoComplete={"off"} maxLength={6} style={{width:"300px"}}/>
)}
</Form.Item>
<Form.Item label="选择角色">
{getFieldDecorator("role",{
rules:[{required:true,message:"请选择角色"}]
})(
<Radio.Group>
<Radio value="manager">管理员</Radio>
<Radio value="developer">开发者</Radio>
<Radio value="reporter">报告者</Radio>
</Radio.Group>
)}
</Form.Item>
</Form>
</Modal>
<CheckProfile {...props} sureFunc={()=>setVisible(true)}>加入项目</CheckProfile>
</React.Fragment>
)
}
export default Form.create()(forwardRef(AddProjectModal));

View File

@ -127,6 +127,9 @@
width: 110px;
text-align: right;
}
.ant-form-explain{
position: absolute;
}
}
// 右上角小铃铛单独样式

View File

@ -340,7 +340,7 @@ function CoderDepot(props){
function createIssue(){
if(baseOper){
window.open(`/${owner}/${projectsId}/issues/new`,'_blank');
props.history.push(`/${owner}/${projectsId}/issues/new`);
}else{
props.showLoginDialog(`/${owner}/${projectsId}/issues/new`);
}

View File

@ -46,7 +46,7 @@ function Index(props) {
return(
<Spin spinning={isSpin}>
<div style={{paddingTop:"10px",minHeight:"400px"}}>
<div style={{paddingTop:"10px",minHeight:"400px",paddingBottom:"30px"}}>
{
list && list.length>0 && list.map((item,key)=>{
return(

View File

@ -1,3 +1,11 @@
.editorBorderBox .CodeMirror
{
height: unset;
}
.editorBorderBox .CodeMirror .CodeMirror-scroll{
min-height: 300px;
}
.setInputAddon{
width: 350px;
margin-right: 20px;
@ -9,12 +17,16 @@
border-right: none!important;
}
.editorBorder .editorBorderBox{
border:1px solid #eee;
border:1px solid #d0d0d0;
border-radius: 2px;
border-bottom: none;
}
.editorBorder .editorBorderSubmitBox{
padding:20px 0px!important;
}
.editorBorderSubmitBox{
border-top: 1px solid #d0d0d0;
}
.userScrew{
margin:20px 0px;
border:1px solid #f4f4f4;

View File

@ -1,6 +1,9 @@
import React, { Component } from "react";
import Editor from "react-monaco-editor";
// import {UnControlled as CodeMirror} from 'react-codemirror2'
import {UnControlled as CodeMirror} from 'react-codemirror2';
import 'codemirror/addon/selection/active-line.js';
import 'codemirror/mode/javascript/javascript.js';
import 'codemirror/mode/clike/clike';
import 'codemirror/mode/css/css';
import UserSubmitComponent from "./UserSubmitComponent";
@ -12,6 +15,7 @@ class m_editor extends Component {
super(props);
this.state = {
editorValue: this.props.content,
changeValue:this.props.content,
prevHeight:0
};
}
@ -22,18 +26,18 @@ class m_editor extends Component {
})
}
}
changeEditor = (editorValue) => {
changeEditor = (editorValue,data) => {
this.setState({
editorValue,
changeValue:editorValue.getValue(),
});
};
render() {
const { editorValue } = this.state;
const { readOnly, editorType, language , currentBranch , descName } = this.props;
const { editorValue , changeValue } = this.state;
const { readOnly, editorType, currentBranch , descName } = this.props;
const editor_options = {
lineNumbers: "on",
wordWrap: true, //强制换行
lineWrapping: true, //强制换行
selectOnLineNumbers: true,
lineHeight: 24,
renderLineHighlight: "line",
@ -46,84 +50,29 @@ class m_editor extends Component {
automaticLayout: true, // 自适应布局
overviewRulerBorder: false, // 不要滚动条的边框
scrollBeyondLastLine: false, // 取消代码后面一大段空白
styleActiveLine:true,//光标代码高亮
minimap: {
// 不要小地图
enabled: false,
},
};
const handleEditorMount = (editor, monaco) => {
editor.onDidChangeModelDecorations(() => {
requestAnimationFrame(updateEditorHeight); // folding
});
const updateEditorHeight = () => {
const editorElement = editor.getDomNode();
if (!editorElement) {
return;
}
const padding = 40;
const lineHeight = editor.getOption(
monaco.editor.EditorOption.lineHeight
);
const lineCount = editor.getModel().getLineCount() || 1;
let height =
editor.getTopForLineNumber(lineCount + 1) +
lineHeight +
padding ;
if(height<400){height = 400;}
if (this.state.prevHeight !== height) {
this.setState({
prevHeight:height
})
// setPrevHeight(height);
editorElement.style.height = `${height}px`;
editor.layout();
}
};
updateEditorHeight(); // typing
};
return (
<React.Fragment>
<div className="editorBorderBox">
<Editor
language={language ? language : "plaintext"}
theme={"vs-grey"}
<CodeMirror
placeholder="请输入内容"
value={editorValue}
options={editor_options}
onChange={this.changeEditor}
editorWillMount={this.editorWillMount}
editorDidMount={handleEditorMount}
/>
{/* <CodeMirror
value={editorValue}
options={{
theme: 'monokai',
mode: 'JavaScript',
extraKeys: {"Ctrl": "autocomplete"},//ctrl可以弹出提示
styleActiveLine: true,
lineNumbers: true,
readOnly:true
}}
/> */}
</div>
{!readOnly && (
<div className="editorBorderSubmitBox" style={{marginTop:"20px",padding:"20px"}}>
<div className="editorBorderSubmitBox" style={{padding:"20px"}}>
<UserSubmitComponent
{...this.props}
{...this.state}
filepath={`${this.props.filepath}`}
content={editorValue}
content={changeValue}
editor_type={editorType}
currentBranch={currentBranch}
descName={descName}

View File

@ -226,6 +226,7 @@ class order extends Component {
// 翻页
ChangePage = (page) => {
window.scrollTo(0,0);
this.setState({
isSpin: true,
checkedValue: [],

View File

@ -445,7 +445,7 @@ class NewTags extends Component {
message: "请填写标记名字",
},
],
})(<Input placeholder="名称10字以内" maxLength="10" />)}
})(<Input placeholder="名称15字以内" maxLength="15" />)}
</Form.Item>
<Form.Item className="inputcount">

View File

@ -297,7 +297,7 @@ class Infos extends Component {
}
{
current_user && current_user.login && current_user.login === username ?
<Menu.Item key="4"><Link to={`/${user && user.login}/devops/CIService`}><i className="iconfont icon-gongzuoliu1"></i>DevOps</Link></Menu.Item>
<Menu.Item key="4"><Link to={`/${user && user.login}/devops/CIService`}><i className="iconfont icon-gongzuoliu1"></i>DevOps</Link></Menu.Item>
:""
}
<Menu.Item key="5">

View File

@ -147,7 +147,7 @@ class InfosUser extends Component {
let list = button_lists.map((item, key) => {
return (
<span key={key} className="pr15">
<span key={key} className={`pr15`}>
<Button
type={
(category && category === item.type) || (!category && !item.type)

View File

@ -19,7 +19,7 @@ body>.-task-title {
min-width: 1200px;
max-width: unset;
height: 100%;
min-height: 100%;
min-height: 70vh;
overflow: hidden;
}
.newHeaders{