forgeplus/public/react/build/static/js/53.6c48cfaf.chunk.js

1 line
26 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(this.webpackJsonp=this.webpackJsonp||[]).push([[53],{"6JOy":function(e,t,a){},AubP:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=c(a("q1tI")),r=a("spEH"),l=c(a("Rs/d")),i=a("PhNK"),o=a("sYIF"),s=a("eO8H");function c(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){var t=e.commits,a=e.projectsId,c=e.owner;return n.default.createElement("div",{className:"pb20"},t.map((function(e,t){return n.default.createElement("div",{className:"prCommits"},n.default.createElement("p",{className:"prCreate"},e.created_at),n.default.createElement("div",{className:"prInfo"},n.default.createElement(r.FlexAJ,null,n.default.createElement(r.AlignCenter,null,n.default.createElement(s.Link,{to:"/"+c+"/"+a+"/commits/"+(0,i.truncateCommitId)(""+e.sha),className:"commitKey",style:{marginLeft:0}},(0,i.truncateCommitId)(""+e.sha)),n.default.createElement("p",{className:"ml15 font-16 color-grey-3 task-hide",style:{maxWidth:"700px"}},e.message)),n.default.createElement(s.Link,{to:"/"+c+"/"+a+"/commits/"+(0,i.truncateCommitId)(e.sha),className:"color-blue"},"浏览代码")),n.default.createElement(r.AlignCenter,{className:"mt15"},n.default.createElement(l.default,{url:(0,o.getImageUrl)("/"+(e.committer&&e.committer.image_url)),name:""+(e.committer&&e.committer.name)}),n.default.createElement("span",null,":提交于",e.time_from_now))))})))}},Fyak:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=u(a("ZTPi")),r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},l=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();a("AUBz");var i=a("q1tI"),o=u(i),s=u(a("AubP")),c=u(a("aABL"));function u(e){return e&&e.__esModule?e:{default:e}}a("6JOy"),a("js5m");var d=n.default.TabPane,f=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.changeTab=function(e){a.setState({activeKey:e})},a.state={activeKey:"1"},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),l(t,[{key:"render",value:function(){var e=this.props.match.params,t=e.projectsId,a=e.owner,l=this.props.comparesData,i=void 0===l?{}:l,u=i.commits,f=i.diff,m=i.commits_count,p=this.state.activeKey;return u&&0===u.length||!f?"":o.default.createElement("div",{className:"main mergeRequest",style:{paddingTop:"0px"}},o.default.createElement(n.default,{activeKey:p,className:"custom-commit-tabs",animated:!1,onChange:this.changeTab},u&&u.length>0&&o.default.createElement(d,{tab:o.default.createElement("span",null,o.default.createElement("span",{className:"font-16"},"提交"),m>0&&o.default.createElement("span",{className:"tabNum"},m)),key:"1"},o.default.createElement(s.default,r({},this.props,{commits:u,projectsId:t,owner:a}))),f&&f.files&&f.files.length>0&&o.default.createElement(d,{tab:o.default.createElement("span",null,o.default.createElement("span",{className:"font-16"},"文件"),f.files_count>0&&o.default.createElement("span",{className:"tabNum"},f.files_count)),key:"3"},o.default.createElement(c.default,r({},this.props,{data:f,projectsId:t,owner:a})))))}}]),t}(i.Component);t.default=f},PhNK:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.truncateCommitId=function(e){return e&&e.length>11?e.substring(0,10):e},t.timeFormat=function(e){var t=new Date(1e3*e),a=t.getHours()<10?"0".concat(t.getHours()):t.getHours(),n=t.getMinutes()<10?"0".concat(t.getMinutes()):t.getMinutes();return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+a+":"+n}},QCvN:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=g(a("W9HT")),r=g(a("2/Rp")),l=g(a("Vl3Y")),i=g(a("5rEg")),o=g(a("mr32")),s=g(a("BvKs")),c=g(a("2fM7")),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},d=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();a("04bd"),a("L/Qf"),a("tULf"),a("1vPl"),a("0lcf"),a("2WkQ"),a("8QGh");var f=a("q1tI"),m=g(f),p=g(a("vDqi"));a("6JOy"),a("js5m");var h=g(a("p7gc"));function g(e){return e&&e.__esModule?e:{default:e}}var v=c.default.Option,_=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.componentDidMount=function(){a.get_default_selects(),a.set_defatul()},a.componentDidUpdate=function(e){var t=a.props.match.params,n=t.projectsId,r=t.owner,l=e.match.params.projectsId,i=e.match.params.owner;l===n&&i===r||a.get_default_selects(),e&&a.props&&!a.props.checkIfLogin()&&a.props.history.push("/403")},a.get_default_selects=function(){var e=a.props.match.params,t=e.projectsId,n=e.owner;a.setState({isSpin:!0}),p.default.get("/"+n+"/"+t+"/pulls/create_merge_infos.json").then((function(e){e&&a.setState({members:e.data.members,issue_tags:e.data.issue_tags,issue_versions:e.data.issue_versions,issue_priories:e.data.issue_priories}),a.setState({isSpin:!1})})).catch((function(e){a.setState({isSpin:!1}),console.log(e)}))},a.set_defatul=function(){var e=a.props,t=e.data,n=e.merge_type;t&&"edit"===n&&a.setState({desc:t.body,issue_tag_ids:t.issue_tag_ids?t.issue_tag_ids[0]:void 0,fixed_version_id:t.fixed_version_id?String(t.fixed_version_id):void 0,assigned_to_id:t.assigned_to_id?String(t.assigned_to_id):void 0,priority_id:t.priority_id?String(t.priority_id):void 0,title:t.title}),a.InitData()},a.InitData=function(){setTimeout((function(){a.props.form.setFieldsValue(u({},a.state))}),100)},a.onPanelChange=function(e,t){a.setState({value:e})},a.onSelect=function(e){a.setState({value:e,selectedValue:e})},a.renderMenu=function(e,t){return m.default.createElement(s.default,null,e&&e.length>0&&e.map((function(e,n){return m.default.createElement(s.default.Item,{key:e,onClick:function(){return a.getOption(e,t)}},e)})))},a.renderSelect=function(e){if(e&&e.length>0)return e.map((function(e,t){return m.default.createElement(v,{key:t+1,value:e.id+""},e.name)}))},a.handleSubmit=function(){a.setState({isSpin:!0}),a.props.form.validateFieldsAndScroll((function(e,t){if(e)a.setState({isSpin:!1});else{var n=a.props.match.params,r=n.projectsId,l=n.mergeId,i=n.owner,o=a.props,s=o.merge,c=o.pull,d=o.merge_type,f=o.data,m=o.commits_count,h=o.files_count;t.issue_tag_ids&&t.issue_tag_ids.length>0?t.issue_tag_ids=[parseInt(t.issue_tag_ids)]:t.issue_tag_ids=[];var g=a.state.desc;if("new"===d){var v="/"+i+"/"+r+"/pulls.json";p.default.post(v,u({},t,{body:g,head:c,base:s,is_original:f&&f.is_original,fork_project_id:f&&f.fork_project_id,merge_user_login:f&&f.merge_user_login,files_count:h,commits_count:m})).then((function(e){if(e){a.setState({isSpin:!1});var t=e.data.pull_request_id;a.props.history.push("/"+i+"/"+r+"/pulls/"+t);var n=a.props.getDetail;n&&n()}else a.setState({isSpin:!1})})).catch((function(e){a.setState({isSpin:!1}),console.log(e)}))}else{var _="/"+i+"/"+r+"/pulls/"+l+".json";p.default.put(_,u({},t,{body:g,head:c,base:s})).then((function(e){e?(a.setState({isSpin:!1}),a.props.history.push("/"+i+"/"+r+"/pulls/"+l)):a.setState({isSpin:!1})})).catch((function(e){a.setState({isSpin:!1}),console.log(e)}))}}}))},a.onContentChange=function(e){a.setState({desc:e})},a.state={desc:void 0,issue_tag_ids:void 0,fixed_version_id:void 0,assigned_to_id:void 0,titledata:void 0,isSpin:!1,mergedata:void 0,priority_id:void 0,title:void 0,members:void 0,issue_tags:void 0,issue_versions:void 0,issue_priories:void 0},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),d(t,[{key:"render",value:function(){var e=this,t=this.props.merge_type,a=this.props.form.getFieldDecorator,s=this.props.match.params,u=s.projectsId,d=s.mergeId,f=s.owner,p=this.state,g=p.issue_tag_ids,_=p.fixed_version_id,y=p.assigned_to_id,E=p.priority_id,b=p.desc,w=p.isSpin,S=p.title,j=p.members,N=p.issue_tags,O=p.issue_versions,I=p.issue_priories;return m.default.createElement("div",null,m.default.createElement(n.default,{spinning:w},m.default.createElement("div",{className:"mb20"},m.default.createElement("span",{className:"font-16 fwb mr10 ver-middle"},"new"===t?"新建":"编辑","合并请求:"),m.default.createElement(o.default,{color:"#28BD6C",className:"ver-middle"},"可合并的")),m.default.createElement(l.default,null,m.default.createElement("div",{className:"width100 inline-block"},m.default.createElement("div",{className:"width70 pull-left"},m.default.createElement(l.default.Item,null,a("title",{rules:[{required:!0,message:"请填写请求标题"}],initialValue:S})(m.default.createElement(i.default,{placeholder:"标题",maxLength:200}))),m.default.createElement(h.default,{placeholder:"请输入合并请求的描述...",height:450,mdID:"merge-new-description",initValue:b,onChange:this.onContentChange}),m.default.createElement("p",{className:"clearfix mt20"},m.default.createElement(r.default,{type:"primary",loading:w,onClick:this.handleSubmit},m.default.createElement("span",{className:"plr10"},"new"===t?"创建":"提交")),m.default.createElement(r.default,{type:"default",className:"ml30",onClick:function(){e.props.history.push("new"===t?"/"+f+"/"+u+"/pulls":"/"+f+"/"+u+"/pulls/"+d)}},m.default.createElement("span",{className:"plr10"},"取消")))),m.default.createElement("div",{className:"width30 pull-left"},m.default.createElement("div",{className:"pl30"},m.default.createElement(l.default.Item,null,a("assigned_to_id",{initialValue:y})(m.default.createElement(c.default,{placeholder:"未选择审查人员",showSearch:!0},m.default.createElement(v,{key:0,value:""},"未选择审查人员"),this.renderSelect(j)))),m.default.createElement(l.default.Item,null,a("fixed_version_id",{initialValue:_})(m.default.createElement(c.default,{placeholder:O&&O.length>0?"未选择里程碑":"请添加里程碑",showSearch:!0},m.default.createElement(v,{key:0,value:""},O&&O.length>0?"未选择里程碑":"请添加里程碑"),this.renderSelect(O)))),m.default.createElement(l.default.Item,null,a("issue_tag_ids",{initialValue:g})(m.default.createElement(c.default,{placeholder:N&&N.length>0?"未选择标记":"请在仓库设置里添加标记",showSearch:!0},m.default.createElement(v,{key:0,value:""},N&&N.length>0?"未选择标记":"请在仓库设置里添加标记"),this.renderSelect(N)))),m.default.createElement(l.default.Item,null,a("priority_id",{initialValue:E})(m.default.createElement(c.default,{placeholder:"优先级",showSearch:!0},this.renderSelect(I))))))))))}}]),t}(f.Component),y=l.default.create({name:"NewMergeForm"})(_);t.default=y},"Rs/d":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r,l=(n=["\n display:flex;\n font-weight: bold;\n ","\n align-items: center;\n & img{\n width:30px;\n height:30px;\n border-radius:50%;\n }\n ","\n "],r=["\n display:flex;\n font-weight: bold;\n ","\n align-items: center;\n & img{\n width:30px;\n height:30px;\n border-radius:50%;\n }\n ","\n "],Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(r)}}))),i=c(a("q1tI")),o=c(a("vOnD")),s=a("eO8H");function c(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){var t=e.url,a=e.name,n=e.column,r=e.id,c=e.login,u=o.default.span(l,n&&"flex-direction: column;text-align:center;",!n&&"\n & span{\n margin-left:8px;\n }");return r?i.default.createElement(s.Link,{to:"/"+c},i.default.createElement(u,null,t&&i.default.createElement("img",{src:t,alt:""}),i.default.createElement("span",null,a))):i.default.createElement(u,null,t&&i.default.createElement("img",{src:t,alt:""}),i.default.createElement("span",null,a))}},VPG4:function(e,t,a){},Yg6f:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=h(a("W9HT")),r=h(a("+KLJ")),l=h(a("5rEg")),i=h(a("2fM7")),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),c=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,r=!1,l=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(a.push(i.value),!t||a.length!==t);n=!0);}catch(e){r=!0,l=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw l}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};a("04bd"),a("2DKY"),a("1vPl"),a("8QGh");var u=a("q1tI"),d=h(u),f=h(a("vDqi")),m=h(a("QCvN")),p=h(a("Fyak"));function h(e){return e&&e.__esModule?e:{default:e}}function g(e){var t={mergeOwner:void 0,mergeBranch:"master",pullOwner:void 0,pullBranch:"master",projectId:void 0},a=e.slice(1).split("/compare"),n=c(a,2),r=n[0],l=n[1],i=r.split("/"),o=c(i,2),s=o[0],u=o[1];if(t.mergeOwner=s,t.pullOwner=s,t.projectId=u,l){var d=l.slice(1);if(d.indexOf("...")>-1){var f=d.split("..."),m=c(f,2),p=m[0],h=m[1];if(t.mergeBranch=p,h.indexOf(":")>-1){var g=h.split(":"),v=c(g,2),_=v[0],y=v[1];t.pullOwner=_,t.pullBranch=y}else t.pullBranch=h}else t.pullBranch=d}return t}a("6JOy"),a("js5m");var v=i.default.Option,_=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));y.call(a);var n=g(a.props.location.pathname),r=n.pullBranch,l=n.mergeBranch;return a.state={data:void 0,pullBranches:void 0,mergeBranches:void 0,mergeProjects:void 0,merge:l||"master",pull:r||"master",id:void 0,projects_names:void 0,isSpin:!0,showMessage:!1,merge_head:!1,defaultMessage:"必须选择不同的分支",project_id:void 0,merge_project_user:void 0,comparesData:void 0,isCompareSpin:!0,isFirstLoading:!0},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),s(t,[{key:"render",value:function(){var e=this,t=this.state,a=t.data,s=t.pullBranches,c=t.mergeBranches,u=t.mergeProjects,f=t.pull,h=t.merge,g=t.isSpin,v=t.isCompareSpin,_=t.isFirstLoading,y=t.showMessage,E=t.defaultMessage,b=t.projects_names,w=t.id,S=t.comparesData,j=this.props.project;return d.default.createElement("div",null,d.default.createElement(n.default,{spinning:g||v},d.default.createElement("div",{className:"main"},d.default.createElement("div",{className:"merge-header width100 inline-block"},d.default.createElement("div",{className:"width40 pull-left"},d.default.createElement("div",{className:"color-grey-3 mb10 fwb"},"源分支:"),d.default.createElement(l.default.Group,{compact:!0,className:"display-flex"},d.default.createElement(i.default,{value:w,className:"hide-1 task-hide flex1",disabled:!0},this.renderProjectNames(b)),d.default.createElement(i.default,{value:f,onSelect:function(t){return e.selectBrach("pull",t)},showSearch:!0,className:"merge-flex1 flex1 matchwidth",dropdownMatchSelectWidth:!1,dropdownClassName:"overlihide"},this.renderBrances(s)))),d.default.createElement("div",{className:"width10 pull-left text-center mt25"},d.default.createElement("i",{className:"iconfont icon-youjiang color-grey-c font-32"})),d.default.createElement("div",{className:"width40 pull-left"},d.default.createElement("div",null,d.default.createElement("div",{className:"color-grey-3 mb10 fwb"},"目标分支:"),d.default.createElement(l.default.Group,{compact:!0,className:"display-flex"},d.default.createElement(i.default,{value:j&&j.id,className:"hide-1 task-hide flex1",onSelect:function(t){return e.selectProjectName(t)}},this.renderProjectNames(u)),d.default.createElement(i.default,{value:h,onSelect:function(t){return e.selectBrach("merge",t)},showSearch:!0,className:"merge-flex1 flex1 matchwidth",dropdownMatchSelectWidth:!1,dropdownClassName:"overlihide"},this.renderBrances(c)))))),!v&&y&&d.default.createElement("div",{className:"mb20"},d.default.createElement(r.default,{description:this.withHtml(E),type:"error"})),!v&&!y&&d.default.createElement(m.default,o({},this.props,{merge_type:"new",data:a,merge:h,pull:f,files_count:S&&S.diff&&S.diff.files_count,commits_count:S&&S.commits_count}))),!_&&d.default.createElement(p.default,o({},this.props,{merge:h,pull:f,comparesData:S}))))}}]),t}(u.Component),y=function(){var e=this;this.componentDidMount=function(){var t=g(e.props.location.pathname);e.getMergeInfo(t)},this.componentDidUpdate=function(t){var a=t.location.pathname,n=e.props.location.pathname;if(a!==n){var r=g(n);e.getMergeInfo(r)}},this.getMergeInfo=function(t){e.setState({isSpin:!0});var a=t.pullOwner,n=t.pullBranch,r=t.mergeOwner,l=t.mergeBranch,i=t.projectId,o="/"+a+"/"+i+"/pulls/new.json";f.default.get(o).then((function(i){if(i){var o=0===(i.data.branches||[]).filter((function(e){return e.name===l})).length,s=0===(i.data.branches||[]).filter((function(e){return e.name===n})).length;e.setState({projects_names:i.data.projects_names,mergeProjects:i.data.merge_projects,pullBranches:i.data.branches,mergeBranches:i.data.branches,project_id:i.data.project_id,id:i.data.id,merge:l,pull:n}),s?e.setState({showMessage:!0,defaultMessage:"源分支不存在",isCompareSpin:!1}):a===r?o?e.setState({showMessage:!0,defaultMessage:"目标分支不存在",isCompareSpin:!1}):e.compareProject(!0,t):e.getBranchList(t)}e.setState({isSpin:!1})})).catch((function(t){e.setState({isSpin:!1}),console.log(t)}))},this.compareProject=function(t,a){var n=a.pullOwner,r=a.pullBranch,l=a.mergeOwner,i=a.mergeBranch,o=a.projectId,s="/"+l+"/"+o+"/compare";s+=t?"/"+r+"..."+i+".json":"/"+i+"..."+n+"/"+o+":"+r+".json",e.setState({isSpin:!1,isCompareSpin:!0}),f.default.get(s).then((function(t){t&&(0===t.data.status?e.setState({showMessage:!1}):e.setState({showMessage:!0,defaultMessage:t.data.message}),e.setState({comparesData:t.data})),e.setState({isFirstLoading:!1,isSpin:!1,isCompareSpin:!1})})).catch((function(t){e.setState({isSpin:!1,isCompareSpin:!1})}))},this.getBranchList=function(t){var a=t.mergeOwner,n=t.projectId,r=t.mergeBranch;e.setState({isSpin:!0});var l="/"+a+"/"+n+"/pulls/get_branches.json";f.default.get(l).then((function(a){if(a){var n=0===(a.data||[]).filter((function(e){return e.name===r})).length;e.setState({mergeBranches:a.data,showMessage:n,defaultMessage:"目标分支不存在",isCompareSpin:!1}),!n&&e.compareProject(!1,t)}e.setState({isSpin:!1})})).catch((function(t){e.setState({isSpin:!1}),console.log(t)}))},this.selectBrach=function(t,a){var n=g(e.props.location.pathname),r=n.pullOwner,l=n.pullBranch,i=n.mergeOwner,o=n.mergeBranch,s="/"+i+"/"+n.projectId+"/compare/",c="pull"===t?a:l,u="pull"===t?o:a;s+=r===i?u+"..."+c:u+"..."+r+":"+c,e.props.history.push(s)},this.selectProjectName=function(t){var a=e.state,n=a.projects_names,r=a.id,l=g(e.props.location.pathname),i=l.pullOwner,o=l.pullBranch,s=n&&n.filter((function(e){return e.id===t})),c=s&&s[0].project_id,u=s&&s[0].project_user_login,d=parseInt(t,10)!==parseInt(r,10);e.setState({isSpin:!0,data:{is_original:d,fork_project_id:d?r:"",merge_user_login:d?n[0].project_user_login:void 0}}),u===i?e.props.history.push("/"+u+"/"+c+"/compare/master..."+o):e.props.history.push("/"+u+"/"+c+"/compare/master..."+i+":"+o)},this.renderBrances=function(e){if(e&&e.length>0)return e.map((function(e,t){return d.default.createElement(v,{key:t+1,value:e.name},e.name)}))},this.renderProjectNames=function(e){if(e&&e.length>0)return e.map((function(e,t){return d.default.createElement(v,{key:t+1,value:e.id},e.project_name)}))},this.withHtml=function(e){return d.default.createElement("div",{dangerouslySetInnerHTML:{__html:e}})}};t.default=_},aABL:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=u(a("3S7+")),r=u(a("CFYs")),l=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,r=!1,l=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(a.push(i.value),!t||a.length!==t);n=!0);}catch(e){r=!0,l=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw l}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};a("TfFZ"),a("D8SU");var i=a("q1tI"),o=u(i),s=a("PhNK"),c=a("spEH");function u(e){return e&&e.__esModule?e:{default:e}}a("js5m"),a("VPG4"),t.default=function(e){var t=e.data,a=e.history,u=e.owner,d=e.projectsId,f=e.parentsSha,m=(0,i.useState)(t&&t.files),p=l(m,2),h=p[0],g=p[1],v=(0,i.useState)("复制文件路径"),_=l(v,2),y=_[0],E=_[1],b=(0,i.useState)(!1),w=l(b,2),S=w[0],j=w[1];function N(e,t,a){if(!a){var n=h.concat();n[t].flag=!e,n.splice(),g(n)}}(0,i.useEffect)((function(){t&&g(t.files)}),[t]),(0,i.useEffect)((function(){document.addEventListener("click",(function(){j(!1)}))}));var O=o.default.createElement("div",{className:"folders"},o.default.createElement("div",{className:"folderList"},h&&h.map((function(e,t){return o.default.createElement("a",{href:"#value"+t},o.default.createElement(c.FlexAJ,{className:"filesInfo",key:t,onClick:function(){e.flag&&N(e.flag,t,e.isBin),j(!1)}},o.default.createElement(c.AlignCenter,null,o.default.createElement("i",{className:"iconfont icon-wenjianicon mr4"}),o.default.createElement("span",{className:"cursor-pointer","data-clipboard-text":e.name},e.name)),o.default.createElement("div",{className:"see-file"},o.default.createElement(n.default,{placement:"top",title:e.addition+e.deletion+"处更改"+(e.addition+e.deletion>0?"":"")+(e.addition>0?e.addition+"处添加":"")+(e.addition>0&&e.deletion>0?"和":"")+(e.deletion>0?e.deletion+"处删除":"")},o.default.createElement(r.default,{showInfo:!1,strokeColor:"#2DB44D",size:"small",percent:e.addition/(e.addition+e.deletion)*100}),e.addition>0&&o.default.createElement("span",{className:"color-green ml10"},"+",e.addition),e.deletion>0&&o.default.createElement("span",{className:"color-red ml10"},"-",e.deletion)))))}))));return o.default.createElement("div",{onClick:function(e){e.nativeEvent.stopImmediatePropagation()}},o.default.createElement(c.AlignCenter,{className:"color-grey-9",style:{position:"relative"}},o.default.createElement("div",{onClick:function(){j(!S)}},o.default.createElement("i",{className:"iconfont mr5 "+(S?"font-18 icon-sanjiaoxing-down":"font-16 icon-triangle")}),o.default.createElement("span",{className:"color-grey-6 update-file-count"},"共有",o.default.createElement("span",{className:"color-grey-3"}," ",t&&t.files_count," 个文件 "),"被更改,包括",t&&t.total_addition?o.default.createElement("span",{className:"color-green"}," ",t&&t.total_addition," 次插入"):"",t&&t.total_addition&&t.total_deletion?" 和 ":"",t&&t.total_deletion?o.default.createElement("span",{className:"color-red"}," ",t&&t.total_deletion," 次删除"):"")),S&&O),h&&h.length>0&&o.default.createElement("div",{className:"fileList"},h.map((function(e,t){return o.default.createElement("div",{className:"files",key:t},o.default.createElement("a",{id:"value"+t,className:"anchorPoint"}),o.default.createElement(c.FlexAJ,{className:"filesInfo"},o.default.createElement(c.AlignCenter,null,e.isBin?"":o.default.createElement("i",{className:e.flag?"iconfont icon-triangle font-15 color-grey-9":"iconfont icon-sanjiaoxing-down color-grey-9 mt4",onClick:function(){return N(e.flag,t,e.isBin)}}),o.default.createElement("span",{className:"cursor-pointer","data-clipboard-text":e.name,onClick:function(){return N(e.flag,t,e.isBin)}},e.name),o.default.createElement(n.default,{title:y,onVisibleChange:function(){return E("复制文件路径")}},o.default.createElement("i",{className:"iconfont icon-fuzhiicon ml6",onClick:function(){return t=e.name,(a=document.createElement("input")).defaultValue=t,document.body.appendChild(a),a.select(),document.execCommand("Copy"),a.className="copyCont",a.style.display="none",void E("复制成功");var t,a}}))),o.default.createElement("div",{className:"see-file"},o.default.createElement(n.default,{placement:"top",title:e.addition+e.deletion+"处更改"+(e.addition+e.deletion>0?"":"")+" "+(e.addition>0?e.addition+"处添加":"")+(e.addition>0&&e.deletion>0?"和":"")+(e.deletion>0?e.deletion+"处删除":"")},o.default.createElement(r.default,{showInfo:!1,strokeColor:"#2DB44D",size:"small",percent:e.addition/(e.addition+e.deletion)*100}),o.default.createElement("span",{className:"ml10"},e.addition+e.deletion,"处")),!e.isSubmodule&&o.default.createElement("span",{className:"see-file-btn",onClick:function(){a.push("/"+u+"/"+d+(e.isDeleted?"/commits/"+(0,s.truncateCommitId)(f):"/tree/"+(0,s.truncateCommitId)(e.sha)+"/"+e.name))}},"查看文件"))),e.sections&&e.sections.length>=1&&!e.flag&&o.default.createElement("div",{className:"filesContent"},e.sections.map((function(e,t){return e.lines&&e.lines.length>0&&e.lines.map((function(e,a){return o.default.createElement("div",{key:t+a,className:2===e.type?"linesContent add":3===e.type?"linesContent reduce":4===e.type?"linesContent translate":"linesContent"},o.default.createElement("span",{className:"lines"},o.default.createElement("span",null,e.leftIdx&&"0"!==e.leftIdx?e.leftIdx:""),o.default.createElement("span",null,e.rightIdx&&"0"!==e.rightIdx?e.rightIdx:"")),o.default.createElement("p",null,e.content))}))}))))}))))}},js5m:function(e,t,a){}}]);