forked from Gitlink/forgeplus
1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[52],{"E+/Y":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenKey=t.httpUrl=void 0;var n=u(a("TeRw")),r=u(a("tsqr"));a("O+I2"),a("8/o9");var l=u(a("vDqi")),i=u(a("Po8q")),o=u(a("H5Q0"));function u(e){return e&&e.__esModule?e:{default:e}}var c="";window.location.href.indexOf("localhost")>-1?c="https://test-search.trustie.net":window.location.href.indexOf("testforgeplus")>-1?(c="https://test-search.trustie.net",l.default.defaults.withCredentials=!0):window.location.href.indexOf("forgeplus")>-1&&(c="https://wiki-api.trustie.net",l.default.defaults.withCredentials=!0);var s=t.httpUrl=c,d=t.TokenKey="autologin_trustie",f=l.default.create({baseURL:s,timeout:1e4});f.interceptors.request.use((function(e){if(i.default.load(d)&&(console.log(i.default.load(d)),e.headers.Authorization=i.default.load(d)),"3007"===window.location.port){var t=sessionStorage.taskToken;-1===e.url.indexOf("?")?e.url=e.url+"?token="+t:e.url=e.url+"&token="+t}return e}),(function(e){console.log(e)})),f.interceptors.response.use((function(e){var t=e||{};return 400===t.status?(r.default.error(t.data.message||"操作失败"),Promise.reject("error")):401===t.status?(r.default.error(t.data.message||"登录信息已过期"),Promise.reject("error")):403===t.status?(r.default.error(t.data.message||"无权限!"),Promise.reject("error")):40001===t.status?(n.default.open({message:"提示",description:"账户或密码错误!"}),Promise.reject("error")):200===e.status||200===t.status?e.data:void n.default.open({message:"提示",description:t.message})}),(function(e){console.log(e);var t=e.response||{};return 400===t.status?(r.default.error(t.data.message||"操作失败"),Promise.reject("error")):401===t.status?(r.default.error(t.data.message||"登录信息已过期"),(0,o.default)(),Promise.reject("error")):403===t.status?(r.default.error(t.data.message||"无权限!"),Promise.reject("error")):(n.default.open({message:"提示",description:e.message}),Promise.reject(e))})),t.default=f},FRFo:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(a("3S7+")),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 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");var l=a("q1tI"),i=o(l);function o(e){return e&&e.__esModule?e:{default:e}}function u(e){var t=e.beforeText,a=e.afterText,o=e.className,u=e.inputId,c=e.timeOut,s=(0,l.useState)((function(){return t})),d=r(s,2),f=d[0],m=d[1],p=(0,l.useCallback)((function(){var e=document.querySelector("#"+u);e?(e.select(),document.execCommand("copy")&&document.execCommand("copy"),document.getSelection().removeAllRanges(),m(a),c&&setTimeout((function(){m(t)}),1500)):console.error("您的CopyTool未设置正确的inputId")}),[]);return i.default.createElement(n.default,{placement:"top",title:f,onVisibleChange:function(){m(t)}},i.default.createElement("i",{className:"iconfont icon-fuzhiicon "+o,style:{color:"#466aff"},onClick:p}))}u.defaultProps={beforeText:"复制链接",afterText:"复制成功",className:"",inputId:"copyText",timeOut:!0},t.default=(0,l.memo)(u)},G99X:function(e,t,a){},H5Q0:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=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")};t.default=function(e){var t=document.createElement("div");function a(){i.unmountComponentAtNode(t)&&t.parentNode&&t.parentNode.removeChild(t)}document.body.appendChild(t),setTimeout((function(){i.render(l.default.createElement(c,{afterClose:a}),t)}))};var r=a("q1tI"),l=u(r),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(a("i8i4")),o=u(a("CWZq"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){var t=e.afterClose,a=(0,r.useState)(!0),i=n(a,2),u=i[0],c=i[1];return l.default.createElement(o.default,{isRender:u,Modifyloginvalue:function(){c(!1),t()}})}},dINp:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=T(a("W9HT")),r=T(a("jsC+")),l=T(a("8z0m")),i=T(a("3S7+")),o=T(a("2/Rp")),u=T(a("CtXQ")),c=T(a("BvKs")),s=T(a("tsqr")),d=T(a("2fM7")),f=T(a("5rEg")),m=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},p=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("aIZi"),a("7W5+"),a("TfFZ"),a("L/Qf"),a("2oDE"),a("2WkQ"),a("8/o9"),a("8QGh"),a("1vPl");var v=a("q1tI"),h=T(v),y=a("sYIF"),k=T(a("Po8q")),w=T(a("FRFo")),E=T(a("zBD+")),g=T(a("v5ho")),N=a("j/6D"),b=a("E+/Y");a("j29u");var _=a("LvDl");function T(e){return e&&e.__esModule?e:{default:e}}var C=f.default.Search,j=f.default.Group,S=d.default.Option;t.default=function(e){var t=e.match,a=e.history,T=e.showNotification,P=e.project,O=e.projectDetail,x=O&&O.permission&&"Reporter"!==O.permission,I=t.params.projectsId,M=t.params.owner,W=(0,v.useState)(null),q=p(W,2),A=q[0],R=q[1],L=(0,v.useState)({}),U=p(L,2),H=U[0],D=U[1],F=(0,v.useState)({}),Q=p(F,2),z=Q[0],K=Q[1],G=(0,v.useState)([]),B=p(G,2),X=B[0],Y=B[1],Z=(0,v.useState)(),J=p(Z,2),V=J[0],$=J[1],ee=(0,v.useState)("HTTPS"),te=p(ee,2),ae=te[0],ne=te[1];(0,v.useEffect)((function(){P&&(0,N.wikiPages)({owner:M,repo:I,projectId:P.id}).then((function(e){e&&"200"===e.message&&(0,_.isArray)(e.data)?(Y(e.data),R(e.data),e.data.length&&D(e.data[0])):(Y([]),R([]))}))}),[P,V]),(0,v.useEffect)((function(){P&&H.name&&(0,N.getWiki)({owner:M,repo:I,pagename:H.name,projectId:P.id}).then((function(e){e&&"200"===e.message?K(e.data):T("加载失败")}))}),[P,H]);var re=h.default.createElement(c.default,null,h.default.createElement(c.default.Item,{key:"1",onClick:function(){le("markdown")}},"Markdown"),h.default.createElement(c.default.Item,{key:"2",onClick:function(){le("html")}},"HTML"),h.default.createElement(c.default.Item,{key:"3",onClick:function(){le("pdf")}},"PDF"));function le(e){window.open(b.httpUrl+"/api/wikiExport/wikiExport-wrapper?repoName="+I+"&owner="+M+"&type="+e+"&projectName="+P.name+"&projectId="+P.id)}var ie={name:"multipartFile",withCredentials:!0,action:b.httpUrl+"/api/wikiExport/uploadWiki/"+M+"/"+I+"/"+(P&&P.id),showUploadList:!1,headers:{Authorization:k.default.load(b.TokenKey)||sessionStorage.taskToken},beforeUpload:function(e){if(!["md","txt"].includes(e.name.split(".").pop()))return s.default.error("只能上传md、txt文件"),!1;if(!/[\[\]`\/:*?''<>|%-+_]/g.test(e.name)){var t=!0,a=!1,n=void 0;try{for(var r,l=A[Symbol.iterator]();!(t=(r=l.next()).done);t=!0){if(r.value.name===e.name)return s.default.error("不能上传与已有文件相同文件名的文件"),!1}}catch(e){a=!0,n=e}finally{try{!t&&l.return&&l.return()}finally{if(a)throw n}}var i=e.size/1024/1024<100;return i||T("文件大小必须小于100MB!"),i}s.default.error("文件名不能有特殊字符")},onChange:function(e){if("uploading"===e.file.status&&console.log(e.file,e.fileList),"done"===e.file.status)if("200"===e.file.response.message)s.default.success(e.file.name+" 上传成功"),$(Math.random());else if("500"===e.file.response.message){var t=JSON.parse(e.file.response.data);s.default.error(t&&t.message?t.message:"文件上传失败")}else s.default.error("文件上传失败");else"error"===e.file.status&&s.default.error(e.file.name+" 上传失败")}};return h.default.createElement(n.default,{spinning:!A,className:"opacitySpin"},A&&A.length?h.default.createElement("div",{className:"wiki-main"},h.default.createElement("div",{className:"wiki-head"},h.default.createElement("span",{className:"head-title"},x?h.default.createElement(o.default,{type:"default",onClick:function(){a.push("/"+M+"/"+I+"/wiki/add")}},h.default.createElement(u.default,{type:"plus"}),"新增页面"):"Wiki文档"),h.default.createElement("div",null,x&&h.default.createElement(l.default,ie,h.default.createElement(i.default,{placement:"top",title:"支持导入txt、markdown格式文件"},h.default.createElement(o.default,{type:"default",className:"ml10"},h.default.createElement(u.default,{type:"plus"}),"导入模板"))),h.default.createElement(r.default,{overlay:re},h.default.createElement(o.default,{type:"default",className:"ml10"},"导出",h.default.createElement(u.default,{type:"caret-down"}))),h.default.createElement(o.default,{type:"default",className:"ml10",onClick:function(){window.open("/"+M+"/"+I+"/wiki/preview/"+encodeURI(P.name)+"/"+P.id)}},"预览"))),h.default.createElement("div",{className:"wiki-body"},h.default.createElement("div",{className:"wiki-nav-parent"},h.default.createElement("div",{className:"wiki-nav"},h.default.createElement(C,{placeholder:"输入关键字搜索文件",className:"wiki-search",onChange:function(e){var t=e.target.value,a=[],n=!0,r=!1,l=void 0;try{for(var i,o=A[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){var u=i.value;u.name.indexOf(t)>-1&&a.push(u)}}catch(e){r=!0,l=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw l}}Y(a)}}),X.map((function(e){return h.default.createElement("div",{className:"wiki-nav-title-parent",key:e.name},h.default.createElement("div",{className:"wiki-nav-title "+(e.name===H.name?"active":""),onClick:function(){D(e)}},h.default.createElement("div",{className:"nav-title-left"},h.default.createElement("i",{className:"iconfont icon-wenjianjia2 mr3"}),h.default.createElement("span",{className:"nav-title-left-text"},e.name)),x&&h.default.createElement("i",{className:"iconfont icon-shanchuicon1 delete-title-icon color-grey-6",onClick:function(t){!function(e,t){e.stopPropagation(),(0,E.default)({title:"删除页面",contentTitle:"您确定要删除“"+t.name+"”此页面吗?",content:"此操作将删除该页面,请进行确认以防文件的丢失",onOk:function(){(0,N.deleteWiki)({owner:M,repo:I,pagename:t.name,projectId:P.id}).then((function(e){e&&"200"===e.message?(s.default.success("删除成功"),$(Math.random())):s.default.error("删除失败")}))}})}(t,e)}})))}))),H.wiki_clone_link&&h.default.createElement(j,{className:"copy-url",compact:!0},h.default.createElement(d.default,{dropdownClassName:"wiki-url-type",defaultValue:"HTTPS",onChange:function(e){ne(e)}},h.default.createElement(S,{value:"HTTPS"},"HTTPS"),h.default.createElement(S,{value:"SSH"},"SSH")),h.default.createElement(f.default,{id:"wikiUrl",value:"HTTPS"===ae?H.wiki_clone_link.https:H.wiki_clone_link.ssh}),h.default.createElement(w.default,{className:"copy-wiki",inputId:"wikiUrl"}))),h.default.createElement("div",{className:"wiki-content"},h.default.createElement("div",{className:"wiki-content-head"},h.default.createElement("div",{className:"wiki-content-head-left"},h.default.createElement("h3",{className:"wiki-detail-title"},H.name),h.default.createElement("span",{className:"user-box mr10",onClick:function(){var e;H.commit&&(e=H.commit.author.name,window.location.href="/"+e)}},z.image_url&&h.default.createElement("img",{alt:"头像",className:"head-log-small",src:(0,y.getImageUrl)("/"+z.image_url)}),h.default.createElement("span",null,z.userName)),h.default.createElement("span",{className:"time-ago"},"上次修改于",H.commit?(0,y.timeAgo)(H.commit.author.when):"刚刚")),x&&h.default.createElement(o.default,{type:"primary",onClick:function(){a.push("/"+M+"/"+I+"/wiki/edit/"+encodeURI(H.name))}},"编辑")),h.default.createElement("div",{className:"wiki-content-detail editor-content-panel markdown-body",dangerouslySetInnerHTML:{__html:z&&z.simple_content}})))):h.default.createElement(g.default,m({},e,{reloadList:$})))}},"j/6D":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wikiPages=function(e){return(0,l.default)({url:"/api/wiki/wikiPages",method:"get",params:e})},t.getWiki=function(e){return(0,l.default)({url:"/api/wiki/getWiki",method:"get",params:e})},t.addWiki=function(e){return(0,l.default)({url:"/api/wiki/createWiki",method:"post",data:e})},t.updateWiki=function(e){return(0,l.default)({url:"/api/wiki/updateWiki",method:"PUT",data:e})},t.deleteWiki=function(e){return(0,l.default)({url:"/api/wiki/deleteWiki",method:"DELETE",data:e})};var n,r=a("E+/Y"),l=(n=r)&&n.__esModule?n:{default:n}},j29u:function(e,t,a){},qqRK:function(e,t,a){},v5ho:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(a("2/Rp"));a("L/Qf");var r=l(a("q1tI"));function l(e){return e&&e.__esModule?e:{default:e}}a("qqRK"),t.default=function(e){var t=e.project,a=e.isManager,l=e.history,i=(e.showNotification,e.match),o=(e.reloadList,i.params.projectsId),u=i.params.owner;return r.default.createElement("div",{className:"welcome-main"},r.default.createElement("i",{className:"iconfont icon-huanying_icon"}),r.default.createElement("p",{className:"welcome-title"},"欢迎使用 ",r.default.createElement("span",{className:"wiki-title"},t&&t.name)," Wiki"),r.default.createElement("p",{className:"welcome-content"},"Wiki主要是您项目的产品设计、文档描述、注释等等"),r.default.createElement("div",{className:"wiki-line"}),a?r.default.createElement(n.default,{type:"primary",onClick:function(){l.push("/"+u+"/"+o+"/wiki/add")}},"创建Wiki文档"):r.default.createElement("p",{className:"welcome-des"},"该项目暂时没有创建Wiki"))}},"zBD+":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=s(a("kLXV")),r=s(a("2/Rp")),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")},i=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};t.default=function(e){d(i({},e,{type:"delete"}))},t.Confirm=function(e){d(i({},e,{type:"confirm"}))},a("k3Gp"),a("L/Qf");var o=a("q1tI"),u=s(o),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(a("i8i4"));function s(e){return e&&e.__esModule?e:{default:e}}function d(e){var t=e.type,a=e.afterClose,n=document.createElement("div");function r(){a&&a(),c.unmountComponentAtNode(n)&&n.parentNode&&n.parentNode.removeChild(n)}document.body.appendChild(n),setTimeout((function(){c.render(function(t){return"delete"===t?u.default.createElement(f,i({title:"删除",contentTitle:"确定要删除吗?",okText:"确认删除"},e,{afterClose:r,contentTitle:u.default.createElement(u.default.Fragment,null,u.default.createElement("i",{className:"red-circle iconfont icon-shanchu_tc_icon mr3"}),e.contentTitle)})):u.default.createElement(f,i({title:"选择",afterClose:r},e))}(t),n)}))}function f(e){var t=e.onCancel,a=e.onOk,i=e.title,c=e.contentTitle,s=e.content,d=e.okText,f=e.cancelText,m=e.afterClose,p=e.className,v=(0,o.useState)(!0),h=l(v,2),y=h[0],k=h[1];function w(){k(!1),t&&t()}return u.default.createElement(n.default,{visible:y,onCancel:w,afterClose:m,title:i,className:"myself-modal "+p,centered:!0,footer:[u.default.createElement(r.default,{type:"default",key:"back",onClick:w},f),u.default.createElement(r.default,{className:"foot-submit",key:"submit",onClick:function(){k(!1),a&&a()}},d)]},u.default.createElement("div",null,c&&u.default.createElement("p",{className:"content-title"},c),u.default.createElement("p",{className:"content-descibe"},s)))}a("G99X"),f.defaultProps={okText:"确认",cancelText:"取消",className:"",inputId:"copyText"}}}]); |