@canmingir/link 1.2.22 → 1.2.24
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/package.json +3 -1
- package/src/Platform.jsx +10 -14
- package/src/config/schemas.js +1 -0
- package/src/context/Context.js +98 -0
- package/src/context/reducer.js +590 -10
- package/src/layouts/auth/modern.jsx +2 -0
- package/src/layouts/common/account-popover.jsx +3 -7
- package/src/lib/APIDialogAction/APIDialogAction.jsx +109 -0
- package/src/lib/APIDialogAction/index.js +1 -0
- package/src/lib/APIDialogAction/styles.js +6 -0
- package/src/lib/APIParams/APIParams.jsx +57 -0
- package/src/lib/APIParams/index.js +1 -0
- package/src/lib/APIPath/APIPath.jsx +82 -0
- package/src/lib/APIPath/index.js +1 -0
- package/src/lib/APIPath/styles.js +19 -0
- package/src/lib/APITree/APITree.jsx +409 -0
- package/src/lib/APITree/Arrow.jsx +21 -0
- package/src/lib/APITree/DeleteMethodDialog.jsx +41 -0
- package/src/lib/APITree/index.js +1 -0
- package/src/lib/APITree/styles.js +19 -0
- package/src/lib/APITypes/APITypes.jsx +141 -0
- package/src/lib/APITypes/TypeEditor.jsx +46 -0
- package/src/lib/APITypes/TypeList.jsx +180 -0
- package/src/lib/APITypes/index.js +1 -0
- package/src/lib/BlankTreeMessage/BlankTreeMessage.jsx +39 -0
- package/src/lib/BlankTreeMessage/index.js +1 -0
- package/src/lib/DialogTootip/DialogTooltip.jsx +67 -0
- package/src/lib/DialogTootip/index.js +1 -0
- package/src/lib/DialogTootip/styles.js +9 -0
- package/src/lib/NewApiBody/NewAPIBody.jsx +97 -0
- package/src/lib/NewApiBody/ParamView.jsx +38 -0
- package/src/lib/NucDialog/NucDialog.jsx +108 -0
- package/src/lib/NucDialog/index.js +1 -0
- package/src/lib/ParamTable/ParamTable.jsx +133 -0
- package/src/lib/ParamTable/TypeMenu.jsx +102 -0
- package/src/lib/ParamTable/defaults.js +47 -0
- package/src/lib/ParamTable/index.js +1 -0
- package/src/lib/ParamTable/styles.js +12 -0
- package/src/lib/ResourceMenu/AlertMassage.jsx +28 -0
- package/src/lib/ResourceMenu/DeleteResourceDialog.jsx +60 -0
- package/src/lib/ResourceMenu/ResourceMenu.jsx +156 -0
- package/src/lib/ResourceMenu/index.js +1 -0
- package/src/lib/ResourceMenu/styles.js +5 -0
- package/src/lib/Schema/Schema.jsx +204 -0
- package/src/lib/Schema/index.js +1 -0
- package/src/lib/SchemaEditor/SchemaEditor.jsx +258 -0
- package/src/lib/SchemaEditor/SchemaEditor.test.js +193 -0
- package/src/lib/SchemaEditor/SchemaPropertyEditor.jsx +135 -0
- package/src/lib/SchemaEditor/SchemaUtils.js +152 -0
- package/src/lib/SchemaEditor/index.js +1 -0
- package/src/lib/ToggleableMenu/ToggleableMenu.jsx +35 -0
- package/src/lib/ToggleableMenu/index.js +1 -0
- package/src/lib/index.js +14 -0
- package/src/pages/Callback.jsx +6 -8
- package/src/stories/APITree.stories.jsx +429 -0
- package/src/stories/FlowChart.stories.jsx +1 -1
- package/src/templates/ActionTemplate.js +24 -0
- package/src/widgets/Login/CognitoLogin.jsx +4 -2
- package/src/widgets/Login/DemoLogin.jsx +8 -6
- package/src/widgets/SettingsDialog.jsx +38 -16
|
@@ -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;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import Schema from "../Schema/Schema";
|
|
2
|
+
import SchemaEditor from "../SchemaEditor";
|
|
3
|
+
import TypeList from "./TypeList";
|
|
4
|
+
import { publish } from "@nucleoidai/react-event";
|
|
5
|
+
|
|
6
|
+
import { Box, Divider, Paper } from "@mui/material";
|
|
7
|
+
import React, { useState } from "react";
|
|
8
|
+
|
|
9
|
+
const APITypes = ({ tstypes, nuctypes, typesRef }) => {
|
|
10
|
+
const combinedData = [
|
|
11
|
+
...tstypes.map((item) => ({ ...item, isTypeScript: true })),
|
|
12
|
+
...nuctypes.map((item) => ({ ...item, isTypeScript: false })),
|
|
13
|
+
];
|
|
14
|
+
const [selectedType, setSelectedType] = useState(
|
|
15
|
+
combinedData.length > 0 ? combinedData[0].name : null
|
|
16
|
+
);
|
|
17
|
+
const preloaded = {};
|
|
18
|
+
combinedData.forEach((item) => {
|
|
19
|
+
preloaded[item.name] = true;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const isTypeScriptType = (typeName) => {
|
|
23
|
+
return tstypes.some((type) => type.name === typeName);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleAddType = (typeName) => {
|
|
27
|
+
publish("API_TYPE_ADD", { typeName });
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const handleDeleteType = (typeName) => {
|
|
31
|
+
publish("API_TYPE_DELETE", { typeName });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleUpdateType = (oldTypeName, newTypeName) => {
|
|
35
|
+
publish("API_TYPE_RENAME", { oldTypeName, newTypeName });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const renderRightPanel = () => {
|
|
39
|
+
if (!selectedType) return null;
|
|
40
|
+
|
|
41
|
+
const useSchemaEditor = !isTypeScriptType(selectedType);
|
|
42
|
+
const initialData = findSchemaByName(selectedType);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Box sx={{ width: "100%", height: "100%" }} data-cy="type-schema-editor">
|
|
46
|
+
{useSchemaEditor ? (
|
|
47
|
+
<SchemaEditor
|
|
48
|
+
key={selectedType}
|
|
49
|
+
ref={typesRef}
|
|
50
|
+
initialData={initialData}
|
|
51
|
+
/>
|
|
52
|
+
) : (
|
|
53
|
+
<Schema initialData={initialData} />
|
|
54
|
+
)}
|
|
55
|
+
</Box>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleTypeSelect = (name) => {
|
|
60
|
+
setSelectedType(name);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Box
|
|
65
|
+
sx={{
|
|
66
|
+
display: "flex",
|
|
67
|
+
flexDirection: "row",
|
|
68
|
+
height: "85%",
|
|
69
|
+
p: 2,
|
|
70
|
+
}}
|
|
71
|
+
data-cy="api-types"
|
|
72
|
+
>
|
|
73
|
+
<Box
|
|
74
|
+
sx={{
|
|
75
|
+
flex: 1,
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
<Paper
|
|
81
|
+
elevation={3}
|
|
82
|
+
sx={{
|
|
83
|
+
width: "100%",
|
|
84
|
+
p: 2,
|
|
85
|
+
bgcolor: "background.paper",
|
|
86
|
+
borderRadius: 2,
|
|
87
|
+
height: "100%",
|
|
88
|
+
boxSizing: "border-box",
|
|
89
|
+
display: "flex",
|
|
90
|
+
flexDirection: "column",
|
|
91
|
+
justifyContent: "space-between",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
<TypeList
|
|
96
|
+
combinedData={combinedData}
|
|
97
|
+
selectedType={selectedType}
|
|
98
|
+
onTypeSelect={handleTypeSelect}
|
|
99
|
+
onAddType={handleAddType}
|
|
100
|
+
onUpdateType={handleUpdateType}
|
|
101
|
+
onDeleteType={handleDeleteType}
|
|
102
|
+
/>
|
|
103
|
+
</Paper>
|
|
104
|
+
</Box>
|
|
105
|
+
<Divider orientation="vertical" flexItem sx={{ width: "1rem" }} />
|
|
106
|
+
|
|
107
|
+
<Box
|
|
108
|
+
sx={{
|
|
109
|
+
flex: 1,
|
|
110
|
+
display: "flex",
|
|
111
|
+
flexDirection: "column",
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<Paper
|
|
115
|
+
elevation={3}
|
|
116
|
+
sx={{
|
|
117
|
+
width: "100%",
|
|
118
|
+
p: 2,
|
|
119
|
+
bgcolor: "background.paper",
|
|
120
|
+
borderRadius: 2,
|
|
121
|
+
height: "100%",
|
|
122
|
+
boxSizing: "border-box",
|
|
123
|
+
display: "flex",
|
|
124
|
+
flexDirection: "column",
|
|
125
|
+
justifyContent: "center",
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
{renderRightPanel()}
|
|
130
|
+
</Paper>
|
|
131
|
+
</Box>
|
|
132
|
+
</Box>
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
function findSchemaByName(name) {
|
|
136
|
+
const schema = combinedData.find((schema) => schema.name === name);
|
|
137
|
+
return schema ? schema.schema : null;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export default APITypes;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Box, IconButton, TextField } from "@mui/material";
|
|
2
|
+
import { Check, Close } from "@mui/icons-material";
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
|
|
5
|
+
const TypeEditor = ({ initialValue = "", onConfirm, onCancel }) => {
|
|
6
|
+
const [typeName, setTypeName] = useState(initialValue);
|
|
7
|
+
|
|
8
|
+
const handleConfirm = () => {
|
|
9
|
+
onConfirm(typeName);
|
|
10
|
+
setTypeName("");
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Box
|
|
15
|
+
sx={{
|
|
16
|
+
display: "flex",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "space-between",
|
|
19
|
+
width: "100%",
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<TextField
|
|
23
|
+
value={typeName}
|
|
24
|
+
onChange={(e) => setTypeName(e.target.value)}
|
|
25
|
+
variant="outlined"
|
|
26
|
+
size="small"
|
|
27
|
+
sx={{ width: "60%", marginRight: 1 }}
|
|
28
|
+
data-cy="type-name-input"
|
|
29
|
+
/>
|
|
30
|
+
<Box>
|
|
31
|
+
<IconButton
|
|
32
|
+
onClick={handleConfirm}
|
|
33
|
+
size="small"
|
|
34
|
+
data-cy="confirm-type-button"
|
|
35
|
+
>
|
|
36
|
+
<Check />
|
|
37
|
+
</IconButton>
|
|
38
|
+
<IconButton onClick={onCancel} size="small">
|
|
39
|
+
<Close />
|
|
40
|
+
</IconButton>
|
|
41
|
+
</Box>
|
|
42
|
+
</Box>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default TypeEditor;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import ToggleableMenu from "../ToggleableMenu";
|
|
2
|
+
import TypeEditor from "./TypeEditor";
|
|
3
|
+
|
|
4
|
+
import { Add, Delete, Edit, MoreVert } from "@mui/icons-material";
|
|
5
|
+
import { Box, Fab, IconButton, Typography } from "@mui/material";
|
|
6
|
+
import React, { useState } from "react";
|
|
7
|
+
|
|
8
|
+
const TypeList = ({
|
|
9
|
+
combinedData,
|
|
10
|
+
selectedType,
|
|
11
|
+
onTypeSelect,
|
|
12
|
+
onAddType,
|
|
13
|
+
onUpdateType,
|
|
14
|
+
onDeleteType,
|
|
15
|
+
}) => {
|
|
16
|
+
const [isAddingType, setIsAddingType] = useState(false);
|
|
17
|
+
const [editingType, setEditingType] = useState(null);
|
|
18
|
+
|
|
19
|
+
const handleAddTypeClick = () => {
|
|
20
|
+
setIsAddingType(true);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleAddTypeConfirm = (typeName) => {
|
|
24
|
+
onAddType(typeName);
|
|
25
|
+
setIsAddingType(false);
|
|
26
|
+
onTypeSelect(typeName);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleEditType = (item) => {
|
|
30
|
+
setEditingType(item);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const handleDeleteType = (typeName) => {
|
|
34
|
+
const deletedIndex = combinedData.findIndex(
|
|
35
|
+
(type) => type.name === typeName
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
onDeleteType(typeName);
|
|
39
|
+
|
|
40
|
+
if (deletedIndex === -1) {
|
|
41
|
+
onTypeSelect(null);
|
|
42
|
+
} else if (deletedIndex > 0) {
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
onTypeSelect(combinedData[deletedIndex - 1].name);
|
|
45
|
+
}, 0);
|
|
46
|
+
} else if (deletedIndex < combinedData.length - 1) {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
onTypeSelect(combinedData[deletedIndex + 1].name);
|
|
49
|
+
}, 0);
|
|
50
|
+
} else {
|
|
51
|
+
onTypeSelect(null);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setEditingType(null);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const handleUpdateType = (updatedTypeName) => {
|
|
58
|
+
onTypeSelect(null);
|
|
59
|
+
onUpdateType(editingType, updatedTypeName);
|
|
60
|
+
setEditingType(null);
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
onTypeSelect(updatedTypeName);
|
|
63
|
+
}, 0);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Box
|
|
68
|
+
sx={{
|
|
69
|
+
width: "100%",
|
|
70
|
+
overflowY: "auto",
|
|
71
|
+
position: "relative",
|
|
72
|
+
height: "100%",
|
|
73
|
+
}}
|
|
74
|
+
data-cy="type-list"
|
|
75
|
+
>
|
|
76
|
+
{combinedData.map((item) => (
|
|
77
|
+
<Box
|
|
78
|
+
key={item.name}
|
|
79
|
+
onClick={() => {
|
|
80
|
+
onTypeSelect(item.name);
|
|
81
|
+
}}
|
|
82
|
+
sx={{
|
|
83
|
+
padding: "6px 16px",
|
|
84
|
+
height: "40px",
|
|
85
|
+
width: "100%",
|
|
86
|
+
borderRadius: 2,
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
justifyContent: "space-between",
|
|
90
|
+
cursor: "pointer",
|
|
91
|
+
bgcolor: (theme) =>
|
|
92
|
+
selectedType === item.name
|
|
93
|
+
? theme.palette.action.selected
|
|
94
|
+
: theme.palette.background.paper,
|
|
95
|
+
"&:hover": {
|
|
96
|
+
bgcolor: (theme) => theme.palette.action.hover,
|
|
97
|
+
},
|
|
98
|
+
}}
|
|
99
|
+
data-cy={`type-list-item-${item.name}`}
|
|
100
|
+
>
|
|
101
|
+
{editingType === item.name ? (
|
|
102
|
+
<TypeEditor
|
|
103
|
+
initialValue={item.name}
|
|
104
|
+
onConfirm={handleUpdateType}
|
|
105
|
+
onCancel={() => setEditingType(null)}
|
|
106
|
+
data-cy="type-editor"
|
|
107
|
+
/>
|
|
108
|
+
) : (
|
|
109
|
+
<>
|
|
110
|
+
<Typography variant="body1" style={{ textAlign: "left" }}>
|
|
111
|
+
{item.name}
|
|
112
|
+
</Typography>
|
|
113
|
+
<Box
|
|
114
|
+
sx={{ display: "flex", alignItems: "center" }}
|
|
115
|
+
data-cy={`type-item-actions-${item.name}`}
|
|
116
|
+
>
|
|
117
|
+
{item.isTypeScript && (
|
|
118
|
+
<span
|
|
119
|
+
style={{
|
|
120
|
+
marginRight: "4px",
|
|
121
|
+
color: "#808080",
|
|
122
|
+
fontWeight: "bold",
|
|
123
|
+
}}
|
|
124
|
+
data-cy={`typescript-item-${item.name}`}
|
|
125
|
+
>
|
|
126
|
+
TS
|
|
127
|
+
</span>
|
|
128
|
+
)}
|
|
129
|
+
{!item.isTypeScript && (
|
|
130
|
+
<ToggleableMenu defaultIcon={<MoreVert />}>
|
|
131
|
+
<IconButton
|
|
132
|
+
size="small"
|
|
133
|
+
onClick={() => handleEditType(item.name)}
|
|
134
|
+
data-cy={`edit-type-button-${item.name}`}
|
|
135
|
+
>
|
|
136
|
+
<Edit />
|
|
137
|
+
</IconButton>
|
|
138
|
+
<IconButton
|
|
139
|
+
size="small"
|
|
140
|
+
onClick={() => handleDeleteType(item.name)}
|
|
141
|
+
data-cy={`delete-type-button-${item.name}`}
|
|
142
|
+
>
|
|
143
|
+
<Delete />
|
|
144
|
+
</IconButton>
|
|
145
|
+
</ToggleableMenu>
|
|
146
|
+
)}
|
|
147
|
+
</Box>
|
|
148
|
+
</>
|
|
149
|
+
)}
|
|
150
|
+
</Box>
|
|
151
|
+
))}
|
|
152
|
+
{isAddingType && (
|
|
153
|
+
<TypeEditor
|
|
154
|
+
onConfirm={handleAddTypeConfirm}
|
|
155
|
+
onCancel={() => setIsAddingType(false)}
|
|
156
|
+
data-cy="add-type-editor"
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
<Box
|
|
160
|
+
sx={{
|
|
161
|
+
position: "absolute",
|
|
162
|
+
bottom: 16,
|
|
163
|
+
left: "50%",
|
|
164
|
+
transform: "translateX(-50%)",
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
167
|
+
<Fab
|
|
168
|
+
color="primary"
|
|
169
|
+
onClick={handleAddTypeClick}
|
|
170
|
+
size="small"
|
|
171
|
+
data-cy="add-type-button"
|
|
172
|
+
>
|
|
173
|
+
<Add />
|
|
174
|
+
</Fab>
|
|
175
|
+
</Box>
|
|
176
|
+
</Box>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export default TypeList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./APITypes";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AutoAwesome } from "@mui/icons-material";
|
|
2
|
+
import { Box, CardActions, Fab, Typography } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
function BlankTreeMessage({ item, openLogicDialog, functionsExist }) {
|
|
5
|
+
return (
|
|
6
|
+
<Box sx={{ height: "100%", display: "flex", flexDirection: "column" }}>
|
|
7
|
+
<Box
|
|
8
|
+
sx={{
|
|
9
|
+
flex: 1,
|
|
10
|
+
display: "flex",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<Typography
|
|
16
|
+
sx={{
|
|
17
|
+
color: "text.secondary",
|
|
18
|
+
textAlign: "center",
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
No {item} defined yet
|
|
22
|
+
</Typography>
|
|
23
|
+
</Box>
|
|
24
|
+
{functionsExist && (
|
|
25
|
+
<Box
|
|
26
|
+
sx={{ display: "flex", justifyContent: "center", marginBottom: 1 }}
|
|
27
|
+
>
|
|
28
|
+
<CardActions>
|
|
29
|
+
<Fab size="medium" onClick={openLogicDialog}>
|
|
30
|
+
<AutoAwesome />
|
|
31
|
+
</Fab>
|
|
32
|
+
</CardActions>
|
|
33
|
+
</Box>
|
|
34
|
+
)}
|
|
35
|
+
</Box>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default BlankTreeMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./BlankTreeMessage";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
2
|
+
import IconButton from "@mui/material/IconButton";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
|
|
5
|
+
import { Grid, Tooltip, Typography, tooltipClasses } from "@mui/material";
|
|
6
|
+
|
|
7
|
+
const DialogTooltip = styled(
|
|
8
|
+
({
|
|
9
|
+
className,
|
|
10
|
+
open,
|
|
11
|
+
handleTooltipClose,
|
|
12
|
+
title,
|
|
13
|
+
message,
|
|
14
|
+
footer,
|
|
15
|
+
...props
|
|
16
|
+
}) => (
|
|
17
|
+
<Tooltip
|
|
18
|
+
open={open}
|
|
19
|
+
onClose={handleTooltipClose}
|
|
20
|
+
disableFocusListener
|
|
21
|
+
disableHoverListener
|
|
22
|
+
disableTouchListener
|
|
23
|
+
title={
|
|
24
|
+
<>
|
|
25
|
+
<Grid
|
|
26
|
+
container
|
|
27
|
+
sx={{
|
|
28
|
+
display: "flex",
|
|
29
|
+
justifyContent: "space-between",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
backgroundColor: (theme) => theme.palette.background.paper,
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<Typography variant="subtitle1" sx={{ flexGrow: 1, marginLeft: 2 }}>
|
|
35
|
+
{title}
|
|
36
|
+
</Typography>
|
|
37
|
+
<IconButton onClick={handleTooltipClose} size="small">
|
|
38
|
+
<CloseIcon />
|
|
39
|
+
</IconButton>
|
|
40
|
+
</Grid>
|
|
41
|
+
<Grid sx={{ padding: 2 }}>
|
|
42
|
+
<Typography
|
|
43
|
+
variant="body2"
|
|
44
|
+
sx={{ color: (theme) => theme.palette.text.primary }}
|
|
45
|
+
>
|
|
46
|
+
{message}
|
|
47
|
+
</Typography>
|
|
48
|
+
{footer}
|
|
49
|
+
</Grid>
|
|
50
|
+
</>
|
|
51
|
+
}
|
|
52
|
+
{...props}
|
|
53
|
+
classes={{ popper: className }}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
)(({ theme }) => ({
|
|
57
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
|
58
|
+
backgroundColor: theme.palette.background.paper,
|
|
59
|
+
color: theme.palette.text.primary,
|
|
60
|
+
width: 600,
|
|
61
|
+
fontSize: theme.typography.pxToRem(12),
|
|
62
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
63
|
+
boxShadow: theme.shadows[1],
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
export default DialogTooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./DialogTooltip";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import ParamView from "./ParamView";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import SchemaEditor from "../SchemaEditor";
|
|
4
|
+
|
|
5
|
+
import { Box, Divider, Paper, Typography } from "@mui/material";
|
|
6
|
+
|
|
7
|
+
const NewAPIBody = ({ types, api, requestSchemaRef, responseSchemaRef }) => {
|
|
8
|
+
return (
|
|
9
|
+
<Box
|
|
10
|
+
sx={{
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "row",
|
|
13
|
+
height: "85%",
|
|
14
|
+
p: 2,
|
|
15
|
+
}}
|
|
16
|
+
data-cy="api-body"
|
|
17
|
+
>
|
|
18
|
+
<Box
|
|
19
|
+
sx={{
|
|
20
|
+
flex: 1,
|
|
21
|
+
display: "flex",
|
|
22
|
+
flexDirection: "column",
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<Paper
|
|
26
|
+
elevation={3}
|
|
27
|
+
sx={{
|
|
28
|
+
width: "100%",
|
|
29
|
+
p: 2,
|
|
30
|
+
bgcolor: "background.paper",
|
|
31
|
+
borderRadius: 2,
|
|
32
|
+
height: "100%",
|
|
33
|
+
boxSizing: "border-box",
|
|
34
|
+
display: "flex",
|
|
35
|
+
flexDirection: "column",
|
|
36
|
+
justifyContent: "center",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
}}
|
|
39
|
+
data-cy="request-schema-editor"
|
|
40
|
+
>
|
|
41
|
+
{api.method === "GET" ? (
|
|
42
|
+
<Box sx={{ width: "100%", height: "100%" }}>
|
|
43
|
+
<ParamView params={api.params} />
|
|
44
|
+
</Box>
|
|
45
|
+
) : (
|
|
46
|
+
<SchemaEditor
|
|
47
|
+
ref={requestSchemaRef}
|
|
48
|
+
initialData={api.request ? api.request.schema : ""}
|
|
49
|
+
customTypes={types}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
<Typography variant="h6" gutterBottom>
|
|
53
|
+
Request
|
|
54
|
+
</Typography>
|
|
55
|
+
</Paper>
|
|
56
|
+
</Box>
|
|
57
|
+
|
|
58
|
+
<Divider orientation="vertical" flexItem sx={{ width: "1rem" }} />
|
|
59
|
+
|
|
60
|
+
<Box
|
|
61
|
+
sx={{
|
|
62
|
+
flex: 1,
|
|
63
|
+
display: "flex",
|
|
64
|
+
flexDirection: "column",
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<Paper
|
|
68
|
+
elevation={3}
|
|
69
|
+
sx={{
|
|
70
|
+
width: "100%",
|
|
71
|
+
p: 2,
|
|
72
|
+
bgcolor: "background.paper",
|
|
73
|
+
borderRadius: 2,
|
|
74
|
+
height: "100%",
|
|
75
|
+
boxSizing: "border-box",
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
justifyContent: "center",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
}}
|
|
81
|
+
data-cy="response-schema-editor"
|
|
82
|
+
>
|
|
83
|
+
<SchemaEditor
|
|
84
|
+
ref={responseSchemaRef}
|
|
85
|
+
customTypes={types}
|
|
86
|
+
initialData={api.response ? api.response.schema : ""}
|
|
87
|
+
/>
|
|
88
|
+
<Typography variant="h6" gutterBottom>
|
|
89
|
+
Response
|
|
90
|
+
</Typography>
|
|
91
|
+
</Paper>
|
|
92
|
+
</Box>
|
|
93
|
+
</Box>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default NewAPIBody;
|