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_ty
|