forked from Gitlink/forgeplus-react
babelrc-runtime
This commit is contained in:
parent
ccb5eb8ae5
commit
a38b74041e
10
.babelrc
10
.babelrc
|
@ -4,5 +4,13 @@
|
|||
"react",
|
||||
"stage-2"
|
||||
],
|
||||
"plugins": []
|
||||
"plugins": [[
|
||||
"transform-runtime",
|
||||
{
|
||||
"helpers": false,
|
||||
"polyfill": false,
|
||||
"regenerator": true,
|
||||
"moduleName": "babel-runtime"
|
||||
}
|
||||
]]
|
||||
}
|
|
@ -2043,7 +2043,7 @@
|
|||
},
|
||||
"babel-plugin-transform-runtime": {
|
||||
"version": "6.23.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz",
|
||||
"resolved": "https://registry.npm.taobao.org/babel-plugin-transform-runtime/download/babel-plugin-transform-runtime-6.23.0.tgz",
|
||||
"integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=",
|
||||
"requires": {
|
||||
"babel-runtime": "^6.22.0"
|
||||
|
|
|
@ -184,6 +184,7 @@
|
|||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
|
|
|
@ -93,11 +93,11 @@ class CoderRootDirectory extends Component {
|
|||
|
||||
// 页面地址返回到主目录
|
||||
returnMain = (branch) => {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { projectsId , owner , branchName } = this.props.match.params;
|
||||
this.setState({
|
||||
readOnly:true
|
||||
})
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}`);
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}`);
|
||||
this.getProjectRoot(branch);
|
||||
};
|
||||
|
||||
|
@ -255,8 +255,8 @@ class CoderRootDirectory extends Component {
|
|||
this.setState({
|
||||
chooseType:type
|
||||
})
|
||||
const { projectsId, owner } = this.props.match.params;
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}?url=${path}`);
|
||||
const { projectsId, owner , branchName } = this.props.match.params;
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}?url=${path}`);
|
||||
if(filename.substring(filename.length - 3) === ".md"){
|
||||
this.setState({
|
||||
md:true
|
||||
|
@ -309,27 +309,18 @@ class CoderRootDirectory extends Component {
|
|||
|
||||
// 选择分支
|
||||
changeBranch = (value) => {
|
||||
// this.setState({
|
||||
// branch: value,
|
||||
// isSpin: true,
|
||||
// readOnly:true
|
||||
// });
|
||||
// const { getTopCount } = this.props;
|
||||
// getTopCount && getTopCount(value);
|
||||
|
||||
// let { search } = this.props.history.location;
|
||||
// if (search && search.indexOf("?url=") > -1) {
|
||||
// let url = search.split("?url=")[1];
|
||||
// this.setState({
|
||||
// filePath: decodeURI(url),
|
||||
// });
|
||||
// this.getFileDetail(decodeURI(url), value);
|
||||
// } else {
|
||||
// this.getProjectRoot(value);
|
||||
// }
|
||||
let { search } = this.props.history.location;
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}/branch/${value}`);
|
||||
|
||||
let url = `/projects/${owner}/${projectsId}${value && `/branch/${value}`}`;
|
||||
if (search && (search.indexOf("?url=") > -1 || search.indexOf("&url=") > -1)) {
|
||||
let u = search.split("url=")[1];
|
||||
if(u && decodeURI(u).indexOf("&")){
|
||||
u=decodeURI(u).split("&")[0];
|
||||
}
|
||||
url += `?url=${u}`;
|
||||
}
|
||||
this.props.history.push(url);
|
||||
}
|
||||
|
||||
// 子目录路径返回链接
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React , { useState } from 'react';
|
||||
import React , { useEffect, useState } from 'react';
|
||||
import SelectBranch from '../Branch/Select';
|
||||
import Title from '../Component/Title';
|
||||
import styled from 'styled-components';
|
||||
|
@ -13,7 +13,15 @@ export default ((props)=>{
|
|||
const [ branch , setBranch ] = useState("master");
|
||||
const { projectsId , owner } = props.match.params;
|
||||
const projectDetail = props.projectDetail;
|
||||
console.log("11",props.defaultBranch);
|
||||
|
||||
const { defaultBranch } = props;
|
||||
useEffect(()=>{
|
||||
if(defaultBranch){
|
||||
setBranch(defaultBranch);
|
||||
}
|
||||
},[defaultBranch]);
|
||||
|
||||
|
||||
function resetSetting(){
|
||||
const url = `/${owner}/${projectsId}.json`;
|
||||
axios.put(url, {
|
||||
|
@ -21,7 +29,7 @@ export default ((props)=>{
|
|||
})
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
this.props.showNotification(`分支设置成功!`);
|
||||
props.showNotification(`分支设置成功!`);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
|
|
@ -1,16 +1,50 @@
|
|||
import React , { forwardRef , useCallback } from 'react';
|
||||
import { Form , Input , Select , Button } from 'antd';
|
||||
import Title from '../Component/Title';
|
||||
import { WhiteBack , Cancel } from '../Component/layout';
|
||||
import styled from 'styled-components';
|
||||
import React, { forwardRef, useCallback, useState, useEffect } from "react";
|
||||
import { Form, Input, Select, Button } from "antd";
|
||||
import Title from "../Component/Title";
|
||||
import { WhiteBack, Cancel } from "../Component/layout";
|
||||
import styled from "styled-components";
|
||||
import axios from "axios";
|
||||
|
||||
const { Option } = Select;
|
||||
const Div = styled.div`{
|
||||
const Div = styled.div`
|
||||
{
|
||||
padding: 20px 30px;
|
||||
}`
|
||||
}
|
||||
`;
|
||||
export default Form.create()(
|
||||
forwardRef(( { form })=>{
|
||||
const { getFieldDecorator } = form;
|
||||
forwardRef(({ form, match, history }) => {
|
||||
const [list, setList] = useState(undefined);
|
||||
const { projectsId, owner } = match.params;
|
||||
const { getFieldDecorator, validateFields } = form;
|
||||
|
||||
useEffect(() => {
|
||||
const url = `/${owner}/${projectsId}/collaborators.json`;
|
||||
axios.get(url).then((result) => {
|
||||
setList(result.data.members);
|
||||
})
|
||||
.catch((error) => {});
|
||||
}, []);
|
||||
|
||||
function getMember(list) {
|
||||
return (
|
||||
list &&
|
||||
list.length > 0 &&
|
||||
list.map((item, key) => {
|
||||
return (
|
||||
item.role !== "Manager" && (
|
||||
<Option value={item.id}>{item.name}</Option>
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
function saveBranchRule() {
|
||||
validateFields((error, values) => {
|
||||
if (!error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const helper = useCallback(
|
||||
(label, name, rules, widget, className, isRequired) => (
|
||||
<div className={className}>
|
||||
|
@ -30,31 +64,48 @@ export default Form.create()(
|
|||
"设置分支/通配符",
|
||||
"sign",
|
||||
[{ required: true, message: "请输入分支/通配符" }],
|
||||
<Input placeholder="请输入分支名称或通配符规则" />,'setStyleRule'
|
||||
<Input placeholder="请输入分支名称或通配符规则" />,
|
||||
"setStyleRule"
|
||||
)}
|
||||
<p className="color-grey-8 mb20">例如:设置为“master”,则对名称为“master”的分支生效;设置为“*-stable“ 或 ”release*“,则对名称符合此通配符的所有保护分支生效。</p>
|
||||
<p className="color-grey-8 mb20">
|
||||
例如:设置为“master”,则对名称为“master”的分支生效;设置为“*-stable“
|
||||
或 ”release*“,则对名称符合此通配符的所有保护分支生效。
|
||||
</p>
|
||||
{helper(
|
||||
"可推送代码成员",
|
||||
"psuhmember",
|
||||
[],
|
||||
[{ required: true, message: "请选择可推送代码成员" }],
|
||||
<Select placeholder="请选择仓库成员">
|
||||
<Option value="0">请选择仓库成员</Option>
|
||||
</Select>,'setSelectWidth'
|
||||
{getMember(list)}
|
||||
</Select>,
|
||||
"setSelectWidth"
|
||||
)}
|
||||
{helper(
|
||||
"可合并Pull Request成员",
|
||||
"pullmember",
|
||||
[],
|
||||
[{ required: true, message: "请选择可合并Pull Request成员" }],
|
||||
<Select placeholder="请选择仓库成员">
|
||||
<Option value="0">请选择仓库成员</Option>
|
||||
</Select>,'setSelectWidth'
|
||||
{getMember(list)}
|
||||
</Select>,
|
||||
"setSelectWidth"
|
||||
)}
|
||||
<div className="df pb30">
|
||||
<Button type="primary">保存</Button>
|
||||
<Cancel className="ml30">取消</Cancel>
|
||||
<Button type="primary" onClick={saveBranchRule}>
|
||||
保存
|
||||
</Button>
|
||||
<Cancel
|
||||
className="ml30"
|
||||
onClick={() => {
|
||||
history.push(`/projects/${owner}/${projectsId}/setting/branch`);
|
||||
}}
|
||||
>
|
||||
取消
|
||||
</Cancel>
|
||||
</div>
|
||||
</Div>
|
||||
</WhiteBack>
|
||||
)
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
|
|
|
@ -65,7 +65,7 @@ class Index extends Component {
|
|||
</Link>
|
||||
</p>
|
||||
</li>
|
||||
<li
|
||||
{/* <li
|
||||
className={
|
||||
pathname.indexOf("setting/branch") > -1 ? "active" : ""
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class Index extends Component {
|
|||
分支设置
|
||||
</Link>
|
||||
</p>
|
||||
</li>
|
||||
</li> */}
|
||||
<li
|
||||
className={pathname.indexOf("setting/tags") > -1 ? "active" : ""}
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue