@quillsql/admin 1.3.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Admin.d.ts +0 -5
- package/dist/cjs/Admin.d.ts.map +1 -1
- package/dist/cjs/Admin.js +37 -99
- package/dist/cjs/AdminProvider.d.ts +0 -6
- package/dist/cjs/AdminProvider.d.ts.map +1 -1
- package/dist/cjs/AdminProvider.js +15 -46
- package/dist/cjs/api/ConnectionClient.d.ts.map +1 -1
- package/dist/cjs/api/ConnectionClient.js +2 -1
- package/dist/cjs/components/OrgSelect.js +2 -2
- package/dist/cjs/forms/client_onboard/CreateSqlViews.d.ts.map +1 -1
- package/dist/cjs/forms/client_onboard/CreateSqlViews.js +2 -4
- package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts +2 -3
- package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts.map +1 -1
- package/dist/cjs/forms/sql_views/CreateEditSqlView.js +3 -3
- package/dist/cjs/primitives/TextInputPrimitive.d.ts +1 -0
- package/dist/cjs/primitives/TextInputPrimitive.d.ts.map +1 -1
- package/dist/cjs/primitives/TextInputPrimitive.js +2 -2
- package/dist/cjs/public_components/DashboardManager.d.ts.map +1 -1
- package/dist/cjs/public_components/DashboardManager.js +12 -19
- package/dist/esm/Admin.d.ts +0 -5
- package/dist/esm/Admin.d.ts.map +1 -1
- package/dist/esm/Admin.js +37 -98
- package/dist/esm/AdminProvider.d.ts +0 -6
- package/dist/esm/AdminProvider.d.ts.map +1 -1
- package/dist/esm/AdminProvider.js +15 -46
- package/dist/esm/api/ConnectionClient.d.ts.map +1 -1
- package/dist/esm/api/ConnectionClient.js +2 -1
- package/dist/esm/components/OrgSelect.js +2 -2
- package/dist/esm/forms/client_onboard/CreateSqlViews.d.ts.map +1 -1
- package/dist/esm/forms/client_onboard/CreateSqlViews.js +3 -5
- package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts +2 -3
- package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts.map +1 -1
- package/dist/esm/forms/sql_views/CreateEditSqlView.js +4 -4
- package/dist/esm/primitives/TextInputPrimitive.d.ts +1 -0
- package/dist/esm/primitives/TextInputPrimitive.d.ts.map +1 -1
- package/dist/esm/primitives/TextInputPrimitive.js +2 -2
- package/dist/esm/public_components/DashboardManager.d.ts.map +1 -1
- package/dist/esm/public_components/DashboardManager.js +12 -19
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { ButtonPrimitive, ModalPrimitive, TextInputPrimitive, } from '../../prim
|
|
|
4
4
|
import { createSQLView, getQueryFromAiWithConnection, getSqlViewData, } from '../../api/ConnectionClient';
|
|
5
5
|
import SqlViewTile from '../../components/SqlViewTile';
|
|
6
6
|
import SqlTextEditor from '../../components/SqlTextEditor';
|
|
7
|
-
import {
|
|
7
|
+
import { QuillTable } from '@quillsql/react';
|
|
8
8
|
export default function CreateSQLViews({ containerStyle, header1Style, header2Style, columnsByTable, environmentDetails, allSchemaInfo, domainName, completeOnboarding, clientId, state, }) {
|
|
9
9
|
const [selectedTable, setSelectedTable] = useState(undefined);
|
|
10
10
|
const [queryInfo, setQueryInfo] = useState({
|
|
@@ -110,12 +110,10 @@ export default function CreateSQLViews({ containerStyle, header1Style, header2St
|
|
|
110
110
|
paddingLeft: 16,
|
|
111
111
|
paddingRight: 16,
|
|
112
112
|
height: 'calc(100vh - 515px)',
|
|
113
|
-
}, children: [_jsx(
|
|
114
|
-
// height="400px"
|
|
115
|
-
containerStyle: {
|
|
113
|
+
}, children: [_jsx(QuillTable, { rows: tableData.rows, columns: tableData.fields, containerStyle: {
|
|
116
114
|
height: 'calc(100vh - 589px)',
|
|
117
115
|
width: '100%',
|
|
118
|
-
},
|
|
116
|
+
}, showDownloadCSVButton: true }), _jsxs("div", { style: {
|
|
119
117
|
width: '100%',
|
|
120
118
|
display: 'flex',
|
|
121
119
|
justifyContent: 'space-between',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonComponentProps,
|
|
2
|
+
import { ButtonComponentProps, TextInputComponentProps, HeaderProps } from '@quillsql/react';
|
|
3
3
|
import { ColumnsByTable } from '../../utils/table';
|
|
4
4
|
interface CreateEditSqlViewProps {
|
|
5
5
|
containerStyle: React.CSSProperties;
|
|
@@ -11,7 +11,6 @@ interface CreateEditSqlViewProps {
|
|
|
11
11
|
Button?: (props: ButtonComponentProps) => JSX.Element;
|
|
12
12
|
SecondaryButtonComponent?: (props: ButtonComponentProps) => JSX.Element;
|
|
13
13
|
TextInput?: (props: TextInputComponentProps) => JSX.Element;
|
|
14
|
-
TableComponent?: (props: TableComponentProps) => JSX.Element;
|
|
15
14
|
LoadingComponent?: () => JSX.Element;
|
|
16
15
|
Header?: (props: HeaderProps) => JSX.Element;
|
|
17
16
|
closeEditView: () => void;
|
|
@@ -19,6 +18,6 @@ interface CreateEditSqlViewProps {
|
|
|
19
18
|
allTableData: ColumnsByTable[];
|
|
20
19
|
schemaIsLoading: boolean;
|
|
21
20
|
}
|
|
22
|
-
export default function CreateEditSqlView({ containerStyle, initialSqlView, closeEditView, addEditView, SecondaryButtonComponent,
|
|
21
|
+
export default function CreateEditSqlView({ containerStyle, initialSqlView, closeEditView, addEditView, SecondaryButtonComponent, LoadingComponent, Button, TextInput, Header, allTableData, schemaIsLoading, }: CreateEditSqlViewProps): JSX.Element;
|
|
23
22
|
export {};
|
|
24
23
|
//# sourceMappingURL=CreateEditSqlView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateEditSqlView.d.ts","sourceRoot":"","sources":["../../../../src/forms/sql_views/CreateEditSqlView.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CreateEditSqlView.d.ts","sourceRoot":"","sources":["../../../../src/forms/sql_views/CreateEditSqlView.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,oBAAoB,EAEpB,uBAAuB,EACv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
2
|
-
import {
|
|
2
|
+
import { QuillTable } from '@quillsql/react';
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { useAdmin } from '../../AdminProvider';
|
|
5
5
|
import { getQueryFromAiWithConnection, getSqlViewData, } from '../../api/ConnectionClient';
|
|
@@ -8,7 +8,7 @@ import { LoadingSpinner, MemoizedButton, MemoizedHeader, MemoizedTextInput, } fr
|
|
|
8
8
|
import { SchemaListComponent } from '@quillsql/react';
|
|
9
9
|
import { ForeignKeyModal } from '../client_onboard/CreateSqlViews';
|
|
10
10
|
import DynamicBanner from '../../components/DynamicBanner';
|
|
11
|
-
export default function CreateEditSqlView({ containerStyle, initialSqlView, closeEditView, addEditView, SecondaryButtonComponent,
|
|
11
|
+
export default function CreateEditSqlView({ containerStyle, initialSqlView, closeEditView, addEditView, SecondaryButtonComponent, LoadingComponent = () => _jsx(LoadingSpinner, {}), Button = MemoizedButton, TextInput = MemoizedTextInput, Header = MemoizedHeader, allTableData, schemaIsLoading, }) {
|
|
12
12
|
const [name, setName] = useState(initialSqlView?.name || '');
|
|
13
13
|
const [editViewQuery, setEditViewQuery] = useState(initialSqlView?.query || '');
|
|
14
14
|
const [ranViewQuery, setRanViewQuery] = useState(initialSqlView?.query || '');
|
|
@@ -27,7 +27,7 @@ export default function CreateEditSqlView({ containerStyle, initialSqlView, clos
|
|
|
27
27
|
const addEditSqlView = async (override = false) => {
|
|
28
28
|
if (!override &&
|
|
29
29
|
tableData &&
|
|
30
|
-
!tableData.fields.find((col) => col.name === state.client.customerFieldName)) {
|
|
30
|
+
!tableData.fields.find((col) => col.name === state.client.customerFieldName.replaceAll('"', ''))) {
|
|
31
31
|
setShowFKModal(true);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
@@ -151,5 +151,5 @@ export default function CreateEditSqlView({ containerStyle, initialSqlView, clos
|
|
|
151
151
|
display: 'flex',
|
|
152
152
|
justifyContent: 'center',
|
|
153
153
|
alignItems: 'center',
|
|
154
|
-
}, children: _jsx(LoadingComponent, {}) })), tableData && (_jsx(
|
|
154
|
+
}, children: _jsx(LoadingComponent, {}) })), tableData && (_jsx(QuillTable, { rows: tableData.rows, columns: tableData.fields, containerStyle: { height: '360px' } })), viewAddable && (_jsx("div", { style: { width: '200px' }, children: _jsx(Button, { label: `${initialSqlView ? 'Save changes' : 'Create view'}`, onClick: () => addEditSqlView(false) }) }))] })] }), _jsx(ForeignKeyModal, { isOpen: showFKModal, setIsOpen: setShowFKModal, override: addEditSqlView, foreignKey: state.client.customerFieldName, tableName: state.client.customerTableName })] }) }));
|
|
155
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputPrimitive.d.ts","sourceRoot":"","sources":["../../../src/primitives/TextInputPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAyB,MAAM,UAAU,CAAC;AAE7D,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInputPrimitive.d.ts","sourceRoot":"","sources":["../../../src/primitives/TextInputPrimitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAyB,MAAM,UAAU,CAAC;AAE7D,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmCzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { theme as defaultTheme } from '../Admin';
|
|
3
|
-
const TextInputPrimitive = ({ onChange, value, placeholder, theme = defaultTheme, disabled = false, }) => {
|
|
3
|
+
const TextInputPrimitive = ({ onChange, value, placeholder, theme = defaultTheme, disabled = false, width = '250px', }) => {
|
|
4
4
|
return (_jsx("input", { style: {
|
|
5
5
|
display: 'flex',
|
|
6
6
|
flexDirection: 'row',
|
|
@@ -9,7 +9,7 @@ const TextInputPrimitive = ({ onChange, value, placeholder, theme = defaultTheme
|
|
|
9
9
|
paddingRight: '12px',
|
|
10
10
|
fontWeight: 'medium',
|
|
11
11
|
height: 38,
|
|
12
|
-
minWidth:
|
|
12
|
+
minWidth: width,
|
|
13
13
|
boxShadow: '0 1px 2px 0 rgba(0,0,0,.05)',
|
|
14
14
|
width: '100%',
|
|
15
15
|
backgroundColor: theme?.backgroundColor || 'white',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardManager.d.ts","sourceRoot":"","sources":["../../../src/public_components/DashboardManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA+B,MAAM,OAAO,CAAC;AAgCnE,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,0BAA0B,EAC1B,cAAc,GACf,EAAE;IACD,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC,
|
|
1
|
+
{"version":3,"file":"DashboardManager.d.ts","sourceRoot":"","sources":["../../../src/public_components/DashboardManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA+B,MAAM,OAAO,CAAC;AAgCnE,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,0BAA0B,EAC1B,cAAc,GACf,EAAE;IACD,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC,2CAkkBA"}
|
|
@@ -13,6 +13,7 @@ import DatabaseMismatchCard from '../components/DatabaseMismatchCard';
|
|
|
13
13
|
export default function DashboardManager({ navigateToDashboardBuilder, containerStyle, }) {
|
|
14
14
|
const { state, dispatch } = useAdmin();
|
|
15
15
|
const parentRef = useRef(null);
|
|
16
|
+
const [initialLoad, setInitialLoad] = useState(true);
|
|
16
17
|
const [dashboards, setDashboards] = useState([]);
|
|
17
18
|
const [reloadFlag, setReloadFlag] = useState(false);
|
|
18
19
|
const [selectedEditDashboard, setSelectedEditDashboard] = useState('');
|
|
@@ -54,6 +55,7 @@ export default function DashboardManager({ navigateToDashboardBuilder, container
|
|
|
54
55
|
});
|
|
55
56
|
// If you need to retrieve the JSON data from the response:
|
|
56
57
|
const data = await response.json();
|
|
58
|
+
setInitialLoad(false);
|
|
57
59
|
if (!data.data.dashboardNames || !data.data.dashboardNames.length) {
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
@@ -107,22 +109,13 @@ export default function DashboardManager({ navigateToDashboardBuilder, container
|
|
|
107
109
|
...state.queryHeaders,
|
|
108
110
|
'Content-Type': 'application/json',
|
|
109
111
|
},
|
|
110
|
-
body: JSON.stringify({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
databaseType: state.client.databaseType,
|
|
118
|
-
}
|
|
119
|
-
: {
|
|
120
|
-
task: 'config',
|
|
121
|
-
name: dashboard,
|
|
122
|
-
clientId: state.client._id,
|
|
123
|
-
databaseType: state.client.databaseType,
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
112
|
+
body: JSON.stringify({ metadata: {
|
|
113
|
+
orgId: state.organizationId || '*',
|
|
114
|
+
task: 'config',
|
|
115
|
+
name: dashboard,
|
|
116
|
+
clientId: state.client._id,
|
|
117
|
+
databaseType: state.client.databaseType,
|
|
118
|
+
} }),
|
|
126
119
|
credentials: state.withCredentials ? 'include' : 'omit', // If withCredentials is true, set to 'include'. Otherwise, set to 'omit'.
|
|
127
120
|
});
|
|
128
121
|
responseData = (await response.json()).data;
|
|
@@ -131,7 +124,7 @@ export default function DashboardManager({ navigateToDashboardBuilder, container
|
|
|
131
124
|
const url = new URL(`${QUILL_SERVER}/dashconfig`);
|
|
132
125
|
// Setting the search parameters for the URL
|
|
133
126
|
url.search = new URLSearchParams({
|
|
134
|
-
orgId: state.organizationId
|
|
127
|
+
orgId: state.organizationId,
|
|
135
128
|
publicKey: state.client._id,
|
|
136
129
|
name: dashboard,
|
|
137
130
|
}).toString();
|
|
@@ -175,7 +168,7 @@ export default function DashboardManager({ navigateToDashboardBuilder, container
|
|
|
175
168
|
display: 'flex',
|
|
176
169
|
position: 'sticky',
|
|
177
170
|
backgroundColor: 'white',
|
|
178
|
-
zIndex:
|
|
171
|
+
zIndex: 3,
|
|
179
172
|
left: 0,
|
|
180
173
|
right: 0,
|
|
181
174
|
top: 0,
|
|
@@ -236,7 +229,7 @@ export default function DashboardManager({ navigateToDashboardBuilder, container
|
|
|
236
229
|
color: state.theme.secondaryTextColor,
|
|
237
230
|
fontFamily: state.theme.fontFamily,
|
|
238
231
|
userSelect: 'none',
|
|
239
|
-
}, children: "Environment" }), _jsx(EnvSelectPopover, { setEnvironment: (env) => dispatch({ type: 'SET_ENVIRONMENT', payload: env }), environment: state.environment, clients: state.clients, client: state.client, setClient: (client) => dispatch({ type: 'SET_CLIENT', payload: client }), theme: state.theme, showPromote: true, handlePromote: () => setIsPromoteDashModalOpen(true) })] })] }), !!state.dashboards.length && !state.databaseTypeMismatch.show && (_jsx(OrgSelect, { parentRef: parentRef, environment: state.environment, setEnvironment: (env) => dispatch({ type: 'SET_ENVIRONMENT', payload: env }), organizations: state.organizations, theme: state.theme, organizationId: state.organizationId, setOrganizationId: (id) => dispatch({ type: 'SET_ORGANIZATION_ID', payload: id }) }))] }) }), state.databaseTypeMismatch.show ? (_jsx(DatabaseMismatchCard, { environemntName: state.client.name, environemntDatabaseType: state.client.databaseType, backendDatabaseType: state.databaseTypeMismatch.backendDatabaseType })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: 'inline-block' }, children: [!state.dashboards.length && (_jsx("div", { style: {
|
|
232
|
+
}, children: "Environment" }), _jsx(EnvSelectPopover, { setEnvironment: (env) => dispatch({ type: 'SET_ENVIRONMENT', payload: env }), environment: state.environment, clients: state.clients, client: state.client, setClient: (client) => dispatch({ type: 'SET_CLIENT', payload: client }), theme: state.theme, showPromote: true, handlePromote: () => setIsPromoteDashModalOpen(true) })] })] }), !!state.dashboards.length && !state.databaseTypeMismatch.show && (_jsx(OrgSelect, { parentRef: parentRef, environment: state.environment, setEnvironment: (env) => dispatch({ type: 'SET_ENVIRONMENT', payload: env }), organizations: state.organizations, theme: state.theme, organizationId: state.organizationId, setOrganizationId: (id) => dispatch({ type: 'SET_ORGANIZATION_ID', payload: id }) }))] }) }), state.databaseTypeMismatch.show ? (_jsx(DatabaseMismatchCard, { environemntName: state.client.name, environemntDatabaseType: state.client.databaseType, backendDatabaseType: state.databaseTypeMismatch.backendDatabaseType })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: 'inline-block' }, children: [!state.dashboards.length && !initialLoad && (_jsx("div", { style: {
|
|
240
233
|
width: '100%',
|
|
241
234
|
display: 'flex',
|
|
242
235
|
flexDirection: 'column',
|