@trieb.work/payload-plugin-backup-mongodb 0.1.1

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 (165) hide show
  1. package/README.md +319 -0
  2. package/dist/backup-dashboard.css +1132 -0
  3. package/dist/client.d.ts +3 -0
  4. package/dist/client.js +3 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/collections/BackupSettings.d.ts +6 -0
  7. package/dist/collections/BackupSettings.js +91 -0
  8. package/dist/collections/BackupSettings.js.map +1 -0
  9. package/dist/collections/BackupTasks.d.ts +2 -0
  10. package/dist/collections/BackupTasks.js +56 -0
  11. package/dist/collections/BackupTasks.js.map +1 -0
  12. package/dist/components/BackupDashboard/BackupItemActions.client.d.ts +7 -0
  13. package/dist/components/BackupDashboard/BackupItemActions.client.js +90 -0
  14. package/dist/components/BackupDashboard/BackupItemActions.client.js.map +1 -0
  15. package/dist/components/BackupDashboard/BackupListCollapsible.client.d.ts +16 -0
  16. package/dist/components/BackupDashboard/BackupListCollapsible.client.js +597 -0
  17. package/dist/components/BackupDashboard/BackupListCollapsible.client.js.map +1 -0
  18. package/dist/components/BackupDashboard/BackupSettingsModal.client.d.ts +2 -0
  19. package/dist/components/BackupDashboard/BackupSettingsModal.client.js +939 -0
  20. package/dist/components/BackupDashboard/BackupSettingsModal.client.js.map +1 -0
  21. package/dist/components/BackupDashboard/CollectionBackupPreviewBody.client.d.ts +18 -0
  22. package/dist/components/BackupDashboard/CollectionBackupPreviewBody.client.js +267 -0
  23. package/dist/components/BackupDashboard/CollectionBackupPreviewBody.client.js.map +1 -0
  24. package/dist/components/BackupDashboard/ManualBackupDialog.client.d.ts +1 -0
  25. package/dist/components/BackupDashboard/ManualBackupDialog.client.js +276 -0
  26. package/dist/components/BackupDashboard/ManualBackupDialog.client.js.map +1 -0
  27. package/dist/components/BackupDashboard/RestoreBackupDialog.client.d.ts +6 -0
  28. package/dist/components/BackupDashboard/RestoreBackupDialog.client.js +551 -0
  29. package/dist/components/BackupDashboard/RestoreBackupDialog.client.js.map +1 -0
  30. package/dist/components/BackupDashboard/TaskActionButton.client.d.ts +29 -0
  31. package/dist/components/BackupDashboard/TaskActionButton.client.js +240 -0
  32. package/dist/components/BackupDashboard/TaskActionButton.client.js.map +1 -0
  33. package/dist/components/BackupDashboard/backupDashboardInlineCss.d.ts +1 -0
  34. package/dist/components/BackupDashboard/backupDashboardInlineCss.js +3 -0
  35. package/dist/components/BackupDashboard/backupDashboardInlineCss.js.map +1 -0
  36. package/dist/components/BackupDashboard/index.client.d.ts +8 -0
  37. package/dist/components/BackupDashboard/index.client.js +9 -0
  38. package/dist/components/BackupDashboard/index.client.js.map +1 -0
  39. package/dist/components/BackupDashboard/index.d.ts +8 -0
  40. package/dist/components/BackupDashboard/index.js +196 -0
  41. package/dist/components/BackupDashboard/index.js.map +1 -0
  42. package/dist/core/archive.d.ts +8 -0
  43. package/dist/core/archive.js +47 -0
  44. package/dist/core/archive.js.map +1 -0
  45. package/dist/core/backup.d.ts +41 -0
  46. package/dist/core/backup.js +188 -0
  47. package/dist/core/backup.js.map +1 -0
  48. package/dist/core/backupBlobIO.d.ts +54 -0
  49. package/dist/core/backupBlobIO.js +179 -0
  50. package/dist/core/backupBlobIO.js.map +1 -0
  51. package/dist/core/backupBlobTransfer.d.ts +29 -0
  52. package/dist/core/backupBlobTransfer.js +85 -0
  53. package/dist/core/backupBlobTransfer.js.map +1 -0
  54. package/dist/core/backupSettings.d.ts +35 -0
  55. package/dist/core/backupSettings.js +95 -0
  56. package/dist/core/backupSettings.js.map +1 -0
  57. package/dist/core/backupSourcePreview.d.ts +10 -0
  58. package/dist/core/backupSourcePreview.js +33 -0
  59. package/dist/core/backupSourcePreview.js.map +1 -0
  60. package/dist/core/blobTokenValidate.d.ts +14 -0
  61. package/dist/core/blobTokenValidate.js +75 -0
  62. package/dist/core/blobTokenValidate.js.map +1 -0
  63. package/dist/core/db.d.ts +24 -0
  64. package/dist/core/db.js +12 -0
  65. package/dist/core/db.js.map +1 -0
  66. package/dist/core/restore.d.ts +27 -0
  67. package/dist/core/restore.js +199 -0
  68. package/dist/core/restore.js.map +1 -0
  69. package/dist/core/restorePreview.d.ts +64 -0
  70. package/dist/core/restorePreview.js +266 -0
  71. package/dist/core/restorePreview.js.map +1 -0
  72. package/dist/core/taskProgress.d.ts +26 -0
  73. package/dist/core/taskProgress.js +73 -0
  74. package/dist/core/taskProgress.js.map +1 -0
  75. package/dist/core/vercelBackupCron.d.ts +8 -0
  76. package/dist/core/vercelBackupCron.js +38 -0
  77. package/dist/core/vercelBackupCron.js.map +1 -0
  78. package/dist/endpoints/createBackupEndpoints.d.ts +1 -0
  79. package/dist/endpoints/createBackupEndpoints.js +3 -0
  80. package/dist/endpoints/createBackupEndpoints.js.map +1 -0
  81. package/dist/endpoints/index.d.ts +3 -0
  82. package/dist/endpoints/index.js +34 -0
  83. package/dist/endpoints/index.js.map +1 -0
  84. package/dist/endpoints/paths/admin-backup-download.d.ts +8 -0
  85. package/dist/endpoints/paths/admin-backup-download.js +72 -0
  86. package/dist/endpoints/paths/admin-backup-download.js.map +1 -0
  87. package/dist/endpoints/paths/admin-delete.d.ts +3 -0
  88. package/dist/endpoints/paths/admin-delete.js +55 -0
  89. package/dist/endpoints/paths/admin-delete.js.map +1 -0
  90. package/dist/endpoints/paths/admin-manual.d.ts +3 -0
  91. package/dist/endpoints/paths/admin-manual.js +61 -0
  92. package/dist/endpoints/paths/admin-manual.js.map +1 -0
  93. package/dist/endpoints/paths/admin-preview.d.ts +6 -0
  94. package/dist/endpoints/paths/admin-preview.js +102 -0
  95. package/dist/endpoints/paths/admin-preview.js.map +1 -0
  96. package/dist/endpoints/paths/admin-restore.d.ts +3 -0
  97. package/dist/endpoints/paths/admin-restore.js +74 -0
  98. package/dist/endpoints/paths/admin-restore.js.map +1 -0
  99. package/dist/endpoints/paths/admin-seed.d.ts +3 -0
  100. package/dist/endpoints/paths/admin-seed.js +47 -0
  101. package/dist/endpoints/paths/admin-seed.js.map +1 -0
  102. package/dist/endpoints/paths/admin-settings.d.ts +3 -0
  103. package/dist/endpoints/paths/admin-settings.js +230 -0
  104. package/dist/endpoints/paths/admin-settings.js.map +1 -0
  105. package/dist/endpoints/paths/admin-task.d.ts +3 -0
  106. package/dist/endpoints/paths/admin-task.js +34 -0
  107. package/dist/endpoints/paths/admin-task.js.map +1 -0
  108. package/dist/endpoints/paths/admin-validate-blob-token.d.ts +8 -0
  109. package/dist/endpoints/paths/admin-validate-blob-token.js +26 -0
  110. package/dist/endpoints/paths/admin-validate-blob-token.js.map +1 -0
  111. package/dist/endpoints/paths/cron-list.d.ts +2 -0
  112. package/dist/endpoints/paths/cron-list.js +33 -0
  113. package/dist/endpoints/paths/cron-list.js.map +1 -0
  114. package/dist/endpoints/paths/cron-restore.d.ts +2 -0
  115. package/dist/endpoints/paths/cron-restore.js +61 -0
  116. package/dist/endpoints/paths/cron-restore.js.map +1 -0
  117. package/dist/endpoints/paths/cron-run.d.ts +3 -0
  118. package/dist/endpoints/paths/cron-run.js +45 -0
  119. package/dist/endpoints/paths/cron-run.js.map +1 -0
  120. package/dist/endpoints/shared.d.ts +13 -0
  121. package/dist/endpoints/shared.js +58 -0
  122. package/dist/endpoints/shared.js.map +1 -0
  123. package/dist/exports/client.d.ts +1 -0
  124. package/dist/exports/client.js +3 -0
  125. package/dist/exports/client.js.map +1 -0
  126. package/dist/exports/rsc.d.ts +1 -0
  127. package/dist/exports/rsc.js +3 -0
  128. package/dist/exports/rsc.js.map +1 -0
  129. package/dist/index.d.ts +18 -0
  130. package/dist/index.js +14 -0
  131. package/dist/index.js.map +1 -0
  132. package/dist/plugin.d.ts +3 -0
  133. package/dist/plugin.js +82 -0
  134. package/dist/plugin.js.map +1 -0
  135. package/dist/publicApiPaths.d.ts +19 -0
  136. package/dist/publicApiPaths.js +20 -0
  137. package/dist/publicApiPaths.js.map +1 -0
  138. package/dist/types.d.ts +21 -0
  139. package/dist/types.js +3 -0
  140. package/dist/types.js.map +1 -0
  141. package/dist/utils/backupSelection.d.ts +6 -0
  142. package/dist/utils/backupSelection.js +16 -0
  143. package/dist/utils/backupSelection.js.map +1 -0
  144. package/dist/utils/blobName.d.ts +32 -0
  145. package/dist/utils/blobName.js +99 -0
  146. package/dist/utils/blobName.js.map +1 -0
  147. package/dist/utils/dashboardRoleAccess.d.ts +23 -0
  148. package/dist/utils/dashboardRoleAccess.js +64 -0
  149. package/dist/utils/dashboardRoleAccess.js.map +1 -0
  150. package/dist/utils/dialogBackdrop.d.ts +9 -0
  151. package/dist/utils/dialogBackdrop.js +17 -0
  152. package/dist/utils/dialogBackdrop.js.map +1 -0
  153. package/dist/utils/formatBytes.d.ts +2 -0
  154. package/dist/utils/formatBytes.js +20 -0
  155. package/dist/utils/formatBytes.js.map +1 -0
  156. package/dist/utils/hostname.d.ts +2 -0
  157. package/dist/utils/hostname.js +17 -0
  158. package/dist/utils/hostname.js.map +1 -0
  159. package/dist/utils/index.d.ts +5 -0
  160. package/dist/utils/index.js +7 -0
  161. package/dist/utils/index.js.map +1 -0
  162. package/dist/utils/maskBlobToken.d.ts +11 -0
  163. package/dist/utils/maskBlobToken.js +42 -0
  164. package/dist/utils/maskBlobToken.js.map +1 -0
  165. package/package.json +140 -0
@@ -0,0 +1,597 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Button, Collapsible } from '@payloadcms/ui';
4
+ import { useCallback, useId, useMemo, useRef, useState } from 'react';
5
+ import { closeNativeDialogOnBackdropPointer } from '../../utils/dialogBackdrop';
6
+ import { formatBytes, getBackupSortTimeMs, transformBlobName } from '../../utils/index';
7
+ import { BackupItemActions } from './BackupItemActions.client';
8
+ const defaultFilterState = {
9
+ dateFrom: '',
10
+ dateTo: '',
11
+ label: '',
12
+ media: 'all',
13
+ showOtherDb: true,
14
+ showOtherHostname: false,
15
+ source: 'all'
16
+ };
17
+ function parseDateInputStartMs(isoDate) {
18
+ const parts = isoDate.split('-').map(Number);
19
+ if (parts.length !== 3 || parts.some((n)=>!Number.isFinite(n))) {
20
+ return null;
21
+ }
22
+ const [y, m, d] = parts;
23
+ const t = new Date(y, m - 1, d, 0, 0, 0, 0).getTime();
24
+ return Number.isFinite(t) ? t : null;
25
+ }
26
+ function parseDateInputEndMs(isoDate) {
27
+ const parts = isoDate.split('-').map(Number);
28
+ if (parts.length !== 3 || parts.some((n)=>!Number.isFinite(n))) {
29
+ return null;
30
+ }
31
+ const [y, m, d] = parts;
32
+ const t = new Date(y, m - 1, d, 23, 59, 59, 999).getTime();
33
+ return Number.isFinite(t) ? t : null;
34
+ }
35
+ function passesDateMediaSource(parsed, displayMs, filters) {
36
+ if (filters.dateFrom) {
37
+ const from = parseDateInputStartMs(filters.dateFrom);
38
+ if (from != null && displayMs < from) {
39
+ return false;
40
+ }
41
+ }
42
+ if (filters.dateTo) {
43
+ const to = parseDateInputEndMs(filters.dateTo);
44
+ if (to != null && displayMs > to) {
45
+ return false;
46
+ }
47
+ }
48
+ if (filters.media === 'with' && parsed.fileType !== 'tar.gz') {
49
+ return false;
50
+ }
51
+ if (filters.media === 'without' && parsed.fileType !== 'json') {
52
+ return false;
53
+ }
54
+ if (filters.source === 'manual' && parsed.type !== 'manual') {
55
+ return false;
56
+ }
57
+ if (filters.source === 'cron' && parsed.type !== 'cron') {
58
+ return false;
59
+ }
60
+ const labelQuery = filters.label.trim().toLowerCase();
61
+ if (labelQuery) {
62
+ const blobLabel = (parsed.label ?? '').toLowerCase();
63
+ if (!blobLabel.includes(labelQuery)) {
64
+ return false;
65
+ }
66
+ }
67
+ return true;
68
+ }
69
+ function hasNonDefaultFilters(f) {
70
+ return f.dateFrom !== defaultFilterState.dateFrom || f.dateTo !== defaultFilterState.dateTo || f.label !== defaultFilterState.label || f.media !== defaultFilterState.media || f.source !== defaultFilterState.source || f.showOtherDb !== defaultFilterState.showOtherDb || f.showOtherHostname !== defaultFilterState.showOtherHostname;
71
+ }
72
+ export const BackupListCollapsible = ({ blobs, countOtherDb, countOtherHostname, currentDbName, currentHostname, i18nLanguage })=>{
73
+ const uid = useId();
74
+ const idDb = `${uid}-show-other-db`;
75
+ const idHost = `${uid}-show-other-host`;
76
+ const dialogRef = useRef(null);
77
+ const [filters, setFilters] = useState(defaultFilterState);
78
+ const visibleRows = useMemo(()=>{
79
+ const rows = [];
80
+ for (const blob of blobs){
81
+ const parsed = transformBlobName(blob.pathname);
82
+ const { dbName, hostname } = parsed;
83
+ const isCurrentDb = currentDbName === dbName;
84
+ const isCurrentHostname = currentHostname === hostname;
85
+ if (!(filters.showOtherDb || isCurrentDb)) {
86
+ continue;
87
+ }
88
+ if (!(filters.showOtherHostname || isCurrentHostname)) {
89
+ continue;
90
+ }
91
+ const uploadedAt = new Date(blob.uploadedAt);
92
+ const displayMs = getBackupSortTimeMs(parsed, uploadedAt);
93
+ if (!passesDateMediaSource(parsed, displayMs, filters)) {
94
+ continue;
95
+ }
96
+ rows.push({
97
+ blob,
98
+ displayAt: new Date(displayMs),
99
+ displayMs,
100
+ parsed
101
+ });
102
+ }
103
+ return rows;
104
+ }, [
105
+ blobs,
106
+ currentDbName,
107
+ currentHostname,
108
+ filters
109
+ ]);
110
+ const openFilterDialog = useCallback(()=>{
111
+ dialogRef.current?.showModal();
112
+ }, []);
113
+ const closeFilterDialog = useCallback(()=>{
114
+ dialogRef.current?.close();
115
+ }, []);
116
+ const clearFilters = useCallback(()=>{
117
+ setFilters(defaultFilterState);
118
+ }, []);
119
+ const hasScopeOptions = countOtherDb > 0 || countOtherHostname > 0;
120
+ const filtersActive = hasNonDefaultFilters(filters);
121
+ const filtersButton = /*#__PURE__*/ _jsx(Button, {
122
+ buttonStyle: "secondary",
123
+ className: filtersActive ? 'backup-dashboard__filter-btn backup-dashboard__filter-btn--active' : 'backup-dashboard__filter-btn',
124
+ onClick: openFilterDialog,
125
+ type: "button",
126
+ children: "Filters"
127
+ });
128
+ return /*#__PURE__*/ _jsxs(_Fragment, {
129
+ children: [
130
+ /*#__PURE__*/ _jsxs(Collapsible, {
131
+ header: /*#__PURE__*/ _jsx("span", {
132
+ className: "backup-dashboard__collapsible-title",
133
+ children: "Backup list"
134
+ }),
135
+ initCollapsed: true,
136
+ children: [
137
+ /*#__PURE__*/ _jsx("div", {
138
+ className: "backup-dashboard__backup-list-toolbar",
139
+ children: filtersButton
140
+ }),
141
+ blobs.length === 0 ? /*#__PURE__*/ _jsx("p", {
142
+ className: "backup-dashboard__list-empty",
143
+ children: "No backups yet"
144
+ }) : visibleRows.length === 0 ? /*#__PURE__*/ _jsx("p", {
145
+ className: "backup-dashboard__list-empty",
146
+ children: "No backups match the current filters"
147
+ }) : visibleRows.map(({ blob, displayAt, parsed })=>{
148
+ const { type, collectionCount, dbName, fileType, hostname, label } = parsed;
149
+ const isCurrentDb = currentDbName === dbName;
150
+ const isCurrentHostname = currentHostname === hostname;
151
+ return /*#__PURE__*/ _jsxs("div", {
152
+ className: "backup-item",
153
+ children: [
154
+ /*#__PURE__*/ _jsxs("div", {
155
+ className: "backup-item__main",
156
+ children: [
157
+ /*#__PURE__*/ _jsxs("div", {
158
+ className: "backup-item__primary",
159
+ children: [
160
+ /*#__PURE__*/ _jsx("time", {
161
+ className: "backup-item__time",
162
+ dateTime: displayAt.toISOString(),
163
+ suppressHydrationWarning: true,
164
+ children: displayAt.toLocaleString(i18nLanguage)
165
+ }),
166
+ /*#__PURE__*/ _jsx("span", {
167
+ className: `backup-item__pill backup-item__pill--kind backup-item__pill--${type === 'cron' ? 'cron' : 'manual'}`,
168
+ children: type === 'cron' ? 'Cron backup' : 'Manual backup'
169
+ }),
170
+ label ? /*#__PURE__*/ _jsxs("span", {
171
+ className: "backup-item__pill backup-item__pill--label",
172
+ title: `Label: ${label}`,
173
+ children: [
174
+ /*#__PURE__*/ _jsx("span", {
175
+ className: "backup-item__pill-key",
176
+ children: "Label"
177
+ }),
178
+ label
179
+ ]
180
+ }) : null
181
+ ]
182
+ }),
183
+ /*#__PURE__*/ _jsxs("div", {
184
+ className: "backup-item__meta",
185
+ children: [
186
+ /*#__PURE__*/ _jsxs("span", {
187
+ className: `backup-item__pill backup-item__pill--db${isCurrentDb ? '' : ' backup-item__pill--warn'}`,
188
+ children: [
189
+ /*#__PURE__*/ _jsx("span", {
190
+ className: "backup-item__pill-key",
191
+ children: isCurrentDb ? 'DB' : 'other DB'
192
+ }),
193
+ dbName || 'Unknown'
194
+ ]
195
+ }),
196
+ /*#__PURE__*/ _jsxs("span", {
197
+ className: `backup-item__pill backup-item__pill--host${isCurrentHostname ? '' : ' backup-item__pill--warn'}`,
198
+ children: [
199
+ /*#__PURE__*/ _jsx("span", {
200
+ className: "backup-item__pill-key",
201
+ children: "Host"
202
+ }),
203
+ hostname || 'Unknown'
204
+ ]
205
+ }),
206
+ typeof collectionCount === 'number' ? /*#__PURE__*/ _jsxs("span", {
207
+ className: "backup-item__pill backup-item__pill--collections",
208
+ children: [
209
+ /*#__PURE__*/ _jsx("span", {
210
+ className: "backup-item__pill-key",
211
+ children: "Collections"
212
+ }),
213
+ collectionCount
214
+ ]
215
+ }) : null,
216
+ fileType === 'tar.gz' ? /*#__PURE__*/ _jsx("span", {
217
+ className: "backup-item__pill backup-item__pill--media",
218
+ children: "With media"
219
+ }) : fileType === 'json' ? /*#__PURE__*/ _jsx("span", {
220
+ className: "backup-item__pill backup-item__pill--media",
221
+ children: "Without media"
222
+ }) : null,
223
+ /*#__PURE__*/ _jsxs("span", {
224
+ className: "backup-item__pill backup-item__pill--size",
225
+ title: `${blob.size.toLocaleString(i18nLanguage)} bytes`,
226
+ children: [
227
+ /*#__PURE__*/ _jsx("span", {
228
+ className: "backup-item__pill-key",
229
+ children: "Size"
230
+ }),
231
+ /*#__PURE__*/ _jsx("span", {
232
+ className: "backup-item__size-value",
233
+ children: formatBytes(blob.size)
234
+ })
235
+ ]
236
+ })
237
+ ]
238
+ })
239
+ ]
240
+ }),
241
+ /*#__PURE__*/ _jsx(BackupItemActions, {
242
+ downloadUrl: blob.downloadUrl,
243
+ pathname: blob.pathname,
244
+ url: blob.url
245
+ })
246
+ ]
247
+ }, blob.pathname);
248
+ })
249
+ ]
250
+ }),
251
+ /*#__PURE__*/ _jsxs("dialog", {
252
+ className: "backup-confirm-dialog backup-confirm-dialog--backup-list-filters",
253
+ onPointerDown: (e)=>closeNativeDialogOnBackdropPointer(e, dialogRef),
254
+ ref: dialogRef,
255
+ children: [
256
+ /*#__PURE__*/ _jsx("h3", {
257
+ className: "backup-confirm-dialog__title",
258
+ children: "Filter backups"
259
+ }),
260
+ /*#__PURE__*/ _jsx("p", {
261
+ className: "backup-confirm-dialog__subtitle",
262
+ children: "All filters apply in the browser only. Current DB and hostname are always shown; enable the options below to include backups from other databases or hosts."
263
+ }),
264
+ /*#__PURE__*/ _jsxs("div", {
265
+ className: "backup-confirm-dialog__body backup-list-filters__body",
266
+ children: [
267
+ hasScopeOptions ? /*#__PURE__*/ _jsxs("fieldset", {
268
+ className: "backup-list-filters__fieldset",
269
+ children: [
270
+ /*#__PURE__*/ _jsx("legend", {
271
+ className: "backup-list-filters__legend",
272
+ children: "Scope"
273
+ }),
274
+ countOtherDb > 0 ? /*#__PURE__*/ _jsxs("div", {
275
+ className: "field-type checkbox backup-dashboard__collapsible-checkbox backup-list-filters__scope-row",
276
+ children: [
277
+ /*#__PURE__*/ _jsx("input", {
278
+ "aria-label": `Show other databases (${countOtherDb} in list)`,
279
+ checked: filters.showOtherDb,
280
+ className: "checkbox-input__input",
281
+ id: idDb,
282
+ onChange: (e)=>setFilters((f)=>({
283
+ ...f,
284
+ showOtherDb: e.target.checked
285
+ })),
286
+ type: "checkbox"
287
+ }),
288
+ /*#__PURE__*/ _jsxs("label", {
289
+ className: "field-label",
290
+ htmlFor: idDb,
291
+ children: [
292
+ "Show other DBs",
293
+ /*#__PURE__*/ _jsxs("span", {
294
+ className: "backup-list-filters__hint",
295
+ children: [
296
+ " (",
297
+ countOtherDb,
298
+ " in list)"
299
+ ]
300
+ })
301
+ ]
302
+ })
303
+ ]
304
+ }) : null,
305
+ countOtherHostname > 0 ? /*#__PURE__*/ _jsxs("div", {
306
+ className: "field-type checkbox backup-dashboard__collapsible-checkbox backup-list-filters__scope-row",
307
+ children: [
308
+ /*#__PURE__*/ _jsx("input", {
309
+ "aria-label": `Show other hostnames (${countOtherHostname} in list)`,
310
+ checked: filters.showOtherHostname,
311
+ className: "checkbox-input__input",
312
+ id: idHost,
313
+ onChange: (e)=>setFilters((f)=>({
314
+ ...f,
315
+ showOtherHostname: e.target.checked
316
+ })),
317
+ type: "checkbox"
318
+ }),
319
+ /*#__PURE__*/ _jsxs("label", {
320
+ className: "field-label",
321
+ htmlFor: idHost,
322
+ children: [
323
+ "Show other Hostnames",
324
+ /*#__PURE__*/ _jsxs("span", {
325
+ className: "backup-list-filters__hint",
326
+ children: [
327
+ ' ',
328
+ "(",
329
+ countOtherHostname,
330
+ " in list)"
331
+ ]
332
+ })
333
+ ]
334
+ })
335
+ ]
336
+ }) : null
337
+ ]
338
+ }) : null,
339
+ /*#__PURE__*/ _jsxs("fieldset", {
340
+ className: "backup-list-filters__fieldset",
341
+ children: [
342
+ /*#__PURE__*/ _jsx("legend", {
343
+ className: "backup-list-filters__legend",
344
+ children: "Label"
345
+ }),
346
+ /*#__PURE__*/ _jsxs("div", {
347
+ className: "backup-list-filters__row backup-list-filters__row--label",
348
+ children: [
349
+ /*#__PURE__*/ _jsx("label", {
350
+ className: "backup-list-filters__label",
351
+ htmlFor: `${uid}-label`,
352
+ children: "Search"
353
+ }),
354
+ /*#__PURE__*/ _jsx("input", {
355
+ "aria-label": "Filter backups by label text",
356
+ autoComplete: "off",
357
+ className: "backup-list-filters__text",
358
+ id: `${uid}-label`,
359
+ onChange: (e)=>setFilters((f)=>({
360
+ ...f,
361
+ label: e.target.value
362
+ })),
363
+ placeholder: "Filter by label text",
364
+ spellCheck: false,
365
+ type: "text",
366
+ value: filters.label
367
+ })
368
+ ]
369
+ })
370
+ ]
371
+ }),
372
+ /*#__PURE__*/ _jsxs("fieldset", {
373
+ className: "backup-list-filters__fieldset",
374
+ children: [
375
+ /*#__PURE__*/ _jsx("legend", {
376
+ className: "backup-list-filters__legend",
377
+ children: "Date range"
378
+ }),
379
+ /*#__PURE__*/ _jsxs("div", {
380
+ className: "backup-list-filters__row",
381
+ children: [
382
+ /*#__PURE__*/ _jsx("label", {
383
+ className: "backup-list-filters__label",
384
+ htmlFor: `${uid}-from`,
385
+ children: "From"
386
+ }),
387
+ /*#__PURE__*/ _jsx("input", {
388
+ "aria-label": "Filter from date",
389
+ className: "backup-list-filters__date",
390
+ id: `${uid}-from`,
391
+ onChange: (e)=>setFilters((f)=>({
392
+ ...f,
393
+ dateFrom: e.target.value
394
+ })),
395
+ type: "date",
396
+ value: filters.dateFrom
397
+ })
398
+ ]
399
+ }),
400
+ /*#__PURE__*/ _jsxs("div", {
401
+ className: "backup-list-filters__row",
402
+ children: [
403
+ /*#__PURE__*/ _jsx("label", {
404
+ className: "backup-list-filters__label",
405
+ htmlFor: `${uid}-to`,
406
+ children: "To"
407
+ }),
408
+ /*#__PURE__*/ _jsx("input", {
409
+ "aria-label": "Filter to date",
410
+ className: "backup-list-filters__date",
411
+ id: `${uid}-to`,
412
+ onChange: (e)=>setFilters((f)=>({
413
+ ...f,
414
+ dateTo: e.target.value
415
+ })),
416
+ type: "date",
417
+ value: filters.dateTo
418
+ })
419
+ ]
420
+ })
421
+ ]
422
+ }),
423
+ /*#__PURE__*/ _jsxs("fieldset", {
424
+ className: "backup-list-filters__fieldset",
425
+ children: [
426
+ /*#__PURE__*/ _jsx("legend", {
427
+ className: "backup-list-filters__legend",
428
+ children: "Media"
429
+ }),
430
+ /*#__PURE__*/ _jsxs("div", {
431
+ className: "field-type radio backup-list-filters__radio-row",
432
+ children: [
433
+ /*#__PURE__*/ _jsx("input", {
434
+ "aria-label": "Media filter: all backups",
435
+ checked: filters.media === 'all',
436
+ className: "radio-input__input",
437
+ id: `${uid}-media-all`,
438
+ name: `${uid}-media`,
439
+ onChange: ()=>setFilters((f)=>({
440
+ ...f,
441
+ media: 'all'
442
+ })),
443
+ type: "radio"
444
+ }),
445
+ /*#__PURE__*/ _jsx("label", {
446
+ className: "field-label",
447
+ htmlFor: `${uid}-media-all`,
448
+ children: "All"
449
+ })
450
+ ]
451
+ }),
452
+ /*#__PURE__*/ _jsxs("div", {
453
+ className: "field-type radio backup-list-filters__radio-row",
454
+ children: [
455
+ /*#__PURE__*/ _jsx("input", {
456
+ "aria-label": "Media filter: with media",
457
+ checked: filters.media === 'with',
458
+ className: "radio-input__input",
459
+ id: `${uid}-media-with`,
460
+ name: `${uid}-media`,
461
+ onChange: ()=>setFilters((f)=>({
462
+ ...f,
463
+ media: 'with'
464
+ })),
465
+ type: "radio"
466
+ }),
467
+ /*#__PURE__*/ _jsx("label", {
468
+ className: "field-label",
469
+ htmlFor: `${uid}-media-with`,
470
+ children: "With media"
471
+ })
472
+ ]
473
+ }),
474
+ /*#__PURE__*/ _jsxs("div", {
475
+ className: "field-type radio backup-list-filters__radio-row",
476
+ children: [
477
+ /*#__PURE__*/ _jsx("input", {
478
+ "aria-label": "Media filter: without media",
479
+ checked: filters.media === 'without',
480
+ className: "radio-input__input",
481
+ id: `${uid}-media-without`,
482
+ name: `${uid}-media`,
483
+ onChange: ()=>setFilters((f)=>({
484
+ ...f,
485
+ media: 'without'
486
+ })),
487
+ type: "radio"
488
+ }),
489
+ /*#__PURE__*/ _jsx("label", {
490
+ className: "field-label",
491
+ htmlFor: `${uid}-media-without`,
492
+ children: "Without media"
493
+ })
494
+ ]
495
+ })
496
+ ]
497
+ }),
498
+ /*#__PURE__*/ _jsxs("fieldset", {
499
+ className: "backup-list-filters__fieldset",
500
+ children: [
501
+ /*#__PURE__*/ _jsx("legend", {
502
+ className: "backup-list-filters__legend",
503
+ children: "Source"
504
+ }),
505
+ /*#__PURE__*/ _jsxs("div", {
506
+ className: "field-type radio backup-list-filters__radio-row",
507
+ children: [
508
+ /*#__PURE__*/ _jsx("input", {
509
+ "aria-label": "Source filter: all",
510
+ checked: filters.source === 'all',
511
+ className: "radio-input__input",
512
+ id: `${uid}-source-all`,
513
+ name: `${uid}-source`,
514
+ onChange: ()=>setFilters((f)=>({
515
+ ...f,
516
+ source: 'all'
517
+ })),
518
+ type: "radio"
519
+ }),
520
+ /*#__PURE__*/ _jsx("label", {
521
+ className: "field-label",
522
+ htmlFor: `${uid}-source-all`,
523
+ children: "All"
524
+ })
525
+ ]
526
+ }),
527
+ /*#__PURE__*/ _jsxs("div", {
528
+ className: "field-type radio backup-list-filters__radio-row",
529
+ children: [
530
+ /*#__PURE__*/ _jsx("input", {
531
+ "aria-label": "Source filter: manual backups",
532
+ checked: filters.source === 'manual',
533
+ className: "radio-input__input",
534
+ id: `${uid}-source-manual`,
535
+ name: `${uid}-source`,
536
+ onChange: ()=>setFilters((f)=>({
537
+ ...f,
538
+ source: 'manual'
539
+ })),
540
+ type: "radio"
541
+ }),
542
+ /*#__PURE__*/ _jsx("label", {
543
+ className: "field-label",
544
+ htmlFor: `${uid}-source-manual`,
545
+ children: "Manual"
546
+ })
547
+ ]
548
+ }),
549
+ /*#__PURE__*/ _jsxs("div", {
550
+ className: "field-type radio backup-list-filters__radio-row",
551
+ children: [
552
+ /*#__PURE__*/ _jsx("input", {
553
+ "aria-label": "Source filter: cron backups",
554
+ checked: filters.source === 'cron',
555
+ className: "radio-input__input",
556
+ id: `${uid}-source-cron`,
557
+ name: `${uid}-source`,
558
+ onChange: ()=>setFilters((f)=>({
559
+ ...f,
560
+ source: 'cron'
561
+ })),
562
+ type: "radio"
563
+ }),
564
+ /*#__PURE__*/ _jsx("label", {
565
+ className: "field-label",
566
+ htmlFor: `${uid}-source-cron`,
567
+ children: "Cron"
568
+ })
569
+ ]
570
+ })
571
+ ]
572
+ })
573
+ ]
574
+ }),
575
+ /*#__PURE__*/ _jsxs("div", {
576
+ className: "backup-confirm-dialog__actions",
577
+ children: [
578
+ /*#__PURE__*/ _jsx(Button, {
579
+ buttonStyle: "secondary",
580
+ onClick: clearFilters,
581
+ type: "button",
582
+ children: "Clear filters"
583
+ }),
584
+ /*#__PURE__*/ _jsx(Button, {
585
+ onClick: closeFilterDialog,
586
+ type: "button",
587
+ children: "Done"
588
+ })
589
+ ]
590
+ })
591
+ ]
592
+ })
593
+ ]
594
+ });
595
+ };
596
+
597
+ //# sourceMappingURL=BackupListCollapsible.client.js.map