diff --git a/.gitignore b/.gitignore
index fd73cf956..504353b2f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.idea/
# Logs
logs
*.log
diff --git a/src/AppConfig.js b/src/AppConfig.js
index 3400ebce3..7072a61d5 100644
--- a/src/AppConfig.js
+++ b/src/AppConfig.js
@@ -32,7 +32,8 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接
initOnlineOfflineListener();
- var proxy = "https://testforgeplus.trustie.net";
+ // var proxy = "https://testforgeplus.trustie.net";
+ var proxy = "http://localhost:3001";
//响应前的设置
axios.interceptors.request.use(
config => {
diff --git a/src/forge/Blockchain/Dispose.jsx b/src/forge/Blockchain/Dispose.jsx
new file mode 100644
index 000000000..f8aad2ebd
--- /dev/null
+++ b/src/forge/Blockchain/Dispose.jsx
@@ -0,0 +1,119 @@
+import React , { useState , useEffect } from 'react';
+import { Spin } from 'antd';
+import { Blueback } from '../Component/layout';
+import Editor from "react-monaco-editor";
+import Modals from './DisposeModal';
+import FileLanguage from '../Component/OpsFileLanguage';
+import axios from 'axios';
+
+
+function Dispose(props){
+ const [ spining , setSpining ] = useState(true);
+ const [ info , setInfo ] = useState('.trustie-pipeline.yml');
+ const [ visible , setVisible ] = useState(false);
+ const [ ymlValue , setYmlValue ] = useState("");
+ const [ sha , setSha ] = useState(undefined);
+ const [ fileLanguage , setFileLanguage ] = useState(undefined);
+ const [ first , setFirst ] = useState(false);
+
+ let projectsId = props.match.params.projectsId;
+ let owner = props.match.params.owner;
+ useEffect(()=>{
+ if(projectsId){
+ const url = `/${owner}/${projectsId}/get_trustie_pipeline.json`;
+ axios.get(url,{
+ params:{
+ project_id:projectsId
+ }
+ }).then(result=>{
+ if(result && result.data.content){
+ setInfo(result.data.name);
+ setYmlValue(result.data.content);
+ setFirst(true);
+ setSha(result.data.sha);
+ }else{
+ setFirst(false);
+ }
+ setSpining(false);
+ }).catch(error=>{
+ console.log(error);
+ })
+ }
+ },[projectsId])
+
+ // 修改文件内容
+ function changeEditor(value){
+ setYmlValue(value);
+ }
+
+ // 切换语言
+ function select_language(value,array){
+ setFileLanguage(value);
+ setYmlValue( array && array.content);
+ }
+
+ // 确定提交
+ function submit(){
+ let url = '';
+ const { defaultBranch } = props;
+ let params = {
+ branch: defaultBranch,
+ content:ymlValue,
+ filepath:info,
+ message:''
+ }
+ if(first){
+ // 为true,则是编辑否则是新建
+ url = `/${owner}/${projectsId}/update_trustie_pipeline.json`;
+ axios.put(url,{
+ ...params,
+ sha
+ }).then(result=>{
+ if(result){
+ setVisible(true);
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ }else{
+ url = `/${owner}/${projectsId}/create_file.json`;
+ axios.post(url,params).then(result=>{
+ if(result){
+ setVisible(true);
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ }
+ }
+ function suresubmit(){
+ setVisible(false);
+ props.history.push(`/projects/${owner}/${projectsId}/devops/list`);
+ }
+
+ return(
+
+ setVisible(flag)} sureFunc={suresubmit}>
+ 编程语言:
+
+
+
+
+ 配置脚本:
+
+ 确定提交
+
+ )
+}
+export default Dispose;
\ No newline at end of file
diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js
index 3a3db57a4..9d5d5ce63 100644
--- a/src/forge/Merge/MessageCount.js
+++ b/src/forge/Merge/MessageCount.js
@@ -1,5 +1,5 @@
import React, { Component } from "react";
-import { Tabs } from 'antd';
+import { Tabs, Select } from 'antd';
import { Link } from "react-router-dom";
import axios from "axios";
import { getImageUrl , turnbar } from "educoder";
@@ -19,6 +19,7 @@ import RenderHtml from "../../components/render-html";
import "../Order/order.scss";
import MergeLinkFooter from "./MergeLinkFooter";
+const Option = Select.Option;
const TextArea = Input.TextArea;
class MessageCount extends Component {
constructor(props) {
@@ -40,6 +41,11 @@ class MessageCount extends Component {
conflict_files:[],
copyVisible:false,
+
+ fix_issue_id: "",
+ unclosed_issue_list: [],
+ ownername: undefined,
+ reponame: undefined,
};
}
@@ -53,6 +59,7 @@ class MessageCount extends Component {
SpinFlag: true,
});
this.getDetail();
+ this.getUnclosedIssueList();
// this.clickBody();
// 监听路由query传参,实现nps调研效果
@@ -89,6 +96,8 @@ class MessageCount extends Component {
getDetail = () => {
const { projectsId, mergeId, owner } = this.props.match.params;
+ this.state.ownername = owner;
+ this.state.reponame = projectsId;
const url = `/${owner}/${projectsId}/pulls/${mergeId}.json`;
axios
.get(url)
@@ -149,7 +158,7 @@ class MessageCount extends Component {
SpinMerge: true,
});
const { projectsId , owner } = this.props.match.params;
- const { data, title, body, mergekey, pr_status } = this.state;
+ const { data, title, body, mergekey, pr_status, fix_issue_id } = this.state;
const url = `/${owner}/${projectsId}/pulls/${data.pull_request.id}/pr_merge.json`;
axios
.post(url, {
@@ -158,6 +167,7 @@ class MessageCount extends Component {
do: mergekey,
body: body,
title: title,
+ fix_issue_id: fix_issue_id,
})
.then((result) => {
if (result) {
@@ -194,6 +204,47 @@ class MessageCount extends Component {
});
};
+ changefixissue = (e) => {
+ this.setState({
+ fix_issue_id: parseInt(e.target.value),
+ });
+ };
+
+ renderIssueList = (list) => {
+ if (list && list.length > 0) {
+ return list.map((item, index) => {
+ return (
+
+ );
+ });
+ }
+ };
+
+ getUnclosedIssueList = () => {
+ const url = `/projects/blockchain/get_unclosed_issue_list`;
+ axios.get(url,{
+ params:{
+ "ownername": this.state.ownername,
+ "reponame": this.state.reponame
+ }
+ }).then(result=>{
+ if(result && result.data){
+ this.state.unclosed_issue_list = result.data.unclosed_issues;
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ }
+
+ selectIssueChange = (selectedKeys, info) => {
+ this.state.fix_issue_id = selectedKeys;
+ };
+
submitmerge = () => {
if (this.state.mergekey === "rebase") {
this.setState({
@@ -593,6 +644,21 @@ class MessageCount extends Component {
value={this.state.body}
onChange={this.changbodypr}
/>
+ {/**/}
+
{
@@ -77,7 +79,7 @@ class Index extends Component {
getOwner=()=>{
const { OIdentifier } = this.props.match.params;
const { user_id } = this.props && this.props.current_user;
-
+
const url = `/owners.json`;
axios.get(url).then(result=>{
if(result && result.data){
@@ -200,8 +202,8 @@ class Index extends Component {
isSpin: true
})
const { projectsType } = this.props.match.params;
- const {
- project_language_id, project_category_id, license_id, ignore_id , owners_id ,
+ const {
+ project_language_id, project_category_id, license_id, ignore_id , owners_id ,
ignoreFlag,licenseFlag,categoreFlag,languageFlag
} = this.state;
const decoderPass = Base64.encode(values.password);
@@ -299,6 +301,19 @@ class Index extends Component {
}
}
+ // add by zxh: handleBlockchainChange
+ handleBlockchainChange = (event) => {
+ if (this.state.show_div == 'hidden') {
+ this.setState({
+ show_div: "visible"
+ });
+ } else {
+ this.setState({
+ show_div: "hidden"
+ });
+ }
+ }
+
changeDesc=(e)=>{
let value = e.target.value;
this.setState({
@@ -444,7 +459,7 @@ class Index extends Component {
validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者')
}],
})(
-
this.ChangePlatform(value, e, 'owners', OwnerList)}
@@ -483,7 +498,7 @@ class Index extends Component {
)}
- {descNum}/200
+ {/*{descNum}/200*/}
-
+
{
(projectsType === "deposit" || !projectsType) &&
@@ -563,6 +578,41 @@ class Index extends Component {
将项目设为私有(只有项目所有人或拥有权限的项目成员才能看到)
)}
+ {/*增加区块链选项,不要求必选,默认是选择的*/}
+
+ {getFieldDecorator('blockchain')(
+ 项目加入确权机制(贡献确权上链并使用token机制)
+ )}
+
+
+ {this.blockchain_item = blockchain_item})}
+ >
+
+ {getFieldDecorator('blockchain_token_all', {
+ rules: [{
+ required: false, message: '请填写项目token总数(单位:枚)'
+ }],
+ })(
+
+ )}
+
+ {getFieldDecorator('blockchain_init_token', {
+ rules: [{
+ required: false, message: '请填写项目创始人获取token总数(单位:枚)'
+ }],
+ })(
+
+ )}
+
+
+
{
projectsType && projectsType === "mirror" &&
this.showLanguageFunc(e)}>项目语言
)}
- {languageFlag &&
+ {languageFlag &&
{getFieldDecorator('project_language', {
rules: [{
diff --git a/src/forge/New/new.scss b/src/forge/New/new.scss
index 15aca70b2..429066583 100644
--- a/src/forge/New/new.scss
+++ b/src/forge/New/new.scss
@@ -71,4 +71,9 @@
.newContent_inline > .ant-form-item:nth-child(2){
margin-left:0px
}
+}
+
+.div_flex_row {
+ display: flex;
+ flex-direction: row;
}
\ No newline at end of file
diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js
index 5dc19bb8c..15a8e470f 100644
--- a/src/forge/Order/Detail.js
+++ b/src/forge/Order/Detail.js
@@ -37,11 +37,13 @@ class Detail extends Component {
visible: false,
journal_spin: false,
edit_spin: false,
+ blockchain_token_num: 0,
};
}
componentDidMount = () => {
this.getDetail();
+ this.getBlockchainTokenNum();
};
componentDidUpdate=()=>{
@@ -76,6 +78,20 @@ class Detail extends Component {
});
};
+ getBlockchainTokenNum = () => {
+ const { projectsId, orderId, owner } = this.props.match.params;
+ const url = `/blockchain/issue/get_token_num`;
+ axios.post(url,{
+ "issue_id": {orderId}
+ }).then(result=>{
+ if(result && result.data){
+ this.state.blockchain_token_num = result.data.blockchain_token_num;
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ };
+
handleok = () => {
this.setState({
isShow: false,
@@ -346,6 +362,10 @@ class Detail extends Component {
)}
+
+ 悬赏金额:
+ {this.state.blockchain_token_num}
+
里程碑:
diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js
index 7eb22d6d7..3b67ba184 100644
--- a/src/forge/Order/order_form.js
+++ b/src/forge/Order/order_form.js
@@ -13,6 +13,7 @@ const Option = Select.Option;
class order_form extends Component {
constructor(props) {
super(props);
+ this.getTokenProject(props.current_user.user_id, this.props.match.params.owner, this.props.match.params.projectsId);
this.state = {
branch_name: "",
issue_tag_ids: "",
@@ -36,9 +37,27 @@ class order_form extends Component {
show_token: false,
cannot_edit: false,
issue_current_user: true,
+ issue_token_num: 0,
+ blockchain_token_num: 0,
atWhoLoginList:undefined
};
}
+
+ getTokenProject = (user_id, owner_login, project_name) => {
+ const url = `/users/blockchain/balance_project`;
+ axios.post(url,{
+ user_id: user_id,
+ owner_login: owner_login,
+ project_name: project_name
+ }).then(result=>{
+ if(result && result.data){
+ this.state.issue_token_num = result.data.balance;
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ }
+
componentDidUpdate=(prevPros)=>{
if(prevPros && this.props && this.props.checkIfLogin()===false){
this.props.history.push("/403")
@@ -98,7 +117,7 @@ class order_form extends Component {
if (result) {
let data ={
branch_name: result.data.branch_name,
- issue_tag_ids:
+ issue_tag_ids:
result.data.issue_tags && result.data.issue_tags[0].id ?
String(result.data.issue_tags[0].id) : ""
,
@@ -153,11 +172,11 @@ class order_form extends Component {
description:"####问题描述\n\n\n####重现问题步骤\n\n\n####截图\n\n\n####建议解决办法\n",
}
this.setState({ ...data });
- this.props.form.setFieldsValue({
+ this.props.form.setFieldsValue({
...this.state,
- fixed_version_id: milepostId || ""
+ fixed_version_id: milepostId || ""
});
-
+
}else if(this.props.form_type !== "new"){
this.get_detail();
}else{
@@ -186,7 +205,7 @@ class order_form extends Component {
// 创建
handleSubmit = () => {
-
+
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
this.setState({
@@ -212,7 +231,7 @@ class order_form extends Component {
if (values.issue_tag_ids.length > 0) {
values.issue_tag_ids = [values.issue_tag_ids];
}
- const { description, start_date, due_date, issue_type , atWhoLoginList } = this.state;
+ const { description, start_date, due_date, issue_type , atWhoLoginList, blockchain_token_num } = this.state;
if (form_type !== "edit") {
const url = `/${owner}/${projectsId}/issues.json`;
axios.post(url, {
@@ -223,6 +242,7 @@ class order_form extends Component {
due_date: due_date,
issue_type: issue_type,
receivers_login:atWhoLoginList,
+ blockchain_token_num: blockchain_token_num
}).then((result) => {
if (result && result.data.id) {
this.props.showNotification("任务创建成功!");
@@ -370,6 +390,20 @@ class order_form extends Component {
}
};
+ adjustTokenNum = (e) => {
+ var val = e.target.value;
+ val = parseInt(val);
+ if (val > this.state.issue_token_num) {
+ val = this.state.issue_token_num;
+ e.target.value = this.state.issue_token_num;
+ } else {
+ e.target.value = val;
+ }
+ this.setState({
+ blockchain_token_num: val,
+ });
+ }
+
render() {
const { getFieldDecorator } = this.props.form;
const { projectsId , owner } = this.props.match.params;
@@ -456,9 +490,21 @@ class order_form extends Component {
+
+ {getFieldDecorator("issue_token_num", {rules: []})(
+ this.input_token=input}
+ type={"number"}
+ min={0}
+ max={this.state.issue_token_num}
+ onChange={this.adjustTokenNum.bind(this)}
+ placeholder="定义悬赏token数量"
+ />
+ )}
+
{getFieldDecorator("assigned_to_id", {rules: []})(
-