@plutonhq/core-frontend 0.1.23 → 0.1.25
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-lib/@types/index.js +4 -1
- package/dist-lib/@types/index.js.map +1 -1
- package/dist-lib/@types/settings.d.ts +14 -0
- package/dist-lib/@types/settings.d.ts.map +1 -1
- package/dist-lib/@types/settings.js +34 -0
- package/dist-lib/@types/settings.js.map +1 -0
- package/dist-lib/components/Plan/Backups/Backups.d.ts.map +1 -1
- package/dist-lib/components/Plan/Backups/Backups.js +189 -159
- package/dist-lib/components/Plan/Backups/Backups.js.map +1 -1
- package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.d.ts.map +1 -1
- package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.js +148 -90
- package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.js.map +1 -1
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.d.ts +32 -0
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.d.ts.map +1 -0
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.js +252 -0
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewer.js.map +1 -0
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.d.ts +23 -0
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.d.ts.map +1 -0
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.js +72 -0
- package/dist-lib/components/Plan/SnapshotViewer/SnapshotViewerFile.js.map +1 -0
- package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.d.ts.map +1 -1
- package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.js +188 -198
- package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.js.map +1 -1
- package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.module.scss.js +20 -64
- package/dist-lib/components/Restore/RestoreFileSelector/RestoreFileSelector.module.scss.js.map +1 -1
- package/dist-lib/components/Restore/RestoredFileBrowser/RestoredFileBrowser.d.ts.map +1 -1
- package/dist-lib/components/Restore/RestoredFileBrowser/RestoredFileBrowser.js +125 -159
- package/dist-lib/components/Restore/RestoredFileBrowser/RestoredFileBrowser.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.d.ts.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.js +52 -47
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.module.scss.js +12 -6
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.module.scss.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.d.ts +9 -0
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.d.ts.map +1 -0
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.js +79 -0
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.js.map +1 -0
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.d.ts +4 -3
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.d.ts.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.js +37 -35
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.d.ts +10 -0
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.d.ts.map +1 -0
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.js +49 -0
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.js.map +1 -0
- package/dist-lib/components/Storage/EditStorage/EditStorage.js +10 -10
- package/dist-lib/components/Storage/EditStorage/EditStorage.js.map +1 -1
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowser.module.scss.js +74 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowser.module.scss.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.d.ts +17 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.js +57 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserDirectories.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.d.ts +18 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.js +24 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileList.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.d.ts +18 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.js +37 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserFileRow.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.d.ts +9 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.js +15 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.d.ts +11 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.js +18 -0
- package/dist-lib/components/common/SnapshotBrowser/SnapshotBrowserToolbar.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.d.ts +12 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.js +70 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.d.ts +22 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.js +79 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.d.ts +6 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.d.ts.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.js +18 -0
- package/dist-lib/components/common/SnapshotBrowser/hooks/useSnapshotSort.js.map +1 -0
- package/dist-lib/components/common/SnapshotBrowser/index.d.ts +11 -0
- package/dist-lib/components/common/SnapshotBrowser/index.d.ts.map +1 -0
- package/dist-lib/components/index.d.ts +12 -0
- package/dist-lib/components/index.d.ts.map +1 -1
- package/dist-lib/components.js +152 -128
- package/dist-lib/components.js.map +1 -1
- package/dist-lib/hooks/usePlanSingleActions.d.ts.map +1 -1
- package/dist-lib/hooks/usePlanSingleActions.js +21 -21
- package/dist-lib/hooks/usePlanSingleActions.js.map +1 -1
- package/dist-lib/services/backups.d.ts +4 -0
- package/dist-lib/services/backups.d.ts.map +1 -1
- package/dist-lib/services/backups.js +34 -25
- package/dist-lib/services/backups.js.map +1 -1
- package/dist-lib/services/settings.d.ts +3 -2
- package/dist-lib/services/settings.d.ts.map +1 -1
- package/dist-lib/services/settings.js +0 -1
- package/dist-lib/services/settings.js.map +1 -1
- package/dist-lib/services.js +113 -112
- package/dist-lib/styles/core-frontend.css +1 -1
- package/dist-lib/utils/index.d.ts +1 -0
- package/dist-lib/utils/index.d.ts.map +1 -1
- package/dist-lib/utils/snapshotDatabase.d.ts +16 -0
- package/dist-lib/utils/snapshotDatabase.d.ts.map +1 -0
- package/dist-lib/utils/snapshotDatabase.js +105 -0
- package/dist-lib/utils/snapshotDatabase.js.map +1 -0
- package/dist-lib/utils.js +24 -22
- package/dist-lib/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/@types/settings.ts +43 -0
- package/src/components/Plan/Backups/Backups.tsx +40 -1
- package/src/components/Plan/PlanSettings/PlanNotificationSettings.tsx +65 -0
- package/src/components/Plan/SnapshotViewer/SnapshotViewer.tsx +344 -0
- package/src/components/Plan/SnapshotViewer/SnapshotViewerFile.tsx +89 -0
- package/src/components/Restore/RestoreFileSelector/RestoreFileSelector.tsx +82 -145
- package/src/components/Restore/RestoredFileBrowser/RestoredFileBrowser.tsx +71 -156
- package/src/components/Settings/IntegrationSettings/IntegrationSettings.module.scss +16 -0
- package/src/components/Settings/IntegrationSettings/IntegrationSettings.tsx +45 -42
- package/src/components/Settings/IntegrationSettings/NtfySettings.tsx +106 -0
- package/src/components/Settings/IntegrationSettings/SMTPSettings.tsx +28 -19
- package/src/components/Settings/IntegrationSettings/ValidateEmailIntegration.tsx +58 -0
- package/src/components/Storage/EditStorage/EditStorage.tsx +1 -1
- package/src/components/common/SnapshotBrowser/SnapshotBrowser.module.scss +376 -0
- package/src/components/common/SnapshotBrowser/SnapshotBrowserDirectories.tsx +84 -0
- package/src/components/common/SnapshotBrowser/SnapshotBrowserFileList.tsx +52 -0
- package/src/components/common/SnapshotBrowser/SnapshotBrowserFileRow.tsx +44 -0
- package/src/components/common/SnapshotBrowser/SnapshotBrowserGoUpRow.tsx +22 -0
- package/src/components/common/SnapshotBrowser/SnapshotBrowserToolbar.tsx +29 -0
- package/src/components/common/SnapshotBrowser/hooks/useSnapshotDatabase.ts +130 -0
- package/src/components/common/SnapshotBrowser/hooks/useSnapshotNavigation.ts +154 -0
- package/src/components/common/SnapshotBrowser/hooks/useSnapshotSort.ts +24 -0
- package/src/components/common/SnapshotBrowser/index.ts +13 -0
- package/src/components/index.ts +15 -0
- package/src/hooks/usePlanSingleActions.tsx +5 -3
- package/src/services/backups.ts +12 -0
- package/src/services/settings.ts +2 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/snapshotDatabase.ts +201 -0
- /package/dist-lib/providers/{azureBlob.png → azureblob.png} +0 -0
- /package/dist-lib/providers/{azureFiles.png → azurefiles.png} +0 -0
- /package/dist-lib/providers/{files.png → filescom.png} +0 -0
- /package/dist-lib/providers/{oracle.png → oracleobjectstorage.png} +0 -0
- /package/dist-lib/providers/{proton.png → protondrive.png} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanNotificationSettings.js","sources":["../../../../src/components/Plan/PlanSettings/PlanNotificationSettings.tsx"],"sourcesContent":["import classes from './PlanSettings.module.scss';\r\nimport Select from '../../common/form/Select/Select';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Toggle from '../../common/form/Toggle/Toggle';\r\nimport { PlanNotification, PlanNotificationCase } from '../../../@types/plans';\r\nimport { NavLink } from 'react-router';\r\nimport PlanNotificationSettingsTester from './PlanNotificationSettingsTester';\r\nimport { Icon } from '../..';\r\n\r\ninterface PlanNotificationSettingsProps {\r\n types: string[];\r\n isSync: boolean;\r\n notificationType?: 'backup' | 'integrity';\r\n admin_email?: string;\r\n planID?: string;\r\n notificationSettings: PlanNotification;\r\n onUpdate: (notificationSettings: PlanNotification) => void;\r\n}\r\n\r\nconst PlanNotificationSettings = ({\r\n planID,\r\n isSync,\r\n types = [],\r\n admin_email = '',\r\n notificationSettings,\r\n notificationType = 'backup',\r\n onUpdate,\r\n}: PlanNotificationSettingsProps) => {\r\n const hasConnectedIntegrations = types.length > 0;\r\n const defaultEmail = !hasConnectedIntegrations && admin_email ? admin_email : '';\r\n\r\n const updateNotificationEmails = (emails: string) => {\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, emails } });\r\n };\r\n\r\n const caseOptions = [\r\n { label: 'On Start', value: 'start' },\r\n { label: 'On End', value: 'end' },\r\n { label: 'On Both Start & End', value: 'both' },\r\n { label: 'On Success Only', value: 'success' },\r\n { label: 'On Failure Only', value: 'failure' },\r\n ];\r\n\r\n return (\r\n <>\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"email\" size={14} />\r\n <Toggle\r\n label=\"Enable Email Notifications\"\r\n fieldValue={notificationSettings?.email?.enabled || false}\r\n onUpdate={(val: boolean) => onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, enabled: val } })}\r\n hint={'Notify me via email when Backup fails or succeeds'}\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.email?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Notification\"\r\n fieldValue={notificationSettings?.email?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Email Addresses\"\r\n fieldValue={notificationSettings?.email?.emails || defaultEmail}\r\n onUpdate={(val) => updateNotificationEmails(val)}\r\n placeholder=\"john@gmail.com, chris@icloud.com\"\r\n full={true}\r\n inline={true}\r\n required={true}\r\n disabled={!hasConnectedIntegrations}\r\n error={!notificationSettings?.email?.emails ? 'Required' : undefined}\r\n />\r\n {!hasConnectedIntegrations && (\r\n <div className={classes.fieldNotice}>\r\n ⚠️ SMTP has not been setup yet. Set it up in <NavLink to={`/settings?t=integration`}>Settings</NavLink> to enable Email\r\n Notification.\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Slack Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"slack\" size={14} />\r\n <Toggle\r\n label=\"Enable Slack Notifications\"\r\n fieldValue={notificationSettings?.slack?.enabled || false}\r\n onUpdate={(val: boolean) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n slack: { ...notificationSettings.slack, enabled: val, url: notificationSettings.slack?.url || '' },\r\n })\r\n }\r\n hint=\"Send notifications to a Slack channel via webhook\"\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.slack?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Slack Notification\"\r\n fieldValue={notificationSettings?.slack?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, slack: { ...notificationSettings.slack, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Slack Webhook URL\"\r\n fieldValue={notificationSettings?.slack?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, slack: { ...notificationSettings.slack, url: val } })}\r\n placeholder=\"https://hooks.slack.com/services/T00/B00/xxxx\"\r\n required={true}\r\n inline={true}\r\n full={true}\r\n error={notificationSettings?.slack?.enabled && !notificationSettings?.slack?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={`${classes.field} ${classes.notificationTestField}`}>\r\n <PlanNotificationSettingsTester\r\n planId={planID || ''}\r\n notificationChannel=\"slack\"\r\n notificationSettings={notificationSettings}\r\n notificationType={notificationType}\r\n />\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Discord Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"discord\" size={14} />\r\n <Toggle\r\n label=\"Send Discord Notifications\"\r\n fieldValue={notificationSettings?.discord?.enabled || false}\r\n onUpdate={(val: boolean) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n discord: { ...notificationSettings.discord, enabled: val, url: notificationSettings.discord?.url || '' },\r\n })\r\n }\r\n hint=\"Send notifications to a Discord channel via webhook\"\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.discord?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Discord Notification\"\r\n fieldValue={notificationSettings?.discord?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, discord: { ...notificationSettings.discord, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Discord Webhook URL\"\r\n fieldValue={notificationSettings?.discord?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, discord: { ...notificationSettings.discord, url: val } })}\r\n placeholder=\"https://discord.com/api/webhooks/xxxx/xxxx\"\r\n required={true}\r\n inline={true}\r\n full={true}\r\n error={notificationSettings?.discord?.enabled && !notificationSettings?.discord?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={`${classes.field} ${classes.notificationTestField}`}>\r\n <PlanNotificationSettingsTester\r\n planId={planID || ''}\r\n notificationChannel=\"discord\"\r\n notificationType={notificationType}\r\n notificationSettings={notificationSettings}\r\n />\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n};\r\n\r\nexport default PlanNotificationSettings;\r\n"],"names":["PlanNotificationSettings","planID","isSync","types","admin_email","notificationSettings","notificationType","onUpdate","hasConnectedIntegrations","defaultEmail","updateNotificationEmails","emails","caseOptions","jsxs","Fragment","classes","jsx","Icon","Toggle","_a","val","_b","Select","_c","Input","_d","_e","NavLink","_f","_g","_h","_i","_j","_k","PlanNotificationSettingsTester","_l","_m","_n","_o","_p","_q"],"mappings":";;;;;;;;AAmBA,MAAMA,IAA2B,CAAC;AAAA,EAC/B,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC,IAAQ,CA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AqB,IAC9D,UAAA,gBAAAC;AAAA,UAACkB;AAAA,UAAA;AAAA,YACE,QAAQjC,KAAU;AAAA,YAClB,qBAAoB;AAAA,YACpB,kBAAAK;AAAA,YACA,sBAAAD;AAAA,UAAA;AAAA,QAAA,EACH,CACH;AAAA,MAAA,EAAA,CACH;AAAA,IAAA,EAAA,CAEN;AAAA,EAAA,GACH;AAEN;"}
|
|
1
|
+
{"version":3,"file":"PlanNotificationSettings.js","sources":["../../../../src/components/Plan/PlanSettings/PlanNotificationSettings.tsx"],"sourcesContent":["import classes from './PlanSettings.module.scss';\r\nimport Select from '../../common/form/Select/Select';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Toggle from '../../common/form/Toggle/Toggle';\r\nimport { PlanNotification, PlanNotificationCase } from '../../../@types/plans';\r\nimport { NavLink } from 'react-router';\r\nimport PlanNotificationSettingsTester from './PlanNotificationSettingsTester';\r\nimport { Icon } from '../..';\r\n\r\ninterface PlanNotificationSettingsProps {\r\n types: string[];\r\n isSync: boolean;\r\n notificationType?: 'backup' | 'integrity';\r\n admin_email?: string;\r\n planID?: string;\r\n notificationSettings: PlanNotification;\r\n onUpdate: (notificationSettings: PlanNotification) => void;\r\n}\r\n\r\nconst PlanNotificationSettings = ({\r\n planID,\r\n isSync,\r\n types = [],\r\n admin_email = '',\r\n notificationSettings,\r\n notificationType = 'backup',\r\n onUpdate,\r\n}: PlanNotificationSettingsProps) => {\r\n const hasConnectedIntegrations = types.length > 0;\r\n const defaultEmail = !hasConnectedIntegrations && admin_email ? admin_email : '';\r\n const hasNtfyConnected = types.includes('ntfy');\r\n\r\n const updateNotificationEmails = (emails: string) => {\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, emails } });\r\n };\r\n\r\n const caseOptions = [\r\n { label: 'On Start', value: 'start' },\r\n { label: 'On End', value: 'end' },\r\n { label: 'On Both Start & End', value: 'both' },\r\n { label: 'On Success Only', value: 'success' },\r\n { label: 'On Failure Only', value: 'failure' },\r\n ];\r\n\r\n return (\r\n <>\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"email\" size={14} />\r\n <Toggle\r\n label=\"Enable Email Notifications\"\r\n fieldValue={notificationSettings?.email?.enabled || false}\r\n onUpdate={(val: boolean) => onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, enabled: val } })}\r\n hint={'Notify me via email when Backup fails or succeeds'}\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.email?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Notification\"\r\n fieldValue={notificationSettings?.email?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Email Addresses\"\r\n fieldValue={notificationSettings?.email?.emails || defaultEmail}\r\n onUpdate={(val) => updateNotificationEmails(val)}\r\n placeholder=\"john@gmail.com, chris@icloud.com\"\r\n full={true}\r\n inline={true}\r\n required={true}\r\n disabled={!hasConnectedIntegrations}\r\n error={!notificationSettings?.email?.emails ? 'Required' : undefined}\r\n />\r\n {!hasConnectedIntegrations && (\r\n <div className={classes.fieldNotice}>\r\n ⚠️ SMTP has not been setup yet. Set it up in <NavLink to={`/settings?t=integration`}>Settings</NavLink> to enable Email\r\n Notification.\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Slack Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"slack\" size={14} />\r\n <Toggle\r\n label=\"Enable Slack Notifications\"\r\n fieldValue={notificationSettings?.slack?.enabled || false}\r\n onUpdate={(val: boolean) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n slack: { ...notificationSettings.slack, enabled: val, url: notificationSettings.slack?.url || '' },\r\n })\r\n }\r\n hint=\"Send notifications to a Slack channel via webhook\"\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.slack?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Slack Notification\"\r\n fieldValue={notificationSettings?.slack?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, slack: { ...notificationSettings.slack, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Slack Webhook URL\"\r\n fieldValue={notificationSettings?.slack?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, slack: { ...notificationSettings.slack, url: val } })}\r\n placeholder=\"https://hooks.slack.com/services/T00/B00/xxxx\"\r\n required={true}\r\n inline={true}\r\n full={true}\r\n error={notificationSettings?.slack?.enabled && !notificationSettings?.slack?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={`${classes.field} ${classes.notificationTestField}`}>\r\n <PlanNotificationSettingsTester\r\n planId={planID || ''}\r\n notificationChannel=\"slack\"\r\n notificationSettings={notificationSettings}\r\n notificationType={notificationType}\r\n />\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Discord Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"discord\" size={14} />\r\n <Toggle\r\n label=\"Send Discord Notifications\"\r\n fieldValue={notificationSettings?.discord?.enabled || false}\r\n onUpdate={(val: boolean) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n discord: { ...notificationSettings.discord, enabled: val, url: notificationSettings.discord?.url || '' },\r\n })\r\n }\r\n hint=\"Send notifications to a Discord channel via webhook\"\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.discord?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Discord Notification\"\r\n fieldValue={notificationSettings?.discord?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, discord: { ...notificationSettings.discord, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Discord Webhook URL\"\r\n fieldValue={notificationSettings?.discord?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, discord: { ...notificationSettings.discord, url: val } })}\r\n placeholder=\"https://discord.com/api/webhooks/xxxx/xxxx\"\r\n required={true}\r\n inline={true}\r\n full={true}\r\n error={notificationSettings?.discord?.enabled && !notificationSettings?.discord?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={`${classes.field} ${classes.notificationTestField}`}>\r\n <PlanNotificationSettingsTester\r\n planId={planID || ''}\r\n notificationChannel=\"discord\"\r\n notificationType={notificationType}\r\n notificationSettings={notificationSettings}\r\n />\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Ntfy Push Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"ntfy\" size={14} />\r\n <Toggle\r\n label=\"Enable Ntfy Push Notifications\"\r\n fieldValue={notificationSettings?.push?.enabled || false}\r\n onUpdate={(val: boolean) => onUpdate({ ...notificationSettings, push: { ...notificationSettings.push, enabled: val } })}\r\n hint={`Send me Push Notifications on Backup failure or success.`}\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings.push?.enabled &&\r\n (hasNtfyConnected ? (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Notification On\"\r\n fieldValue={notificationSettings?.push?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n push: { ...notificationSettings.push, case: val as PlanNotification['push']['case'] },\r\n })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Ntfy Push URL\"\r\n fieldValue={notificationSettings?.push?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, push: { ...notificationSettings.push, url: val } })}\r\n placeholder=\"https://ntfy.sh/mytopic\"\r\n inline={true}\r\n required={true}\r\n full={true}\r\n error={!notificationSettings?.push?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Tags\"\r\n fieldValue={notificationSettings?.push?.tags || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, push: { ...notificationSettings.push, tags: val } })}\r\n placeholder=\"warning, daily-backup\"\r\n inline={true}\r\n full={true}\r\n />\r\n </div>\r\n </div>\r\n ) : (\r\n <div className={classes.notificationSettings}>\r\n <div className={classes.fieldNotice}>\r\n ⚠️ Ntfy Auth Token is not configured. Set it up in <NavLink to={`/settings?t=integration`}>Settings</NavLink> to enable Ntfy\r\n Push Notifications.\r\n </div>\r\n </div>\r\n ))}\r\n </div>\r\n </>\r\n );\r\n};\r\n\r\nexport default PlanNotificationSettings;\r\n"],"names":["PlanNotificationSettings","planID","isSync","types","admin_email","notificationSettings","notificationType","onUpdate","hasConnectedIntegrations","defaultEmail","hasNtfyConnected","updateNotificationEmails","emails","caseOptions","jsxs","Fragment","classes","jsx","Icon","Toggle","_a","val","_b","Select","_c","Input","_d","_e","NavLink","_f","_g","_h","_i","_j","_k","PlanNotificationSettingsTester","_l","_m","_n","_o","_p","_q","_r","_s","_t","_u","_v","_w"],"mappings":";;;;;;;;AAmBA,MAAMA,KAA2B,CAAC;AAAA,EAC/B,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC,IAAQ,CAAA;AAAA,EACR,aAAAC,IAAc;AAAA,EACd,sBAAAC;AAAA,EACA,kBAAA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AEN;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Backup, BackupMirror } from '../../../@types/backups';
|
|
3
|
+
import { FileItem } from '../../../@types/system';
|
|
4
|
+
interface SnapshotViewerProps {
|
|
5
|
+
files: FileItem[];
|
|
6
|
+
backup: Backup;
|
|
7
|
+
planId: string;
|
|
8
|
+
isSync?: boolean;
|
|
9
|
+
mirrors?: BackupMirror[];
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
replicationId?: string;
|
|
12
|
+
toolbarLeftContent?: ReactNode;
|
|
13
|
+
toolbarRightContent?: ReactNode;
|
|
14
|
+
isExternalLoading?: boolean;
|
|
15
|
+
/** Render additional action buttons per file row (e.g. View, Download, Compare in Pro). */
|
|
16
|
+
renderFileActions?: (file: FileItem, meta: {
|
|
17
|
+
fileExtension: string;
|
|
18
|
+
isDirectory: boolean;
|
|
19
|
+
}) => ReactNode;
|
|
20
|
+
/** Extra elements rendered at the end (e.g. BackupFileLoader modal in Pro). */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
primaryStorage?: {
|
|
23
|
+
id: string;
|
|
24
|
+
type: string;
|
|
25
|
+
name: string;
|
|
26
|
+
};
|
|
27
|
+
/** Called when the user selects a different storage mirror. Receives the replicationId (or undefined for primary). */
|
|
28
|
+
onStorageChange?: (replicationId: string | undefined) => void;
|
|
29
|
+
}
|
|
30
|
+
declare const SnapshotViewer: ({ files, backup, planId, isSync, mirrors, onClose, replicationId, toolbarLeftContent, toolbarRightContent, isExternalLoading, renderFileActions, children, primaryStorage, onStorageChange, }: SnapshotViewerProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default SnapshotViewer;
|
|
32
|
+
//# sourceMappingURL=SnapshotViewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapshotViewer.d.ts","sourceRoot":"","sources":["../../../../src/components/Plan/SnapshotViewer/SnapshotViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,SAAS,EAAE,MAAM,OAAO,CAAC;AAQjE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAWlD,UAAU,mBAAmB;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,KAAK,SAAS,CAAC;IACzG,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,sHAAsH;IACtH,eAAe,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE;AAMD,QAAA,MAAM,cAAc,GAAI,+LAerB,mBAAmB,4CAwRrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as he, useCallback as H } from "react";
|
|
3
|
+
import { useQuery as ue } from "@tanstack/react-query";
|
|
4
|
+
import { useNavigate as fe } from "react-router";
|
|
5
|
+
import { toast as Q } from "react-toastify";
|
|
6
|
+
import h from "../../common/Icon/Icon.js";
|
|
7
|
+
import ge from "../../common/FileIcon/FileIcon.js";
|
|
8
|
+
import ye from "../../common/form/Select/Select.js";
|
|
9
|
+
import we from "../../common/ActionModal/ActionModal.js";
|
|
10
|
+
import { useRestoreBackup as Se } from "../../../services/restores.js";
|
|
11
|
+
import { useBrowseSnapshot as ve } from "../../../services/backups.js";
|
|
12
|
+
import { formatBytes as De, timeAgo as Ce, isMobile as Ne } from "../../../utils/helpers.js";
|
|
13
|
+
import Fe from "../../common/SnapshotBrowser/SnapshotBrowserToolbar.js";
|
|
14
|
+
import be from "../../common/SnapshotBrowser/SnapshotBrowserDirectories.js";
|
|
15
|
+
import Re from "../../common/SnapshotBrowser/SnapshotBrowserFileList.js";
|
|
16
|
+
import xe from "./SnapshotViewerFile.js";
|
|
17
|
+
import { useSnapshotDatabase as Me } from "../../common/SnapshotBrowser/hooks/useSnapshotDatabase.js";
|
|
18
|
+
import { useSnapshotNavigation as ze } from "../../common/SnapshotBrowser/hooks/useSnapshotNavigation.js";
|
|
19
|
+
import { useSnapshotSort as Ie } from "../../common/SnapshotBrowser/hooks/useSnapshotSort.js";
|
|
20
|
+
import r from "../../common/SnapshotBrowser/SnapshotBrowser.module.scss.js";
|
|
21
|
+
const Le = Ne(), Pe = "1fr 120px minmax(100px, auto) 120px", Be = "1fr 120px minmax(100px, auto)", tt = ({
|
|
22
|
+
files: u,
|
|
23
|
+
backup: l,
|
|
24
|
+
planId: Y,
|
|
25
|
+
isSync: f = !1,
|
|
26
|
+
mirrors: S,
|
|
27
|
+
onClose: K,
|
|
28
|
+
replicationId: V,
|
|
29
|
+
toolbarLeftContent: J,
|
|
30
|
+
toolbarRightContent: W,
|
|
31
|
+
isExternalLoading: P,
|
|
32
|
+
renderFileActions: B,
|
|
33
|
+
children: X,
|
|
34
|
+
primaryStorage: v,
|
|
35
|
+
onStorageChange: g
|
|
36
|
+
}) => {
|
|
37
|
+
var E;
|
|
38
|
+
const [D, Z] = w(""), [s, C] = w(!1), [$, ee] = w(V), [k, A] = w(u), N = he(null), te = fe(), F = l.id, T = Se(), d = ve(), b = k.length > 1e3, { db: m, initError: R, discoveredDirectories: U, expandedFolders: _, setExpandedFolders: oe, addDirectoriesSorted: re } = Me(
|
|
39
|
+
k,
|
|
40
|
+
F,
|
|
41
|
+
b
|
|
42
|
+
), { selectedFolder: n, handleGoUp: G, handleDirectoryClick: x, toggleFolder: ie, isVisible: se, hasSubdirectories: ne } = ze(
|
|
43
|
+
U,
|
|
44
|
+
_,
|
|
45
|
+
oe
|
|
46
|
+
), { sortField: a, sortDirection: p, handleSort: M } = Ie(), ae = H(
|
|
47
|
+
(t) => {
|
|
48
|
+
ee(t), g == null || g(t), t ? d.mutate(
|
|
49
|
+
{ backupId: l.id, replicationId: t },
|
|
50
|
+
{
|
|
51
|
+
onSuccess: (i) => {
|
|
52
|
+
i != null && i.result && A(i.result);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
) : A(u);
|
|
56
|
+
},
|
|
57
|
+
[l.id, u, d, g]
|
|
58
|
+
), O = (S == null ? void 0 : S.filter((t) => t.status === "completed")) || [], le = v && O.length > 0 ? /* @__PURE__ */ e(
|
|
59
|
+
ye,
|
|
60
|
+
{
|
|
61
|
+
customClasses: r.storageSelect,
|
|
62
|
+
options: [
|
|
63
|
+
{ label: v.name + " (Primary)", value: "primary", image: /* @__PURE__ */ e("img", { src: `/providers/${v.type}.png` }) },
|
|
64
|
+
...O.map((t) => ({
|
|
65
|
+
label: t.storageName + " (Mirror)",
|
|
66
|
+
value: t.replicationId,
|
|
67
|
+
image: /* @__PURE__ */ e("img", { src: `/providers/${t.storageType}.png` })
|
|
68
|
+
}))
|
|
69
|
+
],
|
|
70
|
+
fieldValue: $ || "primary",
|
|
71
|
+
onUpdate: (t) => ae(t === "primary" ? void 0 : t),
|
|
72
|
+
disabled: d.isPending
|
|
73
|
+
}
|
|
74
|
+
) : void 0, j = ue({
|
|
75
|
+
queryKey: ["directoryContents", n, a, p, D, F],
|
|
76
|
+
queryFn: async () => {
|
|
77
|
+
if (!m || n === null) return [];
|
|
78
|
+
const t = await m.getDirectoryContents(n, a, p, D);
|
|
79
|
+
if (b) {
|
|
80
|
+
const i = await m.getSubdirectories(n);
|
|
81
|
+
i.length > 0 && re(i);
|
|
82
|
+
}
|
|
83
|
+
return n ? [{ isGoUp: !0, path: "..", name: "..", isDirectory: !0 }, ...t] : t;
|
|
84
|
+
},
|
|
85
|
+
enabled: !!m && n !== null,
|
|
86
|
+
staleTime: 3e4,
|
|
87
|
+
retry: 1
|
|
88
|
+
}), z = j.data || [], ce = !m && !R, q = j.isPending, de = (t) => {
|
|
89
|
+
T.mutate(
|
|
90
|
+
{
|
|
91
|
+
backupId: F,
|
|
92
|
+
planId: Y,
|
|
93
|
+
target: "",
|
|
94
|
+
includes: [t],
|
|
95
|
+
overwrite: "always",
|
|
96
|
+
deleteOption: !1,
|
|
97
|
+
replicationId: $
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
onSuccess: (i, c) => {
|
|
101
|
+
Q.success("Restoration Process Started..", { autoClose: 5e3 });
|
|
102
|
+
const y = c == null ? void 0 : c.planId;
|
|
103
|
+
y && te(`/plan/${y}?pendingrestore=1`), K();
|
|
104
|
+
},
|
|
105
|
+
onError: (i) => {
|
|
106
|
+
console.error("Restore error:", i), Q.error(`Restore failed. ${i.message || "Unknown error"}`);
|
|
107
|
+
},
|
|
108
|
+
onSettled: () => {
|
|
109
|
+
C(!1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}, I = f ? Be : Pe, me = H(
|
|
114
|
+
({ index: t, style: i }) => {
|
|
115
|
+
const c = z[t];
|
|
116
|
+
return c ? /* @__PURE__ */ e(
|
|
117
|
+
xe,
|
|
118
|
+
{
|
|
119
|
+
style: i,
|
|
120
|
+
file: c,
|
|
121
|
+
isSync: f,
|
|
122
|
+
gridColumns: I,
|
|
123
|
+
onGoUp: G,
|
|
124
|
+
onDirectoryClick: x,
|
|
125
|
+
onRestore: (y) => C(y),
|
|
126
|
+
renderFileActions: B
|
|
127
|
+
}
|
|
128
|
+
) : null;
|
|
129
|
+
},
|
|
130
|
+
[z, f, I, G, x, B]
|
|
131
|
+
);
|
|
132
|
+
if (R)
|
|
133
|
+
return /* @__PURE__ */ e("div", { className: r.snapshotBrowser, children: /* @__PURE__ */ o("div", { className: r.errorState, children: [
|
|
134
|
+
/* @__PURE__ */ e(h, { type: "error", size: 24 }),
|
|
135
|
+
/* @__PURE__ */ e("p", { children: "Failed to initialize database" }),
|
|
136
|
+
/* @__PURE__ */ e("small", { children: R }),
|
|
137
|
+
/* @__PURE__ */ e("button", { onClick: () => window.location.reload(), children: "Reload Page" })
|
|
138
|
+
] }) });
|
|
139
|
+
if (ce)
|
|
140
|
+
return /* @__PURE__ */ e("div", { className: r.snapshotBrowser, children: /* @__PURE__ */ o("div", { className: r.loadingState, children: [
|
|
141
|
+
/* @__PURE__ */ e(h, { type: "loading", size: 24 }),
|
|
142
|
+
/* @__PURE__ */ e("p", { children: "Indexing snapshot data..." }),
|
|
143
|
+
/* @__PURE__ */ o("small", { children: [
|
|
144
|
+
"Building efficient database for ",
|
|
145
|
+
u.length.toLocaleString(),
|
|
146
|
+
" files"
|
|
147
|
+
] })
|
|
148
|
+
] }) });
|
|
149
|
+
const pe = /* @__PURE__ */ o("div", { className: r.stats, children: [
|
|
150
|
+
/* @__PURE__ */ e(h, { type: "box" }),
|
|
151
|
+
/* @__PURE__ */ o("strong", { children: [
|
|
152
|
+
"backup-",
|
|
153
|
+
l.id
|
|
154
|
+
] }),
|
|
155
|
+
" • ",
|
|
156
|
+
De(l.totalSize),
|
|
157
|
+
" • ",
|
|
158
|
+
Ce(new Date(l.ended))
|
|
159
|
+
] });
|
|
160
|
+
return /* @__PURE__ */ o("div", { className: r.snapshotBrowser, children: [
|
|
161
|
+
/* @__PURE__ */ e(
|
|
162
|
+
Fe,
|
|
163
|
+
{
|
|
164
|
+
search: D,
|
|
165
|
+
onSearchChange: Z,
|
|
166
|
+
isLoading: q || P || d.isPending,
|
|
167
|
+
leftContent: J || pe,
|
|
168
|
+
rightContent: /* @__PURE__ */ o(L, { children: [
|
|
169
|
+
le,
|
|
170
|
+
W
|
|
171
|
+
] })
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
P || d.isPending ? /* @__PURE__ */ e("div", { className: `${r.browserContent} ${r.loadingState}`, children: /* @__PURE__ */ o("div", { children: [
|
|
175
|
+
/* @__PURE__ */ e(h, { type: "loading", size: 16 }),
|
|
176
|
+
" Loading..."
|
|
177
|
+
] }) }) : /* @__PURE__ */ o("div", { className: r.browserContent, children: [
|
|
178
|
+
/* @__PURE__ */ e(
|
|
179
|
+
be,
|
|
180
|
+
{
|
|
181
|
+
directories: U,
|
|
182
|
+
selectedFolder: n,
|
|
183
|
+
expandedFolders: _,
|
|
184
|
+
useProgressiveLoading: b,
|
|
185
|
+
onDirectoryClick: x,
|
|
186
|
+
onToggleFolder: ie,
|
|
187
|
+
isVisible: se,
|
|
188
|
+
hasSubdirectories: ne
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ e("div", { className: `${r.content} styled__scrollbar`, ref: N, children: /* @__PURE__ */ e(
|
|
192
|
+
Re,
|
|
193
|
+
{
|
|
194
|
+
files: z,
|
|
195
|
+
height: (E = N.current) != null && E.clientHeight ? N.current.clientHeight - 45 : 520,
|
|
196
|
+
itemSize: Le ? 65 : 46,
|
|
197
|
+
headerContent: /* @__PURE__ */ o(L, { children: [
|
|
198
|
+
/* @__PURE__ */ o("div", { onClick: () => M("name"), className: a === "name" ? r.activeSort : "", children: [
|
|
199
|
+
"Name ",
|
|
200
|
+
a === "name" && (p === "asc" ? "↑" : "↓")
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ o("div", { onClick: () => M("modifiedAt"), className: a === "modifiedAt" ? r.activeSort : "", children: [
|
|
203
|
+
"Last Modified ",
|
|
204
|
+
a === "modifiedAt" && (p === "asc" ? "↑" : "↓")
|
|
205
|
+
] }),
|
|
206
|
+
/* @__PURE__ */ o("div", { onClick: () => M("size"), className: a === "size" ? r.activeSort : "", children: [
|
|
207
|
+
"Size ",
|
|
208
|
+
a === "size" && (p === "asc" ? "↑" : "↓")
|
|
209
|
+
] }),
|
|
210
|
+
!f && /* @__PURE__ */ e("div", { className: r.headerActions, children: "Actions" })
|
|
211
|
+
] }),
|
|
212
|
+
renderRow: me,
|
|
213
|
+
selectedFolder: n,
|
|
214
|
+
isLoading: q,
|
|
215
|
+
gridTemplateColumns: I
|
|
216
|
+
}
|
|
217
|
+
) })
|
|
218
|
+
] }),
|
|
219
|
+
s && /* @__PURE__ */ e(
|
|
220
|
+
we,
|
|
221
|
+
{
|
|
222
|
+
title: `Restore ${s.isDirectory ? "Directory" : "File"}`,
|
|
223
|
+
message: /* @__PURE__ */ o(L, { children: [
|
|
224
|
+
/* @__PURE__ */ o("p", { children: [
|
|
225
|
+
"Are you sure you want to restore this ",
|
|
226
|
+
s.isDirectory ? "Directory" : "File",
|
|
227
|
+
"?"
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ o("p", { className: r.restoreModalFile, children: [
|
|
230
|
+
s.isDirectory ? /* @__PURE__ */ e(h, { type: "fm-directory", size: 16 }) : /* @__PURE__ */ e(ge, { filename: s.path }),
|
|
231
|
+
" ",
|
|
232
|
+
s.path
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ e("p", { children: "This action will overwrite the existing file/directory with the same name in the source." })
|
|
235
|
+
] }),
|
|
236
|
+
closeModal: () => C(!1),
|
|
237
|
+
width: "600px",
|
|
238
|
+
primaryAction: {
|
|
239
|
+
title: `Yes, Restore ${s.isDirectory ? "Directory" : "File"}`,
|
|
240
|
+
type: "default",
|
|
241
|
+
isPending: T.isPending,
|
|
242
|
+
action: () => de(s.path)
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
X
|
|
247
|
+
] });
|
|
248
|
+
};
|
|
249
|
+
export {
|
|
250
|
+
tt as default
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=SnapshotViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapshotViewer.js","sources":["../../../../src/components/Plan/SnapshotViewer/SnapshotViewer.tsx"],"sourcesContent":["import { useState, useCallback, useRef, ReactNode } from 'react';\r\nimport { useQuery } from '@tanstack/react-query';\r\nimport { useNavigate } from 'react-router';\r\nimport { toast } from 'react-toastify';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport FileIcon from '../../common/FileIcon/FileIcon';\r\nimport Select from '../../common/form/Select/Select';\r\nimport ActionModal from '../../common/ActionModal/ActionModal';\r\nimport { Backup, BackupMirror } from '../../../@types/backups';\r\nimport { useRestoreBackup } from '../../../services/restores';\r\nimport { useBrowseSnapshot } from '../../../services/backups';\r\nimport { FileItem } from '../../../@types/system';\r\nimport { isMobile, formatBytes, timeAgo } from '../../../utils/helpers';\r\nimport SnapshotBrowserToolbar from '../../common/SnapshotBrowser/SnapshotBrowserToolbar';\r\nimport SnapshotBrowserDirectories from '../../common/SnapshotBrowser/SnapshotBrowserDirectories';\r\nimport SnapshotBrowserFileList from '../../common/SnapshotBrowser/SnapshotBrowserFileList';\r\nimport SnapshotViewerFile from './SnapshotViewerFile';\r\nimport { useSnapshotDatabase } from '../../common/SnapshotBrowser/hooks/useSnapshotDatabase';\r\nimport { useSnapshotNavigation } from '../../common/SnapshotBrowser/hooks/useSnapshotNavigation';\r\nimport { useSnapshotSort } from '../../common/SnapshotBrowser/hooks/useSnapshotSort';\r\nimport classes from '../../common/SnapshotBrowser/SnapshotBrowser.module.scss';\r\n\r\ninterface SnapshotViewerProps {\r\n files: FileItem[];\r\n backup: Backup;\r\n planId: string;\r\n isSync?: boolean;\r\n mirrors?: BackupMirror[];\r\n onClose: () => void;\r\n replicationId?: string;\r\n toolbarLeftContent?: ReactNode;\r\n toolbarRightContent?: ReactNode;\r\n isExternalLoading?: boolean;\r\n /** Render additional action buttons per file row (e.g. View, Download, Compare in Pro). */\r\n renderFileActions?: (file: FileItem, meta: { fileExtension: string; isDirectory: boolean }) => ReactNode;\r\n /** Extra elements rendered at the end (e.g. BackupFileLoader modal in Pro). */\r\n children?: ReactNode;\r\n primaryStorage?: { id: string; type: string; name: string };\r\n /** Called when the user selects a different storage mirror. Receives the replicationId (or undefined for primary). */\r\n onStorageChange?: (replicationId: string | undefined) => void;\r\n}\r\n\r\nconst isMobileDevice = isMobile();\r\nconst GRID_COLUMNS = '1fr 120px minmax(100px, auto) 120px';\r\nconst GRID_COLUMNS_SYNC = '1fr 120px minmax(100px, auto)';\r\n\r\nconst SnapshotViewer = ({\r\n files,\r\n backup,\r\n planId,\r\n isSync = false,\r\n mirrors,\r\n onClose,\r\n replicationId,\r\n toolbarLeftContent,\r\n toolbarRightContent,\r\n isExternalLoading,\r\n renderFileActions,\r\n children,\r\n primaryStorage,\r\n onStorageChange,\r\n}: SnapshotViewerProps) => {\r\n const [search, setSearch] = useState('');\r\n const [showRestoreModal, setShowRestoreModal] = useState<FileItem | false>(false);\r\n const [selectedReplicationId, setSelectedReplicationId] = useState<string | undefined>(replicationId);\r\n const [currentFiles, setCurrentFiles] = useState<FileItem[]>(files);\r\n const fileListRef = useRef<HTMLDivElement | null>(null);\r\n const navigate = useNavigate();\r\n\r\n const backupId = backup.id;\r\n const restoreMutation = useRestoreBackup();\r\n const browseSnapshotMutation = useBrowseSnapshot();\r\n const useProgressiveLoading = currentFiles.length > 1000;\r\n\r\n const { db, initError, discoveredDirectories, expandedFolders, setExpandedFolders, addDirectoriesSorted } = useSnapshotDatabase(\r\n currentFiles,\r\n backupId,\r\n useProgressiveLoading,\r\n );\r\n\r\n const { selectedFolder, handleGoUp, handleDirectoryClick, toggleFolder, isVisible, hasSubdirectories } = useSnapshotNavigation(\r\n discoveredDirectories,\r\n expandedFolders,\r\n setExpandedFolders,\r\n );\r\n\r\n const { sortField, sortDirection, handleSort } = useSnapshotSort();\r\n\r\n // Handle storage change - re-browse from selected mirror\r\n const handleStorageChange = useCallback(\r\n (replicationIdValue?: string) => {\r\n setSelectedReplicationId(replicationIdValue);\r\n onStorageChange?.(replicationIdValue);\r\n if (replicationIdValue) {\r\n browseSnapshotMutation.mutate(\r\n { backupId: backup.id, replicationId: replicationIdValue },\r\n {\r\n onSuccess: (data: any) => {\r\n if (data?.result) {\r\n setCurrentFiles(data.result);\r\n }\r\n },\r\n },\r\n );\r\n } else {\r\n setCurrentFiles(files);\r\n }\r\n },\r\n [backup.id, files, browseSnapshotMutation, onStorageChange],\r\n );\r\n\r\n // Build storage selector for toolbar\r\n const completedMirrors = mirrors?.filter((m) => m.status === 'completed') || [];\r\n const showStorageDropdown = primaryStorage && completedMirrors.length > 0;\r\n\r\n const storageSelector = showStorageDropdown ? (\r\n <Select\r\n customClasses={classes.storageSelect}\r\n options={[\r\n { label: primaryStorage!.name + ' (Primary)', value: 'primary', image: <img src={`/providers/${primaryStorage.type}.png`} /> },\r\n ...completedMirrors.map((m) => ({\r\n label: m.storageName + ' (Mirror)',\r\n value: m.replicationId,\r\n image: <img src={`/providers/${m.storageType}.png`} />,\r\n })),\r\n ]}\r\n fieldValue={selectedReplicationId || 'primary'}\r\n onUpdate={(value) => handleStorageChange(value === 'primary' ? undefined : value)}\r\n disabled={browseSnapshotMutation.isPending}\r\n />\r\n ) : undefined;\r\n\r\n // Directory contents query\r\n const directoryContentsQuery = useQuery({\r\n queryKey: ['directoryContents', selectedFolder, sortField, sortDirection, search, backupId],\r\n queryFn: async () => {\r\n if (!db || selectedFolder === null) return [];\r\n\r\n const contents = await db.getDirectoryContents(selectedFolder, sortField, sortDirection, search);\r\n\r\n if (useProgressiveLoading) {\r\n const subdirs = await db.getSubdirectories(selectedFolder);\r\n if (subdirs.length > 0) {\r\n addDirectoriesSorted(subdirs);\r\n }\r\n }\r\n\r\n if (selectedFolder) {\r\n return [{ isGoUp: true, path: '..', name: '..', isDirectory: true } as any, ...contents];\r\n }\r\n\r\n return contents;\r\n },\r\n enabled: !!db && selectedFolder !== null,\r\n staleTime: 30000,\r\n retry: 1,\r\n });\r\n\r\n const currentDirectoryFiles = directoryContentsQuery.data || [];\r\n const isInitializing = !db && !initError;\r\n const isDirectoryLoading = directoryContentsQuery.isPending;\r\n\r\n // Restore handler\r\n const restoreFile = (path: string) => {\r\n restoreMutation.mutate(\r\n {\r\n backupId,\r\n planId,\r\n target: '',\r\n includes: [path],\r\n overwrite: 'always',\r\n deleteOption: false,\r\n replicationId: selectedReplicationId,\r\n },\r\n {\r\n onSuccess: (_: any, variables) => {\r\n toast.success('Restoration Process Started..', { autoClose: 5000 });\r\n const targetPlanId = variables?.planId;\r\n if (targetPlanId) {\r\n navigate(`/plan/${targetPlanId}?pendingrestore=1`);\r\n }\r\n onClose();\r\n },\r\n onError: (error) => {\r\n console.error('Restore error:', error);\r\n toast.error(`Restore failed. ${error.message || 'Unknown error'}`);\r\n },\r\n onSettled: () => {\r\n setShowRestoreModal(false);\r\n },\r\n },\r\n );\r\n };\r\n\r\n // File row renderer\r\n const gridColumns = isSync ? GRID_COLUMNS_SYNC : GRID_COLUMNS;\r\n\r\n const renderFileRow = useCallback(\r\n ({ index, style }: { index: number; style: React.CSSProperties }) => {\r\n const file = currentDirectoryFiles[index];\r\n if (!file) return null;\r\n\r\n return (\r\n <SnapshotViewerFile\r\n style={style}\r\n file={file}\r\n isSync={isSync}\r\n gridColumns={gridColumns}\r\n onGoUp={handleGoUp}\r\n onDirectoryClick={handleDirectoryClick}\r\n onRestore={(file) => setShowRestoreModal(file)}\r\n renderFileActions={renderFileActions}\r\n />\r\n );\r\n },\r\n [currentDirectoryFiles, isSync, gridColumns, handleGoUp, handleDirectoryClick, renderFileActions],\r\n );\r\n\r\n // Error state\r\n if (initError) {\r\n return (\r\n <div className={classes.snapshotBrowser}>\r\n <div className={classes.errorState}>\r\n <Icon type=\"error\" size={24} />\r\n <p>Failed to initialize database</p>\r\n <small>{initError}</small>\r\n <button onClick={() => window.location.reload()}>Reload Page</button>\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n // Loading state\r\n if (isInitializing) {\r\n return (\r\n <div className={classes.snapshotBrowser}>\r\n <div className={classes.loadingState}>\r\n <Icon type=\"loading\" size={24} />\r\n <p>Indexing snapshot data...</p>\r\n <small>Building efficient database for {files.length.toLocaleString()} files</small>\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n const defaultToolbarLeft = (\r\n <div className={classes.stats}>\r\n <Icon type=\"box\" />\r\n <strong>backup-{backup.id}</strong> • {formatBytes(backup.totalSize)} • {timeAgo(new Date(backup.ended))}\r\n </div>\r\n );\r\n\r\n return (\r\n <div className={classes.snapshotBrowser}>\r\n <SnapshotBrowserToolbar\r\n search={search}\r\n onSearchChange={setSearch}\r\n isLoading={isDirectoryLoading || isExternalLoading || browseSnapshotMutation.isPending}\r\n leftContent={toolbarLeftContent || defaultToolbarLeft}\r\n rightContent={\r\n <>\r\n {storageSelector}\r\n {toolbarRightContent}\r\n </>\r\n }\r\n />\r\n\r\n {isExternalLoading || browseSnapshotMutation.isPending ? (\r\n <div className={`${classes.browserContent} ${classes.loadingState}`}>\r\n <div>\r\n <Icon type=\"loading\" size={16} /> Loading...\r\n </div>\r\n </div>\r\n ) : (\r\n <div className={classes.browserContent}>\r\n <SnapshotBrowserDirectories\r\n directories={discoveredDirectories}\r\n selectedFolder={selectedFolder}\r\n expandedFolders={expandedFolders}\r\n useProgressiveLoading={useProgressiveLoading}\r\n onDirectoryClick={handleDirectoryClick}\r\n onToggleFolder={toggleFolder}\r\n isVisible={isVisible}\r\n hasSubdirectories={hasSubdirectories}\r\n />\r\n\r\n <div className={`${classes.content} styled__scrollbar`} ref={fileListRef}>\r\n <SnapshotBrowserFileList\r\n files={currentDirectoryFiles}\r\n height={fileListRef.current?.clientHeight ? fileListRef.current.clientHeight - 45 : 520}\r\n itemSize={isMobileDevice ? 65 : 46}\r\n headerContent={\r\n <>\r\n <div onClick={() => handleSort('name')} className={sortField === 'name' ? classes.activeSort : ''}>\r\n Name {sortField === 'name' && (sortDirection === 'asc' ? '↑' : '↓')}\r\n </div>\r\n <div onClick={() => handleSort('modifiedAt')} className={sortField === 'modifiedAt' ? classes.activeSort : ''}>\r\n Last Modified {sortField === 'modifiedAt' && (sortDirection === 'asc' ? '↑' : '↓')}\r\n </div>\r\n <div onClick={() => handleSort('size')} className={sortField === 'size' ? classes.activeSort : ''}>\r\n Size {sortField === 'size' && (sortDirection === 'asc' ? '↑' : '↓')}\r\n </div>\r\n {!isSync && <div className={classes.headerActions}>Actions</div>}\r\n </>\r\n }\r\n renderRow={renderFileRow}\r\n selectedFolder={selectedFolder}\r\n isLoading={isDirectoryLoading}\r\n gridTemplateColumns={gridColumns}\r\n />\r\n </div>\r\n </div>\r\n )}\r\n\r\n {showRestoreModal && (\r\n <ActionModal\r\n title={`Restore ${showRestoreModal.isDirectory ? 'Directory' : 'File'}`}\r\n message={\r\n <>\r\n <p>Are you sure you want to restore this {showRestoreModal.isDirectory ? 'Directory' : 'File'}?</p>\r\n <p className={classes.restoreModalFile}>\r\n {showRestoreModal.isDirectory ? <Icon type={'fm-directory'} size={16} /> : <FileIcon filename={showRestoreModal.path} />}{' '}\r\n {showRestoreModal.path}\r\n </p>\r\n <p>This action will overwrite the existing file/directory with the same name in the source.</p>\r\n </>\r\n }\r\n closeModal={() => setShowRestoreModal(false)}\r\n width=\"600px\"\r\n primaryAction={{\r\n title: `Yes, Restore ${showRestoreModal.isDirectory ? 'Directory' : 'File'}`,\r\n type: 'default',\r\n isPending: restoreMutation.isPending,\r\n action: () => restoreFile(showRestoreModal.path),\r\n }}\r\n />\r\n )}\r\n\r\n {children}\r\n </div>\r\n );\r\n};\r\n\r\nexport default SnapshotViewer;\r\n"],"names":["isMobileDevice","isMobile","GRID_COLUMNS","GRID_COLUMNS_SYNC","SnapshotViewer","files","backup","planId","isSync","mirrors","onClose","replicationId","toolbarLeftContent","toolbarRightContent","isExternalLoading","renderFileActions","children","primaryStorage","onStorageChange","search","setSearch","useState","showRestoreModal","setShowRestoreModal","selectedReplicationId","setSelectedReplicationId","currentFiles","setCurrentFiles","fileListRef","useRef","navigate","useNavigate","backupId","restoreMutation","useRestoreBackup","browseSnapshotMutation","useBrowseSnapshot","useProgressiveLoading","db","initError","discoveredDirectories","expandedFolders","setExpandedFolders","addDirectoriesSorted","useSnapshotDatabase","selectedFolder","handleGoUp","handleDirectoryClick","toggleFolder","isVisible","hasSubdirectories","useSnapshotNavigation","sortField","sortDirection","handleSort","useSnapshotSort","handleStorageChange","useCallback","replicationIdValue","data","completedMirrors","m","storageSelector","jsx","Select","classes","value","directoryContentsQuery","useQuery","contents","subdirs","currentDirectoryFiles","isInitializing","isDirectoryLoading","restoreFile","path","_","variables","toast","targetPlanId","error","gridColumns","renderFileRow","index","style","file","SnapshotViewerFile","jsxs","Icon","defaultToolbarLeft","formatBytes","timeAgo","SnapshotBrowserToolbar","Fragment","SnapshotBrowserDirectories","SnapshotBrowserFileList","_a","ActionModal","FileIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,MAAMA,KAAiBC,GAAA,GACjBC,KAAe,uCACfC,KAAoB,iCAEpBC,KAAiB,CAAC;AAAA,EACrB,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC;AACH,MAA2B;;AACxB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAE,GACjC,CAACC,GAAkBC,CAAmB,IAAIF,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AA,QAAA,GAC9F;AAAA,QAEH,YAAY,MAAMxC,EAAoB,EAAK;AAAA,QAC3C,OAAM;AAAA,QACN,eAAe;AAAA,UACZ,OAAO,gBAAgBD,EAAiB,cAAc,cAAc,MAAM;AAAA,UAC1E,MAAM;AAAA,UACN,WAAWW,EAAgB;AAAA,UAC3B,QAAQ,MAAMyC,GAAYpD,EAAiB,IAAI;AAAA,QAAA;AAAA,MAClD;AAAA,IAAA;AAAA,IAILN;AAAA,EAAA,GACJ;AAEN;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { FileItem } from '../../../@types/system';
|
|
3
|
+
interface SnapshotViewerFileProps {
|
|
4
|
+
style: React.CSSProperties;
|
|
5
|
+
file: FileItem | {
|
|
6
|
+
isGoUp: true;
|
|
7
|
+
path: string;
|
|
8
|
+
name: string;
|
|
9
|
+
isDirectory: true;
|
|
10
|
+
};
|
|
11
|
+
isSync?: boolean;
|
|
12
|
+
gridColumns: string;
|
|
13
|
+
onGoUp: () => void;
|
|
14
|
+
onDirectoryClick: (path: string) => void;
|
|
15
|
+
onRestore: (file: FileItem) => void;
|
|
16
|
+
renderFileActions?: (file: FileItem, meta: {
|
|
17
|
+
fileExtension: string;
|
|
18
|
+
isDirectory: boolean;
|
|
19
|
+
}) => ReactNode;
|
|
20
|
+
}
|
|
21
|
+
declare const SnapshotViewerFile: ({ style, file, isSync, gridColumns, onGoUp, onDirectoryClick, onRestore, renderFileActions, }: SnapshotViewerFileProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
export default SnapshotViewerFile;
|
|
23
|
+
//# sourceMappingURL=SnapshotViewerFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapshotViewerFile.d.ts","sourceRoot":"","sources":["../../../../src/components/Plan/SnapshotViewer/SnapshotViewerFile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,UAAU,uBAAuB;IAC9B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC;IAC3B,IAAI,EAAE,QAAQ,GAAG;QAAE,MAAM,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,IAAI,CAAA;KAAE,CAAC;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,KAAK,SAAS,CAAC;CAC3G;AAED,QAAA,MAAM,kBAAkB,GAAI,+FASzB,uBAAuB,mDA2DzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as s, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import n from "../../common/Icon/Icon.js";
|
|
3
|
+
import u from "../../common/FileIcon/FileIcon.js";
|
|
4
|
+
import { formatDateTime as y, timeAgo as D, formatBytes as C } from "../../../utils/helpers.js";
|
|
5
|
+
import t from "../../common/SnapshotBrowser/SnapshotBrowser.module.scss.js";
|
|
6
|
+
const I = ({
|
|
7
|
+
style: p,
|
|
8
|
+
file: l,
|
|
9
|
+
isSync: r,
|
|
10
|
+
gridColumns: d,
|
|
11
|
+
onGoUp: c,
|
|
12
|
+
onDirectoryClick: f,
|
|
13
|
+
onRestore: h,
|
|
14
|
+
renderFileActions: a
|
|
15
|
+
}) => {
|
|
16
|
+
if (!l) return null;
|
|
17
|
+
if ("isGoUp" in l && l.isGoUp)
|
|
18
|
+
return /* @__PURE__ */ s(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
style: { ...p, gridTemplateColumns: d },
|
|
22
|
+
className: `${t.snapshotFile} ${t.fileIsDir} ${t.goUpButton}`,
|
|
23
|
+
onClick: c,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ i("div", { className: t.fileName, children: "..." }),
|
|
26
|
+
/* @__PURE__ */ i("div", {}),
|
|
27
|
+
/* @__PURE__ */ i("div", {}),
|
|
28
|
+
!r && /* @__PURE__ */ i("div", {})
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
const e = l, m = e.name || e.path.split("/").pop() || "", o = e.isDirectory, v = m.split(".").pop() || "";
|
|
33
|
+
return /* @__PURE__ */ s(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
style: { ...p, gridTemplateColumns: d },
|
|
37
|
+
className: `${t.snapshotFile} ${o ? t.fileIsDir : ""}`,
|
|
38
|
+
onClick: () => {
|
|
39
|
+
o && f(e.path);
|
|
40
|
+
},
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ s("div", { className: t.fileName, children: [
|
|
43
|
+
o ? /* @__PURE__ */ i(n, { type: "fm-directory", size: 16 }) : /* @__PURE__ */ i(u, { filename: m }),
|
|
44
|
+
" ",
|
|
45
|
+
m
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ i("div", { className: t.fileModifiedAt, title: y(e.modifiedAt), children: /* @__PURE__ */ i("i", { children: D(new Date(e.modifiedAt)) }) }),
|
|
48
|
+
/* @__PURE__ */ i("div", { className: t.fileSize, children: o ? "" : C(e.size || 0) }),
|
|
49
|
+
!r && /* @__PURE__ */ s("div", { className: t.fileActions, children: [
|
|
50
|
+
a == null ? void 0 : a(e, { fileExtension: v, isDirectory: o }),
|
|
51
|
+
/* @__PURE__ */ i(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
"data-tooltip-id": "htmlToolTip",
|
|
55
|
+
"data-tooltip-place": "top",
|
|
56
|
+
"data-tooltip-delay-show": 500,
|
|
57
|
+
"data-tooltip-html": "Restore",
|
|
58
|
+
onClick: (N) => {
|
|
59
|
+
N.stopPropagation(), h(e);
|
|
60
|
+
},
|
|
61
|
+
children: /* @__PURE__ */ i(n, { type: "restore", size: 16 })
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
I as default
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=SnapshotViewerFile.js.map
|
|
@@ -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","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,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":"
|
|
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"}
|