@postgres.ai/shared 4.0.1-pr-1059.3 → 4.0.1-pr-1059.4
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
CHANGED
|
@@ -77,11 +77,11 @@ 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();
|
|
84
83
|
const [branchSnapshots, setBranchSnapshots] = useState([]);
|
|
84
|
+
const [selectedBranchKey, setSelectedBranchKey] = useState('main|');
|
|
85
85
|
const { load, branchesList, getBranchesError, createBranch, createBranchError, isBranchesLoading, isCreatingBranch, getSnapshots, snapshotsError, } = stores.main;
|
|
86
86
|
const handleSubmit = async (values) => {
|
|
87
87
|
await createBranch({
|
|
@@ -105,9 +105,9 @@ export const CreateBranchPage = observer(({ instanceId, api, elements, routes, i
|
|
|
105
105
|
const handleParentBranchChange = async (e) => {
|
|
106
106
|
const compositeKey = e.target.value;
|
|
107
107
|
const [branchName, dataset] = compositeKey.split('|');
|
|
108
|
-
|
|
108
|
+
setSelectedBranchKey(compositeKey);
|
|
109
109
|
formik.setFieldValue('baseBranch', branchName);
|
|
110
|
-
await fetchSnapshots(branchName, dataset
|
|
110
|
+
await fetchSnapshots(branchName, dataset);
|
|
111
111
|
};
|
|
112
112
|
const [{ formik }] = useForm(handleSubmit);
|
|
113
113
|
useEffect(() => {
|
|
@@ -119,15 +119,16 @@ export const CreateBranchPage = observer(({ instanceId, api, elements, routes, i
|
|
|
119
119
|
const selected = branchesList.find(b => b.name === formik.values.baseBranch);
|
|
120
120
|
if (!selected)
|
|
121
121
|
return;
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const compositeKey = `${selected.name}|${selected.baseDataset || ''}`;
|
|
123
|
+
setSelectedBranchKey(compositeKey);
|
|
124
|
+
fetchSnapshots(selected.name, selected.baseDataset);
|
|
125
|
+
}, [branchesList]);
|
|
125
126
|
if (isBranchesLoading) {
|
|
126
127
|
return _jsx(StubSpinner, {});
|
|
127
128
|
}
|
|
128
129
|
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
130
|
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:
|
|
131
|
+
}, 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: selectedBranchKey, disabled: !branchesList || formik.isSubmitting, onChange: handleParentBranchChange, error: Boolean(formik.errors.baseBranch), items: branchesList
|
|
131
132
|
? branchesList.map((branch) => {
|
|
132
133
|
const displayName = branch.baseDataset
|
|
133
134
|
? `${branch.name} (${branch.baseDataset})`
|