@postgres.ai/shared 4.0.2-pr-1149.1 → 4.0.2-pr-1200
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/components/UpgradeCloneModal/index.d.ts +11 -0
- package/components/UpgradeCloneModal/index.js +75 -0
- package/package.json +1 -1
- package/pages/Branches/Branch/index.js +27 -2
- package/pages/Branches/Branch/stores/Main.d.ts +5 -0
- package/pages/Branches/Branch/stores/Main.js +29 -0
- package/pages/Branches/components/BranchesTable/index.js +2 -2
- package/pages/Branches/index.js +10 -1
- package/pages/Clone/Status/index.js +3 -0
- package/pages/Clone/index.js +12 -4
- package/pages/Clone/stores/Main.d.ts +9 -1
- package/pages/Clone/stores/Main.js +40 -3
- package/pages/CreateBranch/stores/Main.d.ts +3 -0
- package/pages/CreateClone/index.js +2 -0
- package/pages/CreateClone/stores/Main.d.ts +5 -1
- package/pages/CreateClone/stores/Main.js +8 -3
- package/pages/Instance/Configuration/PhysicalMode/EnvsEditor/index.d.ts +13 -0
- package/pages/Instance/Configuration/PhysicalMode/EnvsEditor/index.js +31 -0
- package/pages/Instance/Configuration/PhysicalMode/PgBackRest/index.d.ts +10 -0
- package/pages/Instance/Configuration/PhysicalMode/PgBackRest/index.js +29 -0
- package/pages/Instance/Configuration/PhysicalMode/Sync/index.d.ts +9 -0
- package/pages/Instance/Configuration/PhysicalMode/Sync/index.js +14 -0
- package/pages/Instance/Configuration/PhysicalMode/Walg/index.d.ts +10 -0
- package/pages/Instance/Configuration/PhysicalMode/Walg/index.js +21 -0
- package/pages/Instance/Configuration/PhysicalMode/index.d.ts +10 -0
- package/pages/Instance/Configuration/PhysicalMode/index.js +17 -0
- package/pages/Instance/Configuration/SimpleMode/PreviewCard.d.ts +13 -0
- package/pages/Instance/Configuration/SimpleMode/PreviewCard.js +14 -0
- package/pages/Instance/Configuration/SimpleMode/index.d.ts +19 -0
- package/pages/Instance/Configuration/SimpleMode/index.js +166 -0
- package/pages/Instance/Configuration/configMode.d.ts +2 -0
- package/pages/Instance/Configuration/configMode.js +7 -0
- package/pages/Instance/Configuration/configOptions.d.ts +16 -0
- package/pages/Instance/Configuration/configOptions.js +71 -0
- package/pages/Instance/Configuration/connectionString.d.ts +20 -0
- package/pages/Instance/Configuration/connectionString.js +129 -0
- package/pages/Instance/Configuration/dockerCatalog.d.ts +2 -0
- package/pages/Instance/Configuration/dockerCatalog.js +19 -0
- package/pages/Instance/Configuration/index.d.ts +1 -2
- package/pages/Instance/Configuration/index.js +115 -86
- package/pages/Instance/Configuration/useForm.d.ts +20 -0
- package/pages/Instance/Configuration/useForm.js +126 -5
- package/pages/Instance/Configuration/utils/index.js +1 -17
- package/pages/Instance/Info/Snapshots/Calendar/Day/index.js +3 -3
- package/pages/Instance/Info/Snapshots/Calendar/utils.d.ts +3 -0
- package/pages/Instance/Info/Snapshots/utils.d.ts +6 -0
- package/pages/Instance/Snapshots/components/SnapshotsList/index.js +11 -1
- package/pages/Instance/Snapshots/index.js +11 -3
- package/pages/Instance/Snapshots/utils/index.d.ts +3 -0
- package/pages/Instance/Tabs/styles.js +6 -6
- package/pages/Instance/index.js +1 -3
- package/pages/Instance/stores/Main.d.ts +22 -2
- package/pages/Instance/stores/Main.js +26 -9
- package/pages/Snapshots/Snapshot/index.js +28 -2
- package/pages/Snapshots/Snapshot/stores/Main.d.ts +5 -0
- package/pages/Snapshots/Snapshot/stores/Main.js +29 -0
- package/stores/Snapshots.d.ts +1 -1
- package/stores/Snapshots.js +12 -6
- package/types/api/endpoints/getBranches.d.ts +6 -0
- package/types/api/endpoints/probeSource.d.ts +32 -0
- package/types/api/endpoints/probeSource.js +1 -0
- package/types/api/endpoints/testDbSource.d.ts +3 -1
- package/types/api/endpoints/testDbSource.js +6 -0
- package/types/api/endpoints/updateBranch.d.ts +11 -0
- package/types/api/endpoints/updateBranch.js +1 -0
- package/types/api/endpoints/updateSnapshot.d.ts +11 -0
- package/types/api/endpoints/updateSnapshot.js +1 -0
- package/types/api/endpoints/upgradeClone.d.ts +8 -0
- package/types/api/endpoints/upgradeClone.js +1 -0
- package/types/api/entities/branchSnapshots.d.ts +3 -0
- package/types/api/entities/clone.d.ts +9 -2
- package/types/api/entities/config.d.ts +32 -0
- package/types/api/entities/config.js +45 -18
- package/types/api/entities/instance.d.ts +11 -1
- package/types/api/entities/instanceState.d.ts +16 -1
- package/types/api/entities/snapshot.d.ts +6 -0
- package/utils/api.d.ts +1 -1
- package/utils/api.js +6 -0
- package/utils/clone.d.ts +3 -1
- package/utils/clone.js +7 -1
- package/utils/clonePoller.d.ts +12 -0
- package/utils/clonePoller.js +41 -0
- package/utils/date.js +12 -12
- package/utils/protection.d.ts +5 -0
- package/utils/protection.js +23 -0
package/utils/date.js
CHANGED
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
*--------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
7
7
|
import { parse, startOfDay, isSameDay, startOfMonth, startOfWeek, endOfMonth, endOfWeek, differenceInDays, addDays, addMonths, isSameMonth, format, formatDistanceToNowStrict, } from 'date-fns';
|
|
8
|
+
const compactDatePattern = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/;
|
|
9
|
+
// formatDateToISO converts a compact UTC timestamp ('20060102150405') to RFC3339 ('2006-01-02T15:04:05Z').
|
|
10
|
+
// The value is a UTC wall-clock, so it must never be interpreted in the browser timezone.
|
|
8
11
|
export const formatDateToISO = (dateString) => {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
var _a;
|
|
13
|
+
const parts = compactDatePattern.exec((_a = dateString === null || dateString === void 0 ? void 0 : dateString.trim()) !== null && _a !== void 0 ? _a : '');
|
|
14
|
+
if (!parts) {
|
|
11
15
|
return '';
|
|
12
16
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!isValidDate(parsedDate) || isNaN(parsedDate.getTime())) {
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
return format(parsedDate, "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
// Return empty string for invalid date formats
|
|
17
|
+
const [compact, year, month, day, hours, minutes, seconds] = parts;
|
|
18
|
+
const parsedDate = new Date(Date.UTC(+year, +month - 1, +day, +hours, +minutes, +seconds));
|
|
19
|
+
if (!isValidDate(parsedDate)) {
|
|
23
20
|
return '';
|
|
24
21
|
}
|
|
22
|
+
const isoDate = parsedDate.toISOString().replace(/\.\d+Z$/, 'Z');
|
|
23
|
+
// reject values rolled over by Date.UTC, e.g. month 13 or hour 25.
|
|
24
|
+
return isoDate.replace(/[-:TZ]/g, '') === compact ? isoDate : '';
|
|
25
25
|
};
|
|
26
26
|
// parseDate parses date of both format: '2006-01-02 15:04:05 UTC' and `2006-01-02T15:04:05Z` (RFC3339).
|
|
27
27
|
export const parseDate = (dateStr) => parse(dateStr.replace(' UTC', 'Z').replace('T', ' '), 'yyyy-MM-dd HH:mm:ssX', new Date());
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// protectionOptions lists the deletion-protection choices shared by the branch and snapshot
|
|
2
|
+
// detail pages: no protection, a set of bounded durations, and forever. The values are the
|
|
3
|
+
// protectionDurationMinutes passed to the update endpoints ('0' means forever, 'none' clears
|
|
4
|
+
// protection).
|
|
5
|
+
export const protectionOptions = [
|
|
6
|
+
{ value: 'none', children: 'No protection' },
|
|
7
|
+
{ value: '60', children: '1 hour' },
|
|
8
|
+
{ value: '720', children: '12 hours' },
|
|
9
|
+
{ value: '1440', children: '1 day' },
|
|
10
|
+
{ value: '4320', children: '3 days' },
|
|
11
|
+
{ value: '10080', children: '7 days' },
|
|
12
|
+
{ value: '43200', children: '30 days' },
|
|
13
|
+
{ value: '0', children: 'Forever' },
|
|
14
|
+
];
|
|
15
|
+
// getProtectionSelectValue maps an entity's protection state to the Select value: 'none' when
|
|
16
|
+
// unprotected, 'current' when protected until a specific time, '0' when protected forever.
|
|
17
|
+
export const getProtectionSelectValue = (isProtected, protectedTillDate) => {
|
|
18
|
+
if (!isProtected)
|
|
19
|
+
return 'none';
|
|
20
|
+
if (!protectedTillDate)
|
|
21
|
+
return '0';
|
|
22
|
+
return 'current';
|
|
23
|
+
};
|