@quillsql/admin 1.3.7 → 1.3.8

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 (145) hide show
  1. package/dist/cjs/Admin.d.ts.map +1 -1
  2. package/dist/cjs/Admin.js +21 -11
  3. package/dist/cjs/AdminProvider.d.ts +10 -0
  4. package/dist/cjs/AdminProvider.d.ts.map +1 -1
  5. package/dist/cjs/AdminProvider.js +63 -43
  6. package/dist/cjs/api/ConnectionClient.d.ts +12 -10
  7. package/dist/cjs/api/ConnectionClient.d.ts.map +1 -1
  8. package/dist/cjs/api/ConnectionClient.js +100 -29
  9. package/dist/cjs/assets/ArrowDownHeadIcon.d.ts +5 -0
  10. package/dist/cjs/assets/ArrowDownHeadIcon.d.ts.map +1 -0
  11. package/dist/cjs/assets/ArrowDownHeadIcon.js +5 -0
  12. package/dist/cjs/assets/XIcon.d.ts +5 -0
  13. package/dist/cjs/assets/XIcon.d.ts.map +1 -0
  14. package/dist/cjs/assets/XIcon.js +5 -0
  15. package/dist/cjs/assets/index.d.ts +3 -0
  16. package/dist/cjs/assets/index.d.ts.map +1 -0
  17. package/dist/cjs/assets/index.js +10 -0
  18. package/dist/cjs/components/DatabaseMismatchCard.d.ts +6 -0
  19. package/dist/cjs/components/DatabaseMismatchCard.d.ts.map +1 -0
  20. package/dist/cjs/components/DatabaseMismatchCard.js +18 -0
  21. package/dist/cjs/components/DatabaseSelector.d.ts +2 -1
  22. package/dist/cjs/components/DatabaseSelector.d.ts.map +1 -1
  23. package/dist/cjs/components/DatabaseSelector.js +2 -2
  24. package/dist/cjs/components/DropDownMenuWithLabel.d.ts +2 -1
  25. package/dist/cjs/components/DropDownMenuWithLabel.d.ts.map +1 -1
  26. package/dist/cjs/components/DropDownMenuWithLabel.js +160 -39
  27. package/dist/cjs/components/DynamicBanner.d.ts +11 -0
  28. package/dist/cjs/components/DynamicBanner.d.ts.map +1 -0
  29. package/dist/cjs/components/DynamicBanner.js +22 -0
  30. package/dist/cjs/components/EnvSelectPopover.d.ts.map +1 -1
  31. package/dist/cjs/components/EnvSelectPopover.js +0 -1
  32. package/dist/cjs/components/OrgSelect.d.ts +23 -0
  33. package/dist/cjs/components/OrgSelect.d.ts.map +1 -1
  34. package/dist/cjs/components/OrgSelect.js +55 -15
  35. package/dist/cjs/components/SqlTextEditor.d.ts +7 -0
  36. package/dist/cjs/components/SqlTextEditor.d.ts.map +1 -0
  37. package/dist/cjs/components/SqlTextEditor.js +44 -0
  38. package/dist/cjs/components/UiComponents.d.ts +119 -0
  39. package/dist/cjs/components/UiComponents.d.ts.map +1 -0
  40. package/dist/cjs/components/UiComponents.js +268 -0
  41. package/dist/cjs/forms/client_onboard/ConnectDatabase.d.ts +3 -2
  42. package/dist/cjs/forms/client_onboard/ConnectDatabase.d.ts.map +1 -1
  43. package/dist/cjs/forms/client_onboard/ConnectDatabase.js +101 -43
  44. package/dist/cjs/forms/client_onboard/ConnectSchema.d.ts +3 -1
  45. package/dist/cjs/forms/client_onboard/ConnectSchema.d.ts.map +1 -1
  46. package/dist/cjs/forms/client_onboard/ConnectSchema.js +13 -14
  47. package/dist/cjs/forms/client_onboard/CreateSqlViews.d.ts +10 -1
  48. package/dist/cjs/forms/client_onboard/CreateSqlViews.d.ts.map +1 -1
  49. package/dist/cjs/forms/client_onboard/CreateSqlViews.js +12 -10
  50. package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts +24 -0
  51. package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts.map +1 -0
  52. package/dist/cjs/forms/sql_views/CreateEditSqlView.js +161 -0
  53. package/dist/cjs/modals/NewDashboardModal.js +1 -1
  54. package/dist/cjs/public_components/CreateEnvironment.d.ts.map +1 -1
  55. package/dist/cjs/public_components/CreateEnvironment.js +34 -8
  56. package/dist/cjs/public_components/DashboardBuilder.d.ts.map +1 -1
  57. package/dist/cjs/public_components/DashboardBuilder.js +30 -16
  58. package/dist/cjs/public_components/DashboardManager.d.ts.map +1 -1
  59. package/dist/cjs/public_components/DashboardManager.js +110 -93
  60. package/dist/cjs/public_components/SQLViewManager.d.ts.map +1 -1
  61. package/dist/cjs/public_components/SQLViewManager.js +252 -333
  62. package/dist/cjs/utils/dataEditor.d.ts +4 -0
  63. package/dist/cjs/utils/dataEditor.d.ts.map +1 -0
  64. package/dist/cjs/utils/dataEditor.js +144 -0
  65. package/dist/cjs/utils/dataFetcher.d.ts +3 -0
  66. package/dist/cjs/utils/dataFetcher.d.ts.map +1 -0
  67. package/dist/cjs/utils/dataFetcher.js +68 -0
  68. package/dist/cjs/utils/databases.d.ts +13 -2
  69. package/dist/cjs/utils/databases.d.ts.map +1 -1
  70. package/dist/cjs/utils/databases.js +52 -9
  71. package/dist/cjs/utils/table.d.ts +2 -0
  72. package/dist/cjs/utils/table.d.ts.map +1 -1
  73. package/dist/esm/Admin.d.ts.map +1 -1
  74. package/dist/esm/Admin.js +21 -11
  75. package/dist/esm/AdminProvider.d.ts +10 -0
  76. package/dist/esm/AdminProvider.d.ts.map +1 -1
  77. package/dist/esm/AdminProvider.js +61 -44
  78. package/dist/esm/api/ConnectionClient.d.ts +12 -10
  79. package/dist/esm/api/ConnectionClient.d.ts.map +1 -1
  80. package/dist/esm/api/ConnectionClient.js +97 -28
  81. package/dist/esm/assets/ArrowDownHeadIcon.d.ts +5 -0
  82. package/dist/esm/assets/ArrowDownHeadIcon.d.ts.map +1 -0
  83. package/dist/esm/assets/ArrowDownHeadIcon.js +3 -0
  84. package/dist/esm/assets/XIcon.d.ts +5 -0
  85. package/dist/esm/assets/XIcon.d.ts.map +1 -0
  86. package/dist/esm/assets/XIcon.js +3 -0
  87. package/dist/esm/assets/index.d.ts +3 -0
  88. package/dist/esm/assets/index.d.ts.map +1 -0
  89. package/dist/esm/assets/index.js +2 -0
  90. package/dist/esm/components/DatabaseMismatchCard.d.ts +6 -0
  91. package/dist/esm/components/DatabaseMismatchCard.d.ts.map +1 -0
  92. package/dist/esm/components/DatabaseMismatchCard.js +15 -0
  93. package/dist/esm/components/DatabaseSelector.d.ts +2 -1
  94. package/dist/esm/components/DatabaseSelector.d.ts.map +1 -1
  95. package/dist/esm/components/DatabaseSelector.js +2 -2
  96. package/dist/esm/components/DropDownMenuWithLabel.d.ts +2 -1
  97. package/dist/esm/components/DropDownMenuWithLabel.d.ts.map +1 -1
  98. package/dist/esm/components/DropDownMenuWithLabel.js +137 -39
  99. package/dist/esm/components/DynamicBanner.d.ts +11 -0
  100. package/dist/esm/components/DynamicBanner.d.ts.map +1 -0
  101. package/dist/esm/components/DynamicBanner.js +16 -0
  102. package/dist/esm/components/EnvSelectPopover.d.ts.map +1 -1
  103. package/dist/esm/components/EnvSelectPopover.js +0 -1
  104. package/dist/esm/components/OrgSelect.d.ts +23 -0
  105. package/dist/esm/components/OrgSelect.d.ts.map +1 -1
  106. package/dist/esm/components/OrgSelect.js +52 -16
  107. package/dist/esm/components/SqlTextEditor.d.ts +7 -0
  108. package/dist/esm/components/SqlTextEditor.d.ts.map +1 -0
  109. package/dist/esm/components/SqlTextEditor.js +38 -0
  110. package/dist/esm/components/UiComponents.d.ts +119 -0
  111. package/dist/esm/components/UiComponents.d.ts.map +1 -0
  112. package/dist/esm/components/UiComponents.js +254 -0
  113. package/dist/esm/forms/client_onboard/ConnectDatabase.d.ts +3 -2
  114. package/dist/esm/forms/client_onboard/ConnectDatabase.d.ts.map +1 -1
  115. package/dist/esm/forms/client_onboard/ConnectDatabase.js +102 -44
  116. package/dist/esm/forms/client_onboard/ConnectSchema.d.ts +3 -1
  117. package/dist/esm/forms/client_onboard/ConnectSchema.d.ts.map +1 -1
  118. package/dist/esm/forms/client_onboard/ConnectSchema.js +13 -14
  119. package/dist/esm/forms/client_onboard/CreateSqlViews.d.ts +10 -1
  120. package/dist/esm/forms/client_onboard/CreateSqlViews.d.ts.map +1 -1
  121. package/dist/esm/forms/client_onboard/CreateSqlViews.js +11 -11
  122. package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts +24 -0
  123. package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts.map +1 -0
  124. package/dist/esm/forms/sql_views/CreateEditSqlView.js +155 -0
  125. package/dist/esm/modals/NewDashboardModal.js +1 -1
  126. package/dist/esm/public_components/CreateEnvironment.d.ts.map +1 -1
  127. package/dist/esm/public_components/CreateEnvironment.js +12 -9
  128. package/dist/esm/public_components/DashboardBuilder.d.ts.map +1 -1
  129. package/dist/esm/public_components/DashboardBuilder.js +30 -16
  130. package/dist/esm/public_components/DashboardManager.d.ts.map +1 -1
  131. package/dist/esm/public_components/DashboardManager.js +111 -94
  132. package/dist/esm/public_components/SQLViewManager.d.ts.map +1 -1
  133. package/dist/esm/public_components/SQLViewManager.js +254 -335
  134. package/dist/esm/utils/dataEditor.d.ts +4 -0
  135. package/dist/esm/utils/dataEditor.d.ts.map +1 -0
  136. package/dist/esm/utils/dataEditor.js +138 -0
  137. package/dist/esm/utils/dataFetcher.d.ts +3 -0
  138. package/dist/esm/utils/dataFetcher.d.ts.map +1 -0
  139. package/dist/esm/utils/dataFetcher.js +63 -0
  140. package/dist/esm/utils/databases.d.ts +13 -2
  141. package/dist/esm/utils/databases.d.ts.map +1 -1
  142. package/dist/esm/utils/databases.js +52 -9
  143. package/dist/esm/utils/table.d.ts +2 -0
  144. package/dist/esm/utils/table.d.ts.map +1 -1
  145. package/package.json +2 -2
@@ -0,0 +1,254 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ //@ts-nocheck
3
+ import { useContext, useEffect, useRef } from 'react';
4
+ import { ArrowDownHeadIcon, XIcon } from '../assets';
5
+ import { ThemeContext } from '@quillsql/react';
6
+ export const MemoizedTextInput = ({ value, onChange, placeholder, id, width, }) => {
7
+ const [theme] = useContext(ThemeContext);
8
+ return (_jsxs("div", { style: { position: 'relative', width: width }, children: [_jsx("style", { children: `
9
+ .quill-text-input {
10
+ background-color: white;
11
+ height: 40px;
12
+ width: 180px;
13
+ color: #384151;
14
+ border: 1px solid #e7e7e7;
15
+ border-radius: 6px;
16
+ text-align: left;
17
+ box-shadow: 0px 1px 4px 0px rgba(56, 65, 81, 0.08);
18
+ padding-left: 12px;
19
+ padding-right: 12px;
20
+ padding-top: 0px;
21
+ padding-bottom: 0px;
22
+ box-sizing: content-box;
23
+ }` }), _jsx("input", { id: id, className: "quill-text-input", type: "text", value: value, onChange: (event) => onChange(event.target.value), placeholder: placeholder, style: {
24
+ fontFamily: theme?.fontFamily,
25
+ width: width ? 'calc(100% - 24px)' : '180px',
26
+ } })] }));
27
+ };
28
+ export const MemoizedButton = ({ label, onClick, primary = true, style = {}, width = 'auto', }) => {
29
+ const [theme] = useContext(ThemeContext);
30
+ return (_jsxs("button", { className: "quill-button", onClick: onClick, style: { fontFamily: theme?.fontFamily, ...style, width: width }, children: [_jsx("style", { children: `
31
+ .quill-button {
32
+ background-color: ${primary ? '#212121' : 'white'};
33
+ color: ${primary ? 'white' : '#212121'};
34
+ height: 40px;
35
+ border: 1px solid transparent;
36
+ font-weight: 500;
37
+ border-radius: 6px;
38
+ box-sizing: content-box;
39
+ padding-left: 16px;
40
+ padding-right: 16px;
41
+ overflow: hidden;
42
+ font-size: 15px;
43
+ cursor: pointer;
44
+ }
45
+ .quill-button:hover {
46
+ background-color: rgba(56, 65, 81, 0.9);
47
+ border-radius: 6px;
48
+ overflow: hidden;
49
+ }` }), label] }));
50
+ };
51
+ export const MemoizedSecondaryButton = ({ label, onClick }) => {
52
+ const [theme] = useContext(ThemeContext);
53
+ return (_jsxs("button", { className: "quill-secondary-button", onClick: onClick, style: { fontFamily: theme?.fontFamily }, children: [_jsx("style", { children: `
54
+ .quill-secondary-button {
55
+ background-color: #F5F5F6;
56
+ background-color: white;
57
+ color: #212121';
58
+ color: rgba(56, 65, 81, 0.75);
59
+ height: 40px;
60
+ border: 1px solid transparent;
61
+ font-weight: 500;
62
+ border-radius: 6px;
63
+ padding-left: 16px;
64
+ border: 1px solid #e7e7e7;
65
+ padding-right: 16px;
66
+ box-sizing: content-box;
67
+ font-size: 15px;
68
+ cursor: pointer;
69
+ }
70
+ .quill-secondary-button:hover {
71
+ background-color: rgba(56, 65, 81, 0.09);
72
+ }` }), label] }));
73
+ };
74
+ export const MemoizedSelect = ({ value, onChange, options, disabled = false, label, }) => {
75
+ const [theme] = useContext(ThemeContext);
76
+ return (_jsxs("div", { style: {
77
+ position: 'relative',
78
+ maxWidth: 206,
79
+ }, children: [_jsx("style", { children: `
80
+ .quill-select {
81
+ background-color: white;
82
+ height: 42px;
83
+ color: #384151;
84
+ width: 206px;
85
+ border: 1px solid #e7e7e7;
86
+ border-radius: 6px;
87
+ text-align: left;
88
+ box-shadow: 0px 1px 4px 0px rgba(56, 65, 81, 0.08);
89
+ padding-left: 12px;
90
+ padding-right: 12px;
91
+ }` }), _jsx("select", { style: { WebkitAppearance: 'none', fontFamily: theme?.fontFamily }, className: "quill-select", value: value, disabled: disabled, onChange: (event) => onChange(event.target.value), children: options.map((option) => (_jsx("option", { className: "quill-option", value: option.value, children: option.label }, option.value))) }), _jsx(ArrowDownHeadIcon, { style: {
92
+ height: '20px',
93
+ width: '20px',
94
+ flex: 'none',
95
+ position: 'absolute',
96
+ right: 8,
97
+ top: 11,
98
+ color: '#6C727F',
99
+ }, "aria-hidden": "true" })] }));
100
+ };
101
+ export const MemoizedHeader = ({ children }) => (_jsx("h1", { style: {
102
+ fontSize: 16,
103
+ fontWeight: 600,
104
+ color: '#384151',
105
+ userSelect: 'none',
106
+ margin: 0,
107
+ padding: 0,
108
+ }, children: children }));
109
+ export const MemoizedLabel = ({ children }) => (_jsx("h1", { style: {
110
+ fontSize: 14,
111
+ fontWeight: 600,
112
+ color: '#575E6A',
113
+ userSelect: 'none',
114
+ paddingBottom: 5,
115
+ }, children: children }));
116
+ export const MemoizedText = ({ children }) => (_jsx("p", { style: {
117
+ fontSize: 12,
118
+ fontWeight: 400,
119
+ margin: 0,
120
+ color: '#575E6A',
121
+ userSelect: 'none',
122
+ }, children: children }));
123
+ const useOnClickOutside = (ref, handler) => {
124
+ useEffect(() => {
125
+ const listener = (event) => {
126
+ if (!ref.current || ref.current.contains(event.target)) {
127
+ return;
128
+ }
129
+ handler(event);
130
+ };
131
+ document.addEventListener('mousedown', listener);
132
+ document.addEventListener('touchstart', listener);
133
+ return () => {
134
+ document.removeEventListener('mousedown', listener);
135
+ document.removeEventListener('touchstart', listener);
136
+ };
137
+ }, [ref, handler]);
138
+ };
139
+ export function MemoizedPopover({ onClose, parentRef, children, style = {}, onClick, label, showTrigger = true, isOpen, setIsOpen, }) {
140
+ const modalRef = useRef(null);
141
+ useOnClickOutside(modalRef, (e) => {
142
+ // Exclude click on trigger button (e.g. Dropdown Button) from outside click handler
143
+ const isTriggerElem = parentRef
144
+ ? parentRef.current?.contains(e.target)
145
+ : false;
146
+ if (isTriggerElem) {
147
+ handleCloseModal();
148
+ }
149
+ });
150
+ const handleCloseModal = () => {
151
+ setIsOpen(false);
152
+ if (onClose) {
153
+ onClose();
154
+ }
155
+ };
156
+ return (_jsxs("div", { children: [showTrigger && (_jsx(MemoizedSecondaryButton, { onClick: (e) => {
157
+ setIsOpen((isOpen) => !isOpen);
158
+ if (onClick) {
159
+ onClick(e);
160
+ }
161
+ }, label: label })), isOpen && (_jsx("div", { id: "quill-popover-modal", ref: modalRef, style: { position: 'relative' }, children: _jsx("div", { style: {
162
+ background: 'white',
163
+ position: 'absolute',
164
+ boxShadow: '0px 1px 12px 0px rgba(56, 65, 81, 0.1)',
165
+ border: '1px solid #e7e7e7',
166
+ boxSizing: 'content-box',
167
+ zIndex: 1,
168
+ top: showTrigger ? 12 : 0,
169
+ borderRadius: 6,
170
+ padding: 20,
171
+ overflow: 'scroll',
172
+ ...style,
173
+ }, children: children }) }))] }));
174
+ }
175
+ export function MemoizedModal({ isOpen, onClose, setIsOpen, title, children, theme, }) {
176
+ if (!isOpen) {
177
+ return null;
178
+ }
179
+ return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
180
+ position: 'fixed',
181
+ top: '0',
182
+ right: '0',
183
+ bottom: '0',
184
+ left: '0',
185
+ zIndex: '50',
186
+ backgroundColor: 'rgba(255, 255, 255, 0.8)',
187
+ backdropFilter: 'blur(5px)',
188
+ }, onClick: onClose }), _jsx("div", { style: {
189
+ // position: "absolute",
190
+ position: 'fixed',
191
+ left: '50%',
192
+ top: '50%',
193
+ zIndex: '50',
194
+ // width: "100%",
195
+ maxWidth: 1024,
196
+ maxHeight: '90vh',
197
+ display: 'flex',
198
+ justifyContent: 'center',
199
+ alignItems: 'center',
200
+ transform: 'translateX(-50%) translateY(-50%)',
201
+ background: 'white',
202
+ borderRadius: 8,
203
+ borderStyle: 'solid',
204
+ borderWidth: 1,
205
+ borderColor: '#e7e7e7',
206
+ overflow: 'hidden',
207
+ // zIndex: 1000,
208
+ }, children: _jsxs("div", { style: {
209
+ // width: "80%",
210
+ maxHeight: '90vh',
211
+ overflowY: 'scroll',
212
+ // maxWidth: "700px",
213
+ backgroundColor: '#ffffff',
214
+ // padding: "20px",
215
+ // borderRadius: "8px",
216
+ display: 'flex',
217
+ flexDirection: 'column',
218
+ alignItems: 'center',
219
+ position: 'relative',
220
+ fontFamily: theme?.fontFamily,
221
+ }, children: [_jsxs("div", { id: "quill-modal-header", style: {
222
+ display: 'flex',
223
+ flexDirection: 'row',
224
+ width: '100%',
225
+ justifyContent: 'space-between',
226
+ alignItems: 'center',
227
+ }, children: [_jsx("h2", { style: {
228
+ fontSize: 18,
229
+ fontWeight: '600',
230
+ marginLeft: 20,
231
+ // width: '90%',
232
+ textAlign: 'left',
233
+ paddingTop: 18,
234
+ color: theme?.primaryTextColor,
235
+ }, children: title }), _jsx(MemoizedDeleteButton, { onClick: onClose, style: { marginRight: 10, marginTop: 10 } })] }), children] }) })] }));
236
+ }
237
+ export const MemoizedDeleteButton = ({ onClick, style }) => (_jsxs("button", { className: "quill-delete-button", type: "button", onClick: onClick, style: {
238
+ height: 42,
239
+ width: 42,
240
+ border: 'none',
241
+ cursor: 'pointer',
242
+ display: 'flex',
243
+ alignItems: 'center',
244
+ justifyContent: 'center',
245
+ borderRadius: 6,
246
+ ...style,
247
+ }, children: [_jsx("style", { children: `
248
+ .quill-delete-button {
249
+ background-color: white;
250
+ }
251
+ .quill-delete-button:hover {
252
+ background-color: rgba(56, 65, 81, 0.03);
253
+ }` }), _jsx(XIcon, { height: "20", width: "20", fill: "#6C727F" })] }));
254
+ export const LoadingSpinner = ({ ...props }) => (_jsxs("svg", { width: "24", height: "24", children: [_jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 6)", stroke: "#364153", fill: "none", transform: "rotate(-90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "-180 12 12", to: "180 12 12", dur: "0.8s", repeatCount: "indefinite" }) }), _jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 1 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", stroke: '#ADB1B9', fill: "none", transform: "rotate(90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) })] }));
@@ -1,11 +1,12 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { ConnectionError, ConnectionType } from '../../utils/databases';
3
3
  import { SchemaDetails } from '../../utils/schema';
4
- export default function ConnectDatabase({ containerStyle, header1Style, header2Style, setEnvironmentDetails, environmentDetails, }: {
4
+ export default function ConnectDatabase({ containerStyle, header1Style, header2Style, setEnvironmentDetails, environmentDetails, envClientId, }: {
5
5
  containerStyle?: CSSProperties;
6
6
  header1Style?: CSSProperties;
7
7
  header2Style?: CSSProperties;
8
8
  environmentDetails?: ConnectionType;
9
- setEnvironmentDetails: (connectionInfo?: ConnectionType, schemaDetails?: SchemaDetails, schemaError?: ConnectionError) => void;
9
+ setEnvironmentDetails: (connectionInfo?: ConnectionType, schemaDetails?: SchemaDetails, schemaError?: ConnectionError, clientId?: string) => void;
10
+ envClientId?: string;
10
11
  }): import("react/jsx-runtime").JSX.Element;
11
12
  //# sourceMappingURL=ConnectDatabase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectDatabase.d.ts","sourceRoot":"","sources":["../../../../src/forms/client_onboard/ConnectDatabase.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAGvD,OAAO,EACL,eAAe,EACf,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GACnB,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,qBAAqB,EAAE,CACrB,cAAc,CAAC,EAAE,cAAc,EAC/B,aAAa,CAAC,EAAE,aAAa,EAC7B,WAAW,CAAC,EAAE,eAAe,KAC1B,IAAI,CAAC;CACX,2CAwRA"}
1
+ {"version":3,"file":"ConnectDatabase.d.ts","sourceRoot":"","sources":["../../../../src/forms/client_onboard/ConnectDatabase.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAoB,MAAM,OAAO,CAAC;AAG/D,OAAO,EACL,eAAe,EACf,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,WAAgB,GACjB,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,qBAAqB,EAAE,CACrB,cAAc,CAAC,EAAE,cAAc,EAC/B,aAAa,CAAC,EAAE,aAAa,EAC7B,WAAW,CAAC,EAAE,eAAe,EAC7B,QAAQ,CAAC,EAAE,MAAM,KACd,IAAI,CAAC;IACV,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAwYA"}
@@ -1,24 +1,61 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useRef, useState } from 'react';
3
3
  import { ButtonPrimitive, TextInputPrimitive } from '../../primitives';
4
4
  import DatabaseSelector from '../../components/DatabaseSelector';
5
5
  import { DATABASE_DEFAULT_INFO, formConnectionString, getDatabaseConnectionFormat, } from '../../utils/databases';
6
6
  import { getSchemaTableInfo, testConnectionString, } from '../../api/ConnectionClient';
7
7
  import { delay } from '../../utils/delay';
8
- export default function ConnectDatabase({ containerStyle, header1Style, header2Style, setEnvironmentDetails, environmentDetails, }) {
8
+ export default function ConnectDatabase({ containerStyle, header1Style, header2Style, setEnvironmentDetails, environmentDetails, envClientId = '', }) {
9
+ // SPECIAL FIELDS FOR BIG QUERY ONLY
10
+ const [companyTag, setCompanyTag] = useState('');
9
11
  const [showError, setShowError] = useState(false);
10
12
  const [connectButtonMessage, setConnectButtonMessage] = useState('Connect');
11
13
  const [copied, setCopied] = useState(false);
14
+ const [clientId, setClientId] = useState(envClientId);
15
+ const [fileLabel, setFileLabel] = useState('No file chosen');
12
16
  const [databaseConnectionDetails, setConnectionDetails] = useState(environmentDetails);
13
17
  const onDatabaseSelect = (database) => {
18
+ setShowError(false);
14
19
  setConnectionDetails(getDatabaseConnectionFormat(database));
15
20
  };
16
- const testConnection = async () => {
21
+ const myInputRef = useRef(null);
22
+ const handleButtonClick = () => {
23
+ // current property is a reference to the actual DOM element
24
+ if (myInputRef.current) {
25
+ myInputRef.current.click();
26
+ }
27
+ };
28
+ const handleFileChange = (e) => {
29
+ // read file
30
+ const file = e.target.files?.[0];
31
+ if (!file) {
32
+ return 'No file selected';
33
+ }
34
+ const reader = new FileReader();
35
+ reader.onload = function (event) {
36
+ try {
37
+ const obj = JSON.parse(event.target.result);
38
+ const jsonString = JSON.stringify(obj, null, 2); // stringify with pretty print
39
+ setConnectionDetails({
40
+ ...databaseConnectionDetails, // Cast databaseConnectionDetails to ConnectionType
41
+ jsonString: jsonString,
42
+ });
43
+ setFileLabel(file.name);
44
+ }
45
+ catch (err) {
46
+ console.log('Error parsing JSON file', err);
47
+ setFileLabel('Error parsing JSON file');
48
+ }
49
+ };
50
+ reader.readAsText(file);
51
+ };
52
+ const testConnectionAndFormClient = async () => {
17
53
  const connectionString = formConnectionString(databaseConnectionDetails);
18
- const result = await testConnectionString(connectionString);
19
- if (result) {
54
+ const result = await testConnectionString(connectionString, databaseConnectionDetails.type, clientId);
55
+ if (result.success) {
20
56
  try {
21
- const suspectedSchema = await getSchemaTableInfo(connectionString, 'public');
57
+ setClientId(result.clientId);
58
+ const suspectedSchema = await getSchemaTableInfo(result.clientId, 'public', databaseConnectionDetails.type);
22
59
  setConnectButtonMessage('Connecting');
23
60
  // Stop the next code from running for a second
24
61
  // This is to show the connecting message
@@ -26,12 +63,12 @@ export default function ConnectDatabase({ containerStyle, header1Style, header2S
26
63
  if ('selectedFields' in suspectedSchema) {
27
64
  setConnectButtonMessage('Connected ✅');
28
65
  await delay(2000);
29
- setEnvironmentDetails(databaseConnectionDetails, suspectedSchema, undefined);
66
+ setEnvironmentDetails(databaseConnectionDetails, suspectedSchema, undefined, result.clientId);
30
67
  }
31
68
  else {
32
69
  setConnectButtonMessage('Connected ✅');
33
70
  await delay(2000);
34
- setEnvironmentDetails(databaseConnectionDetails, undefined, suspectedSchema);
71
+ setEnvironmentDetails(databaseConnectionDetails, undefined, suspectedSchema, result.clientId);
35
72
  }
36
73
  }
37
74
  catch (e) {
@@ -45,7 +82,7 @@ export default function ConnectDatabase({ containerStyle, header1Style, header2S
45
82
  }
46
83
  };
47
84
  return (_jsxs("div", { style: { ...containerStyle }, id: "connect-database-form", children: [_jsx("h1", { style: header1Style, children: "Connect Database" }), _jsxs("div", { style: { marginTop: 12 }, children: [_jsx("h2", { style: { ...header2Style, fontWeight: 600, color: '#565656' }, children: "Database type" }), _jsx("div", { style: { display: 'flex', gap: 10 }, children: DATABASE_DEFAULT_INFO.map((database) => {
48
- return (_jsx(DatabaseSelector, { onDatabaseSelect: onDatabaseSelect, containerStyle: { marginBottom: '12px' }, label: database.label, value: database.value, imageUrl: database.imageUrl }, database.label));
85
+ return (_jsx(DatabaseSelector, { onDatabaseSelect: onDatabaseSelect, databaseType: databaseConnectionDetails?.type || '', containerStyle: { marginBottom: '12px' }, label: database.label, value: database.value, imageUrl: database.imageUrl }, database.label));
49
86
  }) })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsxs("div", { style: {
50
87
  // width: '100%',
51
88
  maxWidth: 330,
@@ -90,48 +127,69 @@ export default function ConnectDatabase({ containerStyle, header1Style, header2S
90
127
  flexDirection: 'row',
91
128
  alignItems: 'center',
92
129
  gap: 6,
93
- }, children: [_jsx("div", { children: "\u2705" }), " ", _jsx("div", { children: "Copied to clipboard" })] }))] }), databaseConnectionDetails && (_jsxs("div", { children: [databaseConnectionDetails.type === 'PostgreSQL' && (_jsx("div", { children: _jsxs("div", { children: [_jsx("h2", { style: { ...header2Style, fontWeight: 600 }, children: "Connection String" }), _jsx(TextInputPrimitive, { onChange: (e) => {
94
- setConnectionDetails({
95
- ...databaseConnectionDetails,
96
- connectionString: e.target.value,
97
- });
98
- }, value: databaseConnectionDetails.connectionString })] }) })), _jsxs("div", { style: {
99
- ...header1Style,
100
- textAlign: 'center',
101
- fontSize: 14,
102
- color: '#565656',
103
- display: 'flex',
104
- flexDirection: 'row',
105
- alignItems: 'center',
106
- paddingTop: 24,
107
- paddingBottom: 0,
108
- }, children: [_jsx("div", { style: { width: '100%', height: 1, background: '#e7e7e7' } }), _jsx("div", { style: { padding: 12 }, children: "or" }), _jsx("div", { style: { width: '100%', height: 1, background: '#e7e7e7' } })] }), _jsx("div", { id: "database-details-form", children: _jsx("div", { style: {
130
+ }, children: [_jsx("div", { children: "\u2705" }), " ", _jsx("div", { children: "Copied to clipboard" })] }))] }), databaseConnectionDetails && (_jsxs("div", { children: [databaseConnectionDetails.type !== 'BigQuery' ? (_jsxs("div", { children: [_jsxs("div", { children: [_jsx("h2", { style: { ...header2Style, fontWeight: 600 }, children: "Connection String" }), _jsx(TextInputPrimitive, { onChange: (e) => {
131
+ setConnectionDetails({
132
+ ...databaseConnectionDetails,
133
+ connectionString: e.target.value,
134
+ });
135
+ }, value: databaseConnectionDetails.connectionString })] }), _jsxs("div", { style: {
136
+ ...header1Style,
137
+ textAlign: 'center',
138
+ fontSize: 14,
139
+ color: '#565656',
140
+ display: 'flex',
141
+ flexDirection: 'row',
142
+ alignItems: 'center',
143
+ paddingTop: 24,
144
+ paddingBottom: 0,
145
+ }, children: [_jsx("div", { style: { width: '100%', height: 1, background: '#e7e7e7' } }), _jsx("div", { style: { padding: 12 }, children: "or" }), _jsx("div", { style: { width: '100%', height: 1, background: '#e7e7e7' } })] }), _jsx("div", { id: "database-details-form", children: _jsx("div", { style: {
146
+ display: 'grid',
147
+ gridTemplateColumns: 'repeat(3, 1fr)',
148
+ gap: '20px',
149
+ justifyContent: 'space-between',
150
+ marginTop: '16px',
151
+ }, children:
152
+ // get a list of types in the databaseConnectionDetails object and create a form for each
153
+ Object.entries(databaseConnectionDetails).map(([key, value]) => {
154
+ if (key !== 'connectionString' && key !== 'type')
155
+ return (_jsxs("div", { children: [_jsx("h2", { style: {
156
+ ...header2Style,
157
+ fontWeight: '600',
158
+ }, children: key
159
+ .split(/(?=[A-Z])/)
160
+ .map((word) => word.charAt(0).toUpperCase() +
161
+ word.slice(1))
162
+ .join(' ') }), _jsx(TextInputPrimitive, { onChange: (e) => {
163
+ setConnectionDetails({
164
+ ...databaseConnectionDetails,
165
+ [key]: e.target.value,
166
+ });
167
+ }, value: value, disabled: key === 'type' })] }, key));
168
+ }) }) })] })) : (_jsx("div", { style: { minWidth: 790 }, children: _jsxs("div", { id: "database-details-form", style: {
109
169
  display: 'grid',
110
- gridTemplateColumns: 'repeat(3, 1fr)',
170
+ gridTemplateColumns: 'repeat(1, 1fr)',
111
171
  gap: '20px',
112
172
  justifyContent: 'space-between',
113
173
  marginTop: '16px',
114
- }, children:
115
- // get a list of types in the databaseConnectionDetails object and create a form for each
116
- Object.entries(databaseConnectionDetails).map(([key, value]) => {
117
- if (key !== 'connectionString' && key !== 'type')
118
- return (_jsxs("div", { children: [_jsx("h2", { style: {
119
- ...header2Style,
120
- fontWeight: '600',
121
- }, children: key
122
- .split(/(?=[A-Z])/)
123
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
124
- .join(' ') }), _jsx(TextInputPrimitive, { onChange: (e) => {
125
- setConnectionDetails({
126
- ...databaseConnectionDetails,
127
- [key]: e.target.value,
128
- });
129
- }, value: value, disabled: key === 'type' })] }, key));
130
- }) }) }), _jsxs("div", { style: {
174
+ }, children: [_jsxs("div", { children: [_jsx("h2", { style: {
175
+ ...header2Style,
176
+ fontWeight: '600',
177
+ }, children: "Project ID" }), _jsx(TextInputPrimitive, { onChange: (e) => {
178
+ setConnectionDetails({
179
+ ...databaseConnectionDetails,
180
+ companyTag: e.target.value,
181
+ });
182
+ setCompanyTag(e.target.value);
183
+ }, value: companyTag })] }), _jsxs("div", { children: [_jsx("h2", { style: { ...header2Style, fontWeight: '600' }, children: "Submit File" }), _jsxs("div", { children: [_jsx("input", { type: "file", accept: ".json", onChange: handleFileChange, style: { display: 'none' }, id: "fileInput", ref: myInputRef }), _jsxs("div", { style: {
184
+ display: 'flex',
185
+ flexDirection: 'row',
186
+ gap: 12,
187
+ alignItems: 'center',
188
+ }, children: [_jsx(ButtonPrimitive, { onClick: handleButtonClick, label: 'Upload JSON' }), _jsx("span", { style: { ...header2Style, fontWeight: '600' }, children: fileLabel })] })] })] })] }) })), _jsxs("div", { style: {
131
189
  width: '100%',
132
190
  display: 'flex',
133
191
  justifyContent: 'space-between',
134
192
  alignItems: 'center',
135
193
  marginTop: '24px',
136
- }, children: [showError ? (_jsx("h2", { style: { ...header2Style, color: 'red' }, children: "Couldn't connect to database." })) : (_jsx("div", {})), _jsx(ButtonPrimitive, { label: connectButtonMessage, onClick: testConnection })] })] }))] }));
194
+ }, children: [showError ? (_jsx("h2", { style: { ...header2Style, color: 'red' }, children: "Couldn't connect to database." })) : (_jsx("div", {})), _jsx(ButtonPrimitive, { label: connectButtonMessage, onClick: testConnectionAndFormClient })] })] }))] }));
137
195
  }
@@ -1,7 +1,7 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { SchemaDetails } from '../../utils/schema';
3
3
  import { ConnectionError, ConnectionType } from '../../utils/databases';
4
- export default function ConnectSchema({ containerStyle, header1Style, header2Style, allSchemaInfo, environmentDetails, propogateSchemaDetails, initialError, }: {
4
+ export default function ConnectSchema({ containerStyle, header1Style, header2Style, allSchemaInfo, environmentDetails, propogateSchemaDetails, initialError, clientId, parentRef, }: {
5
5
  containerStyle?: CSSProperties;
6
6
  header1Style?: CSSProperties;
7
7
  header2Style?: CSSProperties;
@@ -9,5 +9,7 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
9
9
  environmentDetails?: ConnectionType;
10
10
  initialError?: ConnectionError;
11
11
  propogateSchemaDetails: (schemaDetails?: SchemaDetails) => void;
12
+ clientId: string;
13
+ parentRef: any;
12
14
  }): import("react/jsx-runtime").JSX.Element;
13
15
  //# sourceMappingURL=ConnectSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectSchema.d.ts","sourceRoot":"","sources":["../../../../src/forms/client_onboard/ConnectSchema.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAuB,MAAM,OAAO,CAAC;AAIlE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASnD,OAAO,EACL,eAAe,EACf,cAAc,EAEf,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,GACb,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,sBAAsB,EAAE,CAAC,aAAa,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;CACjE,2CA6RA"}
1
+ {"version":3,"file":"ConnectSchema.d.ts","sourceRoot":"","sources":["../../../../src/forms/client_onboard/ConnectSchema.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAA+B,MAAM,OAAO,CAAC;AAI1E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAExE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,sBAAsB,EAAE,CAAC,aAAa,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,GAAG,CAAC;CAChB,2CAiSA"}
@@ -3,8 +3,7 @@ import { useState } from 'react';
3
3
  import { ButtonPrimitive } from '../../primitives';
4
4
  import DropdownMenuWithLabel from '../../components/DropDownMenuWithLabel';
5
5
  import { getFKInfo, getOrgInfo, getSchemaTableInfo, getTableInfo, getTablesBySchema, } from '../../api/ConnectionClient';
6
- import { formConnectionString, } from '../../utils/databases';
7
- export default function ConnectSchema({ containerStyle, header1Style, header2Style, allSchemaInfo, environmentDetails, propogateSchemaDetails, initialError, }) {
6
+ export default function ConnectSchema({ containerStyle, header1Style, header2Style, allSchemaInfo, environmentDetails, propogateSchemaDetails, initialError, clientId, parentRef, }) {
8
7
  const [schemaDetails, setSchemaDetails] = useState(allSchemaInfo);
9
8
  const [schemaError, setSchemaError] = useState(initialError);
10
9
  const [formError, setFormError] = useState({ show: false, message: '' });
@@ -16,8 +15,8 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
16
15
  gap: '16px',
17
16
  alignItems: 'flex-end',
18
17
  paddingBottom: '16px',
19
- }, children: [_jsx(DropdownMenuWithLabel, { items: schemaDetails?.schemas || schemaError?.schemas || [], setSelected: async (e) => {
20
- const tables = await getTablesBySchema(formConnectionString(environmentDetails), e);
18
+ }, children: [_jsx(DropdownMenuWithLabel, { parentRef: parentRef, items: schemaDetails?.schemas || schemaError?.schemas || [], setSelected: async (e) => {
19
+ const tables = await getTablesBySchema(clientId, e);
21
20
  if (tables) {
22
21
  setFormError({ show: false, message: '' });
23
22
  setSchemaError(undefined);
@@ -53,7 +52,7 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
53
52
  });
54
53
  }
55
54
  }, selected: schemaDetails?.selectedFields?.schema || schemaError?.schemaName, label: 'Schema' }), schemaError?.schemas.length === 0 && (_jsx(ButtonPrimitive, { label: "Re-fetch", onClick: async () => {
56
- const suspectedSchema = await getSchemaTableInfo(formConnectionString(environmentDetails), 'public');
55
+ const suspectedSchema = await getSchemaTableInfo(clientId, 'public', environmentDetails.type);
57
56
  if ('selectedFields' in suspectedSchema) {
58
57
  setSchemaError(undefined);
59
58
  setSchemaDetails(suspectedSchema);
@@ -74,8 +73,8 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
74
73
  gap: '20px',
75
74
  justifyContent: 'space-between',
76
75
  marginTop: '8px',
77
- }, children: [_jsx(DropdownMenuWithLabel, { items: schemaDetails?.tables || [], setSelected: async (e) => {
78
- const columns = await getTableInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, e);
76
+ }, children: [_jsx(DropdownMenuWithLabel, { parentRef: parentRef, items: schemaDetails?.tables || [], setSelected: async (e) => {
77
+ const columns = await getTableInfo(clientId, schemaDetails?.selectedFields?.schema, e);
79
78
  setSchemaDetails({
80
79
  ...schemaDetails,
81
80
  columns: columns.columns,
@@ -86,10 +85,10 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
86
85
  table: e,
87
86
  },
88
87
  });
89
- }, selected: schemaDetails?.selectedFields?.table, label: 'Organization table' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.columns || [], setSelected: async (e) => {
90
- const fkStrings = await getFKInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, e);
88
+ }, selected: schemaDetails?.selectedFields?.table, label: 'Organization table' }), _jsx(DropdownMenuWithLabel, { parentRef: parentRef, items: schemaDetails?.columns || [], setSelected: async (e) => {
89
+ const fkStrings = await getFKInfo(clientId, schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, e);
91
90
  if (schemaDetails?.selectedFields.customerNameField) {
92
- const organizations = await getOrgInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, e, schemaDetails?.selectedFields.customerNameField);
91
+ const organizations = await getOrgInfo(clientId, schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, e, schemaDetails?.selectedFields.customerNameField);
93
92
  setSchemaDetails({
94
93
  ...schemaDetails,
95
94
  organizations: organizations,
@@ -107,9 +106,9 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
107
106
  organizationIdField: e,
108
107
  },
109
108
  });
110
- }, selected: schemaDetails?.selectedFields?.organizationIdField, label: 'Organization ID field' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.columns || [], setSelected: async (e) => {
109
+ }, selected: schemaDetails?.selectedFields?.organizationIdField, label: 'Organization ID field' }), _jsx(DropdownMenuWithLabel, { parentRef: parentRef, items: schemaDetails?.columns || [], setSelected: async (e) => {
111
110
  if (schemaDetails?.selectedFields.organizationIdField) {
112
- const organizations = await getOrgInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, schemaDetails?.selectedFields.organizationIdField, e);
111
+ const organizations = await getOrgInfo(clientId, schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, schemaDetails?.selectedFields.organizationIdField, e);
113
112
  setSchemaDetails({
114
113
  ...schemaDetails,
115
114
  organizations: organizations,
@@ -128,7 +127,7 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
128
127
  },
129
128
  });
130
129
  }
131
- }, selected: schemaDetails?.selectedFields?.customerNameField, label: 'Organization name field' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.organizations?.map((orgObj) => orgObj.name) ||
130
+ }, selected: schemaDetails?.selectedFields?.customerNameField, label: 'Organization name field' }), _jsx(DropdownMenuWithLabel, { parentRef: parentRef, items: schemaDetails?.organizations?.map((orgObj) => orgObj.name) ||
132
131
  [], setSelected: async (e) => {
133
132
  const orgObj = schemaDetails?.organizations?.find((orgObj) => orgObj.name === e);
134
133
  setSchemaDetails({
@@ -138,7 +137,7 @@ export default function ConnectSchema({ containerStyle, header1Style, header2Sty
138
137
  defaultOrg: orgObj,
139
138
  },
140
139
  });
141
- }, selected: schemaDetails?.selectedFields?.defaultOrg?.name, label: 'Default organization' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.foreignKeys || [], setSelected: async (e) => {
140
+ }, selected: schemaDetails?.selectedFields?.defaultOrg?.name, label: 'Default organization' }), _jsx(DropdownMenuWithLabel, { parentRef: parentRef, items: schemaDetails?.foreignKeys || [], setSelected: async (e) => {
142
141
  setSchemaDetails({
143
142
  ...schemaDetails,
144
143
  selectedFields: {
@@ -2,7 +2,7 @@ import { CSSProperties } from 'react';
2
2
  import { ColumnsByTable } from '../../utils/table';
3
3
  import { SchemaDetails } from '../../utils/schema';
4
4
  import { ConnectionType } from '../../utils/databases';
5
- export default function CreateSQLViews({ containerStyle, header1Style, header2Style, columnsByTable, environmentDetails, allSchemaInfo, domainName, completeOnboarding, }: {
5
+ export default function CreateSQLViews({ containerStyle, header1Style, header2Style, columnsByTable, environmentDetails, allSchemaInfo, domainName, completeOnboarding, clientId, state, }: {
6
6
  containerStyle?: CSSProperties;
7
7
  header1Style?: CSSProperties;
8
8
  header2Style?: CSSProperties;
@@ -11,5 +11,14 @@ export default function CreateSQLViews({ containerStyle, header1Style, header2St
11
11
  allSchemaInfo?: SchemaDetails;
12
12
  domainName: string | undefined;
13
13
  completeOnboarding: (client: any) => void;
14
+ clientId: string;
15
+ state: any;
16
+ }): import("react/jsx-runtime").JSX.Element;
17
+ export declare function ForeignKeyModal({ isOpen, setIsOpen, override, foreignKey, tableName, }: {
18
+ isOpen: boolean;
19
+ setIsOpen: (e: boolean) => void;
20
+ override: (e: boolean) => Promise<void>;
21
+ foreignKey: string | undefined;
22
+ tableName: string | undefined;
14
23
  }): import("react/jsx-runtime").JSX.Element;
15
24
  //# sourceMappingURL=CreateSqlViews.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreateSqlViews.d.ts","sourceRoot":"","sources":["../../../../src/forms/client_onboard/CreateSqlViews.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAU,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAa3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAwB,MAAM,uBAAuB,CAAC;AAG7E,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,kBAAkB,GACnB,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAC3C,2CA8VA"}
1
+ {"version":3,"file":"CreateSqlViews.d.ts","sourceRoot":"","sources":["../../../../src/forms/client_onboard/CreateSqlViews.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAU,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAa3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAwB,MAAM,uBAAuB,CAAC;AAK7E,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,KAAK,GACN,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;CACZ,2CAmWA;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,GACV,EAAE;IACD,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,2CAiDA"}