@malloy-publisher/sdk 0.3.0 → 0.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.
Files changed (244) hide show
  1. package/README.md +22 -9
  2. package/dist/DocumentStorageProvider-CyOJ0hqf.es.js +24443 -0
  3. package/dist/DocumentStorageProvider-DGPQEd_l.cjs.js +134 -0
  4. package/dist/RenderedResult-BnPzJ9Jf.es.js +549 -0
  5. package/dist/RenderedResult-Dp22kZsQ.cjs.js +115 -0
  6. package/dist/{ServerProvider-DSK9rfSY.es.js → ServerProvider-BWOEKg0O.es.js} +1256 -1318
  7. package/dist/ServerProvider-Cc489A3f.cjs.js +1 -0
  8. package/dist/builder/index.cjs.js +105 -0
  9. package/dist/builder/index.d.ts +2 -0
  10. package/dist/builder/index.es.js +9482 -0
  11. package/dist/builder-entry.d.ts +8 -0
  12. package/dist/client/api.d.ts +100 -42
  13. package/dist/client/index.cjs.js +1 -1
  14. package/dist/client/index.es.js +1 -1
  15. package/dist/components/AppDialog.d.ts +30 -0
  16. package/dist/components/BackLink.d.ts +32 -0
  17. package/dist/components/Dashboard/Dashboard.d.ts +19 -14
  18. package/dist/components/Dashboard/DashboardBar.d.ts +21 -0
  19. package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
  20. package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
  21. package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
  22. package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
  23. package/dist/components/Dashboard/TileCard.d.ts +44 -0
  24. package/dist/components/Dashboard/index.d.ts +2 -0
  25. package/dist/components/Dashboard/promoteMeasureRow.d.ts +7 -3
  26. package/dist/components/Dashboard/telemetry.d.ts +48 -0
  27. package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
  28. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +31 -0
  29. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +118 -0
  30. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +30 -0
  31. package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
  32. package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
  33. package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
  34. package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
  35. package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
  36. package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
  37. package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
  38. package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
  39. package/dist/components/DashboardBuilder/controls.d.ts +157 -0
  40. package/dist/components/DashboardBuilder/diff.d.ts +35 -0
  41. package/dist/components/DashboardBuilder/document.d.ts +218 -0
  42. package/dist/components/DashboardBuilder/layout.d.ts +71 -0
  43. package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
  44. package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
  45. package/dist/components/DashboardBuilder/preview.d.ts +60 -0
  46. package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
  47. package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
  48. package/dist/components/DashboardBuilder/spliceDocument.d.ts +53 -0
  49. package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
  50. package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
  51. package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
  52. package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
  53. package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
  54. package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
  55. package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
  56. package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +7 -0
  57. package/dist/components/DocumentStorage/index.d.ts +1 -1
  58. package/dist/components/FloatingIconButton.d.ts +16 -0
  59. package/dist/components/ItemRow.d.ts +38 -0
  60. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
  61. package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
  62. package/dist/components/Materializations/Materializations.d.ts +7 -3
  63. package/dist/components/Materializations/ScopeButton.d.ts +18 -0
  64. package/dist/components/Materializations/SectionLabel.d.ts +7 -4
  65. package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
  66. package/dist/components/Materializations/index.d.ts +0 -1
  67. package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
  68. package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
  69. package/dist/components/Package/index.d.ts +0 -1
  70. package/dist/components/PackageSection.d.ts +23 -0
  71. package/dist/components/Prose.d.ts +46 -0
  72. package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
  73. package/dist/components/RenderedResult/index.d.ts +1 -0
  74. package/dist/components/buttons.d.ts +53 -0
  75. package/dist/components/drill/index.d.ts +1 -1
  76. package/dist/components/drill/resolveDrill.d.ts +22 -0
  77. package/dist/components/drill/useDrill.d.ts +11 -2
  78. package/dist/components/index.d.ts +6 -0
  79. package/dist/components/styles.d.ts +49 -44
  80. package/dist/hooks/index.d.ts +2 -0
  81. package/dist/hooks/useCrudMutation.d.ts +42 -0
  82. package/dist/hooks/useDocumentControls.d.ts +70 -0
  83. package/dist/hooks/useQueryResult.d.ts +40 -0
  84. package/dist/index.cjs.js +22 -273
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.es.js +16888 -44451
  87. package/dist/telemetry/consoleEvents.d.ts +60 -0
  88. package/dist/utils/malloyLiteral.d.ts +11 -0
  89. package/dist/utils/sha256.d.ts +2 -0
  90. package/package.json +24 -9
  91. package/src/builder-entry.ts +55 -0
  92. package/src/components/AppDialog.tsx +115 -0
  93. package/src/components/BackLink.tsx +83 -0
  94. package/src/components/Connections/AddConnectionDialog.tsx +50 -70
  95. package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
  96. package/src/components/Connections/EditConnectionDialog.tsx +54 -73
  97. package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
  98. package/src/components/Dashboard/Dashboard.tsx +165 -175
  99. package/src/components/Dashboard/DashboardBar.tsx +88 -0
  100. package/src/components/Dashboard/DashboardGrid.tsx +124 -0
  101. package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
  102. package/src/components/Dashboard/DashboardTile.tsx +66 -123
  103. package/src/components/Dashboard/ExploreDialog.tsx +84 -0
  104. package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
  105. package/src/components/Dashboard/RowsDialog.tsx +234 -0
  106. package/src/components/Dashboard/TileCard.tsx +120 -0
  107. package/src/components/Dashboard/index.ts +2 -0
  108. package/src/components/Dashboard/promoteMeasureRow.spec.ts +70 -0
  109. package/src/components/Dashboard/promoteMeasureRow.ts +33 -2
  110. package/src/components/Dashboard/telemetry.ts +51 -0
  111. package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
  112. package/src/components/DashboardBuilder/AddTileDialog.tsx +247 -0
  113. package/src/components/DashboardBuilder/BuilderToolbar.tsx +162 -0
  114. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +852 -0
  115. package/src/components/DashboardBuilder/DashboardBuilder.tsx +666 -0
  116. package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
  117. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +188 -0
  118. package/src/components/DashboardBuilder/DashboardEditor.tsx +567 -0
  119. package/src/components/DashboardBuilder/DiffDialog.tsx +122 -0
  120. package/src/components/DashboardBuilder/DrillDialog.tsx +269 -0
  121. package/src/components/DashboardBuilder/FilterDialog.tsx +562 -0
  122. package/src/components/DashboardBuilder/FilterStrip.tsx +126 -0
  123. package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
  124. package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
  125. package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
  126. package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
  127. package/src/components/DashboardBuilder/catalog.ts +225 -0
  128. package/src/components/DashboardBuilder/controls.spec.ts +243 -0
  129. package/src/components/DashboardBuilder/controls.ts +398 -0
  130. package/src/components/DashboardBuilder/diff.spec.ts +44 -0
  131. package/src/components/DashboardBuilder/diff.ts +93 -0
  132. package/src/components/DashboardBuilder/document.ts +209 -0
  133. package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
  134. package/src/components/DashboardBuilder/layout.ts +143 -0
  135. package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
  136. package/src/components/DashboardBuilder/malloyText.ts +151 -0
  137. package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
  138. package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
  139. package/src/components/DashboardBuilder/newDashboard.ts +48 -0
  140. package/src/components/DashboardBuilder/preview.spec.ts +149 -0
  141. package/src/components/DashboardBuilder/preview.ts +172 -0
  142. package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
  143. package/src/components/DashboardBuilder/readDocument.ts +467 -0
  144. package/src/components/DashboardBuilder/sortable.tsx +151 -0
  145. package/src/components/DashboardBuilder/spliceDocument.spec.ts +1161 -0
  146. package/src/components/DashboardBuilder/spliceDocument.ts +1135 -0
  147. package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
  148. package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
  149. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +311 -0
  150. package/src/components/DashboardBuilder/useDashboardEditor.ts +201 -0
  151. package/src/components/DashboardBuilder/useDraft.ts +43 -0
  152. package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
  153. package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
  154. package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
  155. package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
  156. package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
  157. package/src/components/DashboardBuilder/useTileResize.ts +110 -0
  158. package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
  159. package/src/components/DocumentStorage/DocumentStorageProvider.tsx +12 -0
  160. package/src/components/DocumentStorage/index.ts +1 -0
  161. package/src/components/Environment/About.tsx +16 -62
  162. package/src/components/Environment/AddPackageDialog.tsx +85 -154
  163. package/src/components/Environment/Connections.tsx +125 -205
  164. package/src/components/Environment/DeletePackageDialog.tsx +32 -77
  165. package/src/components/Environment/EditPackageDialog.tsx +46 -58
  166. package/src/components/Environment/Environment.tsx +34 -36
  167. package/src/components/Environment/Packages.tsx +63 -128
  168. package/src/components/FloatingIconButton.tsx +41 -0
  169. package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
  170. package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
  171. package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
  172. package/src/components/Home/Home.tsx +101 -214
  173. package/src/components/ItemRow.tsx +165 -0
  174. package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
  175. package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
  176. package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
  177. package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
  178. package/src/components/Materializations/Materializations.tsx +137 -140
  179. package/src/components/Materializations/ScopeButton.tsx +85 -0
  180. package/src/components/Materializations/SectionLabel.tsx +7 -4
  181. package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
  182. package/src/components/Materializations/TriggerLabel.tsx +36 -0
  183. package/src/components/Materializations/cron.spec.ts +113 -0
  184. package/src/components/Materializations/index.ts +0 -1
  185. package/src/components/Materializations/utils.spec.ts +182 -0
  186. package/src/components/Model/Model.tsx +6 -23
  187. package/src/components/Model/ModelCell.tsx +33 -72
  188. package/src/components/Notebook/Notebook.tsx +25 -88
  189. package/src/components/Notebook/NotebookCell.tsx +35 -183
  190. package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
  191. package/src/components/Package/ContentTypeIcon.tsx +10 -12
  192. package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
  193. package/src/components/Package/NewDashboardDialog.tsx +265 -0
  194. package/src/components/Package/Package.tsx +179 -238
  195. package/src/components/Package/index.ts +0 -1
  196. package/src/components/PackageSection.tsx +85 -0
  197. package/src/components/Prose.spec.tsx +85 -0
  198. package/src/components/Prose.tsx +179 -0
  199. package/src/components/QueryResult/QueryResult.tsx +15 -43
  200. package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
  201. package/src/components/RenderedResult/RenderedResult.tsx +22 -8
  202. package/src/components/RenderedResult/ResultContainer.tsx +4 -12
  203. package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
  204. package/src/components/RenderedResult/ResultPanel.tsx +73 -0
  205. package/src/components/RenderedResult/index.ts +1 -0
  206. package/src/components/ResultsDialog.tsx +8 -32
  207. package/src/components/buttons.tsx +114 -0
  208. package/src/components/designSystem.spec.tsx +316 -0
  209. package/src/components/drill/index.ts +1 -0
  210. package/src/components/drill/resolveDrill.ts +22 -1
  211. package/src/components/drill/useDrill.spec.tsx +94 -0
  212. package/src/components/drill/useDrill.tsx +52 -12
  213. package/src/components/given/GivensPanel.tsx +1 -1
  214. package/src/components/given/paramCodec.spec.ts +1 -1
  215. package/src/components/index.ts +16 -0
  216. package/src/components/styles.ts +49 -122
  217. package/src/hooks/index.ts +13 -0
  218. package/src/hooks/useCrudMutation.spec.tsx +119 -0
  219. package/src/hooks/useCrudMutation.tsx +85 -0
  220. package/src/hooks/useDocumentControls.ts +170 -0
  221. package/src/hooks/useQueryResult.ts +82 -0
  222. package/src/index.ts +9 -0
  223. package/src/telemetry/consoleEvents.spec.ts +130 -0
  224. package/src/telemetry/consoleEvents.ts +124 -0
  225. package/src/theme/defaults.ts +34 -23
  226. package/src/theme/resolveTheme.spec.ts +9 -4
  227. package/src/theme/resolveTheme.ts +12 -8
  228. package/src/utils/malloyLiteral.spec.ts +43 -0
  229. package/src/utils/malloyLiteral.ts +76 -0
  230. package/src/utils/sha256.ts +13 -0
  231. package/test/README.md +1 -1
  232. package/test/serverProvider.tsx +5 -2
  233. package/vite.config.ts +5 -0
  234. package/dist/ServerProvider-CGnLjzag.cjs.js +0 -1
  235. package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
  236. package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
  237. package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
  238. package/dist/components/Materializations/TriggerChip.d.ts +0 -10
  239. package/dist/components/Package/Models.d.ts +0 -6
  240. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
  241. package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
  242. package/src/components/Materializations/ScheduleCard.tsx +0 -231
  243. package/src/components/Materializations/TriggerChip.tsx +0 -44
  244. package/src/components/Package/Models.tsx +0 -71
@@ -5,12 +5,8 @@ import AddIcon from "@mui/icons-material/Add";
5
5
  import DeleteIcon from "@mui/icons-material/Delete";
6
6
  import Box from "@mui/material/Box";
7
7
  import Button from "@mui/material/Button";
8
- import Dialog from "@mui/material/Dialog";
9
- import DialogActions from "@mui/material/DialogActions";
10
- import DialogContent from "@mui/material/DialogContent";
11
- import DialogContentText from "@mui/material/DialogContentText";
12
- import DialogTitle from "@mui/material/DialogTitle";
13
8
  import IconButton from "@mui/material/IconButton";
9
+ import Stack from "@mui/material/Stack";
14
10
  import TextField from "@mui/material/TextField";
15
11
  import Typography from "@mui/material/Typography";
16
12
  import React, { useState } from "react";
@@ -23,6 +19,8 @@ import {
23
19
  ConnectionTypeEnum,
24
20
  DucklakeConnection,
25
21
  } from "../../client/api";
22
+ import { AppDialog } from "../AppDialog";
23
+ import { AddButton, SecondaryButton } from "../buttons";
26
24
  import {
27
25
  attachedDatabaseConnectionFieldName,
28
26
  attributesFieldName,
@@ -401,43 +399,49 @@ export default function AddConnectionDialog({
401
399
 
402
400
  return (
403
401
  <React.Fragment>
404
- {/* Contained with a start icon, matching AddEnvironmentDialog and
405
- AddPackageDialog. This was the only add-trigger of the three still
406
- outlined and icon-less, which read as the secondary action on a
407
- screen where it is the primary one. */}
408
- <Button
409
- variant="contained"
410
- color="primary"
411
- startIcon={<AddIcon />}
412
- onClick={handleClickOpen}
402
+ <AddButton label="Connection" onClick={handleClickOpen} />
403
+ <AppDialog
404
+ open={open}
405
+ onClose={handleClose}
406
+ title="New connection"
407
+ description="Add a connection so packages in this environment can query your database with Malloy."
408
+ actions={
409
+ <>
410
+ <Button disabled={isSubmitting} onClick={handleClose}>
411
+ Cancel
412
+ </Button>
413
+ <Button
414
+ type="submit"
415
+ form="connection-form"
416
+ variant="contained"
417
+ loading={isSubmitting}
418
+ >
419
+ Create connection
420
+ </Button>
421
+ </>
422
+ }
413
423
  >
414
- Add Connection
415
- </Button>
416
- <Dialog open={open} onClose={handleClose}>
417
- <DialogTitle>Create New Connection</DialogTitle>
418
- <DialogContent>
419
- <DialogContentText>
420
- Add a new connection to query your data database using Malloy.
421
- </DialogContentText>
422
- <form onSubmit={handleSubmit} id="connection-form">
424
+ <form onSubmit={handleSubmit} id="connection-form">
425
+ {/* One column, one gap. The fields carry no margin of
426
+ their own, so without this they sit flush and their
427
+ borders overlap. */}
428
+ <Stack sx={{ gap: 2 }}>
423
429
  <TextField
424
430
  autoFocus
425
431
  required
426
- margin="dense"
427
432
  id="name"
428
433
  name="name"
429
- label="Connection Name"
434
+ label="Name"
430
435
  type="text"
431
436
  fullWidth
432
- variant="standard"
437
+ size="small"
433
438
  />
434
439
  <TextField
435
- margin="dense"
436
440
  id="type"
437
441
  name="type"
438
442
  label="Connection Type"
439
443
  fullWidth
440
- variant="standard"
444
+ size="small"
441
445
  value={type}
442
446
  select
443
447
  onChange={(event) =>
@@ -469,11 +473,10 @@ export default function AddConnectionDialog({
469
473
  Catalog
470
474
  </Typography>
471
475
  <TextField
472
- margin="dense"
473
476
  id="ducklake_catalogType"
474
477
  label="Catalog Type"
475
478
  fullWidth
476
- variant="standard"
479
+ size="small"
477
480
  value={ducklakeCatalogType}
478
481
  select
479
482
  onChange={(event) =>
@@ -488,13 +491,12 @@ export default function AddConnectionDialog({
488
491
  (field) => (
489
492
  <TextField
490
493
  key={`pg_${field.name}`}
491
- margin="dense"
492
494
  id={`ducklake_pg_${field.name}`}
493
495
  name={`ducklake_pg_${field.name}`}
494
496
  label={field.label}
495
497
  type={field.type}
496
498
  fullWidth
497
- variant="standard"
499
+ size="small"
498
500
  />
499
501
  ),
500
502
  )}
@@ -518,11 +520,10 @@ export default function AddConnectionDialog({
518
520
  Storage
519
521
  </Typography>
520
522
  <TextField
521
- margin="dense"
522
523
  id="ducklake_storageType"
523
524
  label="Storage Type"
524
525
  fullWidth
525
- variant="standard"
526
+ size="small"
526
527
  value={ducklakeStorageType}
527
528
  select
528
529
  onChange={(event) =>
@@ -533,7 +534,6 @@ export default function AddConnectionDialog({
533
534
  <MenuItem value="gcs">GCS</MenuItem>
534
535
  </TextField>
535
536
  <TextField
536
- margin="dense"
537
537
  required
538
538
  id="ducklake_bucketUrl"
539
539
  name="ducklake_bucketUrl"
@@ -544,7 +544,7 @@ export default function AddConnectionDialog({
544
544
  }
545
545
  type="text"
546
546
  fullWidth
547
- variant="standard"
547
+ size="small"
548
548
  />
549
549
  {ducklakeStorageType === "s3" && (
550
550
  <>
@@ -565,7 +565,6 @@ export default function AddConnectionDialog({
565
565
  .map((field) => (
566
566
  <TextField
567
567
  key={`s3_${field.name}`}
568
- margin="dense"
569
568
  id={`ducklake_s3_${field.name}`}
570
569
  name={`ducklake_s3_${field.name}`}
571
570
  label={field.label}
@@ -575,7 +574,7 @@ export default function AddConnectionDialog({
575
574
  : field.type
576
575
  }
577
576
  fullWidth
578
- variant="standard"
577
+ size="small"
579
578
  required={field.required}
580
579
  select={!!field.selectOptions}
581
580
  defaultValue={
@@ -623,13 +622,12 @@ export default function AddConnectionDialog({
623
622
  {gcsAttachedDatabaseFields.map((field) => (
624
623
  <TextField
625
624
  key={`gcs_${field.name}`}
626
- margin="dense"
627
625
  id={`ducklake_gcs_${field.name}`}
628
626
  name={`ducklake_gcs_${field.name}`}
629
627
  label={field.label}
630
628
  type={field.type}
631
629
  fullWidth
632
- variant="standard"
630
+ size="small"
633
631
  required={field.required}
634
632
  />
635
633
  ))}
@@ -650,14 +648,12 @@ export default function AddConnectionDialog({
650
648
  <Typography variant="subtitle1" fontWeight={500}>
651
649
  Attached Databases
652
650
  </Typography>
653
- <Button
654
- startIcon={<AddIcon />}
651
+ <SecondaryButton
652
+ label="Database"
653
+ icon={<AddIcon />}
655
654
  onClick={addAttachedDatabase}
656
- size="small"
657
- variant="outlined"
658
- >
659
- Add Database
660
- </Button>
655
+ ariaLabel="Add database"
656
+ />
661
657
  </Box>
662
658
  {attachedDatabases.length === 0 && (
663
659
  <Typography
@@ -707,23 +703,21 @@ export default function AddConnectionDialog({
707
703
  </IconButton>
708
704
  </Box>
709
705
  <TextField
710
- margin="dense"
711
706
  required
712
707
  id={`attachedDb_${index}_name`}
713
708
  name={`attachedDb_${index}_name`}
714
709
  label="Database Name"
715
710
  type="text"
716
711
  fullWidth
717
- variant="standard"
712
+ size="small"
718
713
  defaultValue={db.name}
719
714
  />
720
715
  <TextField
721
- margin="dense"
722
716
  id={`attachedDb_${index}_type`}
723
717
  name={`attachedDb_${index}_type`}
724
718
  label="Database Type"
725
719
  fullWidth
726
- variant="standard"
720
+ size="small"
727
721
  value={db.dbType}
728
722
  select
729
723
  onChange={(event) =>
@@ -760,7 +754,6 @@ export default function AddConnectionDialog({
760
754
  .map((field) => (
761
755
  <TextField
762
756
  key={field.name}
763
- margin="dense"
764
757
  id={`attachedDb_${index}_${field.name}`}
765
758
  name={`attachedDb_${index}_${field.name}`}
766
759
  label={field.label}
@@ -770,7 +763,7 @@ export default function AddConnectionDialog({
770
763
  : field.type
771
764
  }
772
765
  fullWidth
773
- variant="standard"
766
+ size="small"
774
767
  required={field.required}
775
768
  select={!!field.selectOptions}
776
769
  defaultValue={
@@ -814,32 +807,19 @@ export default function AddConnectionDialog({
814
807
  connectionFieldsByType[type].map((field) => (
815
808
  <TextField
816
809
  key={field.name}
817
- margin="dense"
818
810
  id={field.name}
819
811
  name={field.name}
820
812
  label={field.label}
821
813
  type={field.type}
822
814
  fullWidth
823
- variant="standard"
815
+ size="small"
824
816
  required={field.required}
825
817
  />
826
818
  ))
827
819
  )}
828
- </form>
829
- </DialogContent>
830
- <DialogActions>
831
- <Button disabled={isSubmitting} onClick={handleClose}>
832
- Cancel
833
- </Button>
834
- <Button
835
- type="submit"
836
- form="connection-form"
837
- loading={isSubmitting}
838
- >
839
- Create Connection
840
- </Button>
841
- </DialogActions>
842
- </Dialog>
820
+ </Stack>
821
+ </form>
822
+ </AppDialog>
843
823
  </React.Fragment>
844
824
  );
845
825
  }
@@ -2,20 +2,14 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import { Delete } from "@mui/icons-material";
5
- import CloseIcon from "@mui/icons-material/Close";
6
- import { Snackbar } from "@mui/material";
7
5
  import Button from "@mui/material/Button";
8
- import Dialog from "@mui/material/Dialog";
9
- import DialogActions from "@mui/material/DialogActions";
10
- import DialogContent from "@mui/material/DialogContent";
11
- import DialogTitle from "@mui/material/DialogTitle";
12
- import IconButton from "@mui/material/IconButton";
13
6
  import ListItemIcon from "@mui/material/ListItemIcon";
14
7
  import ListItemText from "@mui/material/ListItemText";
15
8
  import MenuItem from "@mui/material/MenuItem";
16
9
  import Typography from "@mui/material/Typography";
17
10
  import React, { useState } from "react";
18
11
  import { Connection } from "../../client";
12
+ import { AppDialog } from "../AppDialog";
19
13
 
20
14
  export default function DeleteConnectionDialog({
21
15
  connection,
@@ -29,7 +23,6 @@ export default function DeleteConnectionDialog({
29
23
  onDelete: () => void;
30
24
  }) {
31
25
  const [open, setOpen] = useState(false);
32
- const [notificationMessage, setNotificationMessage] = useState("");
33
26
  const handleClickOpen = () => {
34
27
  setOpen(true);
35
28
  };
@@ -54,50 +47,30 @@ export default function DeleteConnectionDialog({
54
47
  <ListItemText>Delete</ListItemText>
55
48
  </MenuItem>
56
49
 
57
- <Dialog
58
- onClose={handleClose}
59
- aria-labelledby="customized-dialog-title"
50
+ <AppDialog
60
51
  open={open}
52
+ onClose={handleClose}
53
+ title="Delete connection"
54
+ actions={
55
+ <>
56
+ <Button onClick={handleClose}>Cancel</Button>
57
+ <Button
58
+ variant="contained"
59
+ color="error"
60
+ autoFocus
61
+ onClick={() => onDelete()}
62
+ loading={isMutating}
63
+ >
64
+ Delete connection
65
+ </Button>
66
+ </>
67
+ }
61
68
  >
62
- <DialogTitle sx={{ m: 0, p: 2 }} id="customized-dialog-title">
63
- Delete Connection
64
- </DialogTitle>
65
- <IconButton
66
- aria-label="close"
67
- onClick={handleClose}
68
- sx={(theme) => ({
69
- position: "absolute",
70
- right: 8,
71
- top: 8,
72
- color: theme.palette.grey[500],
73
- })}
74
- >
75
- <CloseIcon />
76
- </IconButton>
77
- <DialogContent dividers>
78
- <Typography gutterBottom>
79
- Are you sure you want to delete &quot;{connection.name}&quot;?
80
- This action cannot be undone.
81
- </Typography>
82
- </DialogContent>
83
- <DialogActions>
84
- <Button
85
- loading={isMutating}
86
- variant="contained"
87
- autoFocus
88
- onClick={() => onDelete()}
89
- color="error"
90
- >
91
- Delete
92
- </Button>
93
- </DialogActions>
94
- <Snackbar
95
- open={notificationMessage !== ""}
96
- autoHideDuration={6000}
97
- onClose={() => setNotificationMessage("")}
98
- message={notificationMessage}
99
- />
100
- </Dialog>
69
+ <Typography variant="body2">
70
+ Delete <strong>{connection.name}</strong>? Packages that query
71
+ through it stop working, and this cannot be undone.
72
+ </Typography>
73
+ </AppDialog>
101
74
  </React.Fragment>
102
75
  );
103
76
  }