@postgres.ai/shared 4.0.2-pr-1148 → 4.0.2-pr-1149

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 (35) hide show
  1. package/package.json +1 -1
  2. package/pages/Instance/Configuration/configOptions.d.ts +0 -6
  3. package/pages/Instance/Configuration/configOptions.js +0 -48
  4. package/pages/Instance/Configuration/index.d.ts +2 -1
  5. package/pages/Instance/Configuration/index.js +86 -115
  6. package/pages/Instance/Configuration/useForm.d.ts +0 -20
  7. package/pages/Instance/Configuration/useForm.js +5 -126
  8. package/pages/Instance/Configuration/utils/index.js +17 -1
  9. package/pages/Instance/index.js +3 -1
  10. package/pages/Instance/stores/Main.d.ts +0 -20
  11. package/pages/Instance/stores/Main.js +0 -9
  12. package/types/api/entities/config.d.ts +0 -32
  13. package/types/api/entities/config.js +18 -45
  14. package/pages/Instance/Configuration/PhysicalMode/EnvsEditor/index.d.ts +0 -11
  15. package/pages/Instance/Configuration/PhysicalMode/EnvsEditor/index.js +0 -24
  16. package/pages/Instance/Configuration/PhysicalMode/PgBackRest/index.d.ts +0 -10
  17. package/pages/Instance/Configuration/PhysicalMode/PgBackRest/index.js +0 -29
  18. package/pages/Instance/Configuration/PhysicalMode/Sync/index.d.ts +0 -9
  19. package/pages/Instance/Configuration/PhysicalMode/Sync/index.js +0 -14
  20. package/pages/Instance/Configuration/PhysicalMode/Walg/index.d.ts +0 -10
  21. package/pages/Instance/Configuration/PhysicalMode/Walg/index.js +0 -21
  22. package/pages/Instance/Configuration/PhysicalMode/index.d.ts +0 -10
  23. package/pages/Instance/Configuration/PhysicalMode/index.js +0 -17
  24. package/pages/Instance/Configuration/SimpleMode/PreviewCard.d.ts +0 -11
  25. package/pages/Instance/Configuration/SimpleMode/PreviewCard.js +0 -14
  26. package/pages/Instance/Configuration/SimpleMode/index.d.ts +0 -14
  27. package/pages/Instance/Configuration/SimpleMode/index.js +0 -107
  28. package/pages/Instance/Configuration/configMode.d.ts +0 -2
  29. package/pages/Instance/Configuration/configMode.js +0 -7
  30. package/pages/Instance/Configuration/connectionString.d.ts +0 -20
  31. package/pages/Instance/Configuration/connectionString.js +0 -129
  32. package/pages/Instance/Configuration/dockerCatalog.d.ts +0 -2
  33. package/pages/Instance/Configuration/dockerCatalog.js +0 -19
  34. package/types/api/endpoints/probeSource.d.ts +0 -32
  35. package/types/api/endpoints/probeSource.js +0 -1
@@ -67,6 +67,7 @@ export const Instance = observer((props) => {
67
67
  };
68
68
  const isInstanceIntegrated = instanceRetrieval ||
69
69
  (!isLoadingInstance && !isLoadingInstanceRetrieval && instance && (instance === null || instance === void 0 ? void 0 : instance.url) && !instanceError);
70
+ const isConfigurationActive = (instanceRetrieval === null || instanceRetrieval === void 0 ? void 0 : instanceRetrieval.mode) !== 'physical';
70
71
  useEffect(() => {
71
72
  load(instanceId, isPlatform);
72
73
  }, [instanceId]);
@@ -78,13 +79,14 @@ export const Instance = observer((props) => {
78
79
  var _a, _b;
79
80
  if (instance &&
80
81
  ((_b = (_a = instance.state) === null || _a === void 0 ? void 0 : _a.retrieving) === null || _b === void 0 ? void 0 : _b.status) === 'pending' &&
82
+ isConfigurationActive &&
81
83
  !hasBeenRedirected) {
82
84
  setActiveTab(TABS_INDEX.CONFIGURATION);
83
85
  setHasBeenRedirected(true);
84
86
  }
85
87
  }, [instance, hasBeenRedirected]);
86
88
  return (_jsx(HostProvider, { value: props, children: _jsxs(StoresProvider, { value: stores, children: [props.elements.breadcrumbs, _jsx(SectionTitle, { text: props.title, level: 1, tag: "h1", className: classes.title, rightContent: _jsx(Button, { onClick: () => load(props.instanceId, isPlatform), isDisabled: !instance && !instanceError, className: classes.reloadButton, children: "Reload info" }), children: isInstanceIntegrated && (_jsx(InstanceTabs, { instanceId: props.instanceId, tab: activeTab, onTabChange: (tabID) => setActiveTab(tabID), isPlatform: isPlatform, hasLogs: api.initWS !== undefined, hideInstanceTabs: props.hideBranchingFeatures })) }), instanceError && (_jsx(ErrorStub, { ...instanceError, className: classes.errorStub })), isInstanceIntegrated ? (_jsxs(_Fragment, { children: [_jsxs(TabPanel, { value: activeTab, index: TABS_INDEX.OVERVIEW, children: [!instanceError && (_jsx("div", { className: classes.content, children: instance && ((_b = (_a = instance.state) === null || _a === void 0 ? void 0 : _a.retrieving) === null || _b === void 0 ? void 0 : _b.status) ? (_jsxs(_Fragment, { children: [_jsx(Clones, {}), _jsx(Info, { hideBranchingFeatures: props.hideBranchingFeatures })] })) : (_jsx(StubSpinner, {})) })), _jsx(ClonesModal, {}), _jsx(SnapshotsModal, {})] }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.CLONES, children: activeTab === TABS_INDEX.CLONES && (_jsx("div", { className: classes.content, children: !instanceError &&
87
- (instance ? _jsx(Clones, { onlyRenderList: true }) : _jsx(StubSpinner, {})) })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.LOGS, children: activeTab === TABS_INDEX.LOGS && (_jsx(Logs, { api: api, instanceId: props.instanceId })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.CONFIGURATION, children: activeTab === TABS_INDEX.CONFIGURATION && (_jsx(Configuration, { instanceId: instanceId, switchActiveTab: switchTab, reload: () => load(props.instanceId), disableConfigModification: (_c = instance === null || instance === void 0 ? void 0 : instance.state) === null || _c === void 0 ? void 0 : _c.engine.disableConfigModification })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.SNAPSHOTS, children: activeTab === TABS_INDEX.SNAPSHOTS && (_jsx(Snapshots, { instanceId: instanceId })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.BRANCHES, children: activeTab === TABS_INDEX.BRANCHES && (_jsx(Branches, { instanceId: instanceId })) })] })) : !isLoadingInstance && !isLoadingInstanceRetrieval && !instanceError ? (_jsx(TabPanel, { value: activeTab, index: activeTab, children: _jsx(InactiveInstance, { instance: instance, org: (_d = props.elements.breadcrumbs) === null || _d === void 0 ? void 0 : _d.props.org }) })) : (!instanceError && (_jsx(TabPanel, { value: activeTab, index: activeTab, children: _jsx("div", { className: classes.content, children: _jsx(StubSpinner, {}) }) })))] }) }));
89
+ (instance ? _jsx(Clones, { onlyRenderList: true }) : _jsx(StubSpinner, {})) })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.LOGS, children: activeTab === TABS_INDEX.LOGS && (_jsx(Logs, { api: api, instanceId: props.instanceId })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.CONFIGURATION, children: activeTab === TABS_INDEX.CONFIGURATION && (_jsx(Configuration, { instanceId: instanceId, switchActiveTab: switchTab, isConfigurationActive: isConfigurationActive, reload: () => load(props.instanceId), disableConfigModification: (_c = instance === null || instance === void 0 ? void 0 : instance.state) === null || _c === void 0 ? void 0 : _c.engine.disableConfigModification })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.SNAPSHOTS, children: activeTab === TABS_INDEX.SNAPSHOTS && (_jsx(Snapshots, { instanceId: instanceId })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.BRANCHES, children: activeTab === TABS_INDEX.BRANCHES && (_jsx(Branches, { instanceId: instanceId })) })] })) : !isLoadingInstance && !isLoadingInstanceRetrieval && !instanceError ? (_jsx(TabPanel, { value: activeTab, index: activeTab, children: _jsx(InactiveInstance, { instance: instance, org: (_d = props.elements.breadcrumbs) === null || _d === void 0 ? void 0 : _d.props.org }) })) : (!instanceError && (_jsx(TabPanel, { value: activeTab, index: activeTab, children: _jsx("div", { className: classes.content, children: _jsx(StubSpinner, {}) }) })))] }) }));
88
90
  });
89
91
  function TabPanel(props) {
90
92
  const { children, value, index, ...other } = props;
@@ -5,7 +5,6 @@ import { Config } from '@postgres.ai/shared/types/api/entities/config';
5
5
  import { GetConfig } from '@postgres.ai/shared/types/api/endpoints/getConfig';
6
6
  import { UpdateConfig } from '@postgres.ai/shared/types/api/endpoints/updateConfig';
7
7
  import { TestDbSource } from '@postgres.ai/shared/types/api/endpoints/testDbSource';
8
- import { ProbeSource } from '@postgres.ai/shared/types/api/endpoints/probeSource';
9
8
  import { RefreshInstance } from '@postgres.ai/shared/types/api/endpoints/refreshInstance';
10
9
  import { DestroyClone } from '@postgres.ai/shared/types/api/endpoints/destroyClone';
11
10
  import { ResetClone } from '@postgres.ai/shared/types/api/endpoints/resetClone';
@@ -36,7 +35,6 @@ export declare type Api = {
36
35
  getConfig?: GetConfig;
37
36
  updateConfig?: UpdateConfig;
38
37
  testDbSource?: TestDbSource;
39
- probeSource?: ProbeSource;
40
38
  getFullConfig?: GetFullConfig;
41
39
  getSeImages?: GetSeImages;
42
40
  getEngine?: GetEngine;
@@ -106,17 +104,6 @@ export declare class MainStore {
106
104
  dockerTag?: string | undefined;
107
105
  dockerImageType?: string | undefined;
108
106
  debug: boolean | undefined;
109
- retrievalMode: import("@postgres.ai/shared/types/api/entities/config").RetrievalMode;
110
- physicalTool: string;
111
- physicalDockerImage: string;
112
- physicalSyncEnabled: boolean;
113
- physicalWalgBackupName: string;
114
- physicalPgbackrestStanza: string;
115
- physicalPgbackrestDelta: boolean;
116
- physicalEnvs: {
117
- key: string;
118
- value: string;
119
- }[];
120
107
  dockerImage: string | undefined;
121
108
  } | null | undefined>;
122
109
  updateConfig: (values: Config, instanceId: string) => Promise<Response | null | undefined>;
@@ -140,13 +127,6 @@ export declare class MainStore {
140
127
  message: string;
141
128
  };
142
129
  } | undefined>;
143
- probeSource: (values: {
144
- url: string;
145
- password: string;
146
- }) => Promise<{
147
- response: import("@postgres.ai/shared/types/api/endpoints/probeSource").ProposedConfig | null;
148
- error: import("@postgres.ai/shared/types/api/endpoints/probeSource").ProbeSourceError | null;
149
- } | undefined>;
150
130
  resetClone: (cloneId: string, snapshotId: string) => Promise<boolean | undefined>;
151
131
  destroyClone: (cloneId: string) => Promise<boolean | undefined>;
152
132
  private liveUpdateInstance;
@@ -216,15 +216,6 @@ export class MainStore {
216
216
  error,
217
217
  };
218
218
  };
219
- this.probeSource = async (values) => {
220
- if (!this.api.probeSource)
221
- return;
222
- const { response, error } = await this.api.probeSource(values);
223
- return {
224
- response,
225
- error,
226
- };
227
- };
228
219
  this.resetClone = async (cloneId, snapshotId) => {
229
220
  if (!this.instance || !this.api.resetClone)
230
221
  return;
@@ -1,12 +1,10 @@
1
1
  export interface DatabaseType {
2
2
  [name: string]: string | Object;
3
3
  }
4
- export declare type RetrievalMode = 'logical' | 'physical' | 'unknown' | '';
5
4
  export declare type configTypes = {
6
5
  global?: {
7
6
  debug?: boolean;
8
7
  };
9
- retrievalMode?: RetrievalMode;
10
8
  databaseContainer?: {
11
9
  dockerImage?: string;
12
10
  dockerPath?: string;
@@ -48,25 +46,6 @@ export declare type configTypes = {
48
46
  };
49
47
  };
50
48
  };
51
- physicalRestore?: {
52
- options?: {
53
- tool?: string;
54
- dockerImage?: string;
55
- sync?: {
56
- enabled?: boolean;
57
- };
58
- walg?: {
59
- backupName?: string;
60
- };
61
- pgbackrest?: {
62
- stanza?: string;
63
- delta?: boolean;
64
- };
65
- envs?: {
66
- [key: string]: string | number | boolean;
67
- };
68
- };
69
- };
70
49
  };
71
50
  };
72
51
  };
@@ -92,17 +71,6 @@ export declare const formatConfig: (config: configTypes) => {
92
71
  dockerTag?: string | undefined;
93
72
  dockerImageType?: string | undefined;
94
73
  debug: boolean | undefined;
95
- retrievalMode: RetrievalMode;
96
- physicalTool: string;
97
- physicalDockerImage: string;
98
- physicalSyncEnabled: boolean;
99
- physicalWalgBackupName: string;
100
- physicalPgbackrestStanza: string;
101
- physicalPgbackrestDelta: boolean;
102
- physicalEnvs: {
103
- key: string;
104
- value: string;
105
- }[];
106
74
  dockerImage: string | undefined;
107
75
  };
108
76
  export declare type Config = ReturnType<typeof formatConfig>;
@@ -1,37 +1,10 @@
1
1
  import { formatDatabases, formatDumpCustomOptions, getImageMajorVersion, getImageType, isSeDockerImage, } from '@postgres.ai/shared/pages/Instance/Configuration/utils';
2
2
  import { formatTuningParams } from '../endpoints/testDbSource';
3
- const formatPhysicalEnvs = (envs) => {
4
- if (!envs)
5
- return [];
6
- return Object.entries(envs).map(([key, value]) => ({
7
- key,
8
- value: typeof value === 'string' ? value : String(value),
9
- }));
10
- };
11
- const inferRetrievalMode = (config) => {
12
- var _a, _b, _c, _d;
13
- if (config.retrievalMode)
14
- return config.retrievalMode;
15
- if ((_b = (_a = config.retrieval) === null || _a === void 0 ? void 0 : _a.spec) === null || _b === void 0 ? void 0 : _b.physicalRestore)
16
- return 'physical';
17
- if ((_d = (_c = config.retrieval) === null || _c === void 0 ? void 0 : _c.spec) === null || _d === void 0 ? void 0 : _d.logicalDump)
18
- return 'logical';
19
- return '';
20
- };
21
3
  export const formatConfig = (config) => {
22
- 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, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58;
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, _43, _44, _45;
23
5
  const dockerImage = (_a = config.databaseContainer) === null || _a === void 0 ? void 0 : _a.dockerImage;
24
- const physical = (_d = (_c = (_b = config.retrieval) === null || _b === void 0 ? void 0 : _b.spec) === null || _c === void 0 ? void 0 : _c.physicalRestore) === null || _d === void 0 ? void 0 : _d.options;
25
6
  return {
26
- debug: (_e = config.global) === null || _e === void 0 ? void 0 : _e.debug,
27
- retrievalMode: inferRetrievalMode(config),
28
- physicalTool: (_f = physical === null || physical === void 0 ? void 0 : physical.tool) !== null && _f !== void 0 ? _f : '',
29
- physicalDockerImage: (_g = physical === null || physical === void 0 ? void 0 : physical.dockerImage) !== null && _g !== void 0 ? _g : '',
30
- physicalSyncEnabled: (_j = (_h = physical === null || physical === void 0 ? void 0 : physical.sync) === null || _h === void 0 ? void 0 : _h.enabled) !== null && _j !== void 0 ? _j : false,
31
- physicalWalgBackupName: (_l = (_k = physical === null || physical === void 0 ? void 0 : physical.walg) === null || _k === void 0 ? void 0 : _k.backupName) !== null && _l !== void 0 ? _l : '',
32
- physicalPgbackrestStanza: (_o = (_m = physical === null || physical === void 0 ? void 0 : physical.pgbackrest) === null || _m === void 0 ? void 0 : _m.stanza) !== null && _o !== void 0 ? _o : '',
33
- physicalPgbackrestDelta: (_q = (_p = physical === null || physical === void 0 ? void 0 : physical.pgbackrest) === null || _p === void 0 ? void 0 : _p.delta) !== null && _q !== void 0 ? _q : false,
34
- physicalEnvs: formatPhysicalEnvs(physical === null || physical === void 0 ? void 0 : physical.envs),
7
+ debug: (_b = config.global) === null || _b === void 0 ? void 0 : _b.debug,
35
8
  dockerImage: isSeDockerImage(dockerImage)
36
9
  ? getImageMajorVersion(dockerImage)
37
10
  : dockerImage && getImageType(dockerImage) === 'Generic Postgres'
@@ -45,20 +18,20 @@ export const formatConfig = (config) => {
45
18
  dockerTag: dockerImage.split(':')[1],
46
19
  }),
47
20
  dockerPath: dockerImage,
48
- tuningParams: formatTuningParams((_r = config.databaseConfigs) === null || _r === void 0 ? void 0 : _r.configs),
49
- sharedBuffers: (_t = (_s = config.databaseConfigs) === null || _s === void 0 ? void 0 : _s.configs) === null || _t === void 0 ? void 0 : _t.shared_buffers,
50
- sharedPreloadLibraries: (_v = (_u = config.databaseConfigs) === null || _u === void 0 ? void 0 : _u.configs) === null || _v === void 0 ? void 0 : _v.shared_preload_libraries,
51
- timetable: (_x = (_w = config.retrieval) === null || _w === void 0 ? void 0 : _w.refresh) === null || _x === void 0 ? void 0 : _x.timetable,
52
- dbname: (_3 = (_2 = (_1 = (_0 = (_z = (_y = config.retrieval) === null || _y === void 0 ? void 0 : _y.spec) === null || _z === void 0 ? void 0 : _z.logicalDump) === null || _0 === void 0 ? void 0 : _0.options) === null || _1 === void 0 ? void 0 : _1.source) === null || _2 === void 0 ? void 0 : _2.connection) === null || _3 === void 0 ? void 0 : _3.dbname,
53
- host: (_9 = (_8 = (_7 = (_6 = (_5 = (_4 = config.retrieval) === null || _4 === void 0 ? void 0 : _4.spec) === null || _5 === void 0 ? void 0 : _5.logicalDump) === null || _6 === void 0 ? void 0 : _6.options) === null || _7 === void 0 ? void 0 : _7.source) === null || _8 === void 0 ? void 0 : _8.connection) === null || _9 === void 0 ? void 0 : _9.host,
54
- port: (_15 = (_14 = (_13 = (_12 = (_11 = (_10 = config.retrieval) === null || _10 === void 0 ? void 0 : _10.spec) === null || _11 === void 0 ? void 0 : _11.logicalDump) === null || _12 === void 0 ? void 0 : _12.options) === null || _13 === void 0 ? void 0 : _13.source) === null || _14 === void 0 ? void 0 : _14.connection) === null || _15 === void 0 ? void 0 : _15.port,
55
- username: (_21 = (_20 = (_19 = (_18 = (_17 = (_16 = config.retrieval) === null || _16 === void 0 ? void 0 : _16.spec) === null || _17 === void 0 ? void 0 : _17.logicalDump) === null || _18 === void 0 ? void 0 : _18.options) === null || _19 === void 0 ? void 0 : _19.source) === null || _20 === void 0 ? void 0 : _20.connection) === null || _21 === void 0 ? void 0 : _21.username,
56
- password: (_27 = (_26 = (_25 = (_24 = (_23 = (_22 = config.retrieval) === null || _22 === void 0 ? void 0 : _22.spec) === null || _23 === void 0 ? void 0 : _23.logicalDump) === null || _24 === void 0 ? void 0 : _24.options) === null || _25 === void 0 ? void 0 : _25.source) === null || _26 === void 0 ? void 0 : _26.connection) === null || _27 === void 0 ? void 0 : _27.password,
57
- databases: formatDatabases((_32 = (_31 = (_30 = (_29 = (_28 = config.retrieval) === null || _28 === void 0 ? void 0 : _28.spec) === null || _29 === void 0 ? void 0 : _29.logicalDump) === null || _30 === void 0 ? void 0 : _30.options) === null || _31 === void 0 ? void 0 : _31.databases) !== null && _32 !== void 0 ? _32 : null),
58
- dumpParallelJobs: (_36 = (_35 = (_34 = (_33 = config.retrieval) === null || _33 === void 0 ? void 0 : _33.spec) === null || _34 === void 0 ? void 0 : _34.logicalDump) === null || _35 === void 0 ? void 0 : _35.options) === null || _36 === void 0 ? void 0 : _36.parallelJobs,
59
- dumpIgnoreErrors: (_40 = (_39 = (_38 = (_37 = config.retrieval) === null || _37 === void 0 ? void 0 : _37.spec) === null || _38 === void 0 ? void 0 : _38.logicalDump) === null || _39 === void 0 ? void 0 : _39.options) === null || _40 === void 0 ? void 0 : _40.ignoreErrors,
60
- restoreParallelJobs: (_44 = (_43 = (_42 = (_41 = config.retrieval) === null || _41 === void 0 ? void 0 : _41.spec) === null || _42 === void 0 ? void 0 : _42.logicalRestore) === null || _43 === void 0 ? void 0 : _43.options) === null || _44 === void 0 ? void 0 : _44.parallelJobs,
61
- restoreIgnoreErrors: (_48 = (_47 = (_46 = (_45 = config.retrieval) === null || _45 === void 0 ? void 0 : _45.spec) === null || _46 === void 0 ? void 0 : _46.logicalRestore) === null || _47 === void 0 ? void 0 : _47.options) === null || _48 === void 0 ? void 0 : _48.ignoreErrors,
21
+ tuningParams: formatTuningParams((_c = config.databaseConfigs) === null || _c === void 0 ? void 0 : _c.configs),
22
+ sharedBuffers: (_e = (_d = config.databaseConfigs) === null || _d === void 0 ? void 0 : _d.configs) === null || _e === void 0 ? void 0 : _e.shared_buffers,
23
+ sharedPreloadLibraries: (_g = (_f = config.databaseConfigs) === null || _f === void 0 ? void 0 : _f.configs) === null || _g === void 0 ? void 0 : _g.shared_preload_libraries,
24
+ timetable: (_j = (_h = config.retrieval) === null || _h === void 0 ? void 0 : _h.refresh) === null || _j === void 0 ? void 0 : _j.timetable,
25
+ dbname: (_q = (_p = (_o = (_m = (_l = (_k = config.retrieval) === null || _k === void 0 ? void 0 : _k.spec) === null || _l === void 0 ? void 0 : _l.logicalDump) === null || _m === void 0 ? void 0 : _m.options) === null || _o === void 0 ? void 0 : _o.source) === null || _p === void 0 ? void 0 : _p.connection) === null || _q === void 0 ? void 0 : _q.dbname,
26
+ host: (_w = (_v = (_u = (_t = (_s = (_r = config.retrieval) === null || _r === void 0 ? void 0 : _r.spec) === null || _s === void 0 ? void 0 : _s.logicalDump) === null || _t === void 0 ? void 0 : _t.options) === null || _u === void 0 ? void 0 : _u.source) === null || _v === void 0 ? void 0 : _v.connection) === null || _w === void 0 ? void 0 : _w.host,
27
+ port: (_2 = (_1 = (_0 = (_z = (_y = (_x = config.retrieval) === null || _x === void 0 ? void 0 : _x.spec) === null || _y === void 0 ? void 0 : _y.logicalDump) === null || _z === void 0 ? void 0 : _z.options) === null || _0 === void 0 ? void 0 : _0.source) === null || _1 === void 0 ? void 0 : _1.connection) === null || _2 === void 0 ? void 0 : _2.port,
28
+ username: (_8 = (_7 = (_6 = (_5 = (_4 = (_3 = config.retrieval) === null || _3 === void 0 ? void 0 : _3.spec) === null || _4 === void 0 ? void 0 : _4.logicalDump) === null || _5 === void 0 ? void 0 : _5.options) === null || _6 === void 0 ? void 0 : _6.source) === null || _7 === void 0 ? void 0 : _7.connection) === null || _8 === void 0 ? void 0 : _8.username,
29
+ password: (_14 = (_13 = (_12 = (_11 = (_10 = (_9 = config.retrieval) === null || _9 === void 0 ? void 0 : _9.spec) === null || _10 === void 0 ? void 0 : _10.logicalDump) === null || _11 === void 0 ? void 0 : _11.options) === null || _12 === void 0 ? void 0 : _12.source) === null || _13 === void 0 ? void 0 : _13.connection) === null || _14 === void 0 ? void 0 : _14.password,
30
+ databases: formatDatabases((_19 = (_18 = (_17 = (_16 = (_15 = config.retrieval) === null || _15 === void 0 ? void 0 : _15.spec) === null || _16 === void 0 ? void 0 : _16.logicalDump) === null || _17 === void 0 ? void 0 : _17.options) === null || _18 === void 0 ? void 0 : _18.databases) !== null && _19 !== void 0 ? _19 : null),
31
+ dumpParallelJobs: (_23 = (_22 = (_21 = (_20 = config.retrieval) === null || _20 === void 0 ? void 0 : _20.spec) === null || _21 === void 0 ? void 0 : _21.logicalDump) === null || _22 === void 0 ? void 0 : _22.options) === null || _23 === void 0 ? void 0 : _23.parallelJobs,
32
+ dumpIgnoreErrors: (_27 = (_26 = (_25 = (_24 = config.retrieval) === null || _24 === void 0 ? void 0 : _24.spec) === null || _25 === void 0 ? void 0 : _25.logicalDump) === null || _26 === void 0 ? void 0 : _26.options) === null || _27 === void 0 ? void 0 : _27.ignoreErrors,
33
+ restoreParallelJobs: (_31 = (_30 = (_29 = (_28 = config.retrieval) === null || _28 === void 0 ? void 0 : _28.spec) === null || _29 === void 0 ? void 0 : _29.logicalRestore) === null || _30 === void 0 ? void 0 : _30.options) === null || _31 === void 0 ? void 0 : _31.parallelJobs,
34
+ restoreIgnoreErrors: (_35 = (_34 = (_33 = (_32 = config.retrieval) === null || _32 === void 0 ? void 0 : _32.spec) === null || _33 === void 0 ? void 0 : _33.logicalRestore) === null || _34 === void 0 ? void 0 : _34.options) === null || _35 === void 0 ? void 0 : _35.ignoreErrors,
62
35
  restoreConfigs: (() => {
63
36
  var _a, _b, _c, _d;
64
37
  const configs = (_d = (_c = (_b = (_a = config.retrieval) === null || _a === void 0 ? void 0 : _a.spec) === null || _b === void 0 ? void 0 : _b.logicalRestore) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.configs;
@@ -68,7 +41,7 @@ export const formatConfig = (config) => {
68
41
  .map(([k, v]) => `${k}=${v}`)
69
42
  .join('\n');
70
43
  })(),
71
- pgDumpCustomOptions: formatDumpCustomOptions((_53 = (_52 = (_51 = (_50 = (_49 = config.retrieval) === null || _49 === void 0 ? void 0 : _49.spec) === null || _50 === void 0 ? void 0 : _50.logicalDump) === null || _51 === void 0 ? void 0 : _51.options) === null || _52 === void 0 ? void 0 : _52.customOptions) !== null && _53 !== void 0 ? _53 : null),
72
- pgRestoreCustomOptions: formatDumpCustomOptions((_58 = (_57 = (_56 = (_55 = (_54 = config.retrieval) === null || _54 === void 0 ? void 0 : _54.spec) === null || _55 === void 0 ? void 0 : _55.logicalRestore) === null || _56 === void 0 ? void 0 : _56.options) === null || _57 === void 0 ? void 0 : _57.customOptions) !== null && _58 !== void 0 ? _58 : null),
44
+ pgDumpCustomOptions: formatDumpCustomOptions((_40 = (_39 = (_38 = (_37 = (_36 = config.retrieval) === null || _36 === void 0 ? void 0 : _36.spec) === null || _37 === void 0 ? void 0 : _37.logicalDump) === null || _38 === void 0 ? void 0 : _38.options) === null || _39 === void 0 ? void 0 : _39.customOptions) !== null && _40 !== void 0 ? _40 : null),
45
+ pgRestoreCustomOptions: formatDumpCustomOptions((_45 = (_44 = (_43 = (_42 = (_41 = config.retrieval) === null || _41 === void 0 ? void 0 : _41.spec) === null || _42 === void 0 ? void 0 : _42.logicalRestore) === null || _43 === void 0 ? void 0 : _43.options) === null || _44 === void 0 ? void 0 : _44.customOptions) !== null && _45 !== void 0 ? _45 : null),
73
46
  };
74
47
  };
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { PhysicalEnv } from '../../useForm';
3
- declare type Props = {
4
- envs: PhysicalEnv[];
5
- onChange: (envs: PhysicalEnv[]) => void;
6
- suggestions?: string[];
7
- disabled?: boolean;
8
- keyErrors?: (string | undefined)[];
9
- };
10
- export declare const EnvsEditor: ({ envs, onChange, suggestions, disabled, keyErrors, }: Props) => JSX.Element;
11
- export {};
@@ -1,24 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, IconButton, TextField, Typography } from '@material-ui/core';
3
- import Box from '@mui/material/Box';
4
- // EnvsEditor renders a rows-of-key/value editor with add/remove and a
5
- // click-to-add suggestion list. Engine consumes envs as a free-form map
6
- // (physical.go:76, CopyOptions.Envs map[string]string); the UI is a thin
7
- // surface over that map.
8
- export const EnvsEditor = ({ envs, onChange, suggestions = [], disabled, keyErrors = [], }) => {
9
- const updateRow = (i, patch) => {
10
- const next = envs.slice();
11
- next[i] = { ...next[i], ...patch };
12
- onChange(next);
13
- };
14
- const removeRow = (i) => {
15
- const next = envs.slice();
16
- next.splice(i, 1);
17
- onChange(next);
18
- };
19
- const addRow = (key = '') => {
20
- onChange([...envs, { key, value: '' }]);
21
- };
22
- const usedKeys = new Set(envs.map((e) => e.key));
23
- return (_jsxs(Box, { mt: 1, "data-testid": "envs-editor", children: [_jsx(Typography, { variant: "subtitle2", children: "Environment variables" }), envs.length === 0 ? (_jsx(Box, { mt: 1, mb: 1, children: _jsx(Typography, { variant: "caption", color: "textSecondary", children: "No environment variables set. Use suggestions below or click \"Add\"." }) })) : (envs.map((env, i) => (_jsxs(Box, { display: "flex", alignItems: "center", mt: 1, "data-testid": `envs-row-${i}`, children: [_jsx(TextField, { size: "small", label: "Name", value: env.key, disabled: disabled, error: Boolean(keyErrors[i]), helperText: keyErrors[i], onChange: (e) => updateRow(i, { key: e.target.value }), inputProps: { 'data-testid': `envs-key-${i}` } }), _jsx(Box, { mx: 1, children: _jsx(TextField, { size: "small", label: "Value", value: env.value, disabled: disabled, onChange: (e) => updateRow(i, { value: e.target.value }), inputProps: { 'data-testid': `envs-value-${i}` } }) }), _jsx(IconButton, { size: "small", "aria-label": "remove env", disabled: disabled, onClick: () => removeRow(i), "data-testid": `envs-remove-${i}`, children: "\u00D7" })] }, i)))), _jsx(Box, { mt: 1, children: _jsx(Button, { size: "small", variant: "outlined", disabled: disabled, onClick: () => addRow(), "data-testid": "envs-add", children: "+ Add" }) }), suggestions.length > 0 && (_jsxs(Box, { mt: 1, children: [_jsx(Typography, { variant: "caption", color: "textSecondary", children: "Suggestions:" }), _jsx(Box, { mt: 0.5, children: suggestions.map((s) => (_jsx(Button, { size: "small", variant: "text", disabled: disabled || usedKeys.has(s), onClick: () => addRow(s), "data-testid": `envs-suggest-${s}`, children: s }, s))) })] }))] }));
24
- };
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { FormValues } from '../../useForm';
3
- declare type Props = {
4
- values: FormValues;
5
- onChange: <K extends keyof FormValues>(key: K, value: FormValues[K]) => void;
6
- disabled?: boolean;
7
- envsKeyErrors?: (string | undefined)[];
8
- };
9
- export declare const PgBackRest: ({ values, onChange, disabled, envsKeyErrors, }: Props) => JSX.Element;
10
- export {};
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Checkbox, FormControlLabel, TextField, Typography, } from '@material-ui/core';
3
- import Box from '@mui/material/Box';
4
- import { EnvsEditor } from '../EnvsEditor';
5
- // pgBackRest exposes two structured fields (stanza, delta); repo paths, S3
6
- // keys, archive options all live in the envs map. See
7
- // engine/internal/retrieval/engine/postgres/physical/pgbackrest.go:23-26 and
8
- // the example envs in config.example.physical_pgbackrest.yml:84-99.
9
- const PGBACKREST_ENV_SUGGESTIONS = [
10
- 'PGBACKREST_REPO',
11
- 'PGBACKREST_REPO1_TYPE',
12
- 'PGBACKREST_REPO1_PATH',
13
- 'PGBACKREST_REPO1_HOST',
14
- 'PGBACKREST_REPO1_HOST_USER',
15
- 'PGBACKREST_REPO1_S3_BUCKET',
16
- 'PGBACKREST_REPO1_S3_ENDPOINT',
17
- 'PGBACKREST_REPO1_S3_KEY',
18
- 'PGBACKREST_REPO1_S3_KEY_SECRET',
19
- 'PGBACKREST_REPO1_S3_REGION',
20
- 'PGBACKREST_LOG_LEVEL_CONSOLE',
21
- 'PGBACKREST_PROCESS_MAX',
22
- ];
23
- export const PgBackRest = ({ values, onChange, disabled, envsKeyErrors, }) => {
24
- const onEnvsChange = (envs) => onChange('physicalEnvs', envs);
25
- return (_jsxs(Box, { mt: 2, "data-testid": "pgbackrest-form", children: [_jsx(Typography, { variant: "subtitle1", children: "pgBackRest" }), _jsx(Box, { mt: 1, children: _jsx(TextField, { fullWidth: true, label: "Stanza", placeholder: "my-stanza", value: values.physicalPgbackrestStanza, disabled: disabled, onChange: (e) => onChange('physicalPgbackrestStanza', e.target.value), helperText: "Stanza name (must match the stanza configured in your pgBackRest setup).", inputProps: { 'data-testid': 'pgbackrest-stanza' } }) }), _jsx(Box, { mt: 1, children: _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: values.physicalPgbackrestDelta, disabled: disabled, onChange: (e) => onChange('physicalPgbackrestDelta', e.target.checked), inputProps: {
26
- 'aria-label': 'delta',
27
- 'data-testid': 'pgbackrest-delta',
28
- } }), label: "Delta restore" }) }), _jsx(EnvsEditor, { envs: values.physicalEnvs, onChange: onEnvsChange, suggestions: PGBACKREST_ENV_SUGGESTIONS, disabled: disabled, keyErrors: envsKeyErrors })] }));
29
- };
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { FormValues } from '../../useForm';
3
- declare type Props = {
4
- values: FormValues;
5
- onChange: <K extends keyof FormValues>(key: K, value: FormValues[K]) => void;
6
- disabled?: boolean;
7
- };
8
- export declare const Sync: ({ values, onChange, disabled }: Props) => JSX.Element;
9
- export {};
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Checkbox, FormControlLabel, TextField, Typography, } from '@material-ui/core';
3
- import Box from '@mui/material/Box';
4
- // Shared section rendered below WAL-G / pgBackRest with the structured fields
5
- // that apply across all physical sub-tools (sync.enabled and dockerImage). The
6
- // engine surfaces more knobs (sync.healthCheck, sync.configs, recovery target,
7
- // custom restore command), but they remain YAML-only for 4.2 to keep the
8
- // projection footprint flat.
9
- export const Sync = ({ values, onChange, disabled }) => {
10
- return (_jsxs(Box, { mt: 2, "data-testid": "physical-sync", children: [_jsx(Typography, { variant: "subtitle1", children: "Sync container & image" }), _jsx(Box, { mt: 1, children: _jsx(TextField, { fullWidth: true, label: "Docker image", placeholder: "postgresai/extended-postgres:18-0.6.2", value: values.physicalDockerImage, disabled: disabled, onChange: (e) => onChange('physicalDockerImage', e.target.value), helperText: "Postgres image for restore/sync containers. Major version must match the source.", inputProps: { 'data-testid': 'physical-docker-image' } }) }), _jsx(Box, { mt: 1, children: _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: values.physicalSyncEnabled, disabled: disabled, onChange: (e) => onChange('physicalSyncEnabled', e.target.checked), inputProps: {
11
- 'aria-label': 'sync enabled',
12
- 'data-testid': 'physical-sync-enabled',
13
- } }), label: "Run sync container" }) }), _jsx(Box, { mt: 1, children: _jsx(Typography, { variant: "caption", color: "textSecondary", children: "For advanced sync settings (health check, sync postgres configs, recovery target), edit the YAML config directly." }) })] }));
14
- };
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { FormValues } from '../../useForm';
3
- declare type Props = {
4
- values: FormValues;
5
- onChange: <K extends keyof FormValues>(key: K, value: FormValues[K]) => void;
6
- disabled?: boolean;
7
- envsKeyErrors?: (string | undefined)[];
8
- };
9
- export declare const Walg: ({ values, onChange, disabled, envsKeyErrors }: Props) => JSX.Element;
10
- export {};
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { TextField, Typography } from '@material-ui/core';
3
- import Box from '@mui/material/Box';
4
- import { EnvsEditor } from '../EnvsEditor';
5
- // WAL-G has one structured field (BackupName, defaulting to "LATEST"); storage
6
- // backend, bucket, prefix, and credentials all live in the envs map. See
7
- // engine/internal/retrieval/engine/postgres/physical/wal_g.go:36-38 and the
8
- // example envs in config.example.physical_walg.yml:84-86.
9
- const WALG_ENV_SUGGESTIONS = [
10
- 'WALG_GS_PREFIX',
11
- 'WALG_S3_PREFIX',
12
- 'WALG_FILE_PREFIX',
13
- 'GOOGLE_APPLICATION_CREDENTIALS',
14
- 'AWS_ACCESS_KEY_ID',
15
- 'AWS_SECRET_ACCESS_KEY',
16
- 'AWS_REGION',
17
- ];
18
- export const Walg = ({ values, onChange, disabled, envsKeyErrors }) => {
19
- const onEnvsChange = (envs) => onChange('physicalEnvs', envs);
20
- return (_jsxs(Box, { mt: 2, "data-testid": "walg-form", children: [_jsx(Typography, { variant: "subtitle1", children: "WAL-G" }), _jsx(Box, { mt: 1, children: _jsx(TextField, { fullWidth: true, label: "Backup name", placeholder: "LATEST", value: values.physicalWalgBackupName, disabled: disabled, onChange: (e) => onChange('physicalWalgBackupName', e.target.value), helperText: 'Which backup to restore. "LATEST" picks the most recent.', inputProps: { 'data-testid': 'walg-backup-name' } }) }), _jsx(Box, { mt: 2, children: _jsx(Typography, { variant: "caption", color: "textSecondary", children: "Storage backend, bucket, prefix, and credentials all live in the envs map. Do not paste credentials into the backup name field or any URL." }) }), _jsx(EnvsEditor, { envs: values.physicalEnvs, onChange: onEnvsChange, suggestions: WALG_ENV_SUGGESTIONS, disabled: disabled, keyErrors: envsKeyErrors })] }));
21
- };
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { FormValues } from '../useForm';
3
- declare type Props = {
4
- values: FormValues;
5
- onChange: <K extends keyof FormValues>(key: K, value: FormValues[K]) => void;
6
- disabled?: boolean;
7
- envsKeyErrors?: (string | undefined)[];
8
- };
9
- export declare const PhysicalMode: ({ values, onChange, disabled, envsKeyErrors, }: Props) => JSX.Element;
10
- export {};
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FormControl, FormControlLabel, Radio, RadioGroup, Typography, } from '@material-ui/core';
3
- import Box from '@mui/material/Box';
4
- import { PgBackRest } from './PgBackRest';
5
- import { Sync } from './Sync';
6
- import { Walg } from './Walg';
7
- // Physical-mode restore tool selector + sub-form. Two values surface in the
8
- // UI: WAL-G and pgBackRest, the two tool values the engine accepts outside
9
- // customTool. pg_basebackup is invoked via the customTool path and remains
10
- // YAML-only; when the loaded projection has `tool: customTool` we render a
11
- // banner instead of the sub-form, keeping the user from accidentally wiping a
12
- // hand-edited customTool config.
13
- export const PhysicalMode = ({ values, onChange, disabled, envsKeyErrors, }) => {
14
- const tool = values.physicalTool;
15
- const isCustomTool = tool === 'customTool';
16
- return (_jsxs(Box, { mt: 1, "data-testid": "physical-mode", children: [_jsx(Typography, { variant: "subtitle2", children: "Restore tool" }), isCustomTool ? (_jsx(Box, { mt: 1, "data-testid": "physical-custom-tool-banner", children: _jsx(Typography, { variant: "body2", color: "textSecondary", children: "This config uses a custom restore tool (e.g. pg_basebackup). The UI cannot edit customTool configurations \u2014 edit the YAML directly." }) })) : (_jsx(FormControl, { children: _jsxs(RadioGroup, { row: true, value: tool, onChange: (_, value) => onChange('physicalTool', value), "aria-label": "physical restore tool", children: [_jsx(FormControlLabel, { value: "walg", control: _jsx(Radio, { disabled: disabled }), label: "WAL-G" }), _jsx(FormControlLabel, { value: "pgbackrest", control: _jsx(Radio, { disabled: disabled }), label: "pgBackRest" })] }) })), !isCustomTool && tool === 'walg' && (_jsx(Walg, { values: values, onChange: onChange, disabled: disabled, envsKeyErrors: envsKeyErrors })), !isCustomTool && tool === 'pgbackrest' && (_jsx(PgBackRest, { values: values, onChange: onChange, disabled: disabled, envsKeyErrors: envsKeyErrors })), !isCustomTool && tool && (_jsx(Sync, { values: values, onChange: onChange, disabled: disabled }))] }));
17
- };
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { ProposedConfig } from '@postgres.ai/shared/types/api/endpoints/probeSource';
3
- declare type Props = {
4
- proposed: ProposedConfig;
5
- applying: boolean;
6
- applyError: string | null;
7
- onApply: () => void;
8
- onEdit: () => void;
9
- };
10
- export declare const PreviewCard: ({ proposed, applying, applyError, onApply, onEdit, }: Props) => JSX.Element;
11
- export {};
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, Link, Typography } from '@material-ui/core';
3
- import Box from '@mui/material/Box';
4
- import { Spinner } from '@postgres.ai/shared/components/Spinner';
5
- import { providerKeyToImage } from '../configOptions';
6
- const Field = ({ label, value }) => (_jsxs(Box, { display: "flex", mb: 0.5, children: [_jsx(Box, { minWidth: 220, fontWeight: 600, children: label }), _jsx(Box, { style: { wordBreak: 'break-all' }, children: value })] }));
7
- const Callout = ({ children }) => (_jsx(Box, { mt: 1, p: 1, bgcolor: "#fff8e1", borderLeft: "4px solid #f5a623", fontSize: 13, children: children }));
8
- export const PreviewCard = ({ proposed, applying, applyError, onApply, onEdit, }) => {
9
- var _a, _b;
10
- const mapping = providerKeyToImage(proposed.dockerImage, proposed.pgMajorVersion);
11
- const resolvedTag = proposed.dockerTag || mapping.defaultTag || '(latest)';
12
- const tuningEntries = Object.entries((_a = proposed.queryTuning) !== null && _a !== void 0 ? _a : {});
13
- return (_jsxs(Box, { mt: 2, p: 2, border: "1px solid #e0e0e0", borderRadius: 4, "data-testid": "preview-card", children: [_jsx(Typography, { variant: "h6", children: "Proposed configuration" }), _jsxs(Box, { mt: 2, children: [_jsx(Field, { label: "Detected provider", value: proposed.detectedProvider || 'unknown' }), _jsx(Field, { label: "Docker image", value: mapping.imageType }), _jsx(Field, { label: "Docker tag", value: resolvedTag }), _jsx(Field, { label: "Postgres major version", value: String(proposed.pgMajorVersion || 'unknown') }), _jsx(Field, { label: "Databases", value: ((_b = proposed.databases) === null || _b === void 0 ? void 0 : _b.join(', ')) || '(none)' }), _jsx(Field, { label: "shared_buffers", value: proposed.sharedBuffers || '' }), _jsx(Field, { label: "shared_preload_libraries", value: proposed.sharedPreloadLibraries || '' })] }), tuningEntries.length > 0 && (_jsxs(Box, { mt: 2, children: [_jsx(Typography, { variant: "subtitle2", children: "Query tuning" }), _jsx(Box, { component: "table", mt: 1, style: { borderCollapse: 'collapse' }, children: _jsx("tbody", { children: tuningEntries.map(([k, v]) => (_jsxs("tr", { children: [_jsx("td", { style: { padding: '2px 16px 2px 0', fontWeight: 600 }, children: k }), _jsx("td", { style: { padding: '2px 0' }, children: v })] }, k))) }) })] })), _jsxs(Box, { mt: 2, children: [(mapping.fallback || proposed.detectedProvider === 'generic') && (_jsx(Callout, { children: "Could not detect a managed cloud provider; using the generic Postgres image. Switch to Expert mode if your source runs on a managed service and we missed it." })), !proposed.memoryProbed && (_jsxs(Callout, { children: ["Could not detect host memory; ", _jsx("code", { children: "shared_buffers" }), " is set to a 1\u00A0GB safe default. Adjust in Expert mode if your host has more RAM."] })), _jsx(Callout, { children: "Query tuning is copied from your source. If you use the RDS refresh tool, these values may not match production \u2014 review in Expert mode after the first retrieval run." }), _jsxs(Callout, { children: ["We'll ship ", _jsx("code", { children: proposed.sharedPreloadLibraries }), ". If the chosen image does not bundle one of these libraries, the clone container will fail to start with a \"could not load library\" error \u2014 check ", _jsx("code", { children: "docker logs dblab_server" }), " after Apply."] })] }), _jsxs(Box, { mt: 2, display: "flex", alignItems: "center", children: [_jsxs(Button, { variant: "contained", color: "secondary", onClick: onApply, disabled: applying, "data-testid": "preview-apply", children: ["Apply & start retrieval", applying && _jsx(Spinner, { size: "sm" })] }), _jsx(Box, { ml: 2, children: _jsx(Link, { component: "button", type: "button", onClick: onEdit, "data-testid": "preview-edit", children: "Edit before applying" }) })] }), applyError && (_jsx(Box, { mt: 1, color: "#d32f2f", fontSize: 13, "data-testid": "apply-error", children: applyError }))] }));
14
- };
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- import { ProposedConfig } from '@postgres.ai/shared/types/api/endpoints/probeSource';
3
- import { FormValues } from '../useForm';
4
- declare type Props = {
5
- instanceId: string;
6
- disabled?: boolean;
7
- onApplied?: () => void;
8
- onEdit?: (proposed: ProposedConfig, password: string) => void;
9
- };
10
- export declare const buildProjectionFromProposed: (proposed: ProposedConfig, password: string) => FormValues;
11
- export declare const SimpleMode: (({ instanceId, disabled, onApplied, onEdit }: Props) => JSX.Element) & {
12
- displayName: string;
13
- };
14
- export {};
@@ -1,107 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { observer } from 'mobx-react-lite';
4
- import { Button, TextField, Typography } from '@material-ui/core';
5
- import Box from '@mui/material/Box';
6
- import { Spinner } from '@postgres.ai/shared/components/Spinner';
7
- import { useStores } from '@postgres.ai/shared/pages/Instance/context';
8
- import { providerKeyToImage } from '../configOptions';
9
- import { genericImagePrefix } from '../dockerCatalog';
10
- import { PreviewCard } from './PreviewCard';
11
- // Translates a ProposedConfig from POST /admin/probe-source into the
12
- // FormValues shape the Expert form uses. Both Apply (→ updateConfig) and
13
- // Edit (→ formik.setValues) consume it, so the engine receives the same
14
- // projection regardless of which flow the user picks.
15
- export const buildProjectionFromProposed = (proposed, password) => {
16
- const mapping = providerKeyToImage(proposed.dockerImage, proposed.pgMajorVersion);
17
- const tag = proposed.dockerTag || mapping.defaultTag || '';
18
- const isGeneric = mapping.imageType === 'Generic Postgres';
19
- const dockerPath = isGeneric ? `${genericImagePrefix}:${tag}` : '';
20
- return {
21
- debug: false,
22
- dockerImage: isGeneric
23
- ? String(proposed.pgMajorVersion)
24
- : mapping.imageType,
25
- dockerImageType: mapping.imageType,
26
- dockerPath,
27
- dockerTag: tag,
28
- sharedBuffers: proposed.sharedBuffers,
29
- sharedPreloadLibraries: proposed.sharedPreloadLibraries,
30
- // tuningParams is typed as string on FormValues but updateConfig.ts
31
- // spreads it as a key-value object; cast matches the Expert form's
32
- // formatTuningParamsToObj(...) as unknown as string pattern.
33
- tuningParams: { ...proposed.queryTuning },
34
- timetable: '0 0 * * *',
35
- dbname: proposed.source.dbname,
36
- host: proposed.source.host,
37
- port: String(proposed.source.port),
38
- username: proposed.source.username,
39
- password,
40
- databases: proposed.databases.join(' '),
41
- dumpParallelJobs: '',
42
- dumpIgnoreErrors: false,
43
- restoreParallelJobs: '',
44
- restoreIgnoreErrors: false,
45
- restoreConfigs: '',
46
- pgDumpCustomOptions: '',
47
- pgRestoreCustomOptions: '',
48
- retrievalMode: 'logical',
49
- physicalTool: '',
50
- physicalDockerImage: '',
51
- physicalSyncEnabled: false,
52
- physicalWalgBackupName: '',
53
- physicalPgbackrestStanza: '',
54
- physicalPgbackrestDelta: false,
55
- physicalEnvs: [],
56
- };
57
- };
58
- export const SimpleMode = observer(({ instanceId, disabled, onApplied, onEdit }) => {
59
- const stores = useStores();
60
- const main = stores.main;
61
- const [url, setUrl] = useState('');
62
- const [password, setPassword] = useState('');
63
- const [probing, setProbing] = useState(false);
64
- const [probeError, setProbeError] = useState(null);
65
- const [proposed, setProposed] = useState(null);
66
- const [applying, setApplying] = useState(false);
67
- const [applyError, setApplyError] = useState(null);
68
- const onDetect = async () => {
69
- setProbing(true);
70
- setProbeError(null);
71
- setProposed(null);
72
- setApplyError(null);
73
- const result = await main.probeSource({ url, password });
74
- setProbing(false);
75
- if (!result) {
76
- setProbeError('Probe is not available on this instance.');
77
- return;
78
- }
79
- if (result.error) {
80
- setProbeError(result.error.message);
81
- return;
82
- }
83
- if (result.response)
84
- setProposed(result.response);
85
- };
86
- const onApply = async () => {
87
- var _a;
88
- if (!proposed)
89
- return;
90
- setApplying(true);
91
- setApplyError(null);
92
- const projection = buildProjectionFromProposed(proposed, password);
93
- const response = await main.updateConfig(projection, instanceId);
94
- setApplying(false);
95
- if (!response) {
96
- setApplyError((_a = main.configError) !== null && _a !== void 0 ? _a : 'Could not apply the proposed configuration.');
97
- return;
98
- }
99
- onApplied === null || onApplied === void 0 ? void 0 : onApplied();
100
- };
101
- const handleEdit = () => {
102
- if (proposed)
103
- onEdit === null || onEdit === void 0 ? void 0 : onEdit(proposed, password);
104
- };
105
- const canDetect = !probing && url.trim().length > 0 && password.length > 0 && !disabled;
106
- return (_jsxs(Box, { mt: 2, mb: 2, "data-testid": "simple-mode", children: [!proposed && (_jsxs(Box, { children: [_jsx(Typography, { variant: "h6", children: "Simple configuration" }), _jsx(Typography, { variant: "body2", children: "Paste your source connection string and password. We'll probe the source, propose a configuration, and let you review before starting retrieval." }), _jsx(Box, { mt: 2, children: _jsx(TextField, { label: "Connection string", placeholder: "postgres://user@host:5432/dbname", value: url, onChange: (e) => setUrl(e.target.value), fullWidth: true, disabled: probing || disabled, inputProps: { 'data-testid': 'simple-url' } }) }), _jsx(Box, { mt: 2, children: _jsx(TextField, { label: "Password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), fullWidth: true, disabled: probing || disabled, inputProps: { 'data-testid': 'simple-password' } }) }), _jsx(Box, { mt: 2, children: _jsxs(Button, { variant: "contained", color: "secondary", onClick: onDetect, disabled: !canDetect, "data-testid": "simple-detect", children: ["Detect & preview", probing && _jsx(Spinner, { size: "sm" })] }) }), probeError && (_jsx(Box, { mt: 1, color: "#d32f2f", fontSize: 13, "data-testid": "probe-error", children: probeError }))] })), proposed && (_jsx(PreviewCard, { proposed: proposed, applying: applying, applyError: applyError, onApply: onApply, onEdit: handleEdit }))] }));
107
- });
@@ -1,2 +0,0 @@
1
- export declare type ConfigMode = 'simple' | 'expert';
2
- export declare const getInitialConfigMode: (host: string | undefined, retrievalMode?: string) => ConfigMode;
@@ -1,7 +0,0 @@
1
- // Picks the default Configuration tab when the page first finishes loading
2
- // the server config. An unconfigured instance lands on Simple; an instance
3
- // that already has a source host filled in OR a non-logical retrieval mode
4
- // configured lands on Expert so the user sees the form they previously
5
- // interacted with. Physical-mode users do not have a host field but still
6
- // need to land on Expert because Simple-mode targets logical retrieval.
7
- export const getInitialConfigMode = (host, retrievalMode) => (host || retrievalMode === 'physical' ? 'expert' : 'simple');