@ebubekirylmaz/link-test 1.2.44 → 1.2.46

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 (121) hide show
  1. package/package.json +13 -6
  2. package/src/Platform.jsx +14 -15
  3. package/src/assets/illustrations/avatar-shape.jsx +6 -7
  4. package/src/assets/illustrations/booking-illustration.jsx +4 -14
  5. package/src/assets/illustrations/check-in-illustration.jsx +4 -10
  6. package/src/assets/illustrations/check-out-illustration.jsx +4 -3
  7. package/src/assets/illustrations/coming-soon-illustration.jsx +4 -17
  8. package/src/assets/illustrations/forbidden-illustration.jsx +4 -12
  9. package/src/assets/illustrations/maintenance-illustration.jsx +4 -24
  10. package/src/assets/illustrations/motivation-illustration.jsx +4 -9
  11. package/src/assets/illustrations/order-complete-illustration.jsx +4 -12
  12. package/src/assets/illustrations/page-not-found-illustration.jsx +4 -9
  13. package/src/assets/illustrations/seo-illustration.jsx +4 -16
  14. package/src/assets/illustrations/sever-error-illustration.jsx +4 -21
  15. package/src/assets/illustrations/upgrade-storage-illustration.jsx +4 -20
  16. package/src/assets/illustrations/upload-illustration.jsx +4 -81
  17. package/src/components/NucleoidLoginForm/NucleoidLoginForm.jsx +1 -0
  18. package/src/components/TopNavBar/TopNavBar.jsx +6 -2
  19. package/src/components/file-thumbnail/file-thumbnail.jsx +5 -6
  20. package/src/components/nav-section/horizontal/nav-section-horizontal.jsx +5 -6
  21. package/src/components/settings/drawer/layout-options.jsx +5 -4
  22. package/src/components/settings/drawer/presets-options.jsx +6 -5
  23. package/src/components/settings/drawer/settings-drawer.jsx +7 -4
  24. package/src/components/settings/drawer/stretch-options.jsx +5 -5
  25. package/src/config/schemas.js +1 -0
  26. package/src/context/Context.js +98 -0
  27. package/src/context/reducer.js +590 -10
  28. package/src/hooks/index.js +2 -1
  29. package/src/hooks/use-beta.js +8 -0
  30. package/src/layouts/DashboardLayout/header.jsx +5 -4
  31. package/src/layouts/DashboardLayout/nav-mini.jsx +5 -7
  32. package/src/layouts/DashboardLayout/nav-vertical.jsx +11 -11
  33. package/src/layouts/FullScreenLayout/FullScreenLayout.jsx +5 -1
  34. package/src/layouts/FullScreenLayout/nav-vertical.jsx +11 -11
  35. package/src/layouts/MainLayout/footer.jsx +7 -7
  36. package/src/layouts/MainLayout/header.jsx +3 -2
  37. package/src/layouts/MainLayout/nav/desktop/nav-list.jsx +8 -8
  38. package/src/layouts/MainLayout/nav/mobile/index.jsx +7 -6
  39. package/src/layouts/auth/classic.jsx +6 -6
  40. package/src/layouts/auth/modern.jsx +7 -6
  41. package/src/layouts/common/ProjectBar/index.jsx +13 -11
  42. package/src/layouts/common/account-popover.jsx +1 -2
  43. package/src/layouts/common/header-sim.jsx +3 -2
  44. package/src/layouts/common/header-simple.jsx +6 -3
  45. package/src/layouts/common/notifications-popover/index.jsx +18 -13
  46. package/src/layouts/common/notifications-popover/notification-item.jsx +28 -16
  47. package/src/lib/APIDialogAction/APIDialogAction.jsx +109 -0
  48. package/src/lib/APIDialogAction/index.js +1 -0
  49. package/src/lib/APIDialogAction/styles.js +6 -0
  50. package/src/lib/APIParams/APIParams.jsx +57 -0
  51. package/src/lib/APIParams/index.js +1 -0
  52. package/src/lib/APIPath/APIPath.jsx +82 -0
  53. package/src/lib/APIPath/index.js +1 -0
  54. package/src/lib/APIPath/styles.js +19 -0
  55. package/src/lib/APITree/APITree.jsx +411 -0
  56. package/src/lib/APITree/Arrow.jsx +21 -0
  57. package/src/lib/APITree/DeleteMethodDialog.jsx +41 -0
  58. package/src/lib/APITree/index.js +1 -0
  59. package/src/lib/APITree/styles.js +19 -0
  60. package/src/lib/APITypes/APITypes.jsx +141 -0
  61. package/src/lib/APITypes/TypeEditor.jsx +46 -0
  62. package/src/lib/APITypes/TypeList.jsx +180 -0
  63. package/src/lib/APITypes/index.js +1 -0
  64. package/src/lib/AddItemWizard/AddItemWizard.jsx +21 -10
  65. package/src/lib/BlankTreeMessage/BlankTreeMessage.jsx +39 -0
  66. package/src/lib/BlankTreeMessage/index.js +1 -0
  67. package/src/lib/CustomBreadcrumbs/CustomBreadcrumbs.jsx +3 -2
  68. package/src/lib/DialogTootip/DialogTooltip.jsx +67 -0
  69. package/src/lib/DialogTootip/index.js +1 -0
  70. package/src/lib/DialogTootip/styles.js +9 -0
  71. package/src/lib/Flow/connectors/DynamicConnector.jsx +179 -107
  72. package/src/lib/Flow/core/Flow.jsx +2 -0
  73. package/src/lib/Flow/core/FlowNode.jsx +2 -0
  74. package/src/lib/Flow/core/FlowViewport.jsx +41 -9
  75. package/src/lib/Flow/hooks/useNodeStyle.js +14 -0
  76. package/src/lib/Flow/layouts/CardLayout.jsx +4 -3
  77. package/src/lib/Flow/nodes/DefaultCard.jsx +6 -8
  78. package/src/lib/Flow/nodes/FlowNodeView.jsx +105 -21
  79. package/src/lib/Flow/styles.js +4 -0
  80. package/src/lib/IconSelector/IconSelector.jsx +5 -1
  81. package/src/lib/ItemSummary/ItemSummary.jsx +11 -6
  82. package/src/lib/ItemSummary/ItemsSummary.jsx +38 -26
  83. package/src/lib/NewApiBody/NewAPIBody.jsx +97 -0
  84. package/src/lib/NewApiBody/ParamView.jsx +38 -0
  85. package/src/lib/NucDialog/NucDialog.jsx +108 -0
  86. package/src/lib/NucDialog/index.js +1 -0
  87. package/src/lib/ParamTable/ParamTable.jsx +133 -0
  88. package/src/lib/ParamTable/TypeMenu.jsx +102 -0
  89. package/src/lib/ParamTable/defaults.js +47 -0
  90. package/src/lib/ParamTable/index.js +1 -0
  91. package/src/lib/ParamTable/styles.js +12 -0
  92. package/src/lib/ResourceMenu/AlertMassage.jsx +28 -0
  93. package/src/lib/ResourceMenu/DeleteResourceDialog.jsx +60 -0
  94. package/src/lib/ResourceMenu/ResourceMenu.jsx +158 -0
  95. package/src/lib/ResourceMenu/index.js +1 -0
  96. package/src/lib/ResourceMenu/styles.js +5 -0
  97. package/src/lib/Schema/Schema.jsx +204 -0
  98. package/src/lib/Schema/index.js +1 -0
  99. package/src/lib/SchemaEditor/SchemaEditor.jsx +258 -0
  100. package/src/lib/SchemaEditor/SchemaEditor.test.js +193 -0
  101. package/src/lib/SchemaEditor/SchemaPropertyEditor.jsx +135 -0
  102. package/src/lib/SchemaEditor/SchemaUtils.js +152 -0
  103. package/src/lib/SchemaEditor/index.js +1 -0
  104. package/src/lib/SparkleInput/SparkleInput.jsx +31 -28
  105. package/src/lib/TableSelectedAction/TableSelectedAction.jsx +7 -8
  106. package/src/lib/ToggleableMenu/ToggleableMenu.jsx +35 -0
  107. package/src/lib/ToggleableMenu/index.js +1 -0
  108. package/src/lib/index.js +14 -0
  109. package/src/pages/Callback.jsx +6 -8
  110. package/src/pages/ConfigError.jsx +3 -1
  111. package/src/pages/LoginPage.jsx +3 -12
  112. package/src/stories/APITree.stories.jsx +429 -0
  113. package/src/stories/FlowChart.stories.jsx +1 -1
  114. package/src/templates/ActionTemplate.js +24 -0
  115. package/src/theme/overrides/default-props.jsx +17 -11
  116. package/src/widgets/Login/CognitoLogin.jsx +165 -173
  117. package/src/widgets/Login/DemoLogin.jsx +43 -38
  118. package/src/widgets/Login/amplifyAuth.js +6 -6
  119. package/src/widgets/Login/amplifyConfig.js +3 -0
  120. package/src/widgets/LoginForm/LoginForm.jsx +8 -3
  121. package/src/widgets/SettingsDialog.jsx +206 -16
@@ -0,0 +1,57 @@
1
+ import AddIcon from "@mui/icons-material/Add";
2
+ import ParamTable from "../ParamTable";
3
+
4
+ import { Box, Fab } from "@mui/material";
5
+ import { useEffect, useState } from "react";
6
+
7
+ const APIParams = ({ types, paramsRef, addParams }) => {
8
+ const [params, setParams] = useState(paramsRef.current);
9
+
10
+ useEffect(() => {
11
+ setParams(paramsRef.current);
12
+ }, [paramsRef]);
13
+
14
+ useEffect(() => {
15
+ paramsRef.current = params;
16
+ }, [params, paramsRef]);
17
+
18
+ const handleAddParams = () => {
19
+ const id = Date.now().toString();
20
+ const newParam = {
21
+ id,
22
+ in: "query",
23
+ type: "string",
24
+ required: true,
25
+ };
26
+ setParams((prevParams) => [...prevParams, newParam]);
27
+ };
28
+
29
+ if (addParams) {
30
+ addParams.current = handleAddParams;
31
+ }
32
+
33
+ return (
34
+ <Box
35
+ sx={{
36
+ display: "flex",
37
+ flexDirection: "column",
38
+ height: "85%",
39
+ p: 2,
40
+ }}
41
+ data-cy="api-params"
42
+ >
43
+ <ParamTable types={types} params={params} setParams={setParams} />
44
+ <Box sx={{ display: "flex", justifyContent: "flex-end" }}>
45
+ <Fab
46
+ size={"small"}
47
+ onClick={handleAddParams}
48
+ data-cy="add-param-button"
49
+ >
50
+ <AddIcon />
51
+ </Fab>
52
+ </Box>
53
+ </Box>
54
+ );
55
+ };
56
+
57
+ export default APIParams;
@@ -0,0 +1 @@
1
+ export { default } from "./APIParams";
@@ -0,0 +1,82 @@
1
+ import LanguageIcon from "@mui/icons-material/Language";
2
+ import styles from "./styles";
3
+
4
+ import {
5
+ Box,
6
+ Button,
7
+ Grid,
8
+ MenuItem,
9
+ Select,
10
+ TextField,
11
+ Typography,
12
+ } from "@mui/material";
13
+ import React, { useEffect, useState } from "react";
14
+
15
+ const APIPath = ({
16
+ method,
17
+ path,
18
+ methodRef,
19
+ pathRef,
20
+ onTypesButtonClick,
21
+ allowedMethods,
22
+ isMethodDisabled,
23
+ isPathDisabled,
24
+ validatePath,
25
+ }) => {
26
+ const [selectedMethod, setSelectedMethod] = useState(
27
+ allowedMethods.includes(method) ? method : allowedMethods[0] || ""
28
+ );
29
+ const [selectedPath, setSelectedPath] = useState("");
30
+
31
+ useEffect(() => {
32
+ methodRef.current = selectedMethod;
33
+ pathRef.current = path + (path !== "/" ? "/" : "") + selectedPath;
34
+ validatePath(selectedPath);
35
+ }, [selectedMethod, selectedPath, methodRef, pathRef, path, validatePath]);
36
+
37
+ return (
38
+ <Grid container sx={styles.root} data-cy="api-path">
39
+ <Grid sx={styles.firstElement} />
40
+ <Grid>
41
+ <Grid container sx={styles.content}>
42
+ {isMethodDisabled ? (
43
+ <Typography data-cy="method-text">{method}</Typography>
44
+ ) : (
45
+ <Select
46
+ value={selectedMethod}
47
+ onChange={(e) => setSelectedMethod(e.target.value)}
48
+ data-cy="method-select"
49
+ >
50
+ {allowedMethods.map((method) => (
51
+ <MenuItem
52
+ key={method}
53
+ value={method}
54
+ data-cy={`method-menuitem-${method}`}
55
+ >
56
+ {method}
57
+ </MenuItem>
58
+ ))}
59
+ </Select>
60
+ )}
61
+ <Box component="span" sx={styles.text}></Box>
62
+ <Typography data-cy="path-text">
63
+ {path} {path !== "/" ? "/" : ""}
64
+ </Typography>
65
+ {!isPathDisabled && (
66
+ <TextField
67
+ value={selectedPath}
68
+ onChange={(e) => setSelectedPath(e.target.value)}
69
+ data-cy="path-input"
70
+ />
71
+ )}
72
+ </Grid>
73
+ </Grid>
74
+ <Button onClick={onTypesButtonClick} data-cy="types-button">
75
+ <LanguageIcon sx={styles.icon} />
76
+ Types
77
+ </Button>
78
+ </Grid>
79
+ );
80
+ };
81
+
82
+ export default APIPath;
@@ -0,0 +1 @@
1
+ export { default } from "./APIPath";
@@ -0,0 +1,19 @@
1
+ const styles = {
2
+ root: {
3
+ justifyContent: "space-between",
4
+ },
5
+ firstElement: { width: 50 },
6
+ content: {
7
+ justifyContent: "center",
8
+ alignItems: "center",
9
+ },
10
+ text: {
11
+ fontSize: 16,
12
+ ml: 2,
13
+ mr: 1,
14
+ },
15
+ textField: { width: 75 },
16
+ icon: { fill: "#5d5d5d", mr: 1 },
17
+ };
18
+
19
+ export default styles;
@@ -0,0 +1,411 @@
1
+ import AddIcon from "@mui/icons-material/Add";
2
+ import ArrowIcon from "./Arrow";
3
+ import BlankTreeMessage from "../BlankTreeMessage/BlankTreeMessage";
4
+ import DeleteIcon from "@mui/icons-material/Delete";
5
+ import DeleteMethodDialog from "./DeleteMethodDialog";
6
+ import EditIcon from "@mui/icons-material/Edit";
7
+ import Error from "@mui/icons-material/Error";
8
+ import Fade from "@mui/material/Fade";
9
+ import ResourceMenu from "../ResourceMenu";
10
+ import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView";
11
+ import { TreeItem } from "@mui/x-tree-view/TreeItem";
12
+ import styles from "./styles";
13
+ import { publish, useEvent } from "@nucleoidai/react-event";
14
+ import { useTheme } from "@mui/material/styles";
15
+
16
+ import {
17
+ Box,
18
+ Card,
19
+ CardActions,
20
+ Fab,
21
+ Grid,
22
+ Menu,
23
+ MenuItem,
24
+ Tooltip,
25
+ Typography,
26
+ } from "@mui/material";
27
+ import React, { useEffect, useRef, useState } from "react";
28
+
29
+ function APITree() {
30
+ const map = useRef({});
31
+ const [selected, setSelected] = React.useState(null);
32
+ const [contextMenu, setContextMenu] = React.useState(null);
33
+ const [rightClickMethod, setRightClickMethod] = React.useState();
34
+ const [methodDisabled, setMethodDisabled] = useState();
35
+ const [open, setOpen] = useState(false);
36
+ const [resourceMenu, setResourceMenu] = React.useState(false);
37
+ const [anchor, setAnchor] = React.useState();
38
+ const [expanded, setExpanded] = useState([]);
39
+ const [errors] = useEvent("DIAGNOSTICS_COMPLETED", []);
40
+ const theme = useTheme();
41
+
42
+ const [selectedAPI] = useEvent("SELECTED_API_CHANGED", {
43
+ path: "/",
44
+ method: "GET",
45
+ });
46
+
47
+ const [api] = useEvent("API_DATA_CHANGED", []);
48
+ const apiExists = api.length > 0;
49
+
50
+ const expandList = React.useMemo(() => [], []);
51
+
52
+ const handleToggle = (event, ids) => {
53
+ setExpanded(ids);
54
+ };
55
+
56
+ const handleExpandClick = () => {
57
+ setExpanded([...expandList]);
58
+ };
59
+
60
+ const select = (id, callDispatch = true) => {
61
+ if (map.current[id]) {
62
+ setSelected(id);
63
+ if (callDispatch) {
64
+ publish("SELECTED_API_CHANGED", map.current[id]);
65
+ }
66
+ }
67
+ };
68
+
69
+ useEffect(() => {
70
+ const selectedId = Object.keys(map.current).find(
71
+ (key) =>
72
+ map.current[key].path === selectedAPI.path &&
73
+ map.current[key].method === selectedAPI.method
74
+ );
75
+ if (selectedId) {
76
+ select(selectedId, false);
77
+ }
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps
79
+ }, [selectedAPI]);
80
+
81
+ const handleContextMenu = (event, hash) => {
82
+ event.preventDefault();
83
+
84
+ if (hash) select(hash);
85
+
86
+ setRightClickMethod(hash);
87
+
88
+ setContextMenu(
89
+ !contextMenu
90
+ ? {
91
+ mouseX: event.clientX,
92
+ mouseY: event.clientY,
93
+ }
94
+ : null
95
+ );
96
+ };
97
+
98
+ const handleResourceMenu = (event) => {
99
+ event.preventDefault();
100
+
101
+ setResourceMenu(true);
102
+ setAnchor(event);
103
+ };
104
+
105
+ const handleCloseResourceMenu = () => {
106
+ setResourceMenu(false);
107
+ };
108
+
109
+ const handleClose = () => {
110
+ setRightClickMethod(null);
111
+ setContextMenu(null);
112
+ };
113
+
114
+ const editMethod = () => {
115
+ publish("API_DIALOG_OPEN", { type: "method", action: "edit" });
116
+ handleClose();
117
+ };
118
+
119
+ const deleteMethod = () => {
120
+ publish("API_METHOD_DELETE", {});
121
+ setOpen(false);
122
+ };
123
+
124
+ const handleDeleteMethod = () => {
125
+ setOpen(true);
126
+ handleClose();
127
+ };
128
+
129
+ const checkMethodDeletable = () => {
130
+ const countMethodsForPath = (path) => {
131
+ return api.filter((endpoint) => endpoint.path === path).length;
132
+ };
133
+ if (selectedAPI) {
134
+ const apiSelectedPath = selectedAPI.path;
135
+
136
+ return countMethodsForPath(apiSelectedPath) <= 1;
137
+ }
138
+ return false;
139
+ };
140
+
141
+ useEffect(() => {
142
+ if (!selected) {
143
+ select(Object.keys(map.current)[0]);
144
+ }
145
+ setMethodDisabled(checkMethodDeletable());
146
+ handleExpandClick();
147
+
148
+ // eslint-disable-next-line react-hooks/exhaustive-deps
149
+ }, [selected, api, selectedAPI]);
150
+
151
+ return (
152
+ <Card sx={{ height: "100%" }}>
153
+ {apiExists ? (
154
+ <>
155
+ <Grid sx={styles.apiTreeGrid}>
156
+ {open && (
157
+ <DeleteMethodDialog
158
+ setOpen={setOpen}
159
+ deleteMethod={deleteMethod}
160
+ />
161
+ )}
162
+ <SimpleTreeView
163
+ slots={{
164
+ collapseIcon: () => <ArrowIcon down />,
165
+ expandIcon: () => <ArrowIcon right />,
166
+ }}
167
+ expandedItems={expanded}
168
+ onExpandedItemsChange={(event, itemIds) => setExpanded(itemIds)}
169
+ selectedItems={selected}
170
+ onSelectedItemsChange={(event, itemId) => select(itemId)}
171
+ sx={{
172
+ marginTop: "10px",
173
+ }}
174
+ >
175
+ {compile(
176
+ api,
177
+ handleContextMenu,
178
+ expandList,
179
+ rightClickMethod,
180
+ errors,
181
+ theme,
182
+ select,
183
+ handleResourceMenu,
184
+ map.current
185
+ )}
186
+ </SimpleTreeView>
187
+
188
+ <Menu
189
+ open={contextMenu !== null}
190
+ onClose={handleClose}
191
+ anchorReference="anchorPosition"
192
+ anchorPosition={
193
+ contextMenu !== null
194
+ ? { top: contextMenu.mouseY, left: contextMenu.mouseX }
195
+ : undefined
196
+ }
197
+ slots={{
198
+ transition: Fade
199
+ }}
200
+ >
201
+ <MenuItem
202
+ onClick={() => {
203
+ editMethod();
204
+ }}
205
+ data-cy="edit-method-menu-item"
206
+ >
207
+ <EditIcon />
208
+ <Typography sx={styles.menuItemText}>Edit</Typography>
209
+ </MenuItem>
210
+ <MenuItem
211
+ onClick={handleDeleteMethod}
212
+ disabled={methodDisabled}
213
+ data-cy="delete-method-button"
214
+ >
215
+ <DeleteIcon />
216
+ <Typography sx={styles.menuItemText}>Delete</Typography>
217
+ </MenuItem>
218
+ </Menu>
219
+ <ResourceMenu
220
+ anchor={anchor}
221
+ openMenu={resourceMenu}
222
+ handleClose={handleCloseResourceMenu}
223
+ />
224
+ </Grid>
225
+
226
+ <CardActions>
227
+ <Fab
228
+ variant="button"
229
+ size={"small"}
230
+ onClick={handleResourceMenu}
231
+ data-cy="resource-menu"
232
+ >
233
+ <AddIcon />
234
+ </Fab>
235
+ </CardActions>
236
+ </>
237
+ ) : (
238
+ <BlankTreeMessage item={"API"} />
239
+ )}
240
+ </Card>
241
+ );
242
+ }
243
+
244
+ export const compile = (
245
+ apiData,
246
+ handleContextMenu,
247
+ expandList,
248
+ rightClickMethod,
249
+ errors,
250
+ theme,
251
+ select,
252
+ handleResourceMenu,
253
+ map
254
+ ) => {
255
+ if (apiData.length !== 0) {
256
+ const groupedByPath = apiData.reduce((acc, endpoint) => {
257
+ const parts = endpoint.path.split("/");
258
+ let currentLevel = acc;
259
+
260
+ if (endpoint.path === "/") {
261
+ if (!currentLevel["/"]) {
262
+ currentLevel["/"] = {
263
+ methods: [],
264
+ children: {},
265
+ };
266
+ }
267
+ currentLevel["/"].methods.push(endpoint);
268
+ } else {
269
+ currentLevel = currentLevel["/"].children;
270
+
271
+ parts.forEach((part, idx, arr) => {
272
+ if (idx !== 0) {
273
+ const currentPart = "/" + part;
274
+
275
+ if (!currentLevel[currentPart]) {
276
+ currentLevel[currentPart] = {
277
+ methods: [],
278
+ children: {},
279
+ };
280
+ }
281
+
282
+ if (idx === arr.length - 1) {
283
+ currentLevel[currentPart].methods.push(endpoint);
284
+ } else {
285
+ currentLevel = currentLevel[currentPart].children;
286
+ }
287
+ }
288
+ });
289
+ }
290
+
291
+ return acc;
292
+ }, {});
293
+
294
+ const renderTree = (data) => {
295
+ // eslint-disable-next-line
296
+ let resourceHash;
297
+ // eslint-disable-next-line
298
+
299
+ return Object.keys(data).map((path) => {
300
+ const { methods, children } = data[path];
301
+
302
+ const methodItems = methods.map((method) => {
303
+ const payload = { path: method.path, method: method.method };
304
+ const hash = (resourceHash = window.btoa(JSON.stringify(payload)));
305
+ map[hash] = payload;
306
+
307
+ const error = errors.find((item) => {
308
+ const [errPath, errMethod] = item.file.fileName.split(".", 2);
309
+ if (errPath === method.path && errMethod === method.method) {
310
+ return item;
311
+ } else {
312
+ return null;
313
+ }
314
+ });
315
+
316
+ return (
317
+ <TreeItem
318
+ key={hash}
319
+ itemId={hash}
320
+ onContextMenu={(event) => handleContextMenu(event, hash)}
321
+ sx={{
322
+ bgcolor:
323
+ hash === rightClickMethod &&
324
+ (theme.palette.custom?.apiTreeRightClick ||
325
+ theme.palette.action.selected),
326
+ }}
327
+ label={
328
+ <Box
329
+ sx={{
330
+ display: "flex",
331
+ flexDirection: "row",
332
+ alignItems: "center",
333
+ justifyContent: "space-between",
334
+ }}
335
+ data-cy={`method-${method.path}${method.method}`}
336
+ >
337
+ <Box sx={theme.custom?.apiTreeItem}>
338
+ <span
339
+ style={{
340
+ display: "flex",
341
+ flexDirection: "row",
342
+ alignItems: "center",
343
+ justifyContent: "center",
344
+ }}
345
+ >
346
+ {method.method.toUpperCase()}
347
+ </span>
348
+ </Box>
349
+ {error && (
350
+ <Tooltip title={error.messageText} placement={"right"}>
351
+ <Error sx={{ color: "#8f8f91" }} />
352
+ </Tooltip>
353
+ )}
354
+ </Box>
355
+ }
356
+ />
357
+ );
358
+ });
359
+
360
+ const childItems = children ? renderTree(children) : [];
361
+ expandList.push(path);
362
+
363
+ const handleResourceClick = (event) => {
364
+ event.stopPropagation();
365
+
366
+ if (methods.length > 0) {
367
+ const firstMethod = methods[0];
368
+ const payload = {
369
+ path: firstMethod.path,
370
+ method: firstMethod.method,
371
+ };
372
+ const hash = window.btoa(JSON.stringify(payload));
373
+ select(hash);
374
+ }
375
+ };
376
+
377
+ const handleResourceContextMenu = (event) => {
378
+ event.preventDefault();
379
+ handleResourceClick(event);
380
+ handleResourceMenu(event);
381
+ };
382
+
383
+ return (
384
+ <TreeItem
385
+ key={path}
386
+ itemId={path}
387
+ label={
388
+ <div
389
+ className="path"
390
+ onClick={(e) => e.stopPropagation()}
391
+ onContextMenu={handleResourceContextMenu}
392
+ style={{ cursor: "default" }}
393
+ data-cy={`path-${path}`}
394
+ >
395
+ {path}
396
+ </div>
397
+ }
398
+ >
399
+ {[...methodItems, ...childItems]}
400
+ </TreeItem>
401
+ );
402
+ });
403
+ };
404
+
405
+ return renderTree(groupedByPath);
406
+ } else {
407
+ return null;
408
+ }
409
+ };
410
+
411
+ export default APITree;
@@ -0,0 +1,21 @@
1
+ import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
2
+ import KeyboardArrowLeftIcon from "@mui/icons-material/KeyboardArrowLeft";
3
+ import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight";
4
+ import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
5
+ import React from "react";
6
+
7
+ // fill: "#212121", old fill color
8
+
9
+ function Arrow({ up, down, right, left }) {
10
+ return up ? (
11
+ <KeyboardArrowUpIcon />
12
+ ) : down ? (
13
+ <KeyboardArrowDownIcon />
14
+ ) : right ? (
15
+ <KeyboardArrowRightIcon />
16
+ ) : left ? (
17
+ <KeyboardArrowLeftIcon />
18
+ ) : null;
19
+ }
20
+
21
+ export default Arrow;
@@ -0,0 +1,41 @@
1
+ import Button from "@mui/material/Button";
2
+ import Dialog from "@mui/material/Dialog";
3
+ import DialogActions from "@mui/material/DialogActions";
4
+ import DialogContent from "@mui/material/DialogContent";
5
+ import DialogContentText from "@mui/material/DialogContentText";
6
+ import DialogTitle from "@mui/material/DialogTitle";
7
+
8
+ const DeleteMethodDialog = ({ setOpen, deleteMethod }) => {
9
+ const handleClose = () => {
10
+ setOpen(false);
11
+ };
12
+
13
+ return (
14
+ <Dialog
15
+ open={true}
16
+ onClose={handleClose}
17
+ aria-labelledby="responsive-dialog-title"
18
+ >
19
+ <DialogTitle id="responsive-dialog-title">{"Delete method"}</DialogTitle>
20
+ <DialogContent>
21
+ <DialogContentText>
22
+ The selected method will be deleted.
23
+ </DialogContentText>
24
+ </DialogContent>
25
+ <DialogActions>
26
+ <Button autoFocus onClick={handleClose}>
27
+ Cancel
28
+ </Button>
29
+ <Button
30
+ onClick={deleteMethod}
31
+ autoFocus
32
+ data-cy="delete-method-confirm-button"
33
+ >
34
+ Delete
35
+ </Button>
36
+ </DialogActions>
37
+ </Dialog>
38
+ );
39
+ };
40
+
41
+ export default DeleteMethodDialog;
@@ -0,0 +1 @@
1
+ export { default, compile } from "./APITree";
@@ -0,0 +1,19 @@
1
+ const styles = {
2
+ apiTree: { height: "100%" },
3
+ apiTreeGrid: { maxHeight: "85vh", overflow: "auto" },
4
+ apiTreeItem: {
5
+ fontSize: 12,
6
+ color: "#666",
7
+ fontWeight: "bold",
8
+ backgroundColor: "#fdfdfd",
9
+ border: `1px solid #c3c5c8`,
10
+ width: 44,
11
+ borderRadius: 8,
12
+ mt: 1 / 4,
13
+ mb: 1 / 4,
14
+ boxShadow: "1px 1px #b8b8b8",
15
+ },
16
+ menuItemText: { pl: 3 / 2 },
17
+ };
18
+
19
+ export default styles;