@plutonhq/core-frontend 0.1.24 → 0.1.26

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.
Files changed (121) hide show
  1. package/dist-lib/@types/backups.d.ts +1 -1
  2. package/dist-lib/@types/backups.d.ts.map +1 -1
  3. package/dist-lib/components/Plan/BackupEvents/BackupEvents.d.ts.map +1 -1
  4. package/dist-lib/components/Plan/BackupEvents/BackupEvents.js +27 -27
  5. package/dist-lib/components/Plan/BackupEvents/BackupEvents.js.map +1 -1
  6. package/dist-lib/components/Plan/Backups/Backups.d.ts.map +1 -1
  7. package/dist-lib/components/Plan/Backups/Backups.js +189 -159
  8. package/dist-lib/components/Plan/Backups/Backups.js.map +1 -1
  9. package/dist-lib/components/Plan/PlanPruneModal/PlanPruneModal.d.ts.map +1 -1
  10. package/dist-lib/components/Plan/PlanPruneModal/PlanPruneModal.js +62 -26
  11. package/dist-lib/components/Plan/PlanPruneModal/PlanPruneModal.js.map +1 -1
  12. package/dist-lib/components/Plan/PlanSettings/PlanPruneSettings.d.ts.map +1 -1
  13. package/dist-lib/components/Plan/PlanSettings/PlanPruneSettings.js +138 -62
  14. package/dist-lib/components/Plan/PlanSettings/PlanPruneSettings.js.map +1 -1
  15. package/dist-lib/components/Plan/PlanSettings/PlanSettings.module.scss.js +42 -42
  16. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.d.ts +32 -0
  17. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.d.ts.map +1 -0
  18. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.js +252 -0
  19. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.js.map +1 -0
  20. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.d.ts +23 -0
  21. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.d.ts.map +1 -0
  22. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.js +72 -0
  23. package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.js.map +1 -0
  24. package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.d.ts.map +1 -1
  25. package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.js +188 -198
  26. package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.js.map +1 -1
  27. package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.module.scss.js +20 -64
  28. package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.module.scss.js.map +1 -1
  29. package/dist-lib/components/Restore/RestoredFileBrowser/RestoredFileBrowser.d.ts.map +1 -1
  30. package/dist-lib/components/Restore/RestoredFileBrowser/RestoredFileBrowser.js +125 -159
  31. package/dist-lib/components/Restore/RestoredFileBrowser/RestoredFileBrowser.js.map +1 -1
  32. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowser.module.scss.js +74 -0
  33. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowser.module.scss.js.map +1 -0
  34. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.d.ts +17 -0
  35. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.d.ts.map +1 -0
  36. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.js +57 -0
  37. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.js.map +1 -0
  38. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.d.ts +18 -0
  39. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.d.ts.map +1 -0
  40. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.js +24 -0
  41. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.js.map +1 -0
  42. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.d.ts +18 -0
  43. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.d.ts.map +1 -0
  44. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.js +37 -0
  45. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.js.map +1 -0
  46. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.d.ts +9 -0
  47. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.d.ts.map +1 -0
  48. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.js +15 -0
  49. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.js.map +1 -0
  50. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.d.ts +11 -0
  51. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.d.ts.map +1 -0
  52. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.js +18 -0
  53. package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.js.map +1 -0
  54. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.d.ts +12 -0
  55. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.d.ts.map +1 -0
  56. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.js +70 -0
  57. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.js.map +1 -0
  58. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.d.ts +22 -0
  59. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.d.ts.map +1 -0
  60. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.js +79 -0
  61. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.js.map +1 -0
  62. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.d.ts +6 -0
  63. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.d.ts.map +1 -0
  64. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.js +18 -0
  65. package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.js.map +1 -0
  66. package/dist-lib/components/common/SnapshotBrowser/index.d.ts +11 -0
  67. package/dist-lib/components/common/SnapshotBrowser/index.d.ts.map +1 -0
  68. package/dist-lib/components/common/StatusLabel/StatusLabel.d.ts +1 -1
  69. package/dist-lib/components/common/StatusLabel/StatusLabel.d.ts.map +1 -1
  70. package/dist-lib/components/common/StatusLabel/StatusLabel.js +17 -12
  71. package/dist-lib/components/common/StatusLabel/StatusLabel.js.map +1 -1
  72. package/dist-lib/components/common/form/NumberInput/NumberInput.module.scss.js +4 -4
  73. package/dist-lib/components/index.d.ts +10 -0
  74. package/dist-lib/components/index.d.ts.map +1 -1
  75. package/dist-lib/components.js +152 -132
  76. package/dist-lib/components.js.map +1 -1
  77. package/dist-lib/hooks/usePlanSingleActions.d.ts.map +1 -1
  78. package/dist-lib/hooks/usePlanSingleActions.js +21 -21
  79. package/dist-lib/hooks/usePlanSingleActions.js.map +1 -1
  80. package/dist-lib/services/backups.d.ts +4 -0
  81. package/dist-lib/services/backups.d.ts.map +1 -1
  82. package/dist-lib/services/backups.js +34 -25
  83. package/dist-lib/services/backups.js.map +1 -1
  84. package/dist-lib/services.js +113 -112
  85. package/dist-lib/styles/core-frontend.css +1 -1
  86. package/dist-lib/utils/index.d.ts +1 -0
  87. package/dist-lib/utils/index.d.ts.map +1 -1
  88. package/dist-lib/utils/snapshotDatabase.d.ts +16 -0
  89. package/dist-lib/utils/snapshotDatabase.d.ts.map +1 -0
  90. package/dist-lib/utils/snapshotDatabase.js +105 -0
  91. package/dist-lib/utils/snapshotDatabase.js.map +1 -0
  92. package/dist-lib/utils.js +24 -22
  93. package/dist-lib/utils.js.map +1 -1
  94. package/package.json +1 -1
  95. package/src/@types/backups.ts +1 -1
  96. package/src/components/Plan/BackupEvents/BackupEvents.tsx +5 -3
  97. package/src/components/Plan/Backups/Backups.tsx +40 -1
  98. package/src/components/Plan/PlanPruneModal/PlanPruneModal.tsx +54 -11
  99. package/src/components/Plan/PlanSettings/PlanPruneSettings.tsx +145 -61
  100. package/src/components/Plan/PlanSettings/PlanSettings.module.scss +5 -0
  101. package/src/components/Plan/SnapshotViewer/SnapshotViewer.tsx +344 -0
  102. package/src/components/Plan/SnapshotViewer/SnapshotViewerFile.tsx +89 -0
  103. package/src/components/Restore/RestoreFileSelector/RestoreFileSelector.tsx +82 -145
  104. package/src/components/Restore/RestoredFileBrowser/RestoredFileBrowser.tsx +71 -156
  105. package/src/components/common/SnapshotBrowser/SnapshotBrowser.module.scss +376 -0
  106. package/src/components/common/SnapshotBrowser/SnapshotBrowserDirectories.tsx +84 -0
  107. package/src/components/common/SnapshotBrowser/SnapshotBrowserFileList.tsx +52 -0
  108. package/src/components/common/SnapshotBrowser/SnapshotBrowserFileRow.tsx +44 -0
  109. package/src/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.tsx +22 -0
  110. package/src/components/common/SnapshotBrowser/SnapshotBrowserToolbar.tsx +29 -0
  111. package/src/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.ts +130 -0
  112. package/src/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.ts +154 -0
  113. package/src/components/common/SnapshotBrowser/hooks/useSnapshotSort.ts +24 -0
  114. package/src/components/common/SnapshotBrowser/index.ts +13 -0
  115. package/src/components/common/StatusLabel/StatusLabel.tsx +7 -1
  116. package/src/components/common/form/NumberInput/NumberInput.module.scss +1 -0
  117. package/src/components/index.ts +13 -0
  118. package/src/hooks/usePlanSingleActions.tsx +5 -3
  119. package/src/services/backups.ts +12 -0
  120. package/src/utils/index.ts +1 -0
  121. package/src/utils/snapshotDatabase.ts +201 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnapshotViewerFile.js","sources":["../../../../src/components/Plan/SnapshotViewer/SnapshotViewerFile.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport FileIcon from '../../common/FileIcon/FileIcon';\r\nimport { formatBytes, formatDateTime, timeAgo } from '../../../utils/helpers';\r\nimport { FileItem } from '../../../@types/system';\r\nimport classes from '../../common/SnapshotBrowser/SnapshotBrowser.module.scss';\r\n\r\ninterface SnapshotViewerFileProps {\r\n style: React.CSSProperties;\r\n file: FileItem | { isGoUp: true; path: string; name: string; isDirectory: true };\r\n isSync?: boolean;\r\n gridColumns: string;\r\n onGoUp: () => void;\r\n onDirectoryClick: (path: string) => void;\r\n onRestore: (file: FileItem) => void;\r\n renderFileActions?: (file: FileItem, meta: { fileExtension: string; isDirectory: boolean }) => ReactNode;\r\n}\r\n\r\nconst SnapshotViewerFile = ({\r\n style,\r\n file,\r\n isSync,\r\n gridColumns,\r\n onGoUp,\r\n onDirectoryClick,\r\n onRestore,\r\n renderFileActions,\r\n}: SnapshotViewerFileProps) => {\r\n if (!file) return null;\r\n\r\n if ('isGoUp' in file && file.isGoUp) {\r\n return (\r\n <div\r\n style={{ ...style, gridTemplateColumns: gridColumns }}\r\n className={`${classes.snapshotFile} ${classes.fileIsDir} ${classes.goUpButton}`}\r\n onClick={onGoUp}\r\n >\r\n <div className={classes.fileName}>...</div>\r\n <div></div>\r\n <div></div>\r\n {!isSync && <div></div>}\r\n </div>\r\n );\r\n }\r\n\r\n const typedFile = file as FileItem;\r\n const fileName = typedFile.name || typedFile.path.split('/').pop() || '';\r\n const isDirectory = typedFile.isDirectory;\r\n const fileExtension = fileName.split('.').pop() || '';\r\n\r\n return (\r\n <div\r\n style={{ ...style, gridTemplateColumns: gridColumns }}\r\n className={`${classes.snapshotFile} ${isDirectory ? classes.fileIsDir : ''}`}\r\n onClick={() => {\r\n if (isDirectory) {\r\n onDirectoryClick(typedFile.path);\r\n }\r\n }}\r\n >\r\n <div className={classes.fileName}>\r\n {isDirectory ? <Icon type={'fm-directory'} size={16} /> : <FileIcon filename={fileName} />} {fileName}\r\n </div>\r\n <div className={classes.fileModifiedAt} title={formatDateTime(typedFile.modifiedAt)}>\r\n <i>{timeAgo(new Date(typedFile.modifiedAt))}</i>\r\n </div>\r\n <div className={classes.fileSize}>{!isDirectory ? formatBytes(typedFile.size || 0) : ''}</div>\r\n {!isSync && (\r\n <div className={classes.fileActions}>\r\n {renderFileActions?.(typedFile, { fileExtension, isDirectory })}\r\n <button\r\n data-tooltip-id=\"htmlToolTip\"\r\n data-tooltip-place=\"top\"\r\n data-tooltip-delay-show={500}\r\n data-tooltip-html=\"Restore\"\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n onRestore(typedFile);\r\n }}\r\n >\r\n <Icon type={'restore'} size={16} />\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default SnapshotViewerFile;\r\n"],"names":["SnapshotViewerFile","style","file","isSync","gridColumns","onGoUp","onDirectoryClick","onRestore","renderFileActions","jsxs","classes","jsx","typedFile","fileName","isDirectory","fileExtension","Icon","FileIcon","formatDateTime","formatBytes","e"],"mappings":";;;;;AAkBA,MAAMA,IAAqB,CAAC;AAAA,EACzB,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,mBAAAC;AACH,MAA+B;AAC5B,MAAI,CAACN,EAAM,QAAO;AAElB,MAAI,YAAYA,KAAQA,EAAK;AAC1B,WACG,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,OAAO,EAAE,GAAGR,GAAO,qBAAqBG,EAAA;AAAA,QACxC,WAAW,GAAGM,EAAQ,YAAY,IAAIA,EAAQ,SAAS,IAAIA,EAAQ,UAAU;AAAA,QAC7E,SAASL;AAAA,QAET,UAAA;AAAA,UAAA,gBAAAM,EAAC,OAAA,EAAI,WAAWD,EAAQ,UAAU,UAAA,OAAG;AAAA,4BACpC,OAAA,EAAI;AAAA,4BACJ,OAAA,EAAI;AAAA,UACJ,CAACP,KAAU,gBAAAQ,EAAC,OAAA,CAAA,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAK1B,QAAMC,IAAYV,GACZW,IAAWD,EAAU,QAAQA,EAAU,KAAK,MAAM,GAAG,EAAE,IAAA,KAAS,IAChEE,IAAcF,EAAU,aACxBG,IAAgBF,EAAS,MAAM,GAAG,EAAE,SAAS;AAEnD,SACG,gBAAAJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,OAAO,EAAE,GAAGR,GAAO,qBAAqBG,EAAA;AAAA,MACxC,WAAW,GAAGM,EAAQ,YAAY,IAAII,IAAcJ,EAAQ,YAAY,EAAE;AAAA,MAC1E,SAAS,MAAM;AACZ,QAAII,KACDR,EAAiBM,EAAU,IAAI;AAAA,MAErC;AAAA,MAEA,UAAA;AAAA,QAAA,gBAAAH,EAAC,OAAA,EAAI,WAAWC,EAAQ,UACpB,UAAA;AAAA,UAAAI,IAAc,gBAAAH,EAACK,GAAA,EAAK,MAAM,gBAAgB,MAAM,IAAI,IAAK,gBAAAL,EAACM,GAAA,EAAS,UAAUJ,EAAA,CAAU;AAAA,UAAG;AAAA,UAAEA;AAAA,QAAA,GAChG;AAAA,0BACC,OAAA,EAAI,WAAWH,EAAQ,gBAAgB,OAAOQ,EAAeN,EAAU,UAAU,GAC/E,UAAA,gBAAAD,EAAC,KAAA,EAAG,YAAQ,IAAI,KAAKC,EAAU,UAAU,CAAC,GAAE,GAC/C;AAAA,QACA,gBAAAD,EAAC,OAAA,EAAI,WAAWD,EAAQ,UAAW,UAACI,IAAiD,KAAnCK,EAAYP,EAAU,QAAQ,CAAC,EAAI,CAAG;AAAA,QACvF,CAACT,KACC,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAQ,aACpB,UAAA;AAAA,UAAAF,KAAA,gBAAAA,EAAoBI,GAAW,EAAE,eAAAG,GAAe,aAAAD,EAAA;AAAA,UACjD,gBAAAH;AAAA,YAAC;AAAA,YAAA;AAAA,cACE,mBAAgB;AAAA,cAChB,sBAAmB;AAAA,cACnB,2BAAyB;AAAA,cACzB,qBAAkB;AAAA,cAClB,SAAS,CAACS,MAAM;AACb,gBAAAA,EAAE,gBAAA,GACFb,EAAUK,CAAS;AAAA,cACtB;AAAA,cAEA,UAAA,gBAAAD,EAACK,GAAA,EAAK,MAAM,WAAW,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,QACpC,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIZ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RestoreFileSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/Restore/RestoreFileSelector/RestoreFileSelector.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAM3D,UAAU,wBAAwB;IAC/B,QAAQ,EAAE;QACP,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;KACxB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CACrE;AAKD,QAAA,MAAM,mBAAmB,GAAI,0FAA0F,wBAAwB,4CAye9I,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"RestoreFileSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/Restore/RestoreFileSelector/RestoreFileSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAS3D,UAAU,wBAAwB;IAC/B,QAAQ,EAAE;QACP,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;KACxB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CACrE;AAMD,QAAA,MAAM,mBAAmB,GAAI,0FAA0F,wBAAwB,4CAua9I,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1,268 +1,258 @@
1
- import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
- import { useState as x, useMemo as C } from "react";
3
- import { FixedSizeList as ie } from "react-window";
4
- import $ from "../../common/Icon/Icon.js";
5
- import { calculateDirectorySizes as le, formatNumberToK as A, formatBytes as L, sortFileItems as V, formatDateTime as ne, isMobile as ae } from "../../../utils/helpers.js";
6
- import oe from "../../common/FileIcon/FileIcon.js";
7
- import c from "./RestoreFileSelector.module.scss.js";
8
- import { getPathSeparator as I, splitPath as g, getParentPath as M, normalizePath as P } from "../../../utils/restore.js";
9
- const de = ae(), he = de ? 65 : 45, Ne = ({ selected: T, files: o, isLoading: q, errorFetching: J, showChange: R, onSelect: O, fileSelectCondition: E }) => {
10
- const [p, b] = x(""), [k, Q] = x(""), [u, X] = x("name"), [y, _] = x("asc"), [m, Y] = x(() => ({
11
- include: new Set(T.includes),
12
- exclude: new Set(T.excludes)
1
+ import { jsxs as n, jsx as l, Fragment as ne } from "react/jsx-runtime";
2
+ import { useState as P, useMemo as b, useEffect as le } from "react";
3
+ import I from "../../common/Icon/Icon.js";
4
+ import { calculateDirectorySizes as ae, formatNumberToK as T, formatBytes as A, sortFileItems as O, formatDateTime as de, isMobile as me } from "../../../utils/helpers.js";
5
+ import ue from "../../common/FileIcon/FileIcon.js";
6
+ import o from "./RestoreFileSelector.module.scss.js";
7
+ import { getPathSeparator as V, splitPath as v, getParentPath as M, normalizePath as g } from "../../../utils/restore.js";
8
+ import { useSnapshotNavigation as he } from "../../common/SnapshotBrowser/hooks/useSnapshotNavigation.js";
9
+ import S from "../../common/SnapshotBrowser/SnapshotBrowser.module.scss.js";
10
+ import fe from "../../common/SnapshotBrowser/SnapshotBrowserToolbar.js";
11
+ import pe from "../../common/SnapshotBrowser/SnapshotBrowserDirectories.js";
12
+ import Se from "../../common/SnapshotBrowser/SnapshotBrowserFileList.js";
13
+ import ye from "../../common/SnapshotBrowser/SnapshotBrowserGoUpRow.js";
14
+ const ge = me(), xe = ge ? 65 : 45, W = "1fr 180px minmax(80px, auto)", ke = ({ selected: L, files: a, isLoading: q, errorFetching: J, showChange: R, onSelect: Q, fileSelectCondition: D }) => {
15
+ const [B, X] = P(""), [m, Y] = P("name"), [p, G] = P("asc"), [d, Z] = P(() => ({
16
+ include: new Set(L.includes),
17
+ exclude: new Set(L.excludes)
13
18
  }));
14
- console.log("[RestoreFileSelector] files :", o);
15
- const Z = (e) => {
19
+ console.log("[RestoreFileSelector] files :", a);
20
+ const ee = (e) => {
16
21
  const r = [];
17
- return o.forEach((t) => {
22
+ return a.forEach((t) => {
18
23
  (t.path.startsWith(e + "/") || t.path.startsWith(e + "\\")) && r.push(t.path);
19
24
  }), r;
20
- }, D = (e) => m.exclude.has(e) || Array.from(m.exclude).some(
25
+ }, N = (e) => d.exclude.has(e) || Array.from(d.exclude).some(
21
26
  (s) => e.startsWith(s + "/") || e.startsWith(s + "\\")
22
- ) ? !1 : m.include.size === 0 || m.include.has(e) ? !0 : Array.from(m.include).some(
27
+ ) ? !1 : d.include.size === 0 || d.include.has(e) ? !0 : Array.from(d.include).some(
23
28
  (s) => e.startsWith(s + "/") || e.startsWith(s + "\\")
24
- ), H = (e) => Array.from(m.include).find((r) => e.startsWith(r + "/") || e.startsWith(r + "\\")) || null, [z, j] = x(() => {
29
+ ), _ = (e) => Array.from(d.include).find((r) => e.startsWith(r + "/") || e.startsWith(r + "\\")) || null, [j, te] = P(() => {
25
30
  const e = /* @__PURE__ */ new Set();
26
- return o.forEach((r) => {
27
- const t = I(r.path), s = g(r.path);
31
+ return a.forEach((r) => {
32
+ const t = V(r.path), s = v(r.path);
28
33
  let i = "";
29
- s.forEach((l, f) => {
30
- i = i ? `${i}${t}${l}` : l, f < 3 && e.add(i);
34
+ s.forEach((c, h) => {
35
+ i = i ? `${i}${t}${c}` : c, h < 3 && e.add(i);
31
36
  });
32
37
  }), e;
33
- }), F = C(() => {
34
- const e = {}, r = le(o);
35
- return o.filter((t) => t.path.toLowerCase().includes(k.toLowerCase())).forEach((t) => {
38
+ }), x = b(() => {
39
+ const e = {}, r = ae(a);
40
+ return a.filter((t) => t.path.toLowerCase().includes(B.toLowerCase())).forEach((t) => {
36
41
  let s = t;
37
- const i = M(s.path), l = P(i) || "/";
38
- s.isDirectory && (s.size = r[s.path] || 0), e[l] || (e[l] = []), e[l].push(s);
42
+ const i = M(s.path), c = g(i) || "/";
43
+ s.isDirectory && (s.size = r[s.path] || 0), e[c] || (e[c] = []), e[c].push(s);
39
44
  }), e;
40
- }, [o, k]);
41
- console.log("fileSystem :", F);
42
- const B = C(() => {
43
- const r = o.filter((t) => t.isDirectory).map((t) => P(t.path)).sort((t, s) => {
44
- const i = g(t), l = g(s), f = Math.min(i.length, l.length);
45
- for (let d = 0; d < f; d++) {
46
- const h = i[d].localeCompare(l[d]);
47
- if (h !== 0)
48
- return h;
49
- }
50
- return i.length - l.length;
51
- });
52
- return console.log("SelectedFolder :", r[0]), b(r[0] || ""), r;
53
- }, [o]), w = C(() => {
45
+ }, [a, B]);
46
+ console.log("fileSystem :", x);
47
+ const y = b(() => a.filter((t) => t.isDirectory).map((t) => g(t.path)).sort((t, s) => {
48
+ const i = v(t), c = v(s), h = Math.min(i.length, c.length);
49
+ for (let f = 0; f < h; f++) {
50
+ const z = i[f].localeCompare(c[f]);
51
+ if (z !== 0)
52
+ return z;
53
+ }
54
+ return i.length - c.length;
55
+ }), [a]), { selectedFolder: u, setSelectedFolder: F, hasSubdirectories: se, isVisible: re, expandParentFolders: H, toggleFolder: ie } = he(
56
+ y,
57
+ j,
58
+ te,
59
+ { splitPath: v, getPathSeparator: V, hasLeadingSeparator: !1 }
60
+ );
61
+ le(() => {
62
+ y.length > 0 && u === "" && F(y[0]);
63
+ }, [y, u, F]);
64
+ const C = b(() => {
54
65
  let e = 0, r = 0;
55
- const t = E ? o.filter((s) => E(s)) : o;
66
+ const t = D ? a.filter((s) => D(s)) : a;
56
67
  return t.forEach((s) => {
57
- D(s.path) && (e++, s.isDirectory || (r += s.size));
68
+ N(s.path) && (e++, s.isDirectory || (r += s.size));
58
69
  }), {
59
70
  selectedFiles: e,
60
71
  totalFiles: t.length,
61
72
  selectedBytes: r,
62
73
  totalBytes: t.reduce((s, i) => s + (i.isDirectory ? 0 : i.size), 0)
63
74
  };
64
- }, [o, m]), ee = (e) => {
65
- const r = I(e);
66
- return B.some((t) => t !== e && t.startsWith(e + r));
67
- }, W = (e) => {
68
- u === e ? _(y === "asc" ? "desc" : "asc") : (X(e), _("asc"));
69
- }, G = (e) => {
70
- const r = new Set(z), t = I(e), s = g(e);
71
- let i = "";
72
- s.forEach((l) => {
73
- i = i ? `${i}${t}${l}` : l, r.add(i);
74
- }), j(r);
75
- }, te = (e) => {
76
- const r = new Set(z);
77
- z.has(e) ? r.delete(e) : r.add(e), j(r);
78
- }, se = (e) => {
79
- const r = I(e), s = g(e).slice(0, -1);
80
- let i = "";
81
- return s.every((l) => (i = i ? `${i}${r}${l}` : l, z.has(i)));
82
- }, K = (e, r) => {
83
- const t = { ...m }, s = D(e);
75
+ }, [a, d]), $ = (e) => {
76
+ m === e ? G(p === "asc" ? "desc" : "asc") : (Y(e), G("asc"));
77
+ }, U = (e, r) => {
78
+ const t = { ...d }, s = N(e);
84
79
  if (r) {
85
- const i = Z(e);
86
- s ? (t.exclude.add(e), t.include.delete(e), i.forEach((l) => {
87
- t.include.delete(l), t.exclude.delete(l);
88
- })) : (t.exclude.delete(e), t.include.size > 0 && (H(e) || t.include.add(e)), i.forEach((l) => {
89
- t.include.delete(l), t.exclude.delete(l);
80
+ const i = ee(e);
81
+ s ? (t.exclude.add(e), t.include.delete(e), i.forEach((c) => {
82
+ t.include.delete(c), t.exclude.delete(c);
83
+ })) : (t.exclude.delete(e), t.include.size > 0 && (_(e) || t.include.add(e)), i.forEach((c) => {
84
+ t.include.delete(c), t.exclude.delete(c);
90
85
  }));
91
86
  } else
92
- s ? (t.exclude.add(e), t.include.delete(e)) : (t.exclude.delete(e), t.include.size > 0 ? H(e) || t.include.add(e) : Array.from(t.exclude).some(
93
- (l) => e.startsWith(l + "/") || e.startsWith(l + "\\")
87
+ s ? (t.exclude.add(e), t.include.delete(e)) : (t.exclude.delete(e), t.include.size > 0 ? _(e) || t.include.add(e) : Array.from(t.exclude).some(
88
+ (c) => e.startsWith(c + "/") || e.startsWith(c + "\\")
94
89
  ) && t.include.add(e));
95
- Y({
90
+ Z({
96
91
  include: new Set(t.include),
97
92
  exclude: new Set(t.exclude)
98
- }), O({
93
+ }), Q({
99
94
  includes: t.include,
100
95
  excludes: t.exclude
101
96
  });
102
- }, re = (e) => {
97
+ }, ce = (e) => {
103
98
  let r = [];
104
- !e && F[""] ? r = F[""] : r = F[e] || [];
99
+ !e && x[""] ? r = x[""] : r = x[e] || [];
105
100
  const t = r.filter((i) => i.isDirectory), s = r.filter((i) => !i.isDirectory);
106
101
  return [
107
- ...V(t, u, y),
108
- ...V(s, u, y)
102
+ ...O(t, m, p),
103
+ ...O(s, m, p)
109
104
  ];
110
- }, U = C(() => {
111
- if (!p) return [];
112
- const e = re(p);
113
- return M(p) !== p ? [null, ...e] : e;
114
- }, [p, F, u, y]), ce = ({ index: e, style: r }) => {
115
- const t = U[e];
105
+ }, K = b(() => {
106
+ if (!u) return [];
107
+ const e = ce(u);
108
+ return M(u) !== u ? [null, ...e] : e;
109
+ }, [u, x, m, p]), oe = ({ index: e, style: r }) => {
110
+ const t = K[e];
116
111
  if (t === null)
117
- return /* @__PURE__ */ n(
118
- "div",
112
+ return /* @__PURE__ */ l(
113
+ ye,
119
114
  {
120
115
  style: r,
121
- className: `${c.file} ${c.fileIsDir} ${c.goUpButton}`,
122
- onClick: () => {
123
- const N = M(p), S = P(N);
124
- !S || S === "" || (G(S), b(S));
116
+ onGoUp: () => {
117
+ const k = M(u), E = g(k);
118
+ !E || E === "" || (H(E), F(E));
125
119
  },
126
- children: /* @__PURE__ */ n("div", { className: c.fileName, children: "..." })
120
+ gridTemplateColumns: W
127
121
  }
128
122
  );
129
- const s = t, i = g(s.path), l = i[i.length - 1], f = P(s.path), d = B.includes(f), h = D(s.path), v = E ? E(s) : !0;
130
- return /* @__PURE__ */ a(
123
+ const s = t, i = v(s.path), c = i[i.length - 1], h = g(s.path), f = y.includes(h), z = N(s.path), w = D ? D(s) : !0;
124
+ return /* @__PURE__ */ n(
131
125
  "div",
132
126
  {
133
- style: r,
134
- className: `${c.file} ${d ? c.fileIsDir : ""} ${R && s.changeType === "modified" ? c.fileModified : ""} ${R && s.changeType === "removed" ? c.fileRemoved : ""}`,
127
+ style: { ...r, gridTemplateColumns: W },
128
+ className: `${S.snapshotFile} ${f ? S.fileIsDir : ""} ${R && s.changeType === "modified" ? o.fileModified : ""} ${R && s.changeType === "removed" ? o.fileRemoved : ""}`,
135
129
  onClick: () => {
136
- d && (G(f), b(f));
130
+ f && (H(h), F(h));
137
131
  },
138
132
  children: [
139
- /* @__PURE__ */ a("div", { className: c.fileName, children: [
140
- /* @__PURE__ */ n(
133
+ /* @__PURE__ */ n("div", { className: S.fileName, children: [
134
+ /* @__PURE__ */ l(
141
135
  "button",
142
136
  {
143
- className: `${c.selectButton} ${h ? c.selected : ""} ${v ? "" : c.notSelectable}`,
144
- onClick: (N) => {
145
- v && (N.stopPropagation(), K(s.path, !1));
137
+ className: `${o.selectButton} ${z ? o.selected : ""} ${w ? "" : o.notSelectable}`,
138
+ onClick: (k) => {
139
+ w && (k.stopPropagation(), U(s.path, !1));
146
140
  },
147
- disabled: !v,
148
- children: v ? /* @__PURE__ */ n($, { type: h ? "check-circle-filled" : "check-circle", size: 13 }) : null
141
+ disabled: !w,
142
+ children: w ? /* @__PURE__ */ l(I, { type: z ? "check-circle-filled" : "check-circle", size: 13 }) : null
149
143
  }
150
144
  ),
151
- d ? /* @__PURE__ */ n($, { type: d ? "fm-directory" : "fm-file", size: 16 }) : /* @__PURE__ */ n(oe, { filename: l || "" }),
145
+ f ? /* @__PURE__ */ l(I, { type: f ? "fm-directory" : "fm-file", size: 16 }) : /* @__PURE__ */ l(ue, { filename: c || "" }),
152
146
  " ",
153
- l
147
+ c
154
148
  ] }),
155
- /* @__PURE__ */ n("div", { className: c.fileModified, children: ne(s.modifiedAt) }),
156
- /* @__PURE__ */ n("div", { className: c.fileSize, children: L(s.size || 0) })
149
+ /* @__PURE__ */ l("div", { className: o.fileModified, children: de(s.modifiedAt) }),
150
+ /* @__PURE__ */ l("div", { className: o.fileSize, children: A(s.size || 0) })
157
151
  ]
158
152
  },
159
153
  s.path
160
154
  );
161
155
  };
162
- return /* @__PURE__ */ a("div", { className: c.restoreFileSelector, children: [
163
- q && /* @__PURE__ */ a("div", { className: c.loader, children: [
164
- /* @__PURE__ */ n($, { type: "loading", size: 24 }),
156
+ return /* @__PURE__ */ n("div", { className: o.restoreFileSelector, children: [
157
+ q && /* @__PURE__ */ n("div", { className: o.loader, children: [
158
+ /* @__PURE__ */ l(I, { type: "loading", size: 24 }),
165
159
  " Loading Snapshot Content.."
166
160
  ] }),
167
- /* @__PURE__ */ a("div", { className: c.restoredFileBrowser, children: [
168
- /* @__PURE__ */ a("div", { className: c.toolbar, children: [
169
- /* @__PURE__ */ n("div", { className: c.toolbarLeft, children: /* @__PURE__ */ a("div", { className: c.stats, children: [
170
- /* @__PURE__ */ n("strong", { children: "Summary: " }),
171
- A(w.selectedFiles),
172
- "/",
173
- A(w.totalFiles),
174
- " Items ",
175
- " • ",
176
- L(w.selectedBytes),
177
- "/",
178
- L(w.totalBytes),
179
- m.exclude.size > 0 && /* @__PURE__ */ a("div", { className: c.excludedStat, children: [
161
+ /* @__PURE__ */ n("div", { className: S.snapshotBrowser, children: [
162
+ /* @__PURE__ */ l(
163
+ fe,
164
+ {
165
+ search: B,
166
+ onSearchChange: X,
167
+ leftContent: /* @__PURE__ */ n("div", { className: S.stats, children: [
168
+ /* @__PURE__ */ l("strong", { children: "Summary: " }),
169
+ T(C.selectedFiles),
170
+ "/",
171
+ T(C.totalFiles),
172
+ " Items ",
180
173
  " • ",
181
- /* @__PURE__ */ a("span", { children: [
182
- "Excluded:",
183
- " ",
184
- /* @__PURE__ */ a("i", { title: Array.from(m.exclude).join(`
174
+ A(C.selectedBytes),
175
+ "/",
176
+ A(C.totalBytes),
177
+ d.exclude.size > 0 && /* @__PURE__ */ n("div", { className: o.excludedStat, children: [
178
+ " • ",
179
+ /* @__PURE__ */ n("span", { children: [
180
+ "Excluded:",
181
+ " ",
182
+ /* @__PURE__ */ n("i", { title: Array.from(d.exclude).join(`
185
183
  `), children: [
186
- A(m.exclude.size),
187
- " Items"
184
+ T(d.exclude.size),
185
+ " Items"
186
+ ] })
188
187
  ] })
189
188
  ] })
190
189
  ] })
191
- ] }) }),
192
- /* @__PURE__ */ n("div", { className: c.toolbarRight, children: /* @__PURE__ */ a("div", { className: c.search, children: [
193
- /* @__PURE__ */ n($, { type: "search", size: 16 }),
194
- /* @__PURE__ */ n("input", { type: "text", placeholder: "Search in current Directory...", value: k, onChange: (e) => Q(e.target.value) })
195
- ] }) })
196
- ] }),
197
- /* @__PURE__ */ a("div", { className: c.browserContent, children: [
198
- /* @__PURE__ */ a("div", { className: `${c.sidebar} styled__scrollbar`, children: [
199
- /* @__PURE__ */ n("div", { className: c.sidebarHeader, children: "Directories" }),
200
- B.map((e) => {
201
- var d;
202
- const r = g(e), t = r[r.length - 1], s = r.length - 1, i = z.has(e), l = ee(e), f = D(((d = o.find((h) => h.isDirectory && P(h.path) === e)) == null ? void 0 : d.path) || e);
203
- return s === 0 || se(e) ? /* @__PURE__ */ a(
204
- "div",
205
- {
206
- className: `${c.directory} ${p === e ? c.selected : ""} ${l ? "" : c.directoryEmpty}`,
207
- style: { paddingLeft: `${s * 20}px` },
208
- onClick: () => b(e),
209
- children: [
210
- l ? /* @__PURE__ */ n(
211
- "button",
212
- {
213
- className: `${c.toggleButton} ${i ? c.active : ""}`,
214
- onClick: (h) => {
215
- h.stopPropagation(), te(e);
216
- },
217
- children: i ? "-" : "+"
218
- }
219
- ) : /* @__PURE__ */ n("span", { className: `${c.togglePlaceholder}` }),
220
- /* @__PURE__ */ a("div", { className: c.dirName, children: [
221
- /* @__PURE__ */ n($, { type: "fm-directory", size: 14 }),
222
- /* @__PURE__ */ n(
223
- "button",
224
- {
225
- className: `${c.selectButton} ${f ? c.selected : ""}`,
226
- onClick: (h) => {
227
- var N;
228
- h.stopPropagation();
229
- const v = ((N = o.find((S) => S.isDirectory && P(S.path) === e)) == null ? void 0 : N.path) || e;
230
- K(v, !0);
231
- },
232
- children: /* @__PURE__ */ n($, { type: f ? "check-circle-filled" : "check-circle", size: 13 })
233
- }
234
- ),
235
- t
236
- ] })
237
- ]
238
- },
239
- e
240
- ) : null;
241
- })
242
- ] }),
243
- /* @__PURE__ */ n("div", { className: `${c.content} styled__scrollbar`, children: /* @__PURE__ */ a("div", { className: c.fileList, children: [
244
- /* @__PURE__ */ a("div", { className: c.header, children: [
245
- /* @__PURE__ */ a("div", { onClick: () => W("name"), className: u === "name" ? c.activeSort : "", children: [
246
- "Name ",
247
- u === "name" && (y === "asc" ? "↑" : "↓")
248
- ] }),
249
- /* @__PURE__ */ a("div", { onClick: () => W("modifiedAt"), className: u === "modifiedAt" ? c.activeSort : "", children: [
250
- "Last Modified ",
251
- u === "modifiedAt" && (y === "asc" ? "↑" : "↓")
252
- ] }),
253
- /* @__PURE__ */ a("div", { onClick: () => W("size"), className: u === "size" ? c.activeSort : "", children: [
254
- "Size ",
255
- u === "size" && (y === "asc" ? "↑" : "↓")
256
- ] })
257
- ] }),
258
- p ? /* @__PURE__ */ n(ie, { height: window.innerHeight - 370, itemCount: U.length, itemSize: he, width: "100%", children: ce }) : /* @__PURE__ */ n("div", { className: c.fileListEmpty, children: "Select a folder from the left to browse it's content" }),
259
- J && /* @__PURE__ */ n("div", { className: c.error, children: "Failed to load files. Please try again." })
260
- ] }) })
190
+ }
191
+ ),
192
+ /* @__PURE__ */ n("div", { className: S.browserContent, children: [
193
+ /* @__PURE__ */ l(
194
+ pe,
195
+ {
196
+ directories: y,
197
+ selectedFolder: u,
198
+ expandedFolders: j,
199
+ onDirectoryClick: (e) => F(e),
200
+ onToggleFolder: ie,
201
+ isVisible: re,
202
+ hasSubdirectories: se,
203
+ renderDirectoryExtra: (e) => {
204
+ var t;
205
+ const r = N(((t = a.find((s) => s.isDirectory && g(s.path) === e)) == null ? void 0 : t.path) || e);
206
+ return /* @__PURE__ */ l(
207
+ "button",
208
+ {
209
+ className: `${o.selectButton} ${r ? o.selected : ""}`,
210
+ onClick: (s) => {
211
+ var c;
212
+ s.stopPropagation();
213
+ const i = ((c = a.find((h) => h.isDirectory && g(h.path) === e)) == null ? void 0 : c.path) || e;
214
+ U(i, !0);
215
+ },
216
+ children: /* @__PURE__ */ l(I, { type: r ? "check-circle-filled" : "check-circle", size: 13 })
217
+ }
218
+ );
219
+ }
220
+ }
221
+ ),
222
+ /* @__PURE__ */ n("div", { className: `${S.content} styled__scrollbar`, children: [
223
+ /* @__PURE__ */ l(
224
+ Se,
225
+ {
226
+ files: K,
227
+ height: window.innerHeight - 370,
228
+ itemSize: xe,
229
+ headerContent: /* @__PURE__ */ n(ne, { children: [
230
+ /* @__PURE__ */ n("div", { onClick: () => $("name"), className: m === "name" ? o.activeSort : "", children: [
231
+ "Name ",
232
+ m === "name" && (p === "asc" ? "↑" : "↓")
233
+ ] }),
234
+ /* @__PURE__ */ n("div", { onClick: () => $("modifiedAt"), className: m === "modifiedAt" ? o.activeSort : "", children: [
235
+ "Last Modified ",
236
+ m === "modifiedAt" && (p === "asc" ? "↑" : "↓")
237
+ ] }),
238
+ /* @__PURE__ */ n("div", { onClick: () => $("size"), className: m === "size" ? o.activeSort : "", children: [
239
+ "Size ",
240
+ m === "size" && (p === "asc" ? "↑" : "↓")
241
+ ] })
242
+ ] }),
243
+ renderRow: oe,
244
+ selectedFolder: u || null,
245
+ gridTemplateColumns: W,
246
+ emptyMessage: "Select a folder from the left to browse it's content"
247
+ }
248
+ ),
249
+ J && /* @__PURE__ */ l("div", { className: o.error, children: "Failed to load files. Please try again." })
250
+ ] })
261
251
  ] })
262
252
  ] })
263
253
  ] });
264
254
  };
265
255
  export {
266
- Ne as default
256
+ ke as default
267
257
  };
268
258
  //# sourceMappingURL=RestoreFileSelector.js.map