@postgres.ai/shared 4.0.1-pr-1059.3 → 4.0.1-pr-1054.11
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/package.json +1 -1
- package/pages/CreateBranch/index.js +9 -24
- package/pages/CreateBranch/stores/Main.d.ts +1 -1
- package/pages/CreateBranch/stores/Main.js +1 -2
- package/pages/Instance/Configuration/utils/index.js +1 -2
- package/types/api/endpoints/getBranches.d.ts +0 -4
- package/types/api/endpoints/getSnapshots.d.ts +0 -1
package/package.json
CHANGED
|
@@ -77,7 +77,6 @@ const useStyles = makeStyles({
|
|
|
77
77
|
},
|
|
78
78
|
}, { index: 1 });
|
|
79
79
|
export const CreateBranchPage = observer(({ instanceId, api, elements, routes, isPlatform, hideBranchingFeatures }) => {
|
|
80
|
-
var _a;
|
|
81
80
|
const stores = useCreatedStores(api);
|
|
82
81
|
const classes = useStyles();
|
|
83
82
|
const history = useHistory();
|
|
@@ -93,8 +92,8 @@ export const CreateBranchPage = observer(({ instanceId, api, elements, routes, i
|
|
|
93
92
|
}
|
|
94
93
|
});
|
|
95
94
|
};
|
|
96
|
-
const fetchSnapshots = async (branchName
|
|
97
|
-
await getSnapshots(instanceId, branchName
|
|
95
|
+
const fetchSnapshots = async (branchName) => {
|
|
96
|
+
await getSnapshots(instanceId, branchName).then((response) => {
|
|
98
97
|
var _a;
|
|
99
98
|
if (response) {
|
|
100
99
|
setBranchSnapshots(response);
|
|
@@ -103,39 +102,25 @@ export const CreateBranchPage = observer(({ instanceId, api, elements, routes, i
|
|
|
103
102
|
});
|
|
104
103
|
};
|
|
105
104
|
const handleParentBranchChange = async (e) => {
|
|
106
|
-
const
|
|
107
|
-
const [branchName, dataset] = compositeKey.split('|');
|
|
108
|
-
const selectedBranch = branchesList === null || branchesList === void 0 ? void 0 : branchesList.find((b) => b.name === branchName && b.baseDataset === dataset);
|
|
105
|
+
const branchName = e.target.value;
|
|
109
106
|
formik.setFieldValue('baseBranch', branchName);
|
|
110
|
-
await fetchSnapshots(branchName
|
|
107
|
+
await fetchSnapshots(branchName);
|
|
111
108
|
};
|
|
112
109
|
const [{ formik }] = useForm(handleSubmit);
|
|
113
110
|
useEffect(() => {
|
|
114
111
|
load(instanceId);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (!(branchesList === null || branchesList === void 0 ? void 0 : branchesList.length))
|
|
118
|
-
return;
|
|
119
|
-
const selected = branchesList.find(b => b.name === formik.values.baseBranch);
|
|
120
|
-
if (!selected)
|
|
121
|
-
return;
|
|
122
|
-
const dataset = selected === null || selected === void 0 ? void 0 : selected.baseDataset;
|
|
123
|
-
fetchSnapshots(formik.values.baseBranch, dataset);
|
|
124
|
-
}, [branchesList, formik.values.baseBranch]);
|
|
112
|
+
fetchSnapshots(formik.values.baseBranch);
|
|
113
|
+
}, [formik.values.baseBranch]);
|
|
125
114
|
if (isBranchesLoading) {
|
|
126
115
|
return _jsx(StubSpinner, {});
|
|
127
116
|
}
|
|
128
117
|
return (_jsxs(_Fragment, { children: [elements.breadcrumbs, _jsx(SectionTitle, { tag: "h1", level: 1, text: "Create branch", className: classes.title, children: _jsx(InstanceTabs, { tab: TABS_INDEX.BRANCHES, isPlatform: isPlatform, instanceId: instanceId, hasLogs: api.initWS !== undefined, hideInstanceTabs: hideBranchingFeatures }) }), _jsxs("div", { className: classes.wrapper, children: [_jsxs("div", { className: classes.container, children: [(snapshotsError || getBranchesError) && (_jsx("div", { className: classes.marginTop, children: _jsx(ErrorStub, { message: (snapshotsError === null || snapshotsError === void 0 ? void 0 : snapshotsError.message) || (getBranchesError === null || getBranchesError === void 0 ? void 0 : getBranchesError.message) }) })), _jsxs("div", { className: classes.form, children: [_jsx(TextField, { label: "Branch name", variant: "outlined", required: true, fullWidth: true, size: "small", InputLabelProps: {
|
|
129
118
|
shrink: true,
|
|
130
|
-
}, value: formik.values.branchName, error: Boolean(formik.errors.branchName), helperText: formik.errors.branchName, className: classes.marginBottom, onChange: (e) => formik.setFieldValue('branchName', e.target.value) }), _jsx("p", { className: cn(classes.marginTop, classes.marginBottom), children: "Choose an existing branch. The new branch will initially point at the same snapshot as the parent branch but going further, their evolution paths will be independent - new snapshots can be created for both branches." }), _jsx(Select, { fullWidth: true, label: "Parent branch", value:
|
|
119
|
+
}, value: formik.values.branchName, error: Boolean(formik.errors.branchName), helperText: formik.errors.branchName, className: classes.marginBottom, onChange: (e) => formik.setFieldValue('branchName', e.target.value) }), _jsx("p", { className: cn(classes.marginTop, classes.marginBottom), children: "Choose an existing branch. The new branch will initially point at the same snapshot as the parent branch but going further, their evolution paths will be independent - new snapshots can be created for both branches." }), _jsx(Select, { fullWidth: true, label: "Parent branch", value: formik.values.baseBranch, disabled: !branchesList || formik.isSubmitting, onChange: handleParentBranchChange, error: Boolean(formik.errors.baseBranch), items: branchesList
|
|
131
120
|
? branchesList.map((branch) => {
|
|
132
|
-
const displayName = branch.baseDataset
|
|
133
|
-
? `${branch.name} (${branch.baseDataset})`
|
|
134
|
-
: branch.name;
|
|
135
|
-
const compositeValue = `${branch.name}|${branch.baseDataset || ''}`;
|
|
136
121
|
return {
|
|
137
|
-
value:
|
|
138
|
-
children:
|
|
122
|
+
value: branch.name,
|
|
123
|
+
children: branch.name,
|
|
139
124
|
};
|
|
140
125
|
})
|
|
141
126
|
: [] }), _jsx("strong", { children: "Snapshot ID" }), _jsx("p", { className: cn(classes.marginTop, classes.marginBottom), children: "Choose an existing snapshot. This snapshot will be memorized as a forking point for the new branch; it cannot be deleted while the branch exists." }), _jsx(Select, { fullWidth: true, className: classes.marginBottom2x, label: "Snapshot ID", value: formik.values.snapshotID, disabled: !branchesList || formik.isSubmitting, onChange: (e) => formik.setFieldValue('snapshotID', e.target.value), error: Boolean(formik.errors.baseBranch), items: branchSnapshots
|
|
@@ -25,7 +25,7 @@ export declare class MainStore {
|
|
|
25
25
|
load: (instanceId: string) => Promise<void>;
|
|
26
26
|
createBranch: (values: CreateBranchFormValues) => Promise<import("../../../types/api/entities/createBranch").CreateBranchDTO | null | undefined>;
|
|
27
27
|
getBranches: (instanceId: string) => Promise<Branch[] | null | undefined>;
|
|
28
|
-
getSnapshots: (instanceId: string, branchName?: string
|
|
28
|
+
getSnapshots: (instanceId: string, branchName?: string) => Promise<{
|
|
29
29
|
createdAtDate: Date;
|
|
30
30
|
dataStateAtDate: Date;
|
|
31
31
|
numClones: string | number;
|
|
@@ -41,13 +41,12 @@ export class MainStore {
|
|
|
41
41
|
this.getBranchesError = await error.json().then((err) => err);
|
|
42
42
|
return response;
|
|
43
43
|
};
|
|
44
|
-
this.getSnapshots = async (instanceId, branchName
|
|
44
|
+
this.getSnapshots = async (instanceId, branchName) => {
|
|
45
45
|
if (!this.api.getSnapshots)
|
|
46
46
|
return;
|
|
47
47
|
const { response, error } = await this.api.getSnapshots({
|
|
48
48
|
instanceId,
|
|
49
49
|
branchName,
|
|
50
|
-
dataset,
|
|
51
50
|
});
|
|
52
51
|
if (error) {
|
|
53
52
|
this.snapshotsError = await error.json().then((err) => err);
|
|
@@ -15,7 +15,6 @@ const dockerImagesConfig = {
|
|
|
15
15
|
'15': ['0.5.3', '0.5.2', '0.5.1'],
|
|
16
16
|
'16': ['0.5.3', '0.5.2', '0.5.1'],
|
|
17
17
|
'17': ['0.5.3', '0.5.2', '0.5.1'],
|
|
18
|
-
'18': ['0.6.1'],
|
|
19
18
|
};
|
|
20
19
|
export const uniqueChipValue = (values) => {
|
|
21
20
|
const splitChipArray = values.split(/[,(\s)(\n)(\r)(\t)(\r\n)]/);
|
|
@@ -120,7 +119,7 @@ export const postUniqueCustomOptions = (options) => {
|
|
|
120
119
|
};
|
|
121
120
|
export const customOrGenericImage = (dockerImage) => dockerImage === 'Generic Postgres' || dockerImage === 'custom';
|
|
122
121
|
export const createFallbackDockerImage = (dockerPath, dockerTag) => {
|
|
123
|
-
const majorVersion = getImageMajorVersion(dockerPath) || '
|
|
122
|
+
const majorVersion = getImageMajorVersion(dockerPath) || '17'; // Default to 17 if version can't be extracted
|
|
124
123
|
return {
|
|
125
124
|
package_group: 'postgresai',
|
|
126
125
|
pg_major_version: majorVersion,
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
export interface Branch {
|
|
2
2
|
name: string;
|
|
3
|
-
baseDataset: string;
|
|
4
3
|
parent: string;
|
|
5
4
|
dataStateAt: string;
|
|
6
5
|
snapshotID: string;
|
|
7
|
-
dataset: string;
|
|
8
6
|
numSnapshots: number;
|
|
9
7
|
}
|
|
10
8
|
export declare const formatBranchesDto: (dto: Branch[]) => {
|
|
11
9
|
dataStateAt: string;
|
|
12
10
|
name: string;
|
|
13
|
-
baseDataset: string;
|
|
14
11
|
parent: string;
|
|
15
12
|
snapshotID: string;
|
|
16
|
-
dataset: string;
|
|
17
13
|
numSnapshots: number;
|
|
18
14
|
}[];
|
|
19
15
|
export declare type GetBranches = (instanceId: string) => Promise<{
|