@tachybase/module-backup 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/components/BackupProgressCell.d.ts +36 -0
- package/dist/client/hooks/useBackupProgress.d.ts +53 -0
- package/dist/client/hooks/useDownloadProgress.d.ts +40 -0
- package/dist/client/index.js +3 -3
- package/dist/externalVersion.js +3 -3
- package/dist/locale/en-US.json +7 -0
- package/dist/locale/ja-JP.d.ts +6 -0
- package/dist/locale/ja-JP.js +6 -0
- package/dist/locale/ko_KR.json +6 -0
- package/dist/locale/pt-BR.d.ts +6 -0
- package/dist/locale/pt-BR.js +6 -0
- package/dist/locale/zh-CN.json +7 -0
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/semver/package.json +1 -1
- package/dist/node_modules/yauzl/package.json +1 -1
- package/dist/server/dumper.d.ts +9 -3
- package/dist/server/dumper.js +78 -15
- package/dist/server/progress-tracker.d.ts +76 -0
- package/dist/server/progress-tracker.js +286 -0
- package/dist/server/resourcers/backup-files.js +9 -6
- package/dist/server/server.d.ts +1 -0
- package/dist/server/server.js +49 -1
- package/package.json +7 -7
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BackupProgressCellProps {
|
|
3
|
+
/**
|
|
4
|
+
* 是否正在备份
|
|
5
|
+
*/
|
|
6
|
+
inProgress?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* 状态:'in_progress' | 'ok' | 'error'
|
|
9
|
+
*/
|
|
10
|
+
status?: 'in_progress' | 'ok' | 'error';
|
|
11
|
+
/**
|
|
12
|
+
* 进度百分比 (0-100)
|
|
13
|
+
*/
|
|
14
|
+
progress?: number;
|
|
15
|
+
/**
|
|
16
|
+
* 当前步骤文本
|
|
17
|
+
*/
|
|
18
|
+
currentStep?: string;
|
|
19
|
+
/**
|
|
20
|
+
* 下载进度百分比 (0-100),如果提供则优先显示下载进度
|
|
21
|
+
*/
|
|
22
|
+
downloadProgress?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 是否显示下载进度文本
|
|
25
|
+
*/
|
|
26
|
+
showDownloadText?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 进度条宽度
|
|
29
|
+
*/
|
|
30
|
+
width?: number | string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 备份进度单元格组件
|
|
34
|
+
* 用于在表格中显示备份文件的进度状态
|
|
35
|
+
*/
|
|
36
|
+
export declare const BackupProgressCell: React.FC<BackupProgressCellProps>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface BackupProgressUpdate {
|
|
2
|
+
fileName: string;
|
|
3
|
+
progress: {
|
|
4
|
+
percent: number;
|
|
5
|
+
currentStep: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface UseBackupProgressOptions {
|
|
9
|
+
/**
|
|
10
|
+
* 数据源,用于查找和更新对应文件的进度
|
|
11
|
+
*/
|
|
12
|
+
dataSource: any[];
|
|
13
|
+
/**
|
|
14
|
+
* 更新数据源的回调函数
|
|
15
|
+
*/
|
|
16
|
+
onDataSourceUpdate: (updater: (prev: any[]) => any[]) => void;
|
|
17
|
+
/**
|
|
18
|
+
* 当进度达到 100% 时的回调
|
|
19
|
+
*/
|
|
20
|
+
onComplete?: (fileName: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* WebSocket 消息类型,默认为 'backup:progress'
|
|
23
|
+
*/
|
|
24
|
+
messageType?: string;
|
|
25
|
+
/**
|
|
26
|
+
* 超时时间(毫秒),如果备份任务长时间没有收到进度更新,将被标记为失败
|
|
27
|
+
* 默认为 5 分钟 (300000 毫秒)
|
|
28
|
+
*/
|
|
29
|
+
timeout?: number;
|
|
30
|
+
/**
|
|
31
|
+
* 超时回调,当备份任务超时时调用
|
|
32
|
+
*/
|
|
33
|
+
onTimeout?: (fileName: string) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Hook:监听 WebSocket 消息,自动更新备份进度
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* const [dataSource, setDataSource] = useState([]);
|
|
41
|
+
*
|
|
42
|
+
* useBackupProgress({
|
|
43
|
+
* dataSource,
|
|
44
|
+
* onDataSourceUpdate: setDataSource,
|
|
45
|
+
* onComplete: (fileName) => {
|
|
46
|
+
* console.log('Backup completed:', fileName);
|
|
47
|
+
* refreshList();
|
|
48
|
+
* },
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function useBackupProgress({ dataSource, onDataSourceUpdate, onComplete, messageType, timeout, // 默认 5 分钟
|
|
53
|
+
onTimeout, }: UseBackupProgressOptions): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface UseDownloadProgressOptions {
|
|
2
|
+
/**
|
|
3
|
+
* 下载完成后的回调
|
|
4
|
+
*/
|
|
5
|
+
onDownloadComplete?: (fileName: string, blob: Blob) => void;
|
|
6
|
+
/**
|
|
7
|
+
* 下载失败的回调
|
|
8
|
+
*/
|
|
9
|
+
onDownloadError?: (fileName: string, error: Error) => void;
|
|
10
|
+
/**
|
|
11
|
+
* 下载开始时的回调(用于显示弹窗等)
|
|
12
|
+
*/
|
|
13
|
+
onDownloadStart?: (fileName: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface DownloadProgressState {
|
|
16
|
+
[fileName: string]: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Hook:管理文件下载进度
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { downloadProgress, handleDownload, clearDownloadProgress } = useDownloadProgress({
|
|
24
|
+
* onDownloadComplete: (fileName, blob) => {
|
|
25
|
+
* saveAs(blob, fileName);
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // 在表格列中使用
|
|
30
|
+
* <BackupProgressCell downloadProgress={downloadProgress[record.name]} />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useDownloadProgress(options?: UseDownloadProgressOptions): {
|
|
34
|
+
downloadProgress: DownloadProgressState;
|
|
35
|
+
handleDownload: (fileData: {
|
|
36
|
+
name: string;
|
|
37
|
+
downloadUrl?: string;
|
|
38
|
+
}) => Promise<void>;
|
|
39
|
+
clearDownloadProgress: (fileName?: string) => void;
|
|
40
|
+
};
|
package/dist/client/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(T,k){typeof exports=="object"&&typeof module!="undefined"?k(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("@tego/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","@tego/client","@ant-design/icons","antd","react-i18next"],k):(T=typeof globalThis!="undefined"?globalThis:T||self,k(T["@tachybase/module-backup"]={},T["@tachybase/client"],T.jsxRuntime,T.react,T["@tego/client"],T["@ant-design/icons"],T.antd,T["react-i18next"]))})(this,function(T,k,n,f,me,Q,w,ie){"use strict";var Zo=Object.defineProperty,_o=Object.defineProperties;var Go=Object.getOwnPropertyDescriptors;var po=Object.getOwnPropertySymbols;var $o=Object.prototype.hasOwnProperty,Yo=Object.prototype.propertyIsEnumerable;var mo=(T,k,n)=>k in T?Zo(T,k,{enumerable:!0,configurable:!0,writable:!0,value:n}):T[k]=n,ae=(T,k)=>{for(var n in k||(k={}))$o.call(k,n)&&mo(T,n,k[n]);if(po)for(var n of po(k))Yo.call(k,n)&&mo(T,n,k[n]);return T},De=(T,k)=>_o(T,Go(k));var K=(T,k,n)=>new Promise((f,me)=>{var Q=J=>{try{ie(n.next(J))}catch(R){me(R)}},w=J=>{try{ie(n.throw(J))}catch(R){me(R)}},ie=J=>J.done?f(J.value):Promise.resolve(J.value).then(Q,w);ie((n=n.apply(T,k)).next())});var J=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},R={exports:{}},fo=R.exports,Te;function yo(){return Te||(Te=1,function(e,t){(function(i,o){o()})(fo,function(){function i(a,c){return typeof c=="undefined"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function o(a,c,v){var u=new XMLHttpRequest;u.open("GET",a),u.responseType="blob",u.onload=function(){d(u.response,c,v)},u.onerror=function(){console.error("could not download file")},u.send()}function r(a){var c=new XMLHttpRequest;c.open("HEAD",a,!1);try{c.send()}catch(v){}return 200<=c.status&&299>=c.status}function l(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(v){var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(c)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof J=="object"&&J.global===J?J:void 0,m=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),d=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(a,c,v){var u=s.URL||s.webkitURL,y=document.createElement("a");c=c||a.name||"download",y.download=c,y.rel="noopener",typeof a=="string"?(y.href=a,y.origin===location.origin?l(y):r(y.href)?o(a,c,v):l(y,y.target="_blank")):(y.href=u.createObjectURL(a),setTimeout(function(){u.revokeObjectURL(y.href)},4e4),setTimeout(function(){l(y)},0))}:"msSaveOrOpenBlob"in navigator?function(a,c,v){if(c=c||a.name||"download",typeof a!="string")navigator.msSaveOrOpenBlob(i(a,v),c);else if(r(a))o(a,c,v);else{var u=document.createElement("a");u.href=a,u.target="_blank",setTimeout(function(){l(u)})}}:function(a,c,v,u){if(u=u||open("","_blank"),u&&(u.document.title=u.document.body.innerText="downloading..."),typeof a=="string")return o(a,c,v);var y=a.type==="application/octet-stream",h=/constructor/i.test(s.HTMLElement)||s.safari,p=/CriOS\/[\d]+/.test(navigator.userAgent);if((p||y&&h||m)&&typeof FileReader!="undefined"){var b=new FileReader;b.onloadend=function(){var M=b.result;M=p?M:M.replace(/^data:[^;]*;/,"data:attachment/file;"),u?u.location.href=M:location=M,u=null},b.readAsDataURL(a)}else{var L=s.URL||s.webkitURL,S=L.createObjectURL(a);u?u.location=S:location.href=S,u=null,setTimeout(function(){L.revokeObjectURL(S)},4e4)}});s.saveAs=d.saveAs=d,e.exports=d})}(R)),R.exports}var ho=yo();const le="backup";function ee(){return ie.useTranslation([le,"core"],{nsMode:"fallback"})}const vo=e=>k.tval(e,{ns:le}),{Dragger:bo}=w.Upload;function xo(e){const t=o=>{var r;(r=e.onChange)==null||r.call(e,o)},i=k.useAPIClient();return De(ae({},e),{customRequest({action:o,data:r,file:l,filename:s,headers:m,onError:d,onProgress:a,onSuccess:c,withCredentials:v}){const u=new FormData;return r&&Object.keys(r).forEach(y=>{u.append(y,r[y])}),u.append(s,l),i.axios.post(o,u,{withCredentials:v,headers:m,onUploadProgress:({total:y,loaded:h})=>{a({percent:Math.round(h/y*100).toFixed(2)},l)}}).then(({data:y})=>{c(y,l)}).catch(d).finally(()=>{}),{abort(){console.log("upload progress is aborted.")}}},onChange:t})}const Fe=e=>{const{collectionsData:t}=e,{t:i}=ee(),[o,r]=f.useState(!1),[l,s]=f.useState(t);f.useEffect(()=>{s(t)},[t]);const m=k.useAPIClient(),d=k.useCompile(),a=f.useMemo(()=>m.resource("backupFiles"),[m]),c=()=>K(null,null,function*(){if(e.isBackup){const p=yield a.dumpableCollections();s(p==null?void 0:p.data),r(!0)}r(!0)}),v=()=>{r(!1)},u=()=>{r(!1)},y=[{title:i("Collection"),dataIndex:"collection",key:"collection",render:(p,b)=>{const L=d(b.title);return b.name===L?L:n.jsxs("div",{children:[b.name," ",n.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.3)",fontSize:"0.9em"},children:["(",d(b.title),")"]})]})}},{title:i("Origin"),dataIndex:"origin",key:"origin",width:"50%"}],h=Object.keys(l||{}).map(p=>({key:p,label:i(`${p}.title`),children:n.jsxs(n.Fragment,{children:[n.jsx(w.Alert,{style:{marginBottom:16},message:i(`${p}.description`)}),n.jsx(w.Table,{pagination:{pageSize:100},bordered:!0,size:"small",dataSource:l[p],columns:y,scroll:{y:400}})]})}));return n.jsxs(n.Fragment,{children:[n.jsx("a",{onClick:c,children:i("Learn more")}),n.jsx(w.Modal,{title:i("Backup instructions"),width:"80vw",open:o,footer:null,onOk:v,onCancel:u,children:n.jsx(w.Tabs,{defaultActiveKey:"required",items:h})})]})},Pe=({ButtonComponent:e=w.Button,title:t,upload:i=!1,fileData:o})=>{const{t:r}=ee(),[l,s]=f.useState(["required"]),[m,d]=f.useState(!1),[a,c]=f.useState(null),[v,u]=f.useState(!1),y=k.useAPIClient(),h=f.useMemo(()=>y.resource("backupFiles"),[y]),[p,b]=f.useState([]),L=l.length>0&&l.length<p.length,S=p.length===l.length;f.useEffect(()=>{b(Object.keys((a==null?void 0:a.dumpableCollectionsGroupByGroup)||[]).map(x=>({value:x,label:r(`${x}.title`),disabled:["required","skipped"].includes(x)})))},[a]);const M=()=>K(null,null,function*(){var x,N,j;if(d(!0),!i){u(!0);const{data:V}=yield h.get({filterByTk:o.name});b(Object.keys(((N=(x=V==null?void 0:V.data)==null?void 0:x.meta)==null?void 0:N.dumpableCollectionsGroupByGroup)||[]).map(F=>({value:F,label:r(`${F}.title`),disabled:["required","skipped"].includes(F)}))),c((j=V==null?void 0:V.data)==null?void 0:j.meta),u(!1)}}),_=()=>{h.restore({values:{dataTypes:l,filterByTk:o==null?void 0:o.name,key:a==null?void 0:a.key}}),d(!1)},D=()=>{d(!1),c(null),s(["required"])},A=x=>{s(x.target.checked?p.map(N=>N.value):["required"])};return n.jsxs(n.Fragment,{children:[n.jsx(e,{onClick:M,children:t}),n.jsx(w.Modal,{title:r("Restore"),width:800,footer:i&&!a?null:void 0,open:m,onOk:_,onCancel:D,children:n.jsxs(w.Spin,{spinning:v,children:[i&&!a&&n.jsx(ko,{setRestoreData:c}),(!i||a)&&[n.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[r("Select the data to be restored")," (",n.jsx(Fe,{collectionsData:a==null?void 0:a.dumpableCollectionsGroupByGroup}),"):"]},"info"),n.jsx("div",{style:{lineHeight:2,marginBottom:8},children:n.jsxs(me.FormItem,{children:[n.jsx(k.Checkbox.Group,{options:p,style:{flexDirection:"column"},value:l,onChange:x=>s(x)}),n.jsx(w.Divider,{}),n.jsx(k.Checkbox,{indeterminate:L,onChange:A,checked:S,children:r("Check all")})]})},"dataType")]]})})]})},go=({ButtonComponent:e=w.Button,refresh:t})=>{const{t:i}=ee(),[o,r]=f.useState(!1),[l,s]=f.useState(["required"]),m=k.useAPIClient(),{notification:d}=w.App.useApp(),[a,c]=f.useState([]),v=["required","user","third-party","custom"],u=l.length>0&&l.length<a.filter(D=>D.value!=="skipped").length,y=a.filter(D=>D.value!=="skipped").length===l.length,h=D=>{s(D.target.checked?a.filter(A=>A.value!=="skipped").map(A=>A.value):["required"])},p=D=>{const A=a.filter(x=>v.includes(x.value)&&x.value!=="skipped").map(x=>x.value);if(D.target.checked){const x=[...new Set([...l.filter(N=>N==="required"),...A])];s(x)}else s(["required"])},b=f.useMemo(()=>{const D=a.filter(N=>v.includes(N.value)&&N.value!=="skipped").map(N=>N.value),A=D.filter(N=>l.includes(N)),x=l.filter(N=>N!=="required"&&!D.includes(N));return D.length>0&&A.length===D.length&&x.length===0},[l,a]),L=f.useMemo(()=>{const D=a.filter(x=>v.includes(x.value)&&x.value!=="skipped").map(x=>x.value),A=D.filter(x=>l.includes(x));return A.length>0&&A.length<D.length},[l,a]),S=()=>K(null,null,function*(){const{data:D}=yield m.resource("backupFiles").dumpableCollections();c(Object.keys(D||[]).map(A=>({value:A,label:i(`${A}.title`),disabled:["required","skipped"].includes(A)}))),r(!0)}),M=D=>{m.request({url:"backupFiles:create",method:"post",data:{dataTypes:l,method:D}}),d.info({key:"backup",message:n.jsxs("span",{children:[i("Processing...")," ",n.jsx(w.Spin,{indicator:n.jsx(Q.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0}),r(!1),s(["required"]),setTimeout(()=>{t()},500)},_=()=>{r(!1),s(["required"])};return n.jsxs(n.Fragment,{children:[n.jsx(e,{icon:n.jsx(Q.PlusOutlined,{}),type:"primary",onClick:S,children:i("New backup")}),n.jsxs(w.Modal,{title:i("New backup"),width:800,open:o,onCancel:_,footer:[n.jsxs(w.Row,{gutter:16,justify:"end",align:"middle",children:[n.jsx(w.Col,{children:n.jsx(w.Button,{onClick:_,children:i("Cancel")},"cancel")}),n.jsx(w.Col,{children:n.jsx(w.Dropdown.Button,{type:"primary",onClick:()=>M("priority"),overlay:n.jsxs(w.Menu,{children:[n.jsx(w.Menu.Item,{onClick:()=>M("main"),children:i("Self backup")},"main"),n.jsx(w.Menu.Item,{onClick:()=>M("worker"),children:i("Worker backup")},"worker")]}),children:i("Backup")},"submit")})]})],children:[n.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[i("Select the data to be backed up")," (",n.jsx(Fe,{isBackup:!0}),"):"]}),n.jsxs("div",{style:{lineHeight:2,marginBottom:8},children:[n.jsx(k.Checkbox.Group,{options:a,style:{flexDirection:"column"},onChange:D=>s(D),value:l}),n.jsx(w.Divider,{}),n.jsxs(w.Space,{children:[n.jsx(k.Checkbox,{indeterminate:L,onChange:p,checked:b,children:i("Check common")}),n.jsx(k.Checkbox,{indeterminate:u,onChange:h,checked:y,children:i("Check all")})]})]})]})]})},ko=e=>{const{t}=ee(),i={multiple:!1,action:"/backupFiles:upload",onChange(o){var l,s,m;o.fileList.length>1&&o.fileList.splice(0,o.fileList.length-1);const{status:r}=o.file;r==="done"?(w.message.success(`${o.file.name} `+t("file uploaded successfully")),e.setRestoreData(De(ae({},(s=(l=o.file.response)==null?void 0:l.data)==null?void 0:s.meta),{key:(m=o.file.response)==null?void 0:m.data.key}))):r==="error"&&w.message.error(`${o.file.name} `+t("file upload failed"))},onDrop(o){console.log("Dropped files",o.dataTransfer.files)}};return n.jsxs(bo,De(ae({},xo(i)),{children:[n.jsx("p",{className:"ant-upload-drag-icon",children:n.jsx(Q.InboxOutlined,{})}),n.jsxs("p",{className:"ant-upload-text",children:[" ",t("Click or drag file to this area to upload")]})]}))},wo=()=>{const{t:e}=ee(),t=k.useAPIClient(),[i,o]=f.useState([]),[r,l]=f.useState(!1),[s,m]=f.useState(!1),{modal:d,notification:a}=w.App.useApp(),c=f.useMemo(()=>t.resource("backupFiles"),[t]),v=f.useCallback(()=>K(null,null,function*(){yield u()}),[]);k.useNoticeSub("backup",p=>{(a[p.level]||a.info)({key:"backup",message:p.msg}),v()}),f.useEffect(()=>{u()},[]);const u=()=>K(null,null,function*(){l(!0);const{data:p}=yield c.list();o(p.data),l(!1)}),y=p=>K(null,null,function*(){m(p.name);const b=yield t.request({url:"backupFiles:download",method:"get",params:{filterByTk:p.name},responseType:"blob",onDownloadProgress:S=>{const M=Math.round(S.loaded*100/S.total);M>=100?a.success({key:"downloadBackup",message:n.jsx("span",{children:e("Downloaded success!")}),duration:1}):a.info({key:"downloadBackup",message:n.jsxs("span",{children:[e("Downloading ")+M+"%"," ",n.jsx(w.Spin,{indicator:n.jsx(Q.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})}});m(!1);const L=new Blob([b.data]);ho.saveAs(L,p.name)}),h=p=>{d.confirm({title:e("Delete record",{ns:"core"}),content:e("Are you sure you want to delete it?",{ns:"core"}),onOk:()=>K(null,null,function*(){yield c.destroy({filterByTk:p.name}),yield u(),w.message.success(e("Deleted successfully"))})})};return n.jsx("div",{children:n.jsxs(w.Card,{bordered:!1,children:[n.jsxs(w.Space,{style:{float:"right",marginBottom:16},children:[n.jsx(w.Button,{onClick:v,icon:n.jsx(Q.ReloadOutlined,{}),children:e("Refresh")}),n.jsx(Pe,{upload:!0,title:n.jsxs(n.Fragment,{children:[n.jsx(Q.UploadOutlined,{})," ",e("Restore backup from local")]})}),n.jsx(go,{refresh:v})]}),n.jsx(w.Table,{dataSource:i,loading:r,columns:[{title:e("Backup file"),dataIndex:"name",width:400,onCell:p=>p.inProgress?{colSpan:4}:{},render:(p,b)=>b.inProgress?n.jsxs("div",{style:{color:"rgba(0, 0, 0, 0.88)"},children:[p,"(",e("Backing up"),"...)"]}):b.status==="error"?n.jsxs("div",{style:{color:"red"},children:[p,"(",e("Error"),")"]}):n.jsx("div",{children:p})},{title:e("File size"),dataIndex:"fileSize",onCell:p=>p.inProgress?{colSpan:0}:{}},{title:e("Created at",{ns:"core"}),dataIndex:"createdAt",onCell:p=>p.inProgress?{colSpan:0}:{},render:p=>n.jsx(k.DatePicker.ReadPretty,{value:p,showTime:!0})},{title:e("Actions",{ns:"core"}),dataIndex:"actions",onCell:p=>p.inProgress?{colSpan:0}:{},render:(p,b)=>n.jsxs(w.Space,{split:n.jsx(w.Divider,{type:"vertical"}),children:[b.status!=="error"&&n.jsx(Pe,{ButtonComponent:"a",title:e("Restore"),fileData:b}),b.status!=="error"&&n.jsx("a",{type:"link",onClick:()=>y(b),children:e("Download")}),n.jsx("a",{onClick:()=>h(b),children:e("Delete")})]})}]})]})})},Co={dumpRules:"required",name:"autoBackup",shared:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0,fields:[{type:"string",name:"title",required:!0,uiSchema:{title:'{{ t("Title") }}',type:"string","x-component":"Input",required:!0}},{type:"boolean",name:"enabled",defaultValue:!1,uiSchema:{title:'{{ t("Enabled") }}',type:"boolean","x-component":"Checkbox",required:!0}},{type:"array",name:"dumpRules",uiSchema:{title:'{{ t("Dump rules") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"repeat",required:!0,uiSchema:{title:'{{t("Repeat mode")}}',type:"string","x-component":"RepeatField"}},{type:"integer",name:"maxNumber",uiSchema:{title:'{{ t("Max number") }}',type:"integer","x-component":"Input",required:!0}}]};var W=function(){return W=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},W.apply(this,arguments)};function je(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}function fe(e,t,i){if(i||arguments.length===2)for(var o,r=0,l=t.length;r<l;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Oo=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],oe=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],C={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function Ee(e,t){for(var i=[],o=e;o<=t;o++)i.push(o);return i}function ye(e){return e.sort(function(t,i){return t-i}),e}function Ie(e){var t=[];return e.forEach(function(i){t.indexOf(i)<0&&t.push(i)}),t}function Z(e){return Object.entries(e).filter(function(t){var i=t[0],o=t[1];return i&&o}).map(function(t){return t[0]}).join(" ")}function Le(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||C.errorInvalidCron})}function he(e){var t=parseInt(e,10),i=Number(e);return t===i?i:NaN}function Ve(e,t,i,o,r,l,s,m,d,a,c,v,u,y){i&&i(void 0),t(!1);var h=!1;if(!e){if(o==="always"||l&&o==="for-default-value")return;h=!0}if(!h){if(m&&(m===!0||m.includes(e))){if(e==="@reboot")return void y("reboot");var p=Oo.find(function(S){return S.name===e});p&&(e=p.value)}try{var b=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var M=S.replace(/\s+/g," ").trim().split(" ");if(M.length===5)return M.map(function(_,D){return function(A,x){if(A==="*"||A==="*/1")return[];var N=ye(Ie(We(function(V,F,G){if(G){V=V.toUpperCase();for(var g=0;g<G.length;g++)V=V.replace(G[g],"".concat(g+F))}return V}(A,x.min,x.alt).split(",").map(function(V){var F,G=V.split("/");if(G.length>2)throw new Error('Invalid value "'.concat(A,' for "').concat(x.type,'"'));var g=G[0],O=G[1];F=g==="*"?Ee(x.min,x.max):function(P,E,q){var H=P.split("-");if(H.length===1){var ce=he(H[0]);if(isNaN(ce))throw new Error('Invalid value "'.concat(E,'" for ').concat(q.type));return[ce]}if(H.length===2){var $=he(H[0]),ne=he(H[1]);if(isNaN($)||isNaN(ne))throw new Error('Invalid value "'.concat(E,'" for ').concat(q.type));if(ne<$)throw new Error('Max range is less than min range in "'.concat(P,'" for ').concat(q.type));return Ee($,ne)}throw new Error('Invalid value "'.concat(P,'" for ').concat(q.type))}(g,A,x);var B=function(P,E){if(P!==void 0){var q=he(P);if(isNaN(q)||q<1)throw new Error('Invalid interval step value "'.concat(P,'" for ').concat(E.type));return q}}(O,x),z=function(P,E){if(E){var q=P[0];P=P.filter(function(H){return H%E==q%E||H===q})}return P}(F,B);return z}).flat(),x))),j=ze(N,x);if(j!==void 0)throw new Error('Value "'.concat(j,'" out of range for ').concat(x.type));return N.length===x.total?[]:N}(_,oe[D])});throw new Error("Invalid cron string format")}(e),L=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(b);y(L),d(b[0]),a(b[1]),c(b[2]),v(b[3]),u(b[4])}catch(S){h=!0}}h&&(r.current=e,t(!0),Le(i,s))}function qe(e,t,i,o,r,l,s){if(e==="reboot")return"@reboot";var m=function(d,a){return d.map(function(c,v){var u=oe[v];return He(Ue(c,u),u,a)})}([e!=="minute"&&l?l:[],e!=="minute"&&e!=="hour"&&r?r:[],e!=="year"&&e!=="month"||!i?[]:i,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!o?[]:o],s);return m.join(" ")}function He(e,t,i,o,r){var l="";if(function(m,d){return m.length===d.max-d.min+1}(e,t)||e.length===0)l="*";else{var s=function(m){if(m.length>2){var d=m[1]-m[0];if(d>1)return d}}(e);l=s&&function(m,d){for(var a=1;a<m.length;a++){var c=m[a-1];if(m[a]-c!==d)return!1}return!0}(e,s)?function(m,d,a){var c=Je(m),v=Ze(m),u=m.length===(v-c)/a+1;return!!(c===d.min&&v+a>d.max&&u)}(e,t,s)?"*/".concat(s):"".concat(te(Je(e),t,i,o,r),"-").concat(te(Ze(e),t,i,o,r),"/").concat(s):function(m){var d=[],a=null;return m.forEach(function(c,v,u){c!==u[v+1]-1?a!==null?(d.push([a,c]),a=null):d.push(c):a===null&&(a=c)}),d}(e).map(function(m){return Array.isArray(m)?"".concat(te(m[0],t,i,o,r),"-").concat(te(m[1],t,i,o,r)):te(m,t,i,o,r)}).join(",")}return l}function te(e,t,i,o,r){var l=e.toString(),s=t.type,m=t.alt,d=t.min,a=o&&(o===!0||o.includes(s)),c=r==="24-hour-clock"&&(s==="hours"||s==="minutes");if(i&&s==="week-days"||i&&s==="months"?l=m[e-d]:e<10&&(a||c)&&(l=l.padStart(2,"0")),s==="hours"&&r==="12-hour-clock"){var v=e>=12?"PM":"AM",u=e%12||12;u<10&&a&&(u=u.toString().padStart(2,"0")),l="".concat(u).concat(v)}return l}function Ue(e,t){var i=ye(Ie(We(e,t)));if(i.length===0)return i;var o=ze(i,t);if(o!==void 0)throw new Error('Value "'.concat(o,'" out of range for ').concat(t.type));return i}function We(e,t){return t.type==="week-days"&&(e=e.map(function(i){return i===7?0:i})),e}function ze(e,t){var i=e[0],o=e[e.length-1];return i<t.min?i:o>t.max?o:void 0}function Je(e){return e[0]}function Ze(e){return e[e.length-1]}function se(e){var t=e.value,i=e.grid,o=i===void 0||i,r=e.optionsList,l=e.setValue,s=e.locale,m=e.className,d=e.humanizeLabels,a=e.disabled,c=e.readOnly,v=e.leadingZero,u=e.clockFormat,y=e.period,h=e.unit,p=e.periodicityOnDoubleClick,b=e.mode,L=je(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=f.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(g){return g.toString()})},[t]),M=f.useMemo(function(){return r?r.map(function(g,O){return{value:(h.min===0?O:O+1).toString(),label:g}}):fe([],Array(h.total),!0).map(function(g,O){var B=h.min===0?O:O+1;return{value:B.toString(),label:te(B,h,d,v,u)}})},[r,v,d,u]),_=JSON.stringify(s),D=f.useCallback(function(g){var O=g.value;if(!t||t[0]!==Number(O))return n.jsx(n.Fragment,{});var B=He(Ue(t,h),h,d,v,u),z=B.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:z[1]?"".concat(s.everyText||C.everyText," ").concat(z[1]):B})},[t,_,d,v,u]),A=f.useCallback(function(g){var O=Array.isArray(g)?ye(g):[g],B=O;t&&(B=b==="single"?[]:fe([],t,!0),O.forEach(function(z){var P=Number(z);B=t.some(function(E){return E===P})?B.filter(function(E){return E!==P}):ye(fe(fe([],B,!0),[P],!1))})),B.length===h.total?l([]):l(B)},[l,t]),x=f.useCallback(function(g){if(g!==0&&g!==1){for(var O=h.total+h.min,B=[],z=h.min;z<O;z++)z%g==0&&B.push(z);var P=t&&B&&t.length===B.length&&t.every(function(q,H){return q===B[H]}),E=B.length===M.length;l(E||P?[]:B)}else l([])},[t,M,l]),N=f.useRef([]),j=f.useCallback(function(g){if(!c){var O=N.current;O.push({time:new Date().getTime(),value:Number(g)});var B=window.setTimeout(function(){p&&O.length>1&&O[O.length-1].time-O[O.length-2].time<300?O[O.length-1].value===O[O.length-2].value?x(Number(g)):A([O[O.length-2].value,O[O.length-1].value]):A(Number(g)),N.current=[]},300);return function(){window.clearTimeout(B)}}},[N,A,x,c,p]),V=f.useCallback(function(){c||l([])},[l,c]),F=f.useMemo(function(){var g;return Z(((g={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(m,"-select")]=!!m,g))},[m]),G=f.useMemo(function(){var g;return Z(((g={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(h.type)]=!0,g["react-js-cron-custom-select-dropdown"]=!0,g["react-js-cron-custom-select-dropdown-".concat(h.type)]=!0,g["react-js-cron-custom-select-dropdown-minutes-large"]=h.type==="minutes"&&y!=="hour"&&y!=="day",g["react-js-cron-custom-select-dropdown-minutes-medium"]=h.type==="minutes"&&(y==="day"||y==="hour"),g["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=h.type==="hours"&&u==="12-hour-clock",g["react-js-cron-custom-select-dropdown-grid"]=!!o,g["".concat(m,"-select-dropdown")]=!!m,g["".concat(m,"-select-dropdown-").concat(h.type)]=!!m,g))},[m,o,u,y]);return n.jsx(w.Select,W({mode:b!=="single"||p?"multiple":void 0,allowClear:!c,virtual:!1,open:!c&&void 0,value:S,onClear:V,tagRender:D,className:F,popupClassName:G,options:M,showSearch:!1,showArrow:!c,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:j,onDeselect:j,disabled:a,dropdownAlign:h.type!=="minutes"&&h.type!=="hours"||y==="day"||y==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(h.type)},L))}function So(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.disabled,s=e.readOnly,m=e.leadingZero,d=e.clockFormat,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(r,"-field")]=!!r,y["".concat(r,"-hours")]=!!r,y))},[r]);return n.jsxs("div",W({className:u},{children:[o.prefixHours!==""&&n.jsx("span",{children:o.prefixHours||C.prefixHours}),n.jsx(se,{placeholder:o.emptyHours||C.emptyHours,value:t,unit:oe[1],setValue:i,locale:o,className:r,disabled:l,readOnly:s,leadingZero:m,clockFormat:d,period:a,periodicityOnDoubleClick:c,mode:v})]}))}function Mo(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.disabled,s=e.readOnly,m=e.leadingZero,d=e.clockFormat,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(r,"-field")]=!!r,y["".concat(r,"-minutes")]=!!r,y))},[r]);return n.jsxs("div",W({className:u},{children:[a==="hour"?o.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:o.prefixMinutesForHourPeriod||C.prefixMinutesForHourPeriod}):o.prefixMinutes!==""&&n.jsx("span",{children:o.prefixMinutes||C.prefixMinutes}),n.jsx(se,{placeholder:a==="hour"?o.emptyMinutesForHourPeriod||C.emptyMinutesForHourPeriod:o.emptyMinutes||C.emptyMinutes,value:t,unit:oe[0],setValue:i,locale:o,className:r,disabled:l,readOnly:s,leadingZero:m,clockFormat:d,period:a,periodicityOnDoubleClick:c,mode:v}),a==="hour"&&o.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:o.suffixMinutesForHourPeriod||C.suffixMinutesForHourPeriod})]}))}function Do(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.weekDays,s=e.disabled,m=e.readOnly,d=e.leadingZero,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=!l||l.length===0,y=f.useMemo(function(){var b;return Z(((b={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!u})["".concat(r,"-field")]=!!r,b["".concat(r,"-month-days")]=!!r,b))},[r,u]),h=JSON.stringify(o),p=f.useMemo(function(){return u?o.emptyMonthDays||C.emptyMonthDays:o.emptyMonthDaysShort||C.emptyMonthDaysShort},[u,h]);return!m||t&&t.length>0||(!t||t.length===0)&&(!l||l.length===0)?n.jsxs("div",W({className:y},{children:[o.prefixMonthDays!==""&&n.jsx("span",{children:o.prefixMonthDays||C.prefixMonthDays}),n.jsx(se,{placeholder:p,value:t,setValue:i,unit:oe[2],locale:o,className:r,disabled:s,readOnly:m,leadingZero:d,period:a,periodicityOnDoubleClick:c,mode:v})]})):null}function Ao(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.humanizeLabels,s=e.disabled,m=e.readOnly,d=e.period,a=e.periodicityOnDoubleClick,c=e.mode,v=o.months||C.months,u=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(r,"-field")]=!!r,y["".concat(r,"-months")]=!!r,y))},[r]);return n.jsxs("div",W({className:u},{children:[o.prefixMonths!==""&&n.jsx("span",{children:o.prefixMonths||C.prefixMonths}),n.jsx(se,{placeholder:o.emptyMonths||C.emptyMonths,optionsList:v,grid:!1,value:t,unit:W(W({},oe[3]),{alt:o.altMonths||C.altMonths}),setValue:i,locale:o,className:r,humanizeLabels:l,disabled:s,readOnly:m,period:d,periodicityOnDoubleClick:a,mode:c})]}))}function Bo(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.disabled,s=e.readOnly,m=e.shortcuts,d=e.allowedPeriods,a=[];d.includes("year")&&a.push({value:"year",label:o.yearOption||C.yearOption}),d.includes("month")&&a.push({value:"month",label:o.monthOption||C.monthOption}),d.includes("week")&&a.push({value:"week",label:o.weekOption||C.weekOption}),d.includes("day")&&a.push({value:"day",label:o.dayOption||C.dayOption}),d.includes("hour")&&a.push({value:"hour",label:o.hourOption||C.hourOption}),d.includes("minute")&&a.push({value:"minute",label:o.minuteOption||C.minuteOption}),d.includes("reboot")&&m&&(m===!0||m.includes("@reboot"))&&a.push({value:"reboot",label:o.rebootOption||C.rebootOption});var c=f.useCallback(function(h){s||i(h)},[i,s]),v=f.useMemo(function(){var h;return Z(((h={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(r,"-field")]=!!r,h["".concat(r,"-period")]=!!r,h))},[r]),u=f.useMemo(function(){var h;return Z(((h={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":o.prefixPeriod===""})["".concat(r,"-select")]=!!r,h))},[r,o.prefixPeriod]),y=f.useMemo(function(){var h;return Z(((h={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(r,"-select-dropdown")]=!!r,h["".concat(r,"-select-dropdown-period")]=!!r,h))},[r]);return n.jsxs("div",W({className:v},{children:[o.prefixPeriod!==""&&n.jsx("span",{children:o.prefixPeriod||C.prefixPeriod}),n.jsx(w.Select,{defaultValue:t,value:t,onChange:c,options:a,className:u,popupClassName:y,disabled:l,showArrow:!s,open:!s&&void 0,"data-testid":"select-period"},JSON.stringify(o))]}))}function No(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.humanizeLabels,s=e.monthDays,m=e.disabled,d=e.readOnly,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=o.weekDays||C.weekDays,y=a==="week"||!s||s.length===0,h=f.useMemo(function(){var M;return Z(((M={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!y})["".concat(r,"-field")]=!!r,M["".concat(r,"-week-days")]=!!r,M))},[r,y]),p=JSON.stringify(o),b=f.useMemo(function(){return y?o.emptyWeekDays||C.emptyWeekDays:o.emptyWeekDaysShort||C.emptyWeekDaysShort},[y,p]),L=a==="week"||!d||t&&t.length>0||(!t||t.length===0)&&(!s||s.length===0),S=!d||s&&s.length>0||(!s||s.length===0)&&(!t||t.length===0);return L?n.jsxs("div",W({className:h},{children:[o.prefixWeekDays!==""&&(a==="week"||!S)&&n.jsx("span",{children:o.prefixWeekDays||C.prefixWeekDays}),o.prefixWeekDaysForMonthAndYearPeriod!==""&&a!=="week"&&S&&n.jsx("span",{children:o.prefixWeekDaysForMonthAndYearPeriod||C.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(se,{placeholder:b,optionsList:u,grid:!1,value:t,unit:W(W({},oe[4]),{alt:o.altWeekDays||C.altWeekDays}),setValue:i,locale:o,className:r,humanizeLabels:l,disabled:m,readOnly:d,period:a,periodicityOnDoubleClick:c,mode:v})]})):null}function To(e){var t=e.clearButton,i=t===void 0||t,o=e.clearButtonProps,r=o===void 0?{}:o,l=e.clearButtonAction,s=l===void 0?"fill-with-every":l,m=e.locale,d=m===void 0?C:m,a=e.value,c=a===void 0?"":a,v=e.setValue,u=e.displayError,y=u===void 0||u,h=e.onError,p=e.className,b=e.defaultPeriod,L=b===void 0?"day":b,S=e.allowEmpty,M=S===void 0?"for-default-value":S,_=e.humanizeLabels,D=_===void 0||_,A=e.humanizeValue,x=A!==void 0&&A,N=e.disabled,j=N!==void 0&&N,V=e.readOnly,F=V!==void 0&&V,G=e.leadingZero,g=G!==void 0&&G,O=e.shortcuts,B=O===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:O,z=e.clockFormat,P=e.periodicityOnDoubleClick,E=P===void 0||P,q=e.mode,H=q===void 0?"multiple":q,ce=e.allowedDropdowns,$=ce===void 0?["period","months","month-days","week-days","hours","minutes"]:ce,ne=e.allowedPeriods,Uo=ne===void 0?["year","month","week","day","hour","minute","reboot"]:ne,re=f.useRef(c),Ae=f.useRef(L),Xe=f.useState(),X=Xe[0],ve=Xe[1],Qe=f.useState(),ue=Qe[0],be=Qe[1],Re=f.useState(),xe=Re[0],ge=Re[1],eo=f.useState(),de=eo[0],ke=eo[1],oo=f.useState(),we=oo[0],Ce=oo[1],to=f.useState(),Oe=to[0],Se=to[1],no=f.useState(!1),Be=no[0],pe=no[1],ro=f.useState(!1),Me=ro[0],ao=ro[1],Wo=function(I){var Y=f.useRef(I);return f.useEffect(function(){Y.current=I},[I]),Y.current}(Me),io=JSON.stringify(d);f.useEffect(function(){Ve(c,pe,h,M,re,!0,d,B,Se,Ce,be,ge,ke,ve)},[]),f.useEffect(function(){c!==re.current&&Ve(c,pe,h,M,re,!1,d,B,Se,Ce,be,ge,ke,ve)},[c,re,io,M,B]),f.useEffect(function(){if(!(X||Oe||xe||ue||de||we)||Me||Wo)Me&&ao(!1);else{var I=X||Ae.current,Y=qe(I,xe,ue,de,we,Oe,x);v(Y,{selectedPeriod:I}),re.current=Y,h&&h(void 0),pe(!1)}},[X,ue,xe,de,we,Oe,x,Me]);var lo=f.useCallback(function(){be(void 0),ge(void 0),ke(void 0),Ce(void 0),Se(void 0);var I="",Y=X!=="reboot"&&X?X:Ae.current;Y!==X&&ve(Y),s==="fill-with-every"&&(I=qe(Y,void 0,void 0,void 0,void 0,void 0)),v(I,{selectedPeriod:Y}),re.current=I,ao(!0),M==="never"&&s==="empty"?(pe(!0),Le(h,d)):(h&&h(void 0),pe(!1))},[X,v,h,s]),zo=f.useMemo(function(){var I;return Z(((I={"react-js-cron":!0,"react-js-cron-error":Be&&y,"react-js-cron-disabled":j,"react-js-cron-read-only":F})["".concat(p)]=!!p,I["".concat(p,"-error")]=Be&&y&&!!p,I["".concat(p,"-disabled")]=j&&!!p,I["".concat(p,"-read-only")]=F&&!!p,I))},[p,Be,y,j,F]),Ne=r.className,so=je(r,["className"]),co=f.useMemo(function(){var I;return Z(((I={"react-js-cron-clear-button":!0})["".concat(p,"-clear-button")]=!!p,I["".concat(Ne)]=!!Ne,I))},[p,Ne]),Jo=JSON.stringify(so),uo=f.useMemo(function(){return i&&!F?n.jsx(w.Button,W({className:co,danger:!0,type:"primary",disabled:j},so,{onClick:lo},{children:d.clearButtonText||C.clearButtonText})):null},[i,F,io,co,j,Jo,lo]),U=X||Ae.current;return n.jsxs("div",W({className:zo},{children:[$.includes("period")&&n.jsx(Bo,{value:U,setValue:ve,locale:d,className:p,disabled:j,readOnly:F,shortcuts:B,allowedPeriods:Uo}),U==="reboot"?uo:n.jsxs(n.Fragment,{children:[U==="year"&&$.includes("months")&&n.jsx(Ao,{value:xe,setValue:ge,locale:d,className:p,humanizeLabels:D,disabled:j,readOnly:F,period:U,periodicityOnDoubleClick:E,mode:H}),(U==="year"||U==="month")&&$.includes("month-days")&&n.jsx(Do,{value:ue,setValue:be,locale:d,className:p,weekDays:de,disabled:j,readOnly:F,leadingZero:g,period:U,periodicityOnDoubleClick:E,mode:H}),(U==="year"||U==="month"||U==="week")&&$.includes("week-days")&&n.jsx(No,{value:de,setValue:ke,locale:d,className:p,humanizeLabels:D,monthDays:ue,disabled:j,readOnly:F,period:U,periodicityOnDoubleClick:E,mode:H}),n.jsxs("div",{children:[U!=="minute"&&U!=="hour"&&$.includes("hours")&&n.jsx(So,{value:we,setValue:Ce,locale:d,className:p,disabled:j,readOnly:F,leadingZero:g,clockFormat:z,period:U,periodicityOnDoubleClick:E,mode:H}),U!=="minute"&&$.includes("minutes")&&n.jsx(Mo,{value:Oe,setValue:Se,locale:d,period:U,className:p,disabled:j,readOnly:F,leadingZero:g,clockFormat:z,periodicityOnDoubleClick:E,mode:H}),uo]})]})]}))}const Fo={"zh-CN":{everyText:"每",emptyMonths:"每月",emptyMonthDays:"每日(月)",emptyMonthDaysShort:"每日",emptyWeekDays:"每天(周)",emptyWeekDaysShort:"每天(周)",emptyHours:"每小时",emptyMinutes:"每分钟",emptyMinutesForHourPeriod:"每",yearOption:"年",monthOption:"月",weekOption:"周",dayOption:"天",hourOption:"小时",minuteOption:"分钟",rebootOption:"重启",prefixPeriod:"每",prefixMonths:"的",prefixMonthDays:"的",prefixWeekDays:"的",prefixWeekDaysForMonthAndYearPeriod:"或者",prefixHours:"的",prefixMinutes:":",prefixMinutesForHourPeriod:"的",suffixMinutesForHourPeriod:"分钟",errorInvalidCron:"不符合 cron 规则的表达式",clearButtonText:"清空",weekDays:["周日","周一","周二","周三","周四","周五","周六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],altWeekDays:["周日","周一","周二","周三","周四","周五","周六"],altMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},_e=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ge(e){return _e.filter(i=>!isNaN(+i.value)).reverse().find(i=>!(e%i.value))}function Po(e){if(!e)return"none";if(e&&!isNaN(+e)){const t=Ge(e);return t?t.value:"none"}if(typeof e=="string")return"cron"}function jo({value:e,onChange:t}){const{t:i}=ee(),o=Ge(e);return n.jsx(w.InputNumber,{value:e/o.value,onChange:r=>t(r*o.value),min:1,addonBefore:i("Every"),addonAfter:i(o.unitText),className:"auto-width"})}function Eo({value:e=null,onChange:t}){const{t:i}=ee(),o=Po(e),r=f.useCallback(s=>{if(s==="none"){t(null);return}if(s==="cron"){t("0 * * * * *");return}t(s)},[t]),l=Fo[localStorage.getItem("TACHYBASE_LOCALE")||"en-US"];return n.jsxs("fieldset",{className:k.css`
|
|
1
|
+
(function(N,S){typeof exports=="object"&&typeof module!="undefined"?S(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("@tego/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","@tachybase/schema","@tego/client","@ant-design/icons","antd","react-i18next"],S):(N=typeof globalThis!="undefined"?globalThis:N||self,S(N["@tachybase/module-backup"]={},N["@tachybase/client"],N.jsxRuntime,N.react,N["@tachybase/schema"],N["@tego/client"],N["@ant-design/icons"],N.antd,N["react-i18next"]))})(this,function(N,S,r,f,le,Ae,re,C,X){"use strict";var Gt=Object.defineProperty,Yt=Object.defineProperties;var Kt=Object.getOwnPropertyDescriptors;var pt=Object.getOwnPropertySymbols;var Xt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable;var ft=(N,S,r)=>S in N?Gt(N,S,{enumerable:!0,configurable:!0,writable:!0,value:r}):N[S]=r,$=(N,S)=>{for(var r in S||(S={}))Xt.call(S,r)&&ft(N,r,S[r]);if(pt)for(var r of pt(S))Qt.call(S,r)&&ft(N,r,S[r]);return N},te=(N,S)=>Yt(N,Kt(S));var G=(N,S,r)=>new Promise((f,le)=>{var Ae=X=>{try{C(r.next(X))}catch(ee){le(ee)}},re=X=>{try{C(r.throw(X))}catch(ee){le(ee)}},C=X=>X.done?f(X.value):Promise.resolve(X.value).then(Ae,re);C((r=r.apply(N,S)).next())});var ee=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},me={exports:{}},mt=me.exports,Ne;function ht(){return Ne||(Ne=1,function(e,o){(function(a,t){t()})(mt,function(){function a(l,c){return typeof c=="undefined"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(l.type)?new Blob(["\uFEFF",l],{type:l.type}):l}function t(l,c,b){var p=new XMLHttpRequest;p.open("GET",l),p.responseType="blob",p.onload=function(){i(p.response,c,b)},p.onerror=function(){console.error("could not download file")},p.send()}function n(l){var c=new XMLHttpRequest;c.open("HEAD",l,!1);try{c.send()}catch(b){}return 200<=c.status&&299>=c.status}function u(l){try{l.dispatchEvent(new MouseEvent("click"))}catch(b){var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),l.dispatchEvent(c)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ee=="object"&&ee.global===ee?ee:void 0,d=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),i=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!d?function(l,c,b){var p=s.URL||s.webkitURL,y=document.createElement("a");c=c||l.name||"download",y.download=c,y.rel="noopener",typeof l=="string"?(y.href=l,y.origin===location.origin?u(y):n(y.href)?t(l,c,b):u(y,y.target="_blank")):(y.href=p.createObjectURL(l),setTimeout(function(){p.revokeObjectURL(y.href)},4e4),setTimeout(function(){u(y)},0))}:"msSaveOrOpenBlob"in navigator?function(l,c,b){if(c=c||l.name||"download",typeof l!="string")navigator.msSaveOrOpenBlob(a(l,b),c);else if(n(l))t(l,c,b);else{var p=document.createElement("a");p.href=l,p.target="_blank",setTimeout(function(){u(p)})}}:function(l,c,b,p){if(p=p||open("","_blank"),p&&(p.document.title=p.document.body.innerText="downloading..."),typeof l=="string")return t(l,c,b);var y=l.type==="application/octet-stream",v=/constructor/i.test(s.HTMLElement)||s.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||y&&v||d)&&typeof FileReader!="undefined"){var x=new FileReader;x.onloadend=function(){var g=x.result;g=m?g:g.replace(/^data:[^;]*;/,"data:attachment/file;"),p?p.location.href=g:location=g,p=null},x.readAsDataURL(l)}else{var B=s.URL||s.webkitURL,M=B.createObjectURL(l);p?p.location=M:location.href=M,p=null,setTimeout(function(){B.revokeObjectURL(M)},4e4)}});s.saveAs=i.saveAs=i,e.exports=i})}(me)),me.exports}var yt=ht();const ie="backup";function Q(){return X.useTranslation([ie,"core"],{nsMode:"fallback"})}const vt=e=>S.tval(e,{ns:ie}),gt=({inProgress:e=!1,status:o,progress:a=0,currentStep:t,downloadProgress:n,showDownloadText:u=!0,width:s="180px"})=>{const{t:d}=Q();if(e||o==="in_progress"){const i=a!=null?a:0,l=t||d("Backing up");return r.jsxs("div",{style:{width:s},children:[r.jsx(C.Progress,{percent:i,status:"active",showInfo:!1}),u&&r.jsxs("div",{style:{fontSize:"12px",color:"rgba(0, 0, 0, 0.45)",marginTop:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[l," ",i>0?`${i}%`:""]})]})}return o==="error"?r.jsx("div",{style:{width:s},children:r.jsx(C.Progress,{percent:0,status:"exception",showInfo:!1})}):o==="ok"?r.jsx("div",{style:{width:s},children:r.jsx(C.Progress,{percent:100,status:"success",showInfo:!1})}):n!==void 0&&n>=0?r.jsxs("div",{style:{width:s},children:[r.jsx(C.Progress,{percent:n,status:"active",showInfo:!1}),u&&r.jsxs("div",{style:{fontSize:"12px",color:"rgba(0, 0, 0, 0.45)",marginTop:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[d("Downloading")," ",n,"%"]})]},`download-${n}`):null};function bt({dataSource:e,onDataSourceUpdate:o,onComplete:a,messageType:t="backup:progress",timeout:n=5*60*1e3,onTimeout:u}){const s=S.useApp(),d=f.useRef(a),i=f.useRef(u),l=f.useRef(e),c=f.useRef(!1),b=f.useRef(new Map),p=f.useRef(new Map);f.useEffect(()=>{d.current=a,i.current=u,l.current=e},[a,u,e]),f.useEffect(()=>{if(!s.ws||!s.ws.enabled)return;const m=le.autorun(()=>{if(s.ws.connected&&!c.current){const x=s.apiClient.auth.getToken();if(x){const B={type:"signIn",payload:{token:x}};s.ws.send(JSON.stringify(B)),c.current=!0}}else s.ws.connected||(c.current=!1)});return()=>{m(),c.current=!1}},[s.ws,s.apiClient]);const y=f.useCallback(m=>{const x=p.current.get(m);x&&clearTimeout(x),b.current.set(m,Date.now());const B=setTimeout(()=>{var g;const M=b.current.get(m);M&&Date.now()-M>=n&&(o(h=>h.map(O=>O.name===m&&(O.inProgress||O.status==="in_progress")?(console.warn(`[BackupProgress] Backup task ${m} timed out after ${n}ms`),te($({},O),{inProgress:!1,status:"error",progress:O.progress||0,currentStep:"Timeout: No progress update received"})):O)),p.current.delete(m),b.current.delete(m),(g=i.current)==null||g.call(i,m))},n);p.current.set(m,B)},[n,o]),v=f.useCallback(m=>{const x=p.current.get(m);x&&(clearTimeout(x),p.current.delete(m)),b.current.delete(m)},[]);f.useEffect(()=>{e.forEach(m=>{if((m.inProgress||m.status==="in_progress")&&m.name){if(m.progress>=100){v(m.name);return}p.current.has(m.name)||y(m.name)}else m.name&&p.current.has(m.name)&&v(m.name)})},[e,y,v]),f.useEffect(()=>{if(!s.ws)return;const m=x=>{var B;try{const M=JSON.parse(x.data);if((M==null?void 0:M.type)===t){if(!M.payload){console.warn("[BackupProgress] Received message without payload:",M);return}const{fileName:g,progress:h}=M.payload;if(!g||!h){console.warn("[BackupProgress] Invalid message format:",M.payload);return}if(h.percent>=100){v(g),(B=d.current)==null||B.call(d,g);return}o(O=>O.map(w=>w.name===g?(y(g),te($({},w),{inProgress:!0,status:"in_progress",progress:h.percent,currentStep:h.currentStep})):w))}}catch(M){}};return s.ws.on("message",m),()=>{s.ws.off("message",m),p.current.forEach(x=>{clearTimeout(x)}),p.current.clear(),b.current.clear()}},[s.ws,t,o,y,v])}function xt(e){const o=S.useAPIClient(),[a,t]=f.useState({}),n=f.useCallback(s=>G(null,null,function*(){const d=s.name;t(i=>te($({},i),{[d]:0})),e!=null&&e.onDownloadStart&&e.onDownloadStart(d);try{const i=yield o.request({url:"backupFiles:download",method:"get",params:{filterByTk:d},responseType:"blob",onDownloadProgress:c=>{if(c.total){const b=Math.round(c.loaded*100/c.total);t(p=>te($({},p),{[d]:b}))}}});t(c=>{const b=$({},c);return delete b[d],b});const l=(i==null?void 0:i.data)||i;e!=null&&e.onDownloadComplete&&e.onDownloadComplete(d,l)}catch(i){if(t(l=>{const c=$({},l);return delete c[d],c}),e!=null&&e.onDownloadError)e.onDownloadError(d,i);else throw i}}),[o,e]),u=f.useCallback(s=>{t(s?d=>{const i=$({},d);return delete i[s],i}:{})},[]);return{downloadProgress:a,handleDownload:n,clearDownloadProgress:u}}const{Dragger:kt}=C.Upload;function wt(e){const o=t=>{var n;(n=e.onChange)==null||n.call(e,t)},a=S.useAPIClient();return te($({},e),{customRequest({action:t,data:n,file:u,filename:s,headers:d,onError:i,onProgress:l,onSuccess:c,withCredentials:b}){const p=new FormData;return n&&Object.keys(n).forEach(y=>{p.append(y,n[y])}),p.append(s,u),a.axios.post(t,p,{withCredentials:b,headers:d,onUploadProgress:({total:y,loaded:v})=>{l({percent:Math.round(v/y*100).toFixed(2)},u)}}).then(({data:y})=>{c(y,u)}).catch(i).finally(()=>{}),{abort(){}}},onChange:o})}const Fe=e=>{const{collectionsData:o}=e,{t:a}=Q(),[t,n]=f.useState(!1),[u,s]=f.useState(o);f.useEffect(()=>{s(o)},[o]);const d=S.useAPIClient(),i=S.useCompile(),l=f.useMemo(()=>d.resource("backupFiles"),[d]),c=()=>G(null,null,function*(){if(e.isBackup){const m=yield l.dumpableCollections();s(m==null?void 0:m.data),n(!0)}n(!0)}),b=()=>{n(!1)},p=()=>{n(!1)},y=[{title:a("Collection"),dataIndex:"collection",key:"collection",render:(m,x)=>{const B=i(x.title);return x.name===B?B:r.jsxs("div",{children:[x.name," ",r.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.3)",fontSize:"0.9em"},children:["(",i(x.title),")"]})]})}},{title:a("Origin"),dataIndex:"origin",key:"origin",width:"50%"}],v=Object.keys(u||{}).map(m=>({key:m,label:a(`${m}.title`),children:r.jsxs(r.Fragment,{children:[r.jsx(C.Alert,{style:{marginBottom:16},message:a(`${m}.description`)}),r.jsx(C.Table,{pagination:{pageSize:100},bordered:!0,size:"small",dataSource:u[m],columns:y,scroll:{y:400}})]})}));return r.jsxs(r.Fragment,{children:[r.jsx("a",{onClick:c,children:a("Learn more")}),r.jsx(C.Modal,{title:a("Backup instructions"),width:"80vw",open:t,footer:null,onOk:b,onCancel:p,children:r.jsx(C.Tabs,{defaultActiveKey:"required",items:v})})]})},Ee=({ButtonComponent:e=C.Button,title:o,upload:a=!1,fileData:t})=>{const{t:n}=Q(),[u,s]=f.useState(["required"]),[d,i]=f.useState(!1),[l,c]=f.useState(null),[b,p]=f.useState(!1),y=S.useAPIClient(),v=f.useMemo(()=>y.resource("backupFiles"),[y]),[m,x]=f.useState([]),B=u.length>0&&u.length<m.length,M=m.length===u.length;f.useEffect(()=>{const k=Object.keys((l==null?void 0:l.dumpableCollectionsGroupByGroup)||[]).map(F=>({value:F,label:n(`${F}.title`),disabled:["required","skipped"].includes(F)}));x(k),k.length>0&&s(k.map(F=>F.value))},[l,n]);const g=()=>G(null,null,function*(){var k,F,E;if(i(!0),!a){p(!0);const{data:q}=yield v.get({filterByTk:t.name}),I=Object.keys(((F=(k=q==null?void 0:q.data)==null?void 0:k.meta)==null?void 0:F.dumpableCollectionsGroupByGroup)||[]).map(H=>({value:H,label:n(`${H}.title`),disabled:["required","skipped"].includes(H)}));x(I),c((E=q==null?void 0:q.data)==null?void 0:E.meta),I.length>0&&s(I.map(H=>H.value)),p(!1)}}),h=()=>{v.restore({values:{dataTypes:u,filterByTk:t==null?void 0:t.name,key:l==null?void 0:l.key}}),i(!1)},O=()=>{i(!1),c(null),m.length>0?s(m.map(k=>k.value)):s(["required"])},w=k=>{s(k.target.checked?m.map(F=>F.value):["required"])};return r.jsxs(r.Fragment,{children:[r.jsx(e,{onClick:g,children:o}),r.jsx(C.Modal,{title:n("Restore"),width:800,footer:a&&!l?null:void 0,open:d,onOk:h,onCancel:O,children:r.jsxs(C.Spin,{spinning:b,children:[a&&!l&&r.jsx(St,{setRestoreData:c}),(!a||l)&&[r.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[n("Select the data to be restored")," (",r.jsx(Fe,{collectionsData:l==null?void 0:l.dumpableCollectionsGroupByGroup}),"):"]},"info"),r.jsx("div",{style:{lineHeight:2,marginBottom:8},children:r.jsxs(Ae.FormItem,{children:[r.jsx(S.Checkbox.Group,{options:m,style:{flexDirection:"column"},value:u,onChange:k=>s(k)}),r.jsx(C.Divider,{}),r.jsx(S.Checkbox,{indeterminate:B,onChange:w,checked:M,children:n("Check all")})]})},"dataType")]]})})]})},Ct=({ButtonComponent:e=C.Button,refresh:o})=>{const{t:a}=Q(),[t,n]=f.useState(!1),[u,s]=f.useState(["required"]),d=S.useAPIClient(),[i,l]=f.useState([]),c=["required","user","third-party","custom"],b=u.length>0&&u.length<i.filter(h=>h.value!=="skipped").length,p=i.filter(h=>h.value!=="skipped").length===u.length,y=h=>{s(h.target.checked?i.filter(O=>O.value!=="skipped").map(O=>O.value):["required"])},v=h=>{const O=i.filter(w=>c.includes(w.value)&&w.value!=="skipped").map(w=>w.value);if(h.target.checked){const w=[...new Set([...u.filter(k=>k==="required"),...O])];s(w)}else s(["required"])},m=f.useMemo(()=>{const h=i.filter(k=>c.includes(k.value)&&k.value!=="skipped").map(k=>k.value),O=h.filter(k=>u.includes(k)),w=u.filter(k=>k!=="required"&&!h.includes(k));return h.length>0&&O.length===h.length&&w.length===0},[u,i]),x=f.useMemo(()=>{const h=i.filter(w=>c.includes(w.value)&&w.value!=="skipped").map(w=>w.value),O=h.filter(w=>u.includes(w));return O.length>0&&O.length<h.length},[u,i]),B=()=>G(null,null,function*(){const{data:h}=yield d.resource("backupFiles").dumpableCollections(),O=Object.keys(h||[]).map(k=>({value:k,label:a(`${k}.title`),disabled:["required","skipped"].includes(k)}));l(O);const w=O.filter(k=>c.includes(k.value)&&k.value!=="skipped").map(k=>k.value);s(["required",...w]),n(!0)}),M=h=>G(null,null,function*(){yield d.request({url:"backupFiles:create",method:"post",data:{dataTypes:u,method:h}}),n(!1);const O=i.filter(w=>c.includes(w.value)&&w.value!=="skipped").map(w=>w.value);s(["required",...O]),setTimeout(()=>{o()},500)}),g=()=>{n(!1);const h=i.filter(O=>c.includes(O.value)&&O.value!=="skipped").map(O=>O.value);s(["required",...h])};return r.jsxs(r.Fragment,{children:[r.jsx(e,{icon:r.jsx(re.PlusOutlined,{}),type:"primary",onClick:B,children:a("New backup")}),r.jsxs(C.Modal,{title:a("New backup"),width:800,open:t,onCancel:g,footer:[r.jsxs(C.Row,{gutter:16,justify:"end",align:"middle",children:[r.jsx(C.Col,{children:r.jsx(C.Button,{onClick:g,children:a("Cancel")},"cancel")}),r.jsx(C.Col,{children:r.jsx(C.Dropdown.Button,{type:"primary",onClick:()=>M("priority"),overlay:r.jsxs(C.Menu,{children:[r.jsx(C.Menu.Item,{onClick:()=>M("main"),children:a("Self backup")},"main"),r.jsx(C.Menu.Item,{onClick:()=>M("worker"),children:a("Worker backup")},"worker")]}),children:a("Backup")},"submit")})]})],children:[r.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[a("Select the data to be backed up")," (",r.jsx(Fe,{isBackup:!0}),"):"]}),r.jsxs("div",{style:{lineHeight:2,marginBottom:8},children:[r.jsx(S.Checkbox.Group,{options:i,style:{flexDirection:"column"},onChange:h=>s(h),value:u}),r.jsx(C.Divider,{}),r.jsxs(C.Space,{children:[r.jsx(S.Checkbox,{indeterminate:x,onChange:v,checked:m,children:a("Check common")}),r.jsx(S.Checkbox,{indeterminate:b,onChange:y,checked:p,children:a("Check all")})]})]})]})]})},St=e=>{const{t:o}=Q(),a={multiple:!1,action:"/backupFiles:upload",onChange(t){var u,s,d;t.fileList.length>1&&t.fileList.splice(0,t.fileList.length-1);const{status:n}=t.file;n==="done"?(C.message.success(`${t.file.name} `+o("file uploaded successfully")),e.setRestoreData(te($({},(s=(u=t.file.response)==null?void 0:u.data)==null?void 0:s.meta),{key:(d=t.file.response)==null?void 0:d.data.key}))):n==="error"&&C.message.error(`${t.file.name} `+o("file upload failed"))},onDrop(t){}};return r.jsxs(kt,te($({},wt(a)),{children:[r.jsx("p",{className:"ant-upload-drag-icon",children:r.jsx(re.InboxOutlined,{})}),r.jsxs("p",{className:"ant-upload-text",children:[" ",o("Click or drag file to this area to upload")]})]}))},Ot=()=>{const{t:e}=Q(),o=S.useAPIClient(),a=S.useApp(),[t,n]=f.useState([]),[u,s]=f.useState(!1),{modal:d,notification:i}=C.App.useApp(),[l,c]=f.useState(!1),[b,p]=f.useState(""),y=f.useMemo(()=>o.resource("backupFiles"),[o]),{downloadProgress:v,handleDownload:m}=xt({onDownloadStart:g=>{p(g),c(!0)},onDownloadComplete:(g,h)=>{yt.saveAs(h,g),c(!1),p(""),i.success({key:"downloadBackup",message:r.jsx("span",{children:e("Downloaded success!")}),duration:1})},onDownloadError:(g,h)=>{c(!1),p(""),i.error({key:"downloadBackup",message:r.jsx("span",{children:e("Download failed")}),duration:3})}}),x=f.useCallback((g=!0)=>G(null,null,function*(){g&&s(!0);try{const{data:h}=yield y.list(),O=(h==null?void 0:h.rows)||(h==null?void 0:h.data)||[];n(O)}finally{g&&s(!1)}}),[y]),B=f.useCallback(()=>G(null,null,function*(){yield x()}),[x]);S.useNoticeSub("backup",g=>{(i[g.level]||i.info)({key:"backup",message:g.msg}),B()}),f.useEffect(()=>{x()},[x]),bt({dataSource:t,onDataSourceUpdate:n,onComplete:g=>{x(!1)},onTimeout:g=>{i.error({key:"backup-timeout",message:e("Backup timeout",{ns:"backup"}),description:`${g} ${e("No progress update received for a long time",{ns:"backup"})}`,duration:5}),x(!1)}}),f.useEffect(()=>{if(!t.some(w=>w.inProgress||w.status==="in_progress"))return;let h=null;const O=le.autorun(()=>{var F,E;const w=((F=a.ws)==null?void 0:F.enabled)&&((E=a.ws)==null?void 0:E.connected);h&&(clearInterval(h),h=null),h=setInterval(()=>{x(!1)},w?1e3:500)});return()=>{O(),h&&clearInterval(h)}},[t,x,a.ws]);const M=g=>{d.confirm({title:e("Delete record",{ns:"core"}),content:e("Are you sure you want to delete it?",{ns:"core"}),onOk:()=>G(null,null,function*(){yield y.destroy({filterByTk:g.name}),yield x(),C.message.success(e("Deleted successfully"))})})};return r.jsxs("div",{children:[r.jsxs(C.Card,{bordered:!1,children:[r.jsxs(C.Space,{style:{float:"right",marginBottom:16},children:[r.jsx(C.Button,{onClick:B,icon:r.jsx(re.ReloadOutlined,{}),children:e("Refresh")}),r.jsx(Ee,{upload:!0,title:r.jsxs(r.Fragment,{children:[r.jsx(re.UploadOutlined,{})," ",e("Restore backup from local")]})}),r.jsx(Ct,{refresh:B})]}),r.jsx(C.Table,{dataSource:t,loading:u,columns:[{title:e("Backup file"),dataIndex:"name",width:400,onCell:g=>g.inProgress?{colSpan:1}:{},render:(g,h)=>h.status==="error"?r.jsxs("div",{style:{color:"red"},children:[g,"(",e("Error"),")"]}):r.jsx("div",{children:g})},{title:e("Backup progress"),dataIndex:"progress",width:200,align:"center",render:(g,h)=>r.jsx(gt,{inProgress:h.inProgress,status:h.status,progress:h.progress,currentStep:h.currentStep,downloadProgress:v[h.name],showDownloadText:!1})},{title:e("File size"),dataIndex:"fileSize",width:150,render:(g,h)=>{var k;const O=(k=h.progress)!=null?k:0,w=h.currentStep||e("Backing up");return h.inProgress?r.jsxs("div",{style:{width:"150px",fontSize:"12px",color:"rgba(0, 0, 0, 0.45)",marginTop:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[O>0?`${O}%`:""," ",w]}):g}},{title:e("Created at",{ns:"core"}),dataIndex:"createdAt",onCell:g=>g.inProgress?{colSpan:0}:{},render:g=>r.jsx(S.DatePicker.ReadPretty,{value:g,showTime:!0})},{title:e("Actions",{ns:"core"}),dataIndex:"actions",onCell:g=>g.inProgress?{colSpan:0}:{},render:(g,h)=>r.jsxs(C.Space,{split:r.jsx(C.Divider,{type:"vertical"}),children:[h.status!=="error"&&r.jsx(Ee,{ButtonComponent:"a",title:e("Restore"),fileData:h}),h.status!=="error"&&r.jsx("a",{type:"link",onClick:()=>m(h),children:e("Download")}),r.jsx("a",{onClick:()=>M(h),children:e("Delete")})]})}]})]}),r.jsx(C.Modal,{title:e("Downloading"),open:l,closable:!1,maskClosable:!1,footer:null,width:400,children:r.jsxs("div",{style:{padding:"20px 0"},children:[r.jsx("div",{style:{marginBottom:16,fontSize:"14px",color:"rgba(0, 0, 0, 0.65)"},children:b}),r.jsx(C.Progress,{percent:b&&v[b]||0,status:"active",showInfo:!0,format:g=>`${g}%`})]})})]})},Mt={dumpRules:"required",name:"autoBackup",shared:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0,fields:[{type:"string",name:"title",required:!0,uiSchema:{title:'{{ t("Title") }}',type:"string","x-component":"Input",required:!0}},{type:"boolean",name:"enabled",defaultValue:!1,uiSchema:{title:'{{ t("Enabled") }}',type:"boolean","x-component":"Checkbox",required:!0}},{type:"array",name:"dumpRules",uiSchema:{title:'{{ t("Dump rules") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"repeat",required:!0,uiSchema:{title:'{{t("Repeat mode")}}',type:"string","x-component":"RepeatField"}},{type:"integer",name:"maxNumber",uiSchema:{title:'{{ t("Max number") }}',type:"integer","x-component":"Input",required:!0}}]};var _=function(){return _=Object.assign||function(e){for(var o,a=1,t=arguments.length;a<t;a++)for(var n in o=arguments[a])Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]);return e},_.apply(this,arguments)};function Ie(e,o){var a={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(t=Object.getOwnPropertySymbols(e);n<t.length;n++)o.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(a[t[n]]=e[t[n]])}return a}function he(e,o,a){if(a||arguments.length===2)for(var t,n=0,u=o.length;n<u;n++)!t&&n in o||(t||(t=Array.prototype.slice.call(o,0,n)),t[n]=o[n]);return e.concat(t||Array.prototype.slice.call(o))}var Dt=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],oe=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],A={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function je(e,o){for(var a=[],t=e;t<=o;t++)a.push(t);return a}function ye(e){return e.sort(function(o,a){return o-a}),e}function Le(e){var o=[];return e.forEach(function(a){o.indexOf(a)<0&&o.push(a)}),o}function Z(e){return Object.entries(e).filter(function(o){var a=o[0],t=o[1];return a&&t}).map(function(o){return o[0]}).join(" ")}function Ve(e,o){e&&e({type:"invalid_cron",description:o.errorInvalidCron||A.errorInvalidCron})}function ve(e){var o=parseInt(e,10),a=Number(e);return o===a?a:NaN}function qe(e,o,a,t,n,u,s,d,i,l,c,b,p,y){a&&a(void 0),o(!1);var v=!1;if(!e){if(t==="always"||u&&t==="for-default-value")return;v=!0}if(!v){if(d&&(d===!0||d.includes(e))){if(e==="@reboot")return void y("reboot");var m=Dt.find(function(M){return M.name===e});m&&(e=m.value)}try{var x=function(M){if(typeof M!="string")throw new Error("Invalid cron string");var g=M.replace(/\s+/g," ").trim().split(" ");if(g.length===5)return g.map(function(h,O){return function(w,k){if(w==="*"||w==="*/1")return[];var F=ye(Le(ze(function(q,I,H){if(H){q=q.toUpperCase();for(var D=0;D<H.length;D++)q=q.replace(H[D],"".concat(D+I))}return q}(w,k.min,k.alt).split(",").map(function(q){var I,H=q.split("/");if(H.length>2)throw new Error('Invalid value "'.concat(w,' for "').concat(k.type,'"'));var D=H[0],P=H[1];I=D==="*"?je(k.min,k.max):function(j,L,U){var W=j.split("-");if(W.length===1){var ue=ve(W[0]);if(isNaN(ue))throw new Error('Invalid value "'.concat(L,'" for ').concat(U.type));return[ue]}if(W.length===2){var Y=ve(W[0]),ae=ve(W[1]);if(isNaN(Y)||isNaN(ae))throw new Error('Invalid value "'.concat(L,'" for ').concat(U.type));if(ae<Y)throw new Error('Max range is less than min range in "'.concat(j,'" for ').concat(U.type));return je(Y,ae)}throw new Error('Invalid value "'.concat(j,'" for ').concat(U.type))}(D,w,k);var T=function(j,L){if(j!==void 0){var U=ve(j);if(isNaN(U)||U<1)throw new Error('Invalid interval step value "'.concat(j,'" for ').concat(L.type));return U}}(P,k),J=function(j,L){if(L){var U=j[0];j=j.filter(function(W){return W%L==U%L||W===U})}return j}(I,T);return J}).flat(),k))),E=_e(F,k);if(E!==void 0)throw new Error('Value "'.concat(E,'" out of range for ').concat(k.type));return F.length===k.total?[]:F}(h,oe[O])});throw new Error("Invalid cron string format")}(e),B=function(M){return M[3].length>0?"year":M[2].length>0?"month":M[4].length>0?"week":M[1].length>0?"day":M[0].length>0?"hour":"minute"}(x);y(B),i(x[0]),l(x[1]),c(x[2]),b(x[3]),p(x[4])}catch(M){v=!0}}v&&(n.current=e,o(!0),Ve(a,s))}function He(e,o,a,t,n,u,s){if(e==="reboot")return"@reboot";var d=function(i,l){return i.map(function(c,b){var p=oe[b];return Ue(We(c,p),p,l)})}([e!=="minute"&&u?u:[],e!=="minute"&&e!=="hour"&&n?n:[],e!=="year"&&e!=="month"||!a?[]:a,e==="year"&&o?o:[],e!=="year"&&e!=="month"&&e!=="week"||!t?[]:t],s);return d.join(" ")}function Ue(e,o,a,t,n){var u="";if(function(d,i){return d.length===i.max-i.min+1}(e,o)||e.length===0)u="*";else{var s=function(d){if(d.length>2){var i=d[1]-d[0];if(i>1)return i}}(e);u=s&&function(d,i){for(var l=1;l<d.length;l++){var c=d[l-1];if(d[l]-c!==i)return!1}return!0}(e,s)?function(d,i,l){var c=Je(d),b=$e(d),p=d.length===(b-c)/l+1;return!!(c===i.min&&b+l>i.max&&p)}(e,o,s)?"*/".concat(s):"".concat(ne(Je(e),o,a,t,n),"-").concat(ne($e(e),o,a,t,n),"/").concat(s):function(d){var i=[],l=null;return d.forEach(function(c,b,p){c!==p[b+1]-1?l!==null?(i.push([l,c]),l=null):i.push(c):l===null&&(l=c)}),i}(e).map(function(d){return Array.isArray(d)?"".concat(ne(d[0],o,a,t,n),"-").concat(ne(d[1],o,a,t,n)):ne(d,o,a,t,n)}).join(",")}return u}function ne(e,o,a,t,n){var u=e.toString(),s=o.type,d=o.alt,i=o.min,l=t&&(t===!0||t.includes(s)),c=n==="24-hour-clock"&&(s==="hours"||s==="minutes");if(a&&s==="week-days"||a&&s==="months"?u=d[e-i]:e<10&&(l||c)&&(u=u.padStart(2,"0")),s==="hours"&&n==="12-hour-clock"){var b=e>=12?"PM":"AM",p=e%12||12;p<10&&l&&(p=p.toString().padStart(2,"0")),u="".concat(p).concat(b)}return u}function We(e,o){var a=ye(Le(ze(e,o)));if(a.length===0)return a;var t=_e(a,o);if(t!==void 0)throw new Error('Value "'.concat(t,'" out of range for ').concat(o.type));return a}function ze(e,o){return o.type==="week-days"&&(e=e.map(function(a){return a===7?0:a})),e}function _e(e,o){var a=e[0],t=e[e.length-1];return a<o.min?a:t>o.max?t:void 0}function Je(e){return e[0]}function $e(e){return e[e.length-1]}function ce(e){var o=e.value,a=e.grid,t=a===void 0||a,n=e.optionsList,u=e.setValue,s=e.locale,d=e.className,i=e.humanizeLabels,l=e.disabled,c=e.readOnly,b=e.leadingZero,p=e.clockFormat,y=e.period,v=e.unit,m=e.periodicityOnDoubleClick,x=e.mode,B=Ie(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),M=f.useMemo(function(){if(o&&Array.isArray(o))return o.map(function(D){return D.toString()})},[o]),g=f.useMemo(function(){return n?n.map(function(D,P){return{value:(v.min===0?P:P+1).toString(),label:D}}):he([],Array(v.total),!0).map(function(D,P){var T=v.min===0?P:P+1;return{value:T.toString(),label:ne(T,v,i,b,p)}})},[n,b,i,p]),h=JSON.stringify(s),O=f.useCallback(function(D){var P=D.value;if(!o||o[0]!==Number(P))return r.jsx(r.Fragment,{});var T=Ue(We(o,v),v,i,b,p),J=T.match(/^\*\/([0-9]+),?/)||[];return r.jsx("div",{children:J[1]?"".concat(s.everyText||A.everyText," ").concat(J[1]):T})},[o,h,i,b,p]),w=f.useCallback(function(D){var P=Array.isArray(D)?ye(D):[D],T=P;o&&(T=x==="single"?[]:he([],o,!0),P.forEach(function(J){var j=Number(J);T=o.some(function(L){return L===j})?T.filter(function(L){return L!==j}):ye(he(he([],T,!0),[j],!1))})),T.length===v.total?u([]):u(T)},[u,o]),k=f.useCallback(function(D){if(D!==0&&D!==1){for(var P=v.total+v.min,T=[],J=v.min;J<P;J++)J%D==0&&T.push(J);var j=o&&T&&o.length===T.length&&o.every(function(U,W){return U===T[W]}),L=T.length===g.length;u(L||j?[]:T)}else u([])},[o,g,u]),F=f.useRef([]),E=f.useCallback(function(D){if(!c){var P=F.current;P.push({time:new Date().getTime(),value:Number(D)});var T=window.setTimeout(function(){m&&P.length>1&&P[P.length-1].time-P[P.length-2].time<300?P[P.length-1].value===P[P.length-2].value?k(Number(D)):w([P[P.length-2].value,P[P.length-1].value]):w(Number(D)),F.current=[]},300);return function(){window.clearTimeout(T)}}},[F,w,k,c,m]),q=f.useCallback(function(){c||u([])},[u,c]),I=f.useMemo(function(){var D;return Z(((D={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(d,"-select")]=!!d,D))},[d]),H=f.useMemo(function(){var D;return Z(((D={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(v.type)]=!0,D["react-js-cron-custom-select-dropdown"]=!0,D["react-js-cron-custom-select-dropdown-".concat(v.type)]=!0,D["react-js-cron-custom-select-dropdown-minutes-large"]=v.type==="minutes"&&y!=="hour"&&y!=="day",D["react-js-cron-custom-select-dropdown-minutes-medium"]=v.type==="minutes"&&(y==="day"||y==="hour"),D["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=v.type==="hours"&&p==="12-hour-clock",D["react-js-cron-custom-select-dropdown-grid"]=!!t,D["".concat(d,"-select-dropdown")]=!!d,D["".concat(d,"-select-dropdown-").concat(v.type)]=!!d,D))},[d,t,p,y]);return r.jsx(C.Select,_({mode:x!=="single"||m?"multiple":void 0,allowClear:!c,virtual:!1,open:!c&&void 0,value:M,onClear:q,tagRender:O,className:I,popupClassName:H,options:g,showSearch:!1,showArrow:!c,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:E,onDeselect:E,disabled:l,dropdownAlign:v.type!=="minutes"&&v.type!=="hours"||y==="day"||y==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(v.type)},B))}function At(e){var o=e.value,a=e.setValue,t=e.locale,n=e.className,u=e.disabled,s=e.readOnly,d=e.leadingZero,i=e.clockFormat,l=e.period,c=e.periodicityOnDoubleClick,b=e.mode,p=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(n,"-field")]=!!n,y["".concat(n,"-hours")]=!!n,y))},[n]);return r.jsxs("div",_({className:p},{children:[t.prefixHours!==""&&r.jsx("span",{children:t.prefixHours||A.prefixHours}),r.jsx(ce,{placeholder:t.emptyHours||A.emptyHours,value:o,unit:oe[1],setValue:a,locale:t,className:n,disabled:u,readOnly:s,leadingZero:d,clockFormat:i,period:l,periodicityOnDoubleClick:c,mode:b})]}))}function Pt(e){var o=e.value,a=e.setValue,t=e.locale,n=e.className,u=e.disabled,s=e.readOnly,d=e.leadingZero,i=e.clockFormat,l=e.period,c=e.periodicityOnDoubleClick,b=e.mode,p=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(n,"-field")]=!!n,y["".concat(n,"-minutes")]=!!n,y))},[n]);return r.jsxs("div",_({className:p},{children:[l==="hour"?t.prefixMinutesForHourPeriod!==""&&r.jsx("span",{children:t.prefixMinutesForHourPeriod||A.prefixMinutesForHourPeriod}):t.prefixMinutes!==""&&r.jsx("span",{children:t.prefixMinutes||A.prefixMinutes}),r.jsx(ce,{placeholder:l==="hour"?t.emptyMinutesForHourPeriod||A.emptyMinutesForHourPeriod:t.emptyMinutes||A.emptyMinutes,value:o,unit:oe[0],setValue:a,locale:t,className:n,disabled:u,readOnly:s,leadingZero:d,clockFormat:i,period:l,periodicityOnDoubleClick:c,mode:b}),l==="hour"&&t.suffixMinutesForHourPeriod!==""&&r.jsx("span",{children:t.suffixMinutesForHourPeriod||A.suffixMinutesForHourPeriod})]}))}function Bt(e){var o=e.value,a=e.setValue,t=e.locale,n=e.className,u=e.weekDays,s=e.disabled,d=e.readOnly,i=e.leadingZero,l=e.period,c=e.periodicityOnDoubleClick,b=e.mode,p=!u||u.length===0,y=f.useMemo(function(){var x;return Z(((x={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!p})["".concat(n,"-field")]=!!n,x["".concat(n,"-month-days")]=!!n,x))},[n,p]),v=JSON.stringify(t),m=f.useMemo(function(){return p?t.emptyMonthDays||A.emptyMonthDays:t.emptyMonthDaysShort||A.emptyMonthDaysShort},[p,v]);return!d||o&&o.length>0||(!o||o.length===0)&&(!u||u.length===0)?r.jsxs("div",_({className:y},{children:[t.prefixMonthDays!==""&&r.jsx("span",{children:t.prefixMonthDays||A.prefixMonthDays}),r.jsx(ce,{placeholder:m,value:o,setValue:a,unit:oe[2],locale:t,className:n,disabled:s,readOnly:d,leadingZero:i,period:l,periodicityOnDoubleClick:c,mode:b})]})):null}function Tt(e){var o=e.value,a=e.setValue,t=e.locale,n=e.className,u=e.humanizeLabels,s=e.disabled,d=e.readOnly,i=e.period,l=e.periodicityOnDoubleClick,c=e.mode,b=t.months||A.months,p=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(n,"-field")]=!!n,y["".concat(n,"-months")]=!!n,y))},[n]);return r.jsxs("div",_({className:p},{children:[t.prefixMonths!==""&&r.jsx("span",{children:t.prefixMonths||A.prefixMonths}),r.jsx(ce,{placeholder:t.emptyMonths||A.emptyMonths,optionsList:b,grid:!1,value:o,unit:_(_({},oe[3]),{alt:t.altMonths||A.altMonths}),setValue:a,locale:t,className:n,humanizeLabels:u,disabled:s,readOnly:d,period:i,periodicityOnDoubleClick:l,mode:c})]}))}function Nt(e){var o=e.value,a=e.setValue,t=e.locale,n=e.className,u=e.disabled,s=e.readOnly,d=e.shortcuts,i=e.allowedPeriods,l=[];i.includes("year")&&l.push({value:"year",label:t.yearOption||A.yearOption}),i.includes("month")&&l.push({value:"month",label:t.monthOption||A.monthOption}),i.includes("week")&&l.push({value:"week",label:t.weekOption||A.weekOption}),i.includes("day")&&l.push({value:"day",label:t.dayOption||A.dayOption}),i.includes("hour")&&l.push({value:"hour",label:t.hourOption||A.hourOption}),i.includes("minute")&&l.push({value:"minute",label:t.minuteOption||A.minuteOption}),i.includes("reboot")&&d&&(d===!0||d.includes("@reboot"))&&l.push({value:"reboot",label:t.rebootOption||A.rebootOption});var c=f.useCallback(function(v){s||a(v)},[a,s]),b=f.useMemo(function(){var v;return Z(((v={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(n,"-field")]=!!n,v["".concat(n,"-period")]=!!n,v))},[n]),p=f.useMemo(function(){var v;return Z(((v={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":t.prefixPeriod===""})["".concat(n,"-select")]=!!n,v))},[n,t.prefixPeriod]),y=f.useMemo(function(){var v;return Z(((v={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(n,"-select-dropdown")]=!!n,v["".concat(n,"-select-dropdown-period")]=!!n,v))},[n]);return r.jsxs("div",_({className:b},{children:[t.prefixPeriod!==""&&r.jsx("span",{children:t.prefixPeriod||A.prefixPeriod}),r.jsx(C.Select,{defaultValue:o,value:o,onChange:c,options:l,className:p,popupClassName:y,disabled:u,showArrow:!s,open:!s&&void 0,"data-testid":"select-period"},JSON.stringify(t))]}))}function Ft(e){var o=e.value,a=e.setValue,t=e.locale,n=e.className,u=e.humanizeLabels,s=e.monthDays,d=e.disabled,i=e.readOnly,l=e.period,c=e.periodicityOnDoubleClick,b=e.mode,p=t.weekDays||A.weekDays,y=l==="week"||!s||s.length===0,v=f.useMemo(function(){var g;return Z(((g={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!y})["".concat(n,"-field")]=!!n,g["".concat(n,"-week-days")]=!!n,g))},[n,y]),m=JSON.stringify(t),x=f.useMemo(function(){return y?t.emptyWeekDays||A.emptyWeekDays:t.emptyWeekDaysShort||A.emptyWeekDaysShort},[y,m]),B=l==="week"||!i||o&&o.length>0||(!o||o.length===0)&&(!s||s.length===0),M=!i||s&&s.length>0||(!s||s.length===0)&&(!o||o.length===0);return B?r.jsxs("div",_({className:v},{children:[t.prefixWeekDays!==""&&(l==="week"||!M)&&r.jsx("span",{children:t.prefixWeekDays||A.prefixWeekDays}),t.prefixWeekDaysForMonthAndYearPeriod!==""&&l!=="week"&&M&&r.jsx("span",{children:t.prefixWeekDaysForMonthAndYearPeriod||A.prefixWeekDaysForMonthAndYearPeriod}),r.jsx(ce,{placeholder:x,optionsList:p,grid:!1,value:o,unit:_(_({},oe[4]),{alt:t.altWeekDays||A.altWeekDays}),setValue:a,locale:t,className:n,humanizeLabels:u,disabled:d,readOnly:i,period:l,periodicityOnDoubleClick:c,mode:b})]})):null}function Et(e){var o=e.clearButton,a=o===void 0||o,t=e.clearButtonProps,n=t===void 0?{}:t,u=e.clearButtonAction,s=u===void 0?"fill-with-every":u,d=e.locale,i=d===void 0?A:d,l=e.value,c=l===void 0?"":l,b=e.setValue,p=e.displayError,y=p===void 0||p,v=e.onError,m=e.className,x=e.defaultPeriod,B=x===void 0?"day":x,M=e.allowEmpty,g=M===void 0?"for-default-value":M,h=e.humanizeLabels,O=h===void 0||h,w=e.humanizeValue,k=w!==void 0&&w,F=e.disabled,E=F!==void 0&&F,q=e.readOnly,I=q!==void 0&&q,H=e.leadingZero,D=H!==void 0&&H,P=e.shortcuts,T=P===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:P,J=e.clockFormat,j=e.periodicityOnDoubleClick,L=j===void 0||j,U=e.mode,W=U===void 0?"multiple":U,ue=e.allowedDropdowns,Y=ue===void 0?["period","months","month-days","week-days","hours","minutes"]:ue,ae=e.allowedPeriods,_t=ae===void 0?["year","month","week","day","hour","minute","reboot"]:ae,se=f.useRef(c),Pe=f.useRef(B),Qe=f.useState(),R=Qe[0],ge=Qe[1],Re=f.useState(),de=Re[0],be=Re[1],et=f.useState(),xe=et[0],ke=et[1],tt=f.useState(),pe=tt[0],we=tt[1],ot=f.useState(),Ce=ot[0],Se=ot[1],rt=f.useState(),Oe=rt[0],Me=rt[1],nt=f.useState(!1),Be=nt[0],fe=nt[1],at=f.useState(!1),De=at[0],st=at[1],Jt=function(V){var K=f.useRef(V);return f.useEffect(function(){K.current=V},[V]),K.current}(De),lt=JSON.stringify(i);f.useEffect(function(){qe(c,fe,v,g,se,!0,i,T,Me,Se,be,ke,we,ge)},[]),f.useEffect(function(){c!==se.current&&qe(c,fe,v,g,se,!1,i,T,Me,Se,be,ke,we,ge)},[c,se,lt,g,T]),f.useEffect(function(){if(!(R||Oe||xe||de||pe||Ce)||De||Jt)De&&st(!1);else{var V=R||Pe.current,K=He(V,xe,de,pe,Ce,Oe,k);b(K,{selectedPeriod:V}),se.current=K,v&&v(void 0),fe(!1)}},[R,de,xe,pe,Ce,Oe,k,De]);var it=f.useCallback(function(){be(void 0),ke(void 0),we(void 0),Se(void 0),Me(void 0);var V="",K=R!=="reboot"&&R?R:Pe.current;K!==R&&ge(K),s==="fill-with-every"&&(V=He(K,void 0,void 0,void 0,void 0,void 0)),b(V,{selectedPeriod:K}),se.current=V,st(!0),g==="never"&&s==="empty"?(fe(!0),Ve(v,i)):(v&&v(void 0),fe(!1))},[R,b,v,s]),$t=f.useMemo(function(){var V;return Z(((V={"react-js-cron":!0,"react-js-cron-error":Be&&y,"react-js-cron-disabled":E,"react-js-cron-read-only":I})["".concat(m)]=!!m,V["".concat(m,"-error")]=Be&&y&&!!m,V["".concat(m,"-disabled")]=E&&!!m,V["".concat(m,"-read-only")]=I&&!!m,V))},[m,Be,y,E,I]),Te=n.className,ct=Ie(n,["className"]),ut=f.useMemo(function(){var V;return Z(((V={"react-js-cron-clear-button":!0})["".concat(m,"-clear-button")]=!!m,V["".concat(Te)]=!!Te,V))},[m,Te]),Zt=JSON.stringify(ct),dt=f.useMemo(function(){return a&&!I?r.jsx(C.Button,_({className:ut,danger:!0,type:"primary",disabled:E},ct,{onClick:it},{children:i.clearButtonText||A.clearButtonText})):null},[a,I,lt,ut,E,Zt,it]),z=R||Pe.current;return r.jsxs("div",_({className:$t},{children:[Y.includes("period")&&r.jsx(Nt,{value:z,setValue:ge,locale:i,className:m,disabled:E,readOnly:I,shortcuts:T,allowedPeriods:_t}),z==="reboot"?dt:r.jsxs(r.Fragment,{children:[z==="year"&&Y.includes("months")&&r.jsx(Tt,{value:xe,setValue:ke,locale:i,className:m,humanizeLabels:O,disabled:E,readOnly:I,period:z,periodicityOnDoubleClick:L,mode:W}),(z==="year"||z==="month")&&Y.includes("month-days")&&r.jsx(Bt,{value:de,setValue:be,locale:i,className:m,weekDays:pe,disabled:E,readOnly:I,leadingZero:D,period:z,periodicityOnDoubleClick:L,mode:W}),(z==="year"||z==="month"||z==="week")&&Y.includes("week-days")&&r.jsx(Ft,{value:pe,setValue:we,locale:i,className:m,humanizeLabels:O,monthDays:de,disabled:E,readOnly:I,period:z,periodicityOnDoubleClick:L,mode:W}),r.jsxs("div",{children:[z!=="minute"&&z!=="hour"&&Y.includes("hours")&&r.jsx(At,{value:Ce,setValue:Se,locale:i,className:m,disabled:E,readOnly:I,leadingZero:D,clockFormat:J,period:z,periodicityOnDoubleClick:L,mode:W}),z!=="minute"&&Y.includes("minutes")&&r.jsx(Pt,{value:Oe,setValue:Me,locale:i,period:z,className:m,disabled:E,readOnly:I,leadingZero:D,clockFormat:J,periodicityOnDoubleClick:L,mode:W}),dt]})]})]}))}const It={"zh-CN":{everyText:"每",emptyMonths:"每月",emptyMonthDays:"每日(月)",emptyMonthDaysShort:"每日",emptyWeekDays:"每天(周)",emptyWeekDaysShort:"每天(周)",emptyHours:"每小时",emptyMinutes:"每分钟",emptyMinutesForHourPeriod:"每",yearOption:"年",monthOption:"月",weekOption:"周",dayOption:"天",hourOption:"小时",minuteOption:"分钟",rebootOption:"重启",prefixPeriod:"每",prefixMonths:"的",prefixMonthDays:"的",prefixWeekDays:"的",prefixWeekDaysForMonthAndYearPeriod:"或者",prefixHours:"的",prefixMinutes:":",prefixMinutesForHourPeriod:"的",suffixMinutesForHourPeriod:"分钟",errorInvalidCron:"不符合 cron 规则的表达式",clearButtonText:"清空",weekDays:["周日","周一","周二","周三","周四","周五","周六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],altWeekDays:["周日","周一","周二","周三","周四","周五","周六"],altMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},Ze=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ge(e){return Ze.filter(a=>!isNaN(+a.value)).reverse().find(a=>!(e%a.value))}function jt(e){if(!e)return"none";if(e&&!isNaN(+e)){const o=Ge(e);return o?o.value:"none"}if(typeof e=="string")return"cron"}function Lt({value:e,onChange:o}){const{t:a}=Q(),t=Ge(e);return r.jsx(C.InputNumber,{value:e/t.value,onChange:n=>o(n*t.value),min:1,addonBefore:a("Every"),addonAfter:a(t.unitText),className:"auto-width"})}function Vt({value:e=null,onChange:o}){const{t:a}=Q(),t=jt(e),n=f.useCallback(s=>{if(s==="none"){o(null);return}if(s==="cron"){o("0 * * * * *");return}o(s)},[o]),u=It[localStorage.getItem("TACHYBASE_LOCALE")||"en-US"];return r.jsxs("fieldset",{className:S.css`
|
|
2
2
|
display: flex;
|
|
3
|
-
flex-direction: ${
|
|
3
|
+
flex-direction: ${t==="cron"?"column":"row"};
|
|
4
4
|
align-items: flex-start;
|
|
5
5
|
gap: 0.5em;
|
|
6
6
|
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
`,children:[
|
|
30
|
+
`,children:[r.jsx(C.Select,{value:t,onChange:n,className:"auto-width",options:Ze.map(s=>({value:s.value,label:a(s.text)}))}),t&&!isNaN(+t)?r.jsx(Lt,{value:e,onChange:o}):null,t==="cron"?r.jsx(Et,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:s=>o(`0 ${s}`),clearButton:!1,locale:u}):null]})}const Ye={name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.name","x-component-props":{}},title:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.title","x-component-props":{}},enabled:{type:"boolean","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.enabled","x-component-props":{}},repeat:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.repeat","x-component-props":{}},dumpRules:{title:'{{ t("Dump rules") }}',type:"array","x-component":"Checkbox.Group","x-decorator":"FormItem","x-component-props":{style:{display:"flex",flexDirection:"column"},options:"{{ dumpRuleTypes }}"},"x-reactions":e=>{const o=new Set(e.value||[]);o.add("required"),e.value=Array.from(o)}},maxNumber:{title:'{{ t("Max number") }}',description:'{{ t("Keep only the maximum number and delete the oldest versions with redundant time.") }}',type:"number","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.maxNumber","x-component-props":{}}},qt={type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"autoBackup:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:"autoBackup"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:$({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},type:"void"}}}},Ye)}}},Ht={type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{form:qt}}}},Ut={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"autoBackup:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"autoBackup"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:$({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}}},Ye)}}}}}}},Wt={type:"void",properties:{autoBackupTable:{type:"void","x-decorator":"TableBlockProvider","x-acl-action":"autoBackup:list","x-use-decorator-props":"useTableBlockDecoratorProps","x-decorator-props":{collection:"autoBackup",dataSource:"main",action:"list",params:{pageSize:20},rowKey:"id",showIndex:!0,dragSort:!1},"x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},create:Ht}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{"x-collection-field":"autoBackup.title","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},enabled:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{enabled:{"x-collection-field":"autoBackup.enabled","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},maxNumber:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{maxNumber:{"x-collection-field":"autoBackup.maxNumber","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:100,fixed:"right"},properties:{actions:{type:"void","x-component":"Space",properties:{editAction:Ut,delete:{type:"void",title:"Delete","x-action":"destroy","x-component":"Action.Link","x-component-props":{confirm:{title:"Delete",content:"Are you sure you want to delete it?"}},"x-decorator":"ACLActionProvider","x-use-component-props":"useDestroyActionProps"},clear:{type:"void",title:vt("Clear current times"),"x-action":"clearLimit","x-component":"Action.Link","x-component-props":{confirm:{title:"Clear",content:"Are you sure you want to clear current times?"}},"x-decorator":"ACLActionProvider","x-use-component-props":()=>{const{refresh:e}=S.useDataBlockRequest(),o=S.useDataBlockResource(),a=S.useRecord();return{onClick(){return G(this,null,function*(){yield o.clearLimitExecuted({id:a.id}),e()})}}}}}}}}}}}}}},zt=()=>{const{t:e}=Q(),{data:o,loading:a,refresh:t}=S.useRequest({url:"backupFiles:dumpableCollections"}),n=f.useMemo(()=>o?Object.keys(o).map(u=>({value:u,label:e(`${u}.title`),disabled:["required","skipped"].includes(u)})):[],[o]);return r.jsx(S.ExtendCollectionsProvider,{collections:[Mt],children:r.jsx(S.SchemaComponent,{schema:Wt,name:"auto-backup-table",components:{RepeatField:Vt},scope:{t:e,dumpRuleTypes:n}})})},Ke=function(e){return r.jsx(S.SchemaComponentOptions,{children:e.children})};Ke.displayName="DuplicatorProvider";class Xe extends S.Plugin{load(){return G(this,null,function*(){this.app.use(Ke),this.app.systemSettingsManager.add("system-services."+ie,{title:this.t("Backup & Restore"),icon:"CloudServerOutlined",sort:-50}),this.app.systemSettingsManager.add("system-services."+ie+".files",{title:this.t("Backup file"),icon:"CloudServerOutlined",Component:Ot,aclSnippet:"pm.backup.restore"}),this.app.systemSettingsManager.add("system-services."+ie+".auto",{title:this.t("Auto backup"),icon:"CloudServerOutlined",Component:zt,aclSnippet:"pm.backup.auto",sort:20})})}}N.PluginBackupRestoreClient=Xe,N.default=Xe,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.
|
|
4
|
-
"@ant-design/icons": "5.6.1",
|
|
3
|
+
"@tachybase/client": "1.6.0",
|
|
5
4
|
"@tego/client": "1.3.52",
|
|
5
|
+
"@ant-design/icons": "5.6.1",
|
|
6
6
|
"antd": "5.22.5",
|
|
7
|
+
"@tachybase/schema": "1.3.52",
|
|
7
8
|
"@tego/server": "1.3.52",
|
|
8
9
|
"dayjs": "1.11.13",
|
|
9
10
|
"lodash": "4.17.21",
|
|
10
|
-
"@tachybase/schema": "1.3.52",
|
|
11
11
|
"react-i18next": "16.2.1"
|
|
12
12
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
"Backup & Restore": "Backup & Restore",
|
|
6
6
|
"Backup file": "Backup file",
|
|
7
7
|
"Backup instructions": "Backup instructions",
|
|
8
|
+
"Backup progress": "Backup progress",
|
|
9
|
+
"Backup timeout": "Backup timeout",
|
|
8
10
|
"Business data": "Business data",
|
|
9
11
|
"Check all": "Check all",
|
|
10
12
|
"Check common": "Check common",
|
|
@@ -14,11 +16,16 @@
|
|
|
14
16
|
"Deleted successfully": "Deleted successfully",
|
|
15
17
|
"Done": "Done",
|
|
16
18
|
"Download": "Download",
|
|
19
|
+
"Download failed": "Download failed",
|
|
20
|
+
"Downloaded success!": "Downloaded successfully!",
|
|
21
|
+
"Downloading": "Downloading",
|
|
17
22
|
"File size": "File size",
|
|
18
23
|
"Learn more": "Learn more",
|
|
19
24
|
"New backup": "New backup",
|
|
25
|
+
"No progress update received for a long time": "No progress update received for a long time",
|
|
20
26
|
"Origin": "Origin",
|
|
21
27
|
"Plugin": "Plugin",
|
|
28
|
+
"Progress": "Progress",
|
|
22
29
|
"Refresh": "Refresh",
|
|
23
30
|
"Restore": "Restore",
|
|
24
31
|
"Restore backup from local": "Restore backup from local",
|
package/dist/locale/ja-JP.d.ts
CHANGED
|
@@ -16,10 +16,16 @@ declare const _default: {
|
|
|
16
16
|
Plugin: string;
|
|
17
17
|
'file uploaded successfully': string;
|
|
18
18
|
Download: string;
|
|
19
|
+
'Download failed': string;
|
|
20
|
+
Downloading: string;
|
|
19
21
|
'Restore backup from local': string;
|
|
20
22
|
'Backup instructions': string;
|
|
21
23
|
'File size': string;
|
|
22
24
|
'New backup': string;
|
|
25
|
+
'No progress update received for a long time': string;
|
|
26
|
+
'Backup progress': string;
|
|
27
|
+
'Backup timeout': string;
|
|
28
|
+
Progress: string;
|
|
23
29
|
Origin: string;
|
|
24
30
|
'Backing up': string;
|
|
25
31
|
'workflow.title': string;
|
package/dist/locale/ja-JP.js
CHANGED
|
@@ -38,10 +38,16 @@ var ja_JP_default = {
|
|
|
38
38
|
Plugin: "\u30D7\u30E9\u30B0\u30A4\u30F3",
|
|
39
39
|
"file uploaded successfully": "\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
|
|
40
40
|
Download: "\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",
|
|
41
|
+
"Download failed": "\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u5931\u6557",
|
|
42
|
+
Downloading: "\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u4E2D",
|
|
41
43
|
"Restore backup from local": "\u30ED\u30FC\u30AB\u30EB\u304B\u3089\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306B\u8FD4\u4FE1",
|
|
42
44
|
"Backup instructions": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u8AAC\u660E",
|
|
43
45
|
"File size": "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA",
|
|
44
46
|
"New backup": "\u65B0\u898F\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7",
|
|
47
|
+
"No progress update received for a long time": "\u9577\u6642\u9593\u9032\u6357\u66F4\u65B0\u3092\u53D7\u4FE1\u3057\u3066\u3044\u307E\u305B\u3093",
|
|
48
|
+
"Backup progress": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u9032\u6357",
|
|
49
|
+
"Backup timeout": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8",
|
|
50
|
+
Progress: "\u9032\u6357",
|
|
45
51
|
Origin: "\u30BD\u30FC\u30B9",
|
|
46
52
|
"Backing up": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u4E2D",
|
|
47
53
|
"workflow.title": "\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u5B9F\u884C\u30EC\u30B3\u30FC\u30C9",
|
package/dist/locale/ko_KR.json
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
"Backup & Restore": "백업 및 복원",
|
|
6
6
|
"Backup file": "백업 파일",
|
|
7
7
|
"Backup instructions": "백업 지침",
|
|
8
|
+
"Backup progress": "백업 진행률",
|
|
9
|
+
"Backup timeout": "백업 시간 초과",
|
|
8
10
|
"Basic Data": "기본 데이터",
|
|
9
11
|
"Business data": "비즈니스 데이터",
|
|
10
12
|
"Check all": "전체 선택",
|
|
@@ -14,12 +16,16 @@
|
|
|
14
16
|
"Delete": "삭제",
|
|
15
17
|
"Deleted successfully": "성공적으로 삭제됨",
|
|
16
18
|
"Download": "다운로드",
|
|
19
|
+
"Download failed": "다운로드 실패",
|
|
20
|
+
"Downloading": "다운로드 중",
|
|
17
21
|
"File size": "파일 크기",
|
|
18
22
|
"Learn more": "더 알아보기",
|
|
19
23
|
"New backup": "새로운 백업",
|
|
24
|
+
"No progress update received for a long time": "오랫동안 진행 상황 업데이트를 받지 못했습니다",
|
|
20
25
|
"Optional Data": "선택 데이터",
|
|
21
26
|
"Origin": "원본",
|
|
22
27
|
"Plugin": "플러그인",
|
|
28
|
+
"Progress": "진행률",
|
|
23
29
|
"Refresh": "새로 고침",
|
|
24
30
|
"Restore": "복원",
|
|
25
31
|
"Restore backup from local": "로컬에서 백업 복원",
|
package/dist/locale/pt-BR.d.ts
CHANGED
|
@@ -17,10 +17,16 @@ declare const locale: {
|
|
|
17
17
|
'file uploaded successfully': string;
|
|
18
18
|
'file upload failed': string;
|
|
19
19
|
Download: string;
|
|
20
|
+
'Download failed': string;
|
|
21
|
+
Downloading: string;
|
|
20
22
|
'Restore backup from local': string;
|
|
21
23
|
'Backup instructions': string;
|
|
22
24
|
'File size': string;
|
|
23
25
|
'New backup': string;
|
|
26
|
+
'No progress update received for a long time': string;
|
|
27
|
+
'Backup progress': string;
|
|
28
|
+
'Backup timeout': string;
|
|
29
|
+
Progress: string;
|
|
24
30
|
Origin: string;
|
|
25
31
|
'Backing up': string;
|
|
26
32
|
'workflow.title': string;
|
package/dist/locale/pt-BR.js
CHANGED
|
@@ -39,10 +39,16 @@ const locale = {
|
|
|
39
39
|
"file uploaded successfully": "O ficheiro foi enviado com sucesso",
|
|
40
40
|
"file upload failed": "O envio do ficheiro falhou",
|
|
41
41
|
Download: "download",
|
|
42
|
+
"Download failed": "Falha no download",
|
|
43
|
+
Downloading: "Baixando",
|
|
42
44
|
"Restore backup from local": "Restaurar a c\xF3pia de seguran\xE7a localmente",
|
|
43
45
|
"Backup instructions": "Instru\xE7\xF5es de c\xF3pia de seguran\xE7a",
|
|
44
46
|
"File size": "tamanho do ficheiro",
|
|
45
47
|
"New backup": "Nova C\xF3pia de Seguran\xE7a",
|
|
48
|
+
"No progress update received for a long time": "N\xE3o recebeu atualiza\xE7\xE3o de progresso por muito tempo",
|
|
49
|
+
"Backup progress": "Progresso do backup",
|
|
50
|
+
"Backup timeout": "Tempo limite de backup",
|
|
51
|
+
Progress: "Progresso",
|
|
46
52
|
Origin: "fonte",
|
|
47
53
|
"Backing up": "C\xF3pia de seguran\xE7a em curso",
|
|
48
54
|
"workflow.title": "Registros de execu\xE7\xE3o do fluxo de trabalho",
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
"Backup & Restore": "备份和还原",
|
|
8
8
|
"Backup file": "备份文件",
|
|
9
9
|
"Backup instructions": "备份说明",
|
|
10
|
+
"Backup progress": "备份进度",
|
|
11
|
+
"Backup timeout": "备份超时",
|
|
10
12
|
"Basic Data": "基础数据",
|
|
11
13
|
"Business data": "业务数据",
|
|
12
14
|
"By custom date": "自定义时间",
|
|
@@ -26,6 +28,9 @@
|
|
|
26
28
|
"Deleted successfully": "删除成功",
|
|
27
29
|
"Done": "完成",
|
|
28
30
|
"Download": "下载",
|
|
31
|
+
"Download failed": "下载失败",
|
|
32
|
+
"Downloaded success!": "下载成功!",
|
|
33
|
+
"Downloading": "下载中",
|
|
29
34
|
"Dump rules": "备份规则",
|
|
30
35
|
"End": "结束",
|
|
31
36
|
"Ends on": "结束于",
|
|
@@ -42,10 +47,12 @@
|
|
|
42
47
|
"New backup": "新建备份",
|
|
43
48
|
"No end": "不结束",
|
|
44
49
|
"No limit": "不限",
|
|
50
|
+
"No progress update received for a long time": "长时间未收到进度更新",
|
|
45
51
|
"No repeat": "不重复",
|
|
46
52
|
"Optional Data": "可选数据",
|
|
47
53
|
"Origin": "来源",
|
|
48
54
|
"Plugin": "插件",
|
|
55
|
+
"Progress": "进度",
|
|
49
56
|
"Refresh": "刷新",
|
|
50
57
|
"Repeat limit": "重复次数",
|
|
51
58
|
"Repeat mode": "重复模式",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-11-
|
|
1
|
+
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-11-20T08:10:24.690Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"archiver","version":"7.0.1","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 14"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^5.0.2","async":"^3.2.4","buffer-crc32":"^1.0.0","readable-stream":"^4.0.0","readdir-glob":"^1.1.2","tar-stream":"^3.0.0","zip-stream":"^6.0.1"},"devDependencies":{"archiver-jsdoc-theme":"1.1.3","chai":"4.4.1","jsdoc":"4.0.2","mkdirp":"3.0.1","mocha":"10.3.0","rimraf":"5.0.5","stream-bench":"0.1.2","tar":"6.2.0","yauzl":"3.1.2"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-11-
|
|
1
|
+
{"name":"archiver","version":"7.0.1","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 14"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^5.0.2","async":"^3.2.4","buffer-crc32":"^1.0.0","readable-stream":"^4.0.0","readdir-glob":"^1.1.2","tar-stream":"^3.0.0","zip-stream":"^6.0.1"},"devDependencies":{"archiver-jsdoc-theme":"1.1.3","chai":"4.4.1","jsdoc":"4.0.2","mkdirp":"3.0.1","mocha":"10.3.0","rimraf":"5.0.5","stream-bench":"0.1.2","tar":"6.2.0","yauzl":"3.1.2"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-11-20T08:10:24.576Z"}
|