UNPKG

@topgroup/diginext

Version:

A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.

1 lines 8.41 kB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[979],{13923:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(1413),o=n(67294),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"}}]},name:"history",theme:"outlined"},i=n(91146),a=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:c}))})},36545:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return cronjob}});var r,o=n(22598),c=n(59499),i=n(50029),a=n(16835),s=n(87794),l=n.n(s),u=n(1413),d=n(67294),f={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 112c17.7 0 32 14.3 32 32v736c0 17.7-14.3 32-32 32H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32zm-40 72H184v656h656V184zM640.01 338.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-square",theme:"outlined"},p=n(91146),h=d.forwardRef(function(e,t){return d.createElement(p.Z,(0,u.Z)((0,u.Z)({},e),{},{ref:t,icon:f}))}),j=n(13923),x=n(48689),b=n(84213),m=n(73318),v=n(66309),g=n(83062),w=n(71230),y=n(15746),Z=n(71471),k=n(26855),_=n(78957),C=n(86738),O=n(44973),P=n(27484),S=n.n(P),N=n(11778),T=n(61123),z=n(90447),A=n(56832),E=n(3669),L=n(55611),I=n(85893);function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){(0,c.Z)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var R=n(56176),V=n(84110);S().extend(V),S().extend(R);var q=null!==(r=L.XL.tableConfig.defaultPageSize)&&void 0!==r?r:20,CronjobList=function(){var e,t,n=(0,E.Jl)().responsive,r=(0,d.useState)(1),o=r[0],c=r[1],s=(0,N.wz)(["cronjobs","list"],"/api/v1/cronjob",{populate:"owner",pagination:{page:o,size:q}}),u=s.data,f=s.status,p=u||{},P=p.list,L=(p.pagination||{}).total_items;console.log("[CRONJOB] list :>> ",P);var R=(0,N.TV)(["cronjobs"],"/api/v1/cronjob"),V=(0,a.Z)(R,1)[0],F=(0,N.TV)(["cronjobs"],"/api/v1/cronjob/cancel",void 0),D=(0,a.Z)(F,1)[0],H=(0,A.o)(),B=(0,a.Z)(H,2),K=(B[0],B[1].setQuery),M=[{title:"Name",width:50,dataIndex:"name",key:"name",render:function(e,t){return(0,I.jsx)(m.ZP,{type:"link",onClick:function(){return K({lv1:"edit",type:"cronjob",cronjob:t.slug})},style:{overflowWrap:"break-word",whiteSpace:"pre-wrap",textAlign:"left"},children:e})},fixed:null!=n&&n.md?"left":void 0,filterSearch:!0,filters:[{text:"goon",value:"goon"}],onFilter:function(e,t){return!t.name||t.name.indexOf(e.toString())>-1}},{title:"Type",dataIndex:"type",key:"type",width:20,render:function(e,t){return t.repeat&&t.repeat.range?(0,I.jsx)(v.Z,{color:"blue",children:"recurrent"}):(0,I.jsx)(v.Z,{color:"green",children:"once"})}},{title:"Repeat",dataIndex:"repeat",key:"repeat",width:30,render:function(e,t){return t.repeat&&t.repeat.range?(0,I.jsx)(g.Z,{overlay:(0,I.jsxs)(I.Fragment,{children:["Next run at: ",S()(t.nextRunAt).format("llll")]}),children:(0,I.jsxs)(v.Z,{children:["Every ",t.repeat.range," ",t.repeat.unit]})}):(0,I.jsx)(I.Fragment,{children:"-"})}},{title:"Status",dataIndex:"status",key:"status",width:20,render:function(e,t){return t.nextRunAt?(0,I.jsx)(v.Z,{color:"processing",children:"waiting"}):t.active?(0,I.jsx)(v.Z,{color:"success",children:"finished"}):(0,I.jsx)(v.Z,{color:"error",children:"cancelled"})}},{title:"HTTP Request",dataIndex:"request",key:"request",width:44,render:function(e,t){return(0,I.jsxs)(w.Z,{children:[(0,I.jsx)(y.Z,{children:(0,I.jsx)(v.Z,{children:null==t?void 0:t.method})}),(0,I.jsx)(y.Z,{span:16,children:(0,I.jsx)(Z.Z.Text,{ellipsis:!0,children:null==t?void 0:t.url})})]})}},{title:"Created by",dataIndex:"owner",key:"owner",width:30,render:function(e,t){return(0,I.jsx)(I.Fragment,{children:null==t?void 0:t.owner.name})}},{title:"Created at",dataIndex:"createdAt",key:"createdAt",width:25,render:function(e){return(0,I.jsx)(T.q,{date:e})},sorter:function(e,t){return S()(e.createdAt).diff(S()(t.createdAt))}},{title:(0,I.jsx)(Z.Z.Text,{className:"text-xs md:text-sm",children:"Action"}),key:"action",fixed:"right",width:null!=n&&n.md?30:26,render:function(e,t){return t.actions}}],W=(e=(0,i.Z)(l().mark(function _callee(e){var t;return l().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return e||k.ZP.error({message:"Unable to cancel this job."}),n.next=3,D({_id:e});case 3:null!=(t=n.sent)&&t.status&&k.ZP.success({message:"Cronjob has been cancelled successfully."});case 5:case"end":return n.stop()}},_callee)})),function(t){return e.apply(this,arguments)}),X=(t=(0,i.Z)(l().mark(function _callee2(e){var t;return l().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return e||k.ZP.error({message:"Unable to cancel this job."}),n.next=3,V({_id:e});case 3:null!=(t=n.sent)&&t.status&&k.ZP.success({message:"Item deleted successfully."});case 5:case"end":return n.stop()}},_callee2)})),function(e){return t.apply(this,arguments)}),J=(null==P?void 0:P.map(function(e,t){return _objectSpread(_objectSpread({},e),{},{actions:(0,I.jsxs)(_.Z.Compact,{children:[(0,I.jsx)(g.Z,{overlay:"Cancel cronjob",children:(0,I.jsx)(m.ZP,{icon:(0,I.jsx)(h,{}),onClick:function(){return W(null==e?void 0:e._id)}})}),(0,I.jsx)(g.Z,{overlay:"View history",children:(0,I.jsx)(m.ZP,{icon:(0,I.jsx)(j.Z,{}),onClick:function(){return k.ZP.warning({message:"This feature is under development."})}})}),(0,I.jsx)(C.Z,{title:"Are you sure to delete this item?",description:(0,I.jsx)("span",{className:"text-red-500",children:"Caution: this is permanent and cannot be rolled back."}),onConfirm:function(){return X(e._id)},okText:"Yes",cancelText:"No",children:(0,I.jsx)(m.ZP,{icon:(0,I.jsx)(x.Z,{})})})]})})}))||[],U=(0,d.useRef)(null),Q=(0,b.Z)(U);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(z.V,{title:"Cronjobs (".concat(null!=L?L:"-",")"),breadcrumbs:[{name:"Workspace"}],actions:[]}),(0,I.jsx)("div",{className:"h-full flex-auto overflow-hidden",ref:U,children:(0,I.jsx)(O.Z,{sticky:!0,size:"small",loading:"loading"===f,columns:M,dataSource:J,scroll:{x:1e3,y:void 0!==(null==Q?void 0:Q.height)?Q.height-140:void 0},pagination:{pageSize:q,total:L,position:["bottomCenter"]},onChange:function(e){var t=e.current;t&&c(t)}})})]})},F=n(6761),D=n(1071),cronjob=function(){return(0,I.jsx)(o.Wk,{children:(0,I.jsx)(F.o,{meta:(0,I.jsx)(D.h,{title:"Cronjobs",description:"List of cronjobs."}),children:(0,I.jsx)(CronjobList,{})})})}},13657:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cronjob",function(){return n(36545)}])}},function(e){e.O(0,[3662,5877,3945,9774,2888,179],function(){return e(e.s=13657)}),_N_E=e.O()}]);