build/static/js/121.b205e228.chunk.js

1 line
12 KiB
JavaScript

(this.webpackJsonp=this.webpackJsonp||[]).push([[121],{Jwem:function(e,t,n){"use strict";n.r(t),n("T2oS");var a,o=n("W9HT"),i=(n("DjyN"),n("NUBc")),r=n("zLi2"),c=n.n(r),l=n("YdDX"),s=n.n(l),u=n("o+MX"),p=n.n(u),f=n("cDcd"),m=n.n(f),d=n("spEH"),v=(n("g9YV"),n("wCAj")),h=(n("P2fV"),n("NJEC")),b=n("2iEm"),y=n("sYIF"),g=function(e){var t=e.list,n=e.operate,a=e.projectsId,o=e.owner,i=e.showModal,r=e.deleteFunc,c=[{title:"流水线名称",dataIndex:"pipeline_name",key:1,ellipsis:!0,render:function(e,t){return m.a.createElement("span",{onDoubleClick:function(){return i(e,t.id,t.branch,t.event)},style:{display:"block",cursor:"pointer"}},e)}},{title:"文件名称",dataIndex:"file_name",key:1,width:"15%",ellipsis:!0,render:function(e,t){var n,i,r,c=Object(y.x)(t.branch);return m.a.createElement(b.a,{to:p()(n=p()(i=p()(r="/".concat(o,"/")).call(r,a,"/tree/")).call(i,c,"/")).call(n,e),className:"color-blue"},e)}},{title:"触发分支",dataIndex:"branch",key:1,width:"10%",ellipsis:!0},{title:"触发事件",dataIndex:"event",key:1,width:"10%",ellipsis:!0},{title:"最近构建时间",dataIndex:"last_build_time",key:1,width:"15%",ellipsis:!0},{title:"最近构建状态",dataIndex:"pipeline_status",key:1,width:"12%",ellipsis:!0,render:function(e){return function(e){switch(e){case"running":return m.a.createElement("span",{className:"statusTag running"},m.a.createElement("i",{className:"iconfont icon-yunhangzhong"}),"运行中");case"failure":case"error":return m.a.createElement("span",{className:"statusTag failed"},m.a.createElement("i",{className:"iconfont icon-weitongguo"}),"未通过");case"success":return m.a.createElement("span",{className:"statusTag pass"},m.a.createElement("i",{className:"iconfont icon-yitongguo"}),"已通过");case"killed":return m.a.createElement("span",{className:"statusTag killed"},m.a.createElement("i",{className:"iconfont icon-weitongguo"}),"已撤销");default:return m.a.createElement("span",{className:"statusTag Preparing"},m.a.createElement("i",{className:"iconfont icon-zhunbeizhong"}),"准备中")}}(e)}},{title:"操作",dataIndex:"operation",key:1,width:"21%",render:function(e,t){var i,c,l,s;return m.a.createElement("span",null,n?m.a.createElement(b.a,{to:p()(i=p()(c="/".concat(o,"/")).call(c,a,"/devops/")).call(i,t.id),className:"mr10 color-grey-6"},m.a.createElement("i",{className:"iconfont icon-zaibianji font-13 mr3"}),"编辑"):"",n?m.a.createElement(h.a,{title:"确定要删除此流水线?",onConfirm:function(){return r(t.id)},okText:"确定",cancelText:"取消"},m.a.createElement("a",{className:"mr10 color-grey-6"},m.a.createElement("i",{className:"iconfont icon-lajitong font-13 mr3"}),"删除")):"",m.a.createElement(b.a,{to:p()(l=p()(s="/".concat(o,"/")).call(s,a,"/devops/list/")).call(l,t.branch),className:"color-grey-6"},m.a.createElement("i",{className:"iconfont icon-yunhang font-13 mr3"}),"查看运行记录"))}}];return m.a.createElement(v.a,{size:"small",columns:c,dataSource:t,rowKey:function(e){return e.id},pagination:!1})},E=n("gyhb"),O=n("vDqi"),w=n.n(O),j=(n("2qtc"),n("kLXV")),N=(n("5NDa"),n("5rEg")),C=(n("OaEy"),n("2fM7")),k=n("FLGM"),x=n.n(k),S=C.a.Option,P=["push","pull_request","tag","cron","custom","promote","rollback"],_=function(e){var t=e.visible,n=e.onCancel,a=e.onOk,o=e.value,i=e.branchList,r=Object(f.useState)(void 0),l=c()(r,2),s=l[0],u=l[1],p=Object(f.useState)(void 0),d=c()(p,2),v=d[0],h=d[1],b=Object(f.useState)([P[0]]),y=c()(b,2),g=y[0],E=y[1];return Object(f.useEffect)((function(){i&&i.length>0&&h(i[0].name)}),[i]),Object(f.useEffect)((function(){o?(u(o.pipeline_name),h(o.branch),E(o.event)):u(void 0)}),[o]),m.a.createElement(j.a,{visible:t,title:"流水线名称",width:"500px",onCancel:n,onOk:function(){a(s,o&&o.id,v,g)},centered:!0},m.a.createElement("div",{className:"choosenList"},m.a.createElement("span",null,"流水线名称:"),m.a.createElement(N.a,{value:s,onChange:function(e){return u(e.target.value)},placeholder:"请输入名称",style:{width:"340px",margin:"6px 0px"}})),m.a.createElement("div",{className:"choosenList mt20"},m.a.createElement("span",null,"触发条件:"),m.a.createElement(C.a,{value:v,style:{width:"150px"},dropdownClassName:"chooseCon",onChange:function(e){return h(e)}},i&&i.length>0&&x()(i).call(i,(function(e,t){return m.a.createElement(S,{value:e.name,key:t},e.name)}))),m.a.createElement(C.a,{mode:"multiple",allowClear:!0,value:g,dropdownClassName:"chooseCon",style:{width:"180px",marginLeft:"10px"},onChange:function(e){E(e)}},x()(P).call(P,(function(e,t){return m.a.createElement(S,{value:e,key:t},e)})))))},T=n("vOnD").a.div(a||(a=s()(["{\n padding:24px 30px;\n}"])));t.default=function(e){var t=Object(f.useState)(!0),n=c()(t,2),a=n[0],r=n[1],l=Object(f.useState)(void 0),s=c()(l,2),u=s[0],v=s[1],h=Object(f.useState)(void 0),b=c()(h,2),y=b[0],O=b[1],j=Object(f.useState)(void 0),N=c()(j,2),C=N[0],k=N[1],x=Object(f.useState)(!1),S=c()(x,2),P=S[0],D=S[1],V=Object(f.useState)(1),I=c()(V,2),L=I[0],z=I[1],R=Object(f.useState)(0),H=c()(R,2),M=H[0],F=(H[1],Object(f.useState)(void 0)),J=c()(F,2),B=J[0],X=J[1],Y=e.projectDetail,q=e.current_user,Q=e.match.params.projectsId,A=e.match.params.owner;function U(){w.a.get("/ci/pipelines/list.json",{params:{identifier:Q,owner:A,page:L,limit:15}}).then((function(e){e&&e.data&&O(e.data.pipelines),r(!1)})).catch((function(e){r(!1)}))}function Z(e,t,n,a){if(D(!0),v(void 0),e){var o=a.split(",");v({pipeline_name:e,id:t,branch:n,event:o})}else v(void 0)}Object(f.useEffect)((function(){Y&&k(e.projectDetail.permission)}),[Y]),Object(f.useEffect)((function(){U()}),[L]),Object(f.useEffect)((function(){if(A&&Q){var e,t=p()(e="/".concat(A,"/")).call(e,Q,"/branches.json");w.a.get(t).then((function(e){e&&e.data&&X(e.data)})).catch((function(e){}))}}),[A,Q]);var G=q&&C&&"Reporter"!==C;return m.a.createElement(o.a,{spinning:a},m.a.createElement(_,{branchList:B,visible:P,value:u,onCancel:function(){return D(!1)},onOk:function(t,n,a,o){if(t){for(var i="",r=0;r<o.length;r++)i+=o[r]+",";if(i=i.substring(0,i.length-1),n){var c="/ci/pipelines/".concat(n,".json");w.a.put(c,{pipeline_name:t,repo:Q,branch:a,event:i,owner:A}).then((function(t){t&&t.data?(D(!1),U(),e.showNotification("流水线名称更新成功!")):e.showNotification("流水线名称更新失败,请稍后再试!")})).catch((function(e){}))}else w.a.post("/ci/pipelines.json",{pipeline_name:t,file_name:".trustie-pipeline.yml",repo:Q,branch:a,event:i,owner:A}).then((function(t){var n,a;D(!1),t&&t.data?(e.showNotification("流水线新增成功,请进行工作流配置!"),e.history.push(p()(n=p()(a="/".concat(A,"/")).call(a,Q,"/devops/")).call(n,t.data.id))):e.showNotification("流水线新增失败,请稍后再试!")})).catch((function(e){}))}else e.showNotification("请输入流水线名称!")}}),m.a.createElement("div",{className:"disposePanel"},m.a.createElement(E.a,{manager:G?function(){var t;e.history.push(p()(t="/".concat(A,"/")).call(t,Q,"/devops/mould"))}:void 0,parameter:G?function(){var t;e.history.push(p()(t="/".concat(A,"/")).call(t,Q,"/devops/params"))}:void 0}),m.a.createElement(T,null,G&&m.a.createElement(d.e,{onClick:function(){return Z(void 0,void 0)}},"新增流水线"),m.a.createElement("div",{className:"mt20 disposeList"},m.a.createElement(g,{list:y,operate:G,projectsId:Q,owner:A,showModal:Z,deleteFunc:function(t){var n="/ci/pipelines/".concat(t,".json");w.a.delete(n).then((function(t){t&&t.data&&(e.showNotification("流水线删除成功!"),U())})).catch((function(e){}))}}),M>15&&m.a.createElement("div",{className:"mt20 pb20",style:{textAlign:"center"}},m.a.createElement(i.a,{simple:!0,current:L,pageSize:15,total:M,onChange:function(e){return z(e)}}))))))}},NJEC:function(e,t,n){"use strict";var a=n("cDcd"),o=n("VCL8"),i=n("3S7+"),r=n("CtXQ"),c=n("2/Rp"),l=n("YMnH"),s=n("ZvpZ"),u=n("H84U");function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}function m(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(p,e);var t,n,o,r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(a,arguments,o)}else n=a.apply(this,arguments);return v(this,n)}}(p);function p(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(t=r.call(this,e)).onConfirm=function(e){t.setVisible(!1,e);var n=t.props.onConfirm;n&&n.call(h(t),e)},t.onCancel=function(e){t.setVisible(!1,e);var n=t.props.onCancel;n&&n.call(h(t),e)},t.onVisibleChange=function(e){t.props.disabled||t.setVisible(e)},t.saveTooltip=function(e){t.tooltip=e},t.renderOverlay=function(e,n){var o=t.props,i=o.okButtonProps,r=o.cancelButtonProps,l=o.title,s=o.cancelText,u=o.okText,p=o.okType,m=o.icon;return a.createElement("div",null,a.createElement("div",{className:"".concat(e,"-inner-content")},a.createElement("div",{className:"".concat(e,"-message")},m,a.createElement("div",{className:"".concat(e,"-message-title")},l)),a.createElement("div",{className:"".concat(e,"-buttons")},a.createElement(c.a,f({onClick:t.onCancel,size:"small"},r),s||n.cancelText),a.createElement(c.a,f({onClick:t.onConfirm,type:p,size:"small"},i),u||n.okText))))},t.renderConfirm=function(e){var n=e.getPrefixCls,o=t.props,r=o.prefixCls,c=o.placement,u=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}(o,["prefixCls","placement"]),p=n("popover",r),m=a.createElement(l.a,{componentName:"Popconfirm",defaultLocale:s.a.Popconfirm},(function(e){return t.renderOverlay(p,e)}));return a.createElement(i.a,f({},u,{prefixCls:p,placement:c,onVisibleChange:t.onVisibleChange,visible:t.state.visible,overlay:m,ref:t.saveTooltip}))},t.state={visible:e.visible},t}return t=p,o=[{key:"getDerivedStateFromProps",value:function(e){return"visible"in e?{visible:e.visible}:"defaultVisible"in e?{visible:e.defaultVisible}:null}}],(n=[{key:"getPopupDomNode",value:function(){return this.tooltip.getPopupDomNode()}},{key:"setVisible",value:function(e,t){var n=this.props;"visible"in n||this.setState({visible:e});var a=n.onVisibleChange;a&&a(e,t)}},{key:"render",value:function(){return a.createElement(u.a,null,this.renderConfirm)}}])&&m(t.prototype,n),o&&m(t,o),p}(a.Component);y.defaultProps={transitionName:"zoom-big",placement:"top",trigger:"click",okType:"primary",icon:a.createElement(r.a,{type:"exclamation-circle",theme:"filled"}),disabled:!1},Object(o.polyfill)(y),t.a=y},P2fV:function(e,t,n){"use strict";n("cIOH"),n("Q9mQ"),n("+L6B")},gyhb:function(e,t,n){"use strict";var a=n("cDcd"),o=n.n(a),i=n("spEH");t.a=function(e){var t=e.manager,n=e.parameter;return o.a.createElement(i.b,null,o.a.createElement("span",{className:"font-20"},"引擎配置"),o.a.createElement(i.j,null,n&&o.a.createElement(i.f,{onClick:n},"参数管理"),t&&o.a.createElement(i.f,{style:{marginLeft:"20px"},onClick:t},"模板管理"),o.a.createElement("a",{href:"https://forum.trustie.net/forums/3111/detail",target:"_blank",className:"color-grey-6 ml20"},o.a.createElement("i",{className:"iconfont icon-tishi1 font-14 mr3"}),"模板使用说明")))}}}]);