@postgres.ai/shared 3.5.0-pr-1027.1 → 4.0.0-pr-1028.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.
- package/components/DestroyCloneModal/index.js +3 -3
- package/components/DestroyCloneRestrictionModal/index.js +1 -1
- package/components/MenuButton/index.d.ts +2 -0
- package/components/MenuButton/index.js +1 -1
- package/components/ResetCloneModal/index.js +5 -3
- package/icons/ArrowDropDown/index.d.ts +1 -0
- package/icons/ArrowDropDown/index.js +1 -1
- package/icons/PostgresSQL/index.d.ts +2 -0
- package/icons/PostgresSQL/index.js +40 -0
- package/package.json +1 -1
- package/pages/Branches/Branch/context.d.ts +22 -0
- package/pages/Branches/Branch/context.js +3 -0
- package/pages/Branches/Branch/index.d.ts +9 -0
- package/pages/Branches/Branch/index.js +172 -0
- package/pages/Branches/Branch/stores/Main.d.ts +37 -0
- package/pages/Branches/Branch/stores/Main.js +90 -0
- package/pages/Branches/Branch/useCreatedStores.d.ts +6 -0
- package/pages/Branches/Branch/useCreatedStores.js +5 -0
- package/pages/Branches/components/BranchesTable/index.d.ts +10 -0
- package/pages/Branches/components/BranchesTable/index.js +107 -0
- package/pages/Branches/components/Modals/DeleteBranchModal/index.d.ts +11 -0
- package/pages/Branches/components/Modals/DeleteBranchModal/index.js +49 -0
- package/pages/Branches/components/Modals/types.d.ts +4 -0
- package/pages/Branches/components/Modals/types.js +1 -0
- package/pages/Branches/index.d.ts +6 -0
- package/pages/Branches/index.js +60 -0
- package/pages/Clone/context.d.ts +2 -0
- package/pages/Clone/index.d.ts +3 -1
- package/pages/Clone/index.js +54 -23
- package/pages/Clone/stores/Main.d.ts +4 -2
- package/pages/Clone/utils/index.d.ts +4 -0
- package/pages/Clone/utils/index.js +12 -0
- package/pages/CreateBranch/index.d.ts +17 -0
- package/pages/CreateBranch/index.js +135 -0
- package/pages/CreateBranch/stores/Main.d.ts +43 -0
- package/pages/CreateBranch/stores/Main.js +59 -0
- package/pages/CreateBranch/useCreatedStores.d.ts +6 -0
- package/pages/CreateBranch/useCreatedStores.js +5 -0
- package/pages/CreateBranch/useForm.d.ts +51 -0
- package/pages/CreateBranch/useForm.js +30 -0
- package/pages/CreateBranch/utils/index.d.ts +2 -0
- package/pages/CreateBranch/utils/index.js +10 -0
- package/pages/CreateClone/index.d.ts +4 -2
- package/pages/CreateClone/index.js +92 -40
- package/pages/CreateClone/stores/Main.d.ts +25 -2
- package/pages/CreateClone/stores/Main.js +26 -2
- package/pages/CreateClone/styles.module.scss +47 -4
- package/pages/CreateClone/useForm.d.ts +1 -0
- package/pages/CreateClone/useForm.js +1 -0
- package/pages/CreateClone/utils/index.d.ts +3 -0
- package/pages/CreateClone/utils/index.js +17 -0
- package/pages/CreateSnapshot/index.d.ts +17 -0
- package/pages/CreateSnapshot/index.js +117 -0
- package/pages/CreateSnapshot/stores/Main.d.ts +21 -0
- package/pages/CreateSnapshot/stores/Main.js +31 -0
- package/pages/CreateSnapshot/useCreatedStores.d.ts +6 -0
- package/pages/CreateSnapshot/useCreatedStores.js +5 -0
- package/pages/CreateSnapshot/useForm.d.ts +53 -0
- package/pages/CreateSnapshot/useForm.js +25 -0
- package/pages/CreateSnapshot/utils/index.d.ts +1 -0
- package/pages/CreateSnapshot/utils/index.js +3 -0
- package/pages/Instance/{components → Clones}/ClonesList/MenuCell/index.js +1 -1
- package/pages/Instance/{components → Clones}/ClonesList/MenuCell/utils.js +2 -2
- package/pages/Instance/Clones/ClonesList/index.js +96 -0
- package/pages/Instance/{components → Clones}/ClonesList/styles.module.scss +10 -0
- package/pages/Instance/{ClonesModal → Clones/ClonesModal}/index.js +5 -5
- package/pages/Instance/Clones/Header/styles.module.scss +4 -1
- package/pages/Instance/Clones/index.d.ts +5 -1
- package/pages/Instance/Clones/index.js +6 -8
- package/pages/{Configuration → Instance/Configuration}/InputWithTooltip/index.js +15 -11
- package/pages/{Configuration → Instance/Configuration}/index.d.ts +2 -1
- package/pages/{Configuration → Instance/Configuration}/index.js +9 -6
- package/pages/{Configuration → Instance/Configuration}/tooltipText.js +1 -1
- package/pages/Instance/Info/Disks/Disk/index.js +6 -4
- package/pages/Instance/Info/Retrieval/RetrievalModal/index.js +0 -4
- package/pages/Instance/Info/Retrieval/index.js +1 -3
- package/pages/Instance/Info/Snapshots/Calendar/utils.d.ts +4 -0
- package/pages/Instance/Info/Snapshots/index.js +10 -5
- package/pages/Instance/Info/Snapshots/utils.d.ts +13 -2
- package/pages/Instance/Info/Snapshots/utils.js +16 -6
- package/pages/Instance/Info/Status/index.js +2 -2
- package/pages/Instance/Info/index.js +2 -1
- package/pages/Instance/Snapshots/components/SnapshotHeader/index.d.ts +11 -0
- package/pages/Instance/Snapshots/components/SnapshotHeader/index.js +36 -0
- package/pages/Instance/Snapshots/components/SnapshotsList/index.d.ts +11 -0
- package/pages/Instance/Snapshots/components/SnapshotsList/index.js +157 -0
- package/pages/Instance/Snapshots/components/SnapshotsTable/index.d.ts +6 -0
- package/pages/Instance/Snapshots/components/SnapshotsTable/index.js +125 -0
- package/pages/Instance/Snapshots/index.d.ts +6 -0
- package/pages/Instance/Snapshots/index.js +92 -0
- package/pages/Instance/Snapshots/utils/index.d.ts +16 -0
- package/pages/Instance/Snapshots/utils/index.js +30 -0
- package/pages/Instance/SnapshotsModal/index.js +1 -1
- package/pages/Instance/Tabs/PlatformTabs.d.ts +10 -0
- package/pages/Instance/Tabs/PlatformTabs.js +51 -0
- package/pages/Instance/Tabs/index.d.ts +19 -2
- package/pages/Instance/Tabs/index.js +71 -36
- package/pages/Instance/Tabs/styles.d.ts +1 -0
- package/pages/Instance/Tabs/styles.js +62 -0
- package/pages/Instance/components/ModalReloadButton/index.js +1 -1
- package/pages/Instance/context.d.ts +7 -0
- package/pages/Instance/index.js +14 -13
- package/pages/Instance/stores/Main.d.ts +36 -10
- package/pages/Instance/stores/Main.js +83 -24
- package/pages/Instance/styles.scss +1 -4
- package/pages/Logs/hooks/useWsScroll.js +6 -8
- package/pages/Logs/index.d.ts +2 -1
- package/pages/Logs/index.js +42 -31
- package/pages/Logs/wsLogs.d.ts +3 -2
- package/pages/Logs/wsLogs.js +24 -8
- package/pages/Logs/wsSnackbar.js +7 -7
- package/pages/Snapshots/Snapshot/DestorySnapshotModal/index.d.ts +12 -0
- package/pages/Snapshots/Snapshot/DestorySnapshotModal/index.js +69 -0
- package/pages/Snapshots/Snapshot/context.d.ts +23 -0
- package/pages/Snapshots/Snapshot/context.js +3 -0
- package/pages/Snapshots/Snapshot/index.d.ts +9 -0
- package/pages/Snapshots/Snapshot/index.js +171 -0
- package/pages/Snapshots/Snapshot/stores/Main.d.ts +33 -0
- package/pages/Snapshots/Snapshot/stores/Main.js +71 -0
- package/pages/Snapshots/Snapshot/useCreatedStores.d.ts +6 -0
- package/pages/Snapshots/Snapshot/useCreatedStores.js +5 -0
- package/stores/Snapshots.d.ts +12 -3
- package/stores/Snapshots.js +27 -3
- package/types/api/endpoints/createBranch.d.ts +12 -0
- package/types/api/endpoints/createBranch.js +1 -0
- package/types/api/endpoints/createClone.d.ts +1 -0
- package/types/api/endpoints/createSnapshot.d.ts +5 -0
- package/types/api/endpoints/createSnapshot.js +1 -0
- package/types/api/endpoints/deleteBranch.d.ts +4 -0
- package/types/api/endpoints/deleteBranch.js +1 -0
- package/types/api/endpoints/destroySnapshot.d.ts +4 -0
- package/types/api/endpoints/destroySnapshot.js +1 -0
- package/types/api/endpoints/getBranchSnapshot.d.ts +5 -0
- package/types/api/endpoints/getBranchSnapshot.js +1 -0
- package/types/api/endpoints/getBranches.d.ts +18 -0
- package/types/api/endpoints/getBranches.js +5 -0
- package/types/api/endpoints/getConfig.d.ts +2 -2
- package/types/api/endpoints/getEngine.d.ts +1 -1
- package/types/api/endpoints/getFullConfig.d.ts +1 -1
- package/types/api/endpoints/getSnapshotList.d.ts +10 -0
- package/types/api/endpoints/getSnapshotList.js +1 -0
- package/types/api/endpoints/getSnapshots.d.ts +1 -0
- package/types/api/endpoints/updateConfig.d.ts +1 -1
- package/types/api/entities/branchSnapshot.d.ts +6 -0
- package/types/api/entities/branchSnapshot.js +1 -0
- package/types/api/entities/branchSnapshots.d.ts +15 -0
- package/types/api/entities/branchSnapshots.js +7 -0
- package/types/api/entities/clone.d.ts +6 -0
- package/types/api/entities/config.js +1 -1
- package/types/api/entities/createBranch.d.ts +5 -0
- package/types/api/entities/createBranch.js +1 -0
- package/types/api/entities/createSnapshot.d.ts +5 -0
- package/types/api/entities/createSnapshot.js +1 -0
- package/types/api/entities/dbSource.d.ts +1 -0
- package/types/api/entities/instance.d.ts +5 -0
- package/types/api/entities/instanceState.d.ts +5 -0
- package/types/api/entities/snapshot.d.ts +8 -0
- package/types/api/entities/snapshot.js +1 -1
- package/utils/date.d.ts +2 -0
- package/utils/date.js +7 -0
- package/utils/snapshot.d.ts +5 -2
- package/utils/snapshot.js +6 -1
- package/pages/Instance/components/ClonesList/index.js +0 -52
- /package/pages/Instance/{components → Clones}/ClonesList/ConnectionModal/index.d.ts +0 -0
- /package/pages/Instance/{components → Clones}/ClonesList/ConnectionModal/index.js +0 -0
- /package/pages/Instance/{components → Clones}/ClonesList/MenuCell/index.d.ts +0 -0
- /package/pages/Instance/{components → Clones}/ClonesList/MenuCell/utils.d.ts +0 -0
- /package/pages/Instance/{components → Clones}/ClonesList/index.d.ts +0 -0
- /package/pages/Instance/{ClonesModal → Clones/ClonesModal}/index.d.ts +0 -0
- /package/pages/Instance/{ClonesModal → Clones/ClonesModal}/utils.d.ts +0 -0
- /package/pages/Instance/{ClonesModal → Clones/ClonesModal}/utils.js +0 -0
- /package/pages/{Configuration → Instance/Configuration}/Header/index.d.ts +0 -0
- /package/pages/{Configuration → Instance/Configuration}/Header/index.js +0 -0
- /package/pages/{Configuration → Instance/Configuration}/InputWithTooltip/index.d.ts +0 -0
- /package/pages/{Configuration → Instance/Configuration}/ResponseMessage/index.d.ts +0 -0
- /package/pages/{Configuration → Instance/Configuration}/ResponseMessage/index.js +0 -0
- /package/pages/{Configuration → Instance/Configuration}/configOptions.d.ts +0 -0
- /package/pages/{Configuration → Instance/Configuration}/configOptions.js +0 -0
- /package/pages/{Configuration → Instance/Configuration}/styles.module.scss +0 -0
- /package/pages/{Configuration → Instance/Configuration}/tooltipText.d.ts +0 -0
- /package/pages/{Configuration → Instance/Configuration}/useForm.d.ts +0 -0
- /package/pages/{Configuration → Instance/Configuration}/useForm.js +0 -0
- /package/pages/{Configuration → Instance/Configuration}/utils/index.d.ts +0 -0
- /package/pages/{Configuration → Instance/Configuration}/utils/index.js +0 -0
- /package/pages/Instance/{SnapshotsModal → Snapshots/components/SnapshotsModal}/utils.d.ts +0 -0
- /package/pages/Instance/{SnapshotsModal → Snapshots/components/SnapshotsModal}/utils.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Branch {
|
|
2
|
+
name: string;
|
|
3
|
+
parent: string;
|
|
4
|
+
dataStateAt: string;
|
|
5
|
+
snapshotID: string;
|
|
6
|
+
numSnapshots: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const formatBranchesDto: (dto: Branch[]) => {
|
|
9
|
+
dataStateAt: string;
|
|
10
|
+
name: string;
|
|
11
|
+
parent: string;
|
|
12
|
+
snapshotID: string;
|
|
13
|
+
numSnapshots: number;
|
|
14
|
+
}[];
|
|
15
|
+
export declare type GetBranches = (instanceId: string) => Promise<{
|
|
16
|
+
response: Branch[] | null;
|
|
17
|
+
error: Response | null;
|
|
18
|
+
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Config } from
|
|
2
|
-
export declare type GetConfig = () => Promise<{
|
|
1
|
+
import { Config } from '../entities/config';
|
|
2
|
+
export declare type GetConfig = (instanceId: string) => Promise<{
|
|
3
3
|
response: Config | null;
|
|
4
4
|
error: Response | null;
|
|
5
5
|
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface SnapshotList {
|
|
2
|
+
branch: string[];
|
|
3
|
+
id: string;
|
|
4
|
+
dataStateAt: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export declare type GetSnapshotList = (branchName: string, instanceId: string) => Promise<{
|
|
8
|
+
response: SnapshotList[] | null;
|
|
9
|
+
error: Response | null;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '@postgres.ai/shared/types/api/entities/config';
|
|
2
|
-
export declare type UpdateConfig = (values: Config) => Promise<{
|
|
2
|
+
export declare type UpdateConfig = (values: Config, instanceId: string) => Promise<{
|
|
3
3
|
response: Response | null;
|
|
4
4
|
error: Response | null;
|
|
5
5
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const formatBranchSnapshotDto = (dto) => dto;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SnapshotDto } from './snapshot';
|
|
2
|
+
export declare const formatBranchSnapshotDto: (dto: SnapshotDto[]) => {
|
|
3
|
+
numClones: string;
|
|
4
|
+
createdAtDate: Date;
|
|
5
|
+
dataStateAtDate: Date;
|
|
6
|
+
clones: string[];
|
|
7
|
+
createdAt: string;
|
|
8
|
+
dataStateAt: string;
|
|
9
|
+
id: string;
|
|
10
|
+
pool: string;
|
|
11
|
+
physicalSize: number;
|
|
12
|
+
logicalSize: number;
|
|
13
|
+
message: string;
|
|
14
|
+
branch: string;
|
|
15
|
+
}[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { parseDate } from '@postgres.ai/shared/utils/date';
|
|
2
|
+
export const formatBranchSnapshotDto = (dto) => dto.map((item) => ({
|
|
3
|
+
...item,
|
|
4
|
+
numClones: item.numClones.toString(),
|
|
5
|
+
createdAtDate: parseDate(item.createdAt),
|
|
6
|
+
dataStateAtDate: parseDate(item.dataStateAt),
|
|
7
|
+
}));
|
|
@@ -2,6 +2,7 @@ import { SnapshotDto } from '@postgres.ai/shared/types/api/entities/snapshot';
|
|
|
2
2
|
export declare type CloneDto = {
|
|
3
3
|
createdAt: string;
|
|
4
4
|
id: string;
|
|
5
|
+
branch: string;
|
|
5
6
|
status: {
|
|
6
7
|
code: 'OK' | 'CREATING' | 'DELETING' | 'RESETTING' | 'FATAL';
|
|
7
8
|
message: string;
|
|
@@ -24,14 +25,19 @@ export declare const formatCloneDto: (dto: CloneDto) => {
|
|
|
24
25
|
snapshot: {
|
|
25
26
|
createdAtDate: Date;
|
|
26
27
|
dataStateAtDate: Date;
|
|
28
|
+
numClones: string | number;
|
|
29
|
+
clones: string[];
|
|
27
30
|
createdAt: string;
|
|
28
31
|
dataStateAt: string;
|
|
29
32
|
id: string;
|
|
30
33
|
pool: string;
|
|
31
34
|
physicalSize: number;
|
|
32
35
|
logicalSize: number;
|
|
36
|
+
message: string;
|
|
37
|
+
branch: string;
|
|
33
38
|
} | null;
|
|
34
39
|
id: string;
|
|
40
|
+
branch: string;
|
|
35
41
|
status: {
|
|
36
42
|
code: 'OK' | 'CREATING' | 'DELETING' | 'RESETTING' | 'FATAL';
|
|
37
43
|
message: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatDatabases, formatDumpCustomOptions, getImageMajorVersion, getImageType, isSeDockerImage, } from '@postgres.ai/shared/pages/Configuration/utils';
|
|
1
|
+
import { formatDatabases, formatDumpCustomOptions, getImageMajorVersion, getImageType, isSeDockerImage, } from '@postgres.ai/shared/pages/Instance/Configuration/utils';
|
|
2
2
|
import { formatTuningParams } from '../endpoints/testDbSource';
|
|
3
3
|
export const formatConfig = (config) => {
|
|
4
4
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const formatCreateBranchDto = (dto) => dto;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const formatCreateSnapshotDto = (dto) => dto;
|
|
@@ -64,14 +64,19 @@ export declare const formatInstanceDto: (dto: InstanceDto) => {
|
|
|
64
64
|
snapshot: {
|
|
65
65
|
createdAtDate: Date;
|
|
66
66
|
dataStateAtDate: Date;
|
|
67
|
+
numClones: string | number;
|
|
68
|
+
clones: string[];
|
|
67
69
|
createdAt: string;
|
|
68
70
|
dataStateAt: string;
|
|
69
71
|
id: string;
|
|
70
72
|
pool: string;
|
|
71
73
|
physicalSize: number;
|
|
72
74
|
logicalSize: number;
|
|
75
|
+
message: string;
|
|
76
|
+
branch: string;
|
|
73
77
|
} | null;
|
|
74
78
|
id: string;
|
|
79
|
+
branch: string;
|
|
75
80
|
status: {
|
|
76
81
|
code: "OK" | "CREATING" | "DELETING" | "RESETTING" | "FATAL";
|
|
77
82
|
message: string;
|
|
@@ -67,14 +67,19 @@ export declare const formatInstanceStateDto: (dto: InstanceStateDto) => {
|
|
|
67
67
|
snapshot: {
|
|
68
68
|
createdAtDate: Date;
|
|
69
69
|
dataStateAtDate: Date;
|
|
70
|
+
numClones: string | number;
|
|
71
|
+
clones: string[];
|
|
70
72
|
createdAt: string;
|
|
71
73
|
dataStateAt: string;
|
|
72
74
|
id: string;
|
|
73
75
|
pool: string;
|
|
74
76
|
physicalSize: number;
|
|
75
77
|
logicalSize: number;
|
|
78
|
+
message: string;
|
|
79
|
+
branch: string;
|
|
76
80
|
} | null;
|
|
77
81
|
id: string;
|
|
82
|
+
branch: string;
|
|
78
83
|
status: {
|
|
79
84
|
code: "OK" | "CREATING" | "DELETING" | "RESETTING" | "FATAL";
|
|
80
85
|
message: string;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
export declare type SnapshotDto = {
|
|
2
|
+
numClones: string | number;
|
|
3
|
+
clones: string[];
|
|
2
4
|
createdAt: string;
|
|
3
5
|
dataStateAt: string;
|
|
4
6
|
id: string;
|
|
5
7
|
pool: string;
|
|
6
8
|
physicalSize: number;
|
|
7
9
|
logicalSize: number;
|
|
10
|
+
message: string;
|
|
11
|
+
branch: string;
|
|
8
12
|
};
|
|
9
13
|
export declare const formatSnapshotDto: (dto: SnapshotDto) => {
|
|
10
14
|
createdAtDate: Date;
|
|
11
15
|
dataStateAtDate: Date;
|
|
16
|
+
numClones: string | number;
|
|
17
|
+
clones: string[];
|
|
12
18
|
createdAt: string;
|
|
13
19
|
dataStateAt: string;
|
|
14
20
|
id: string;
|
|
15
21
|
pool: string;
|
|
16
22
|
physicalSize: number;
|
|
17
23
|
logicalSize: number;
|
|
24
|
+
message: string;
|
|
25
|
+
branch: string;
|
|
18
26
|
};
|
|
19
27
|
export declare type Snapshot = ReturnType<typeof formatSnapshotDto>;
|
package/utils/date.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const formatDateToISO: (dateString: string) => string;
|
|
1
2
|
export declare const parseDate: (dateStr: string) => Date;
|
|
2
3
|
export declare const startOfMonthUTC: (date: Date, ...otherArgs: unknown[]) => Date;
|
|
3
4
|
export declare const startOfWeekUTC: (date: Date, ...otherArgs: unknown[]) => Date;
|
|
@@ -14,3 +15,4 @@ export declare const formatDistanceStd: (date: Date) => string;
|
|
|
14
15
|
export declare const formatDateStd: (date: Date, options?: {
|
|
15
16
|
withDistance?: boolean;
|
|
16
17
|
}) => string;
|
|
18
|
+
export declare const isValidDate: (dateObject: Date) => boolean;
|
package/utils/date.js
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
*--------------------------------------------------------------------------
|
|
6
6
|
*/
|
|
7
7
|
import { parse, startOfDay, isSameDay, startOfMonth, startOfWeek, endOfMonth, endOfWeek, differenceInDays, addDays, addMonths, isSameMonth, format, formatDistanceToNowStrict, } from 'date-fns';
|
|
8
|
+
export const formatDateToISO = (dateString) => {
|
|
9
|
+
const parsedDate = parse(dateString, 'yyyyMMddHHmmss', new Date());
|
|
10
|
+
return format(parsedDate, "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
11
|
+
};
|
|
8
12
|
// parseDate parses date of both format: '2006-01-02 15:04:05 UTC' and `2006-01-02T15:04:05Z` (RFC3339).
|
|
9
13
|
export const parseDate = (dateStr) => parse(dateStr.replace(' UTC', 'Z').replace('T', ' '), 'yyyy-MM-dd HH:mm:ssX', new Date());
|
|
10
14
|
// UTCf - UTC formatted, but not actually UTC.
|
|
@@ -31,3 +35,6 @@ export const isSameDayUTC = (date1, date2) => isSameDay(toUTCf(date1), toUTCf(da
|
|
|
31
35
|
// Std date utils.
|
|
32
36
|
export const formatDistanceStd = (date) => formatDistanceToNowStrict(date, { addSuffix: true });
|
|
33
37
|
export const formatDateStd = (date, options) => `${formatUTC(date, 'yyyy-MM-dd HH:mm:ss')} UTC ${(options === null || options === void 0 ? void 0 : options.withDistance) ? `(${formatDistanceStd(date)})` : ''}`;
|
|
38
|
+
export const isValidDate = (dateObject) => {
|
|
39
|
+
return new Date(dateObject).toString() !== 'Invalid Date';
|
|
40
|
+
};
|
package/utils/snapshot.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const compareSnapshotsDesc: (a: {
|
|
2
|
+
dataStateAtDate: Date;
|
|
3
|
+
}, b: {
|
|
4
|
+
dataStateAtDate: Date;
|
|
5
|
+
}) => number;
|
package/utils/snapshot.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export const compareSnapshotsDesc = (a, b) =>
|
|
1
|
+
export const compareSnapshotsDesc = (a, b) => {
|
|
2
|
+
var _a, _b, _c, _d;
|
|
3
|
+
const dataStateAtDateA = (_b = (_a = a.dataStateAtDate) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0;
|
|
4
|
+
const dataStateAtDateB = (_d = (_c = b.dataStateAtDate) === null || _c === void 0 ? void 0 : _c.getTime()) !== null && _d !== void 0 ? _d : 0;
|
|
5
|
+
return dataStateAtDateB - dataStateAtDateA;
|
|
6
|
+
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
|
|
4
|
-
* All Rights Reserved. Proprietary and confidential.
|
|
5
|
-
* Unauthorized copying of this file, via any medium is strictly prohibited
|
|
6
|
-
*--------------------------------------------------------------------------
|
|
7
|
-
*/
|
|
8
|
-
import { useState } from 'react';
|
|
9
|
-
import cn from 'classnames';
|
|
10
|
-
import { formatDistanceToNowStrict } from 'date-fns';
|
|
11
|
-
import { useHistory } from 'react-router-dom';
|
|
12
|
-
import { Table, TableHead, TableRow, TableHeaderCell, TableBody, TableBodyCell, } from '@postgres.ai/shared/components/Table';
|
|
13
|
-
import { ArrowDropDownIcon } from '@postgres.ai/shared/icons/ArrowDropDown';
|
|
14
|
-
import { ShieldIcon } from '@postgres.ai/shared/icons/Shield';
|
|
15
|
-
import { RenewableIcon } from '@postgres.ai/shared/icons/Renewable';
|
|
16
|
-
import { InfoIcon } from '@postgres.ai/shared/icons/Info';
|
|
17
|
-
import { HorizontalScrollContainer } from '@postgres.ai/shared/components/HorizontalScrollContainer';
|
|
18
|
-
import { Status } from '@postgres.ai/shared/components/Status';
|
|
19
|
-
import { Tooltip } from '@postgres.ai/shared/components/Tooltip';
|
|
20
|
-
import { useHost } from '@postgres.ai/shared/pages/Instance/context';
|
|
21
|
-
import { getCloneStatusType, getCloneStatusText, } from '@postgres.ai/shared/utils/clone';
|
|
22
|
-
import { formatBytesIEC } from '@postgres.ai/shared/utils/units';
|
|
23
|
-
import { MenuCell } from './MenuCell';
|
|
24
|
-
import { ConnectionModal } from './ConnectionModal';
|
|
25
|
-
import styles from './styles.module.scss';
|
|
26
|
-
export const ClonesList = (props) => {
|
|
27
|
-
var _a;
|
|
28
|
-
const host = useHost();
|
|
29
|
-
const history = useHistory();
|
|
30
|
-
const [cloneIdForConnect, setCloneIdForConnect] = useState(null);
|
|
31
|
-
const [isOpenConnectionModal, setIsOpenConnectionModal] = useState(false);
|
|
32
|
-
const openConnectionModal = (cloneId) => {
|
|
33
|
-
setCloneIdForConnect(cloneId);
|
|
34
|
-
setIsOpenConnectionModal(true);
|
|
35
|
-
};
|
|
36
|
-
const closeConnectionModal = () => {
|
|
37
|
-
setIsOpenConnectionModal(false);
|
|
38
|
-
};
|
|
39
|
-
if (!((_a = props.clones) === null || _a === void 0 ? void 0 : _a.length))
|
|
40
|
-
return _jsx("p", { className: styles.emptyStub, children: props.emptyStubText });
|
|
41
|
-
return (_jsxs(_Fragment, { children: [_jsx(HorizontalScrollContainer, { children: _jsxs(Table, { children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableHeaderCell, {}), _jsx(TableHeaderCell, { children: "Status" }), _jsx(TableHeaderCell, { children: "ID" }), _jsx(TableHeaderCell, { children: _jsx(Tooltip, { content: "When enabled, neither manual nor automated deletion of this clone is possible. Note that abandoned protected clones may lead to out-of-disk-space events because they hold old data, blocking cleanup and refresh processes.", children: _jsxs("div", { className: styles.verticalCentered, children: ["Protected", _jsx(InfoIcon, { className: styles.infoIcon })] }) }) }), _jsx(TableHeaderCell, { children: _jsxs("div", { className: styles.verticalCentered, children: ["Created", _jsx(ArrowDropDownIcon, { className: styles.sortIcon })] }) }), _jsx(TableHeaderCell, { children: "Port" }), _jsx(TableHeaderCell, { children: "DB user" }), _jsx(TableHeaderCell, { children: _jsx(Tooltip, { content: "Clone's own size \u2013 how much data was added or modified.", children: _jsxs("div", { className: styles.verticalCentered, children: ["Diff size", _jsx(InfoIcon, { className: styles.infoIcon })] }) }) }), _jsx(TableHeaderCell, { children: "Disk" }), _jsx(TableHeaderCell, { children: "Data state time" })] }) }), _jsx(TableBody, { children: props.clones.map((clone) => {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
const clonePagePath = host.routes.clone(clone.id);
|
|
44
|
-
return (_jsxs(TableRow, { hover: !props.isDisabled, onClick: props.isDisabled
|
|
45
|
-
? undefined
|
|
46
|
-
: () => history.push(clonePagePath), className: cn(!props.isDisabled && styles.interactiveRow), children: [_jsx(MenuCell, { clone: clone, onConnect: openConnectionModal, clonePagePath: clonePagePath }), _jsx(TableBodyCell, { children: _jsx(Tooltip, { content: clone.status.message, children: _jsx(Status, { type: getCloneStatusType(clone.status.code), children: getCloneStatusText(clone.status.code) }) }) }), _jsx(TableBodyCell, { children: clone.id }), _jsx(TableBodyCell, { children: clone.protected ? (_jsx(Tooltip, { content: "Clone is protected from manual and automated deletion. Note that abandoned protected clones may lead to out-of-disk-space events because they hold old data, blocking cleanup and refresh processes.", children: _jsx(ShieldIcon, { className: styles.protectionIcon }) })) : (_jsx(Tooltip, { content: "Clone is not protected from deletion. To save disk space it will be automatically deleted if there is no activity for a long time.", children: _jsx(RenewableIcon, { className: styles.protectionIcon }) })) }), _jsxs(TableBodyCell, { children: [clone.createdAt, " (", formatDistanceToNowStrict(clone.createdAtDate, {
|
|
47
|
-
addSuffix: true,
|
|
48
|
-
}), ")"] }), _jsx(TableBodyCell, { children: clone.db.port }), _jsx(TableBodyCell, { children: clone.db.username }), _jsx(TableBodyCell, { children: formatBytesIEC(clone.metadata.cloneDiffSize) }), _jsx(TableBodyCell, { children: (_b = (_a = clone.snapshot) === null || _a === void 0 ? void 0 : _a.pool) !== null && _b !== void 0 ? _b : '-' }), _jsx(TableBodyCell, { children: clone.snapshot ? (_jsxs(_Fragment, { children: [clone.snapshot.dataStateAt, " (", formatDistanceToNowStrict(clone.snapshot.dataStateAtDate, {
|
|
49
|
-
addSuffix: true,
|
|
50
|
-
}), ")"] })) : ('-') })] }, clone.id));
|
|
51
|
-
}) })] }) }), cloneIdForConnect && (_jsx(ConnectionModal, { cloneId: cloneIdForConnect, isOpen: isOpenConnectionModal, onClose: closeConnectionModal }))] }));
|
|
52
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|