Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] WIP load old extensions #776

Merged
merged 12 commits into from
Jul 2, 2024
19 changes: 12 additions & 7 deletions Build/Sources/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import defaultAuthor from "./initialValues/author";
import defaultModule from "./initialValues/module";
import defaultPlugin from "./initialValues/plugin";
import convertModulesToNodes from "./helper/converter/convertModulesToNodes";
import convertRelationsToReactFlowRelations from "./helper/converter/convertRelationsToReactFlowRelations";

export const NodesContext = createContext([]);
export const EdgesContext = createContext([]);
Expand Down Expand Up @@ -238,8 +239,7 @@ function App() {
// Instead the modules could be handed into the nodes but needs to be converted to the correct format. This could be a lot of work.
const working = JSON.parse(extension.working);

console.log("working inside handleOpenExtension:");
console.log(working);
console.log("working inside handleOpenExtension: ", working);

// Sets properties.
setProperties(prev => ({...prev, ...working.properties}));
Expand All @@ -259,14 +259,19 @@ function App() {
// let modules = convertModuleToNode(working.modules);
let modules = convertModulesToNodes(working.modules);
// Check if nodes or edges are available, and update them.
console.log("modules");
console.log(modules);
console.log(working.nodes);
let edges = convertRelationsToReactFlowRelations(working.wires, modules);

// console.log("41:" + JSON.stringify(working.modules, null, 2));
console.log("42:" + JSON.stringify(working.edges, null, 2));

setNodes(modules ? modules: []);
setEdges(working.edges ? working.edges : []);
setEdges(edges ? edges : []);

console.log("modulesLength: " + (modules ? modules.length : 0))
console.log("working edgesLength: " + (working.edges ? working.edges.length : 0))
console.log("edgesLength: " + (edges ? edges.length : 0))
// Set the custom model node index depending on the amount of nodes.
setCustomModelNodeIndex(working.nodes ? working.nodes.length : 0);
setCustomModelNodeIndex(modules ? modules.length : 0);
}


Expand Down
24 changes: 11 additions & 13 deletions Build/Sources/components/ActionButtonsComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export const ActionButtonsComponent = (props) => {
properties.push(
{
"allowedFileTypes": "",
"propertyDescription": property.description,
"excludeField": property.excludeField,
"propertyIsL10nModeExclude": property.isl10nModeExlude,
"propertyIsNullable": property.isNullable,
"propertyIsRequired": property.isRequired,
"propertyType": property.type,
"propertyDescription": property.propertyDescription,
"propertyIsExcludeField": property.propertyIsExcludeField,
"propertyIsL10nModeExclude": property.propertyIsL10nModeExclude,
"propertyIsNullable": property.propertyIsNullable,
"propertyIsRequired": property.propertyIsRequired,
"propertyName": property.propertyName,
"propertyType": property.propertyType,
"typeSelect": {
"selectboxValues": property.typeSelect?.selectboxValues || "",
"renderType": property.typeSelect?.renderType || "selectSingle",
Expand Down Expand Up @@ -106,7 +106,7 @@ export const ActionButtonsComponent = (props) => {
{
"foreignRelationClass": relation.foreignRelationClass || "",
"lazyLoading": relation.lazyLoading || false,
"propertyIsExcludeField": relation.propertyIsExcludeField || false,
"excludeField": relation.excludeField || false,
"relationDescription": relation.relationDescription || "",
"relationName": relation.relationName || "",
"relationType": relation.relationType || "anyToMany",
Expand Down Expand Up @@ -182,13 +182,11 @@ export const ActionButtonsComponent = (props) => {
return {
"src": {
"moduleId": modules.findIndex(node => node.name === nodes[sourceIndex].data.label),
"moduleName": nodes[sourceIndex].data.label,
"terminal": `relationWire_${relationIndex}`,
"uid": edge.id
},
"tgt": {
"moduleId": modules.findIndex(node => node.name === nodes[targetIndex].data.label),
"moduleName": nodes[targetIndex].data.label,
"terminal": "SOURCES",
"uid": edge.source
}
Expand Down Expand Up @@ -223,9 +221,9 @@ export const ActionButtonsComponent = (props) => {
"plugins": props.plugins,
"vendorName": props.properties.vendorName
},
"wires": wires,
"wires": wires
/*"nodes": nodes,*/
"edges": edges
/*"edges": edges*/
};

let payload = {
Expand Down Expand Up @@ -300,8 +298,8 @@ export const ActionButtonsComponent = (props) => {
// error = null, if no error occurs
// success = true, when the request was successful
// result with the array of extensions
console.log("available extensions");
console.log(extensions);
// console.log("available extensions");
// console.log(extensions);

if(extensions.error !== null && extensions.success === false) {
console.log("fetching failed");
Expand Down
Loading
Loading