1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[97],{BtkW:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=b(a("W9HT")),r=b(a("2/Rp")),l=b(a("CtXQ")),o=b(a("9yH6")),i=b(a("Vl3Y")),c=b(a("5rEg")),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}}();a("04bd"),a("L/Qf"),a("2oDE"),a("K4yd"),a("tULf"),a("1vPl");var u=a("q1tI"),f=b(u),d=a("sYIF"),p=a("eO8H");a("XmZk");var m=a("J66h"),h=b(a("vDqi"));function b(e){return e&&e.__esModule?e:{default:e}}var v=c.default.TextArea,y=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(){var e=a.props.descName;e&&a.props.form.setFieldsValue({desc:e})},a.componentDidUpdate=function(e){var t=a.props.descName;e&&t&&e.descName!==t&&a.props.form.setFieldsValue({desc:t})},a.changeSubmittype=function(e){a.setState({submitType:e.target.value})},a.changeFileName=function(e){a.setState({filename:e.target.value})},a.subMitFrom=function(){var e=a.props,t=e.filepath,n=e.content,r=e.editor_type,l=e.checkName,o=a.props.match.params,i=o.branch,c=o.projectsId,s=o.owner,u=a.state,f=u.submitType,p=u.filename;a.setState({isSpin:!0});var b="upload"===r?t:t.substr(1);a.props.form.validateFieldsAndScroll((function(e,t){if(e||l)a.setState({isSpin:!1});else{var o="/"+s+"/"+c+"/create_file.json";h.default.post(o,{filepath:p||b,branch:(0,d.returnbar)(i),new_branch:"1"===f?t.branchname:void 0,content:"upload"===r?n:m.Base64.encode(n),message:t.desc}).then((function(e){if(a.setState({isSpin:!1}),e.data&&e.data.name){if(a.props.showNotification("文件新建成功!"),"1"===f){var n=a.props.getDetail;n&&n()}var r="/"+s+"/"+c+(t.branchname?"/tree/"+(0,d.turnbar)(t.branchname):i?"/tree/"+(0,d.turnbar)(i):"");a.props.history.push(r)}})).catch((function(e){a.setState({isSpin:!1}),console.log(e)}))}}))},a.UpdateFile=function(){a.setState({isSpin:!0});var e=a.props,t=e.branch,n=e.detail,r=e.content,l=e.currentBranch,o=e.checkName,i=a.props.match.params,c=i.projectsId,s=i.owner,u=a.state.submitType,f="/"+s+"/"+c+"/update_file.json",p=l||t;a.props.form.validateFieldsAndScroll((function(e,i){e||o?a.setState({isSpin:!1}):h.default.put(f,{filepath:n.path,branch:"1"===u?void 0:(0,d.returnbar)(p),new_branch:"1"===u?i.branchname:void 0,content:r,sha:n.sha,message:i.desc}).then((function(e){if(a.setState({isSpin:!1}),e.data&&1===e.data.status){var n=l||t,r="/"+s+"/"+c+(i.branchname?"/tree/"+(0,d.turnbar)(i.branchname):n?"/tree/"+(0,d.turnbar)(n):"");a.props.history.push(r),a.props.showNotification("文件修改成功!")}})).catch((function(e){a.setState({isSpin:!1}),console.log(e)}))}))},a.checkBranchName=function(e,t,a){if(t||a(),t){if(/\\/g.test(t))a(f.default.createElement("span",null,"分支名不能包含下列任何字符:^*\\/"));else for(var n=0;n<"^*/".length;n++){var r="^*/"[n];if(t.indexOf(r)>-1)return void a(f.default.createElement("span",null,"分支名不能包含下列任何字符:^*\\/"))}}a()},a.state={submitType:"0",filename:"",isSpin:!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),s(t,[{key:"render",value:function(){var e=this,t=this.state,a=t.submitType,s=t.filename,u=t.isSpin,m=this.props.form.getFieldDecorator,h=this.props.match.params,b=h.branch,y=h.projectsId,g=h.owner,E=this.props,w=E.current_user,N=E.filepath,_=E.projectDetail,S=E.currentBranch,O=this.props.editor_type,j=S||b;return f.default.createElement("div",null,f.default.createElement("span",{className:"df",style:{alignItems:"center"}},f.default.createElement(p.Link,{to:"/"+(w&&w.login),className:"show-user-link"},f.default.createElement("img",{src:(0,d.getImageUrl)("/"+(w&&w.image_url)),alt:"",className:"screwImg"}),f.default.createElement("span",{className:"color-grey-3 ver-middle"},w&&w.username,":")),f.default.createElement("span",{className:"color-grey-8"},"提交变更")),f.default.createElement(n.default,{spinning:u},f.default.createElement("div",{className:"userScrew"},f.default.createElement("div",{className:"screwPanel"},f.default.createElement(i.default,null,f.default.createElement(i.default.Item,{style:{display:"upload"===O?"block":"none"}},m("path",{rules:[]})(f.default.createElement("div",{className:"setInputAddon"},f.default.createElement(c.default,{addonBefore:"/"+(_&&_.identifier)+"/",value:s||N,onChange:this.changeFileName,placeholder:"文件路径..."})))),f.default.createElement(i.default.Item,null,m("desc",{rules:[{required:!0,message:"请添加描述信息"}]})(f.default.createElement(v,{placeholder:"必填,描述主要修改类型和内容",authSize:{minRows:3,maxRows:5}}))),f.default.createElement(o.default.Group,{value:a,onChange:this.changeSubmittype},f.default.createElement(o.default,{value:"0",className:"mb10"},f.default.createElement("i",{className:"iconfont icon-banbenku font-16 mr5"}),"直接提交至",f.default.createElement("span",{className:"color-orange"},(0,d.returnbar)(j)),"分支"),f.default.createElement(o.default,{value:"1"},f.default.createElement(l.default,{type:"pull-request",className:"mr5"}),"为此提交创建一个",f.default.createElement("span",{className:"font-bd"},"新的分支"),"并发起合并请求")),"1"===a?f.default.createElement("div",{className:"mt15"},f.default.createElement(i.default.Item,{style:{paddingLeft:"24px"}},m("branchname",{rules:[{required:!0,message:"请输入分支名称"},{validator:this.checkBranchName}]})(f.default.createElement(c.default,{placeholder:"请输入分支名称",style:{width:"220px"}})))):""))),f.default.createElement("div",{className:"mt20"},f.default.createElement(r.default,{type:"primary",onClick:"update"===O?this.UpdateFile:this.subMitFrom,className:"mr30"},"提交变更"),f.default.createElement(r.default,{type:"primary grey",onClick:function(){e.props.history.push("/"+g+"/"+y)},className:"mr20"},"取消"))))}}]),t}(u.Component),g=i.default.create({name:"UserSubmitForm"})(y);t.default=g},PgMy:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(a("2fM7")),r=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 o,i=e[Symbol.iterator]();!(n=(o=i.next()).done)&&(a.push(o.value),!t||a.length!==t);n=!0);}catch(e){r=!0,l=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw l}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};a("8QGh");var l=a("q1tI"),o=i(l);i(a("vDqi"));function i(e){return e&&e.__esModule?e:{default:e}}var c=n.default.Option,s=["apex","azcli","bat","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","handlebars","html","ini","java","javascript","json","less","lua","markdown","msdax","mysql","objective","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","ruby","rust","sb","scheme","scss","shell","solidity","sql","st","swift","typescript","vb","xml","yaml"];t.default=function(e){var t=e.language,a=e.select_language,i=(0,l.useState)(void 0),u=r(i,2);u[0],u[1];return o.default.createElement(n.default,{showSearch:!0,placeholder:"请选择文本语言",style:{width:200},value:t,onChange:function(e){a(e)}},o.default.createElement(c,{value:void 0},"请选择文本语言"),s&&s.map((function(e,t){return o.default.createElement(c,{value:e},e)})))}},"R/Rt":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=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},r=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}}(),l=a("q1tI"),o=s(l),i=a("a2PE");a("McUL"),a("+dQi"),a("S6bl"),a("ewDg");var c=s(a("BtkW"));function s(e){return e&&e.__esModule?e:{default:e}}a("XmZk"),a("lr0e");var u=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.componentDidUpdate=function(e){e&&a.props&&a.props.content!==e.content&&a.setState({editorValue:a.props.content})},a.changeEditor=function(e,t){a.setState({changeValue:e.getValue()})},a.editorDidMount=function(e,t){a.props.goLine&&e.scrollIntoView({line:a.props.goLine,char:1},200)},a.editorDidMount=a.editorDidMount.bind(a),a.state={editorValue:a.props.content,changeValue:a.props.content,prevHeight: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),r(t,[{key:"render",value:function(){var e=this.state,t=e.editorValue,a=e.changeValue,r=this.props,l=r.readOnly,s=r.editorType,u=r.currentBranch,f=r.descName,d=r.checkName,p={lineNumbers:"on",lineWrapping:!0,selectOnLineNumbers:!0,lineHeight:24,renderLineHighlight:"line",revealHorizontalRightPadding:5,placeholder:"请输入内容",readOnly:l,cursorStyle:l?"underline-thin":"line",folding:!0,foldingStrategy:"indentation",automaticLayout:!0,overviewRulerBorder:!1,scrollBeyondLastLine:!1,styleActiveLine:!0,minimap:{enabled:!1}};return o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:"editorBorderBox"},o.default.createElement(i.UnControlled,{placeholder:"请输入内容",value:t,options:p,onChange:this.changeEditor,onUpdate:this.editorDidMount})),!l&&o.default.createElement("div",{className:"editorBorderSubmitBox",style:{padding:"20px"}},o.default.createElement(c.default,n({},this.props,this.state,{filepath:""+this.props.filepath,content:a,editor_type:s,currentBranch:u,descName:f,checkName:d}))))}}]),t}(l.Component);t.default=u},XmZk:function(e,t,a){},eacs:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=u(a("5rEg")),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("1vPl");var o=a("q1tI"),i=u(o),c=u(a("R/Rt"));a("XmZk");var s=u(a("PgMy"));function u(e){return e&&e.__esModule?e:{default:e}}var 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.changeFileName=function(e){a.setState({filename:e.target.value})},a.CancelAddFile=function(){a.props.history.goBack()},a.select_language=function(e){a.setState({language:e})},a.checkFileName=function(e){var t=e.target.value,n='!!@/::"“”<《》>||??%';if(/\\/g.test(t))a.setState({checkName:!0});else for(var r=0;r<n.length;r++){var l=n[r];if(t.indexOf(l)>-1)return void a.setState({checkName:!0});a.setState({checkName:!1})}},a.state={editorValue:"",filename:"",language:void 0,checkName:!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.location.pathname,t=this.state,a=t.filename,l=t.language,o=t.checkName,u=e.split("newfile")[1],f=u+"/"+a,d=this.props.projectDetail;return i.default.createElement(i.default.Fragment,null,i.default.createElement("div",{className:"main"},i.default.createElement("p",{className:"pb15 bor-bottom-greyE font-16 color-grey-3 mb20"},"新建文件"),i.default.createElement("div",null,i.default.createElement("div",{className:"grid-item mb30"},i.default.createElement("div",{className:"grid-item"},i.default.createElement("div",{className:o?"setInputAddon red":"setInputAddon"},i.default.createElement(n.default,{addonBefore:"/"+(d&&d.identifier)+u+"/",value:a,onChange:this.changeFileName,placeholder:"命名文件...",onBlur:this.checkFileName}),o?i.default.createElement("p",{style:{color:"red",position:"absolute"}},"文件名不能包含下列任何字符:\\",'!@/:"<>|?%'):""),i.default.createElement("a",{onClick:this.CancelAddFile,className:"color-blue"},"取消")),i.default.createElement("div",{className:"text-right"},i.default.createElement(s.default,{language:l,select_language:this.select_language}))),i.default.createElement("div",{className:"editorBorder"},i.default.createElement(c.default,r({},this.props,this.state,{filepath:""+f,language:l,content:void 0,readOnly:!1,editorType:"new",descName:a?"Add "+a:"",checkName:o}))))))}}]),t}(o.Component);t.default=f},lr0e:function(e,t,a){}}]); |