Skip to content

Commit

Permalink
Linters
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarMrZ committed Sep 30, 2024
1 parent bd34e7a commit a597fac
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const App = () => {
const [currentProjectname, setCurrentProjectname] = useState<string>("");
const [currentUniverseName, setCurrentUniverseName] = useState<string>("");
const [actionNodesData, setActionNodesData] = useState<Record<string, any>>(
{}
{},
);
const [modelJson, setModelJson] = useState<string>("");
const [isErrorModalOpen, setErrorModalOpen] = useState<boolean>(false);
Expand Down
30 changes: 15 additions & 15 deletions frontend/src/api_helper/TreeWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const saveProject = async (modelJson: string, currentProjectname: string) => {

const loadProjectConfig = async (
currentProjectname: string,
settings: Object
settings: Object,
) => {
if (!currentProjectname) throw new Error("Current Project name is not set");

Expand All @@ -101,7 +101,7 @@ const loadProjectConfig = async (
// Handle unsuccessful response status (e.g., non-2xx status)
if (!isSuccessful(response)) {
throw new Error(
response.data.message || "Failed to retrieve project config"
response.data.message || "Failed to retrieve project config",
); // Response error
}

Expand All @@ -112,7 +112,7 @@ const loadProjectConfig = async (
// Load all the settings
Object.entries(settings).map(([key, value]) => {
value.setter(
project_settings[key] ? project_settings[key] : value.default_value
project_settings[key] ? project_settings[key] : value.default_value,
);
});
} catch (error) {
Expand All @@ -135,7 +135,7 @@ const getProjectGraph = async (currentProjectname: string) => {
// Handle unsuccessful response status (e.g., non-2xx status)
if (!isSuccessful(response)) {
throw new Error(
response.data.message || "Failed to retrieve project graph"
response.data.message || "Failed to retrieve project graph",
); // Response error
}

Expand All @@ -149,21 +149,21 @@ const getProjectGraph = async (currentProjectname: string) => {

const getUniverseConfig = async (
universeName: string,
currentProjectname: string
currentProjectname: string,
) => {
if (!universeName) throw new Error("The universe name is not set");
if (!currentProjectname) throw new Error("Current Project name is not set");

const apiUrl = `/tree_api/get_universe_configuration?project_name=${encodeURIComponent(
currentProjectname
currentProjectname,
)}&universe_name=${encodeURIComponent(universeName)}`;
try {
const response = await axios.get(apiUrl);

// Handle unsuccessful response status (e.g., non-2xx status)
if (!isSuccessful(response)) {
throw new Error(
response.data.message || "Failed to retrieve universe config"
response.data.message || "Failed to retrieve universe config",
); // Response error
}

Expand All @@ -175,7 +175,7 @@ const getUniverseConfig = async (

const getCustomUniverseZip = async (
universeName: string,
currentProjectname: string
currentProjectname: string,
) => {
if (!universeName) throw new Error("The universe name is not set");
if (!currentProjectname) throw new Error("Current Project name is not set");
Expand All @@ -201,7 +201,7 @@ const getCustomUniverseZip = async (
// Handle unsuccessful response status (e.g., non-2xx status)
if (!isSuccessful(response)) {
throw new Error(
response.data.message || "Failed to retrieve custom universe"
response.data.message || "Failed to retrieve custom universe",
); // Response error
}
return new Blob([response.data], { type: "application/octet-stream" });
Expand All @@ -215,7 +215,7 @@ const getCustomUniverseZip = async (
const generateApp = async (
modelJson: Object,
currentProjectname: string,
btOrder: string
btOrder: string,
) => {
if (!modelJson) throw new Error("Tree JSON is empty!");
if (!currentProjectname) throw new Error("Current Project name is not set");
Expand All @@ -232,7 +232,7 @@ const generateApp = async (
},
{
responseType: "blob", // Ensure the response is treated as a Blob
}
},
);

// Handle unsuccessful response status (e.g., non-2xx status)
Expand All @@ -249,7 +249,7 @@ const generateApp = async (
const generateDockerizedApp = async (
modelJson: Object,
currentProjectname: string,
btOrder: string
btOrder: string,
) => {
if (!modelJson) throw new Error("Tree JSON is empty!");
if (!currentProjectname) throw new Error("Current Project name is not set");
Expand All @@ -266,7 +266,7 @@ const generateDockerizedApp = async (
},
{
responseType: "blob", // Ensure the response is treated as a Blob
}
},
);

// Handle unsuccessful response status (e.g., non-2xx status)
Expand All @@ -284,7 +284,7 @@ const generateDockerizedApp = async (

const createSubtree = async (
subtreeName: string,
currentProjectname: string
currentProjectname: string,
) => {
if (!subtreeName.trim()) {
throw new Error("Subtree name cannot be empty.");
Expand Down Expand Up @@ -353,7 +353,7 @@ const getSubtree = async (subtreeName: string, projectName: string) => {
const saveSubtree = async (
modelJson: string,
currentProjectname: string,
subtreeName: string
subtreeName: string,
) => {
if (!modelJson) throw new Error("Tree JSON is empty!");
if (!currentProjectname) throw new Error("Current Project name is not set");
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/header_menu/HeaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const HeaderMenu = ({
const appBlob = await generateApp(
modelJson,
currentProjectname,
"bottom-to-top"
"bottom-to-top",
);

// Create a download link and trigger download
Expand Down Expand Up @@ -185,7 +185,7 @@ const HeaderMenu = ({
const appBlob = await generateDockerizedApp(
modelJson,
currentProjectname,
"bottom-to-top"
"bottom-to-top",
);

// Send the blob directly
Expand Down Expand Up @@ -252,7 +252,7 @@ const HeaderMenu = ({
try {
const universeConfig = await getUniverseConfig(
universeName,
currentProjectname
currentProjectname,
);
try {
// Launch if new universe selected
Expand Down
23 changes: 13 additions & 10 deletions frontend/src/components/tree_editor/TreeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const TreeEditor = memo(
/>
</div>
);
}
},
);

const DiagramEditor = memo(
Expand Down Expand Up @@ -125,38 +125,41 @@ const DiagramEditor = memo(
engine.current
.getPortFactories()
.registerFactory(
new SimplePortFactory("children", (config) => new ChildrenPortModel())
new SimplePortFactory(
"children",
(config) => new ChildrenPortModel(),
),
);
engine.current
.getPortFactories()
.registerFactory(
new SimplePortFactory("parent", (config) => new ParentPortModel())
new SimplePortFactory("parent", (config) => new ParentPortModel()),
);
engine.current
.getPortFactories()
.registerFactory(
new SimplePortFactory("output", (config) => new OutputPortModel(""))
new SimplePortFactory("output", (config) => new OutputPortModel("")),
);
engine.current
.getPortFactories()
.registerFactory(
new SimplePortFactory("input", (config) => new InputPortModel(""))
new SimplePortFactory("input", (config) => new InputPortModel("")),
);
engine.current
.getPortFactories()
.registerFactory(
new SimplePortFactory(
"tag output",
(config) => new TagOutputPortModel()
)
(config) => new TagOutputPortModel(),
),
);
engine.current
.getPortFactories()
.registerFactory(
new SimplePortFactory(
"tag input",
(config) => new TagInputPortModel()
)
(config) => new TagInputPortModel(),
),
);

// Disable loose links
Expand Down Expand Up @@ -412,7 +415,7 @@ const DiagramEditor = memo(
)}
</div>
);
}
},
);

export default TreeEditor;

0 comments on commit a597fac

Please sign in to comment.