diff --git a/Build/Sources/App.js b/Build/Sources/App.js index 0af86b14e..be6605c4f 100644 --- a/Build/Sources/App.js +++ b/Build/Sources/App.js @@ -9,6 +9,14 @@ const initialNodes = []; const initialEdges = []; function App() { + // Nodes for ReactFlow + const [nodes, setNodes] = useState([]); + + const onNodesChanged = (nodes) => { + // Dont use prev + setNodes(nodes); + } + // Zustand für das Ein- und Ausklappen der linken Spalte const [isLeftColumnVisible, setLeftColumnVisible] = useState(true); @@ -142,22 +150,22 @@ const updatePluginHandler = (pluginId, field, value) => { }); } -const updateModuleHandler = (moduleId, field, value) => { - setModules((prevModules) => { - return prevModules.map((module) => { - if (module.id === moduleId) { - if (field.includes('.')) { - const [parentKey, childKey] = field.split('.'); - return {...module, [parentKey]: {...module[parentKey], [childKey]: value}}; + const updateModuleHandler = (moduleId, field, value) => { + setModules((prevModules) => { + return prevModules.map((module) => { + if (module.id === moduleId) { + if (field.includes('.')) { + const [parentKey, childKey] = field.split('.'); + return {...module, [parentKey]: {...module[parentKey], [childKey]: value}}; + } else { + return {...module, [field]: value}; + } } else { - return {...module, [field]: value}; + return module; } - } else { - return module; - } + }); }); - }); -} + } const removeAuthorHandler = (authorId) => { // TODO Testen !!! @@ -280,6 +288,7 @@ const updateModuleHandler = (moduleId, field, value) => { authors={authors} plugins={plugins} modules={modules} + nodes={nodes} addNewAuthorHandler={addNewAuthorHandler} addNewModuleHandler={addNewModuleHandler} addNewPluginHandler={addNewPluginHandler} @@ -299,7 +308,9 @@ const updateModuleHandler = (moduleId, field, value) => {
- +
diff --git a/Build/Sources/components/ActionButtonsComponent.jsx b/Build/Sources/components/ActionButtonsComponent.jsx index 7517de224..213eea6fb 100644 --- a/Build/Sources/components/ActionButtonsComponent.jsx +++ b/Build/Sources/components/ActionButtonsComponent.jsx @@ -19,8 +19,82 @@ export const ActionButtonsComponent = (props) => { console.log(props); console.log("----------") + // modules => nodes from react flow + let modules = []; + + // For each props.nodes, create a module object + props.nodes.forEach((node) => { + console.log("Node"); + console.log(node); + let customActions = []; + node.data.customActions.map((action) => { + customActions.push(action); + }); + console.log("Custom Actions"); + console.log(customActions); + + let module = { + "config": { + "position": [ + node.position.x, + node.position.y + ] + }, + "name": node.data.label, + "value": { + "actionGroup": { + "_default0_index": node.data.actions.actionIndex, + "_default1_list": node.data.actions.actionList, + "_default2_show": node.data.actions.actionShow, + "_default3_new_create": node.data.actions.actionNewCreate, + "_default4_edit_update": node.data.actions.actionEditUpdate, + "_default5_delete": node.data.actions.actionDelete, + "customActions": customActions + }, + "name": node.data.label, + "objectsettings": { + "addDeletedField": node.data.addDeletedField, + "addHiddenField": node.data.addHiddenField, + "addStarttimeEndtimeFields": node.data.addStarttimeEndtimeFields, + "aggregateRoot": node.data.isAggregateRoot, + "categorizable": node.data.enableCategorization, + "description": node.data.description, + "mapToTable": node.data.mapToExistingTable, + "parentClass": node.data.extendExistingModelClass, + "sorting": node.data.enableSorting, + "type": "Entity", + "uid": "1173301976935" + }, + "propertyGroup": { + "properties": [ + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsNullable": false, + "propertyIsRequired": false, + "propertyName": "titel", + "propertyType": "String", + "uid": "1357067104948" + } + ] + }, + "relationGroup": { + "relations": [] + } + } + }; + modules.push(module); + }); + + console.log("-Nodes-") + console.log(props.nodes); + console.log("-Nodes END-") + let working = { - "modules": [], + "modules": modules, "properties": { "backendModules": props.modules, "description": props.properties.description || "", @@ -30,9 +104,9 @@ export const ActionButtonsComponent = (props) => { "dependsOn": props.properties.emConf.dependsOn || "", "disableLocalization": props.properties.emConf.disableLocalization || false, "disableVersioning": props.properties.emConf.disableVersioning || false, - "generateDocumentationTemplate": props.properties.emConf.generateDocumentationTemplate || true, - "generateEditorConfig": props.properties.emConf.generateEditorConfig || true, - "generateEmptyGitRepository": props.properties.emConf.generateEmptyGitRepository || true, + "generateDocumentationTemplate": props.properties.emConf.generateDocumentationTemplate || false, + "generateEditorConfig": props.properties.emConf.generateEditorConfig || false, + "generateEmptyGitRepository": props.properties.emConf.generateEmptyGitRepository || false, "sourceLanguage": props.properties.emConf.sourceLanguage || "en", "state": props.properties.emConf.state || "alpha", "targetVersion": `${props.properties.emConf.targetVersion}.0-${props.properties.emConf.targetVersion}.99` || "12.4.0", @@ -61,6 +135,7 @@ export const ActionButtonsComponent = (props) => { }; console.log("----------") console.log("payload"); + console.log(payload); console.log("----------") // TYPO3 will be available in the global scope @@ -74,8 +149,12 @@ export const ActionButtonsComponent = (props) => { .then(function (response) { console.log("Successfull saved"); console.log(response.data.success); + if(response.data.success === null || response.data.success === undefined) { + top.TYPO3.Modal.confirm('Successfull saved but ...', '... Something went wrong on server side'); + } else { + top.TYPO3.Modal.confirm('Successfull saved', response.data.success); + } // eslint-disable-next-line no-restricted-globals,no-undef - top.TYPO3.Modal.confirm('Successfull saved', response.data.success); setSuccess(response); }) .catch(function (error) { @@ -106,18 +185,6 @@ export const ActionButtonsComponent = (props) => { id="eb-btn-save" >Open -{/* */} - -{/* */} ) } diff --git a/Build/Sources/components/ReactFlow/CustomModelNode.jsx b/Build/Sources/components/ReactFlow/CustomModelNode.jsx index e48728605..7b1a5e385 100644 --- a/Build/Sources/components/ReactFlow/CustomModelNode.jsx +++ b/Build/Sources/components/ReactFlow/CustomModelNode.jsx @@ -60,6 +60,11 @@ export const CustomModelNode = (props) => { props.data.label = value; } + const updateCustomAction = (index, value) => { + props.data.customActions[index] = value; + console.log(props.data); + } + return (
@@ -228,10 +233,15 @@ export const CustomModelNode = (props) => { >
{ - customActions.map((action) => { + customActions.map((action, index) => { return (
- + { + // Store custom Action to props.data.actions.customActions + updateCustomAction(index, e.target.value); + }} + />
) }) diff --git a/Build/Sources/components/ReactFlow/ReactFlowComponent.jsx b/Build/Sources/components/ReactFlow/ReactFlowComponent.jsx index 78dda3b29..831be3588 100644 --- a/Build/Sources/components/ReactFlow/ReactFlowComponent.jsx +++ b/Build/Sources/components/ReactFlow/ReactFlowComponent.jsx @@ -102,7 +102,6 @@ export const ReactFlowComponent = (props) => { actionDelete: false, }, customActions: [ - ], properties: [], relations: [], diff --git a/Build/Sources/components/views/RightContentComponent.jsx b/Build/Sources/components/views/RightContentComponent.jsx index eeca3ddbf..01b09dd38 100644 --- a/Build/Sources/components/views/RightContentComponent.jsx +++ b/Build/Sources/components/views/RightContentComponent.jsx @@ -1,9 +1,9 @@ import {ReactFlowComponent} from "../ReactFlow/ReactFlowComponent"; -export const RightContentComponent = () => { +export const RightContentComponent = (props) => { return ( ) } diff --git a/Classes/Configuration/ExtensionBuilderConfigurationManager.php b/Classes/Configuration/ExtensionBuilderConfigurationManager.php index 893ccc94e..d880ac532 100644 --- a/Classes/Configuration/ExtensionBuilderConfigurationManager.php +++ b/Classes/Configuration/ExtensionBuilderConfigurationManager.php @@ -125,7 +125,7 @@ public function getSettings(?array $typoscript = null): array if (empty($settings['publicResourcesPath'])) { $settings['publicResourcesPath'] = ExtensionManagementUtility::extPath('extension_builder') . 'Resources/Public/'; $settings['codeTemplateRootPaths'][] = ExtensionManagementUtility::extPath('extension_builder') . 'Resources/Private/CodeTemplates/Extbase/'; - $settings['codeTemplatePartialPaths'][] = ExtensionManagementUtility::extPath('extension_builder') . 'Resources/Private/Partials/'; + $settings['codeTemplatePartialPaths'][] = ExtensionManagementUtility::extPath('extension_builder') . 'Resources/Private/CodeTemplates/Extbase/Partials/'; } return $settings; } diff --git a/Classes/Domain/Validator/ExtensionValidator.php b/Classes/Domain/Validator/ExtensionValidator.php index 80c067f4a..a475f563c 100644 --- a/Classes/Domain/Validator/ExtensionValidator.php +++ b/Classes/Domain/Validator/ExtensionValidator.php @@ -428,7 +428,7 @@ public function validateConfigurationFormat(array $configuration): array $propertyNames = []; if (isset($domainObjectConfiguration['value']['propertyGroup']['properties'])) { foreach ($domainObjectConfiguration['value']['propertyGroup']['properties'] as $property) { - if (in_array($property['propertyName'], $propertyNames, true)) { + if (in_array($property['propertyName'] ?? '', $propertyNames, true)) { $this->validationResult['errors'][] = new ExtensionException( 'Property "' . $property['propertyName'] . '" of Model "' . $domainObjectConfiguration['value']['name'] . '" exists twice.', self::ERROR_PROPERTY_DUPLICATE diff --git a/Resources/Private/CodeTemplates/Extbase/Configuration/Backend/Modules.phpt b/Resources/Private/CodeTemplates/Extbase/Configuration/Backend/Modules.phpt index 62a8e4fa5..07e4d5dbf 100644 --- a/Resources/Private/CodeTemplates/Extbase/Configuration/Backend/Modules.phpt +++ b/Resources/Private/CodeTemplates/Extbase/Configuration/Backend/Modules.phpt @@ -2,23 +2,23 @@ return [ '{backendModule.key}' => [ - 'parent' => '{backendModule.mainModule}', - 'position' => ['bottom'], - 'access' => 'user', - 'workspaces' => 'live', - 'path' => '/module/{extension.vendorName}/{backendModule.key}', - 'labels' => 'LLL:EXT:{extension.extensionKey}/Resources/Private/Language/locallang_{backendModule.key}.xlf', - 'extensionName' => '{extension.extensionName}', - 'controllerActions' => [ - ModuleController::class => [ - 'flash','tree','clipboard','links','fileReference','fileReferenceCreate', - ], + 'parent' => '{backendModule.mainModule}', + 'position' => ['bottom'], + 'access' => 'user', + 'workspaces' => 'live', + 'path' => '/module/{extension.vendorName}/{backendModule.key}', + 'labels' => 'LLL:EXT:{extension.extensionKey}/Resources/Private/Language/locallang_{backendModule.key}.xlf', + 'extensionName' => '{extension.extensionName}', + 'controllerActions' => [ + ModuleController::class => [ + 'flash','tree','clipboard','links','fileReference','fileReferenceCreate', ], - 'routes' => [ - '_default' => [ - 'target' => 'test', - ], + ], + 'routes' => [ + '_default' => [ + 'target' => 'test', ], ], - + ], + ]; diff --git a/Resources/Public/JavaScript/main.js b/Resources/Public/JavaScript/main.js index 26e61e851..c75bd08e1 100644 --- a/Resources/Public/JavaScript/main.js +++ b/Resources/Public/JavaScript/main.js @@ -1,2 +1,2 @@ /*! For license information please see main.js.LICENSE.txt */ -!function(c,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var a in n)("object"==typeof exports?exports:c)[a]=n[a]}}(self,(function(){return function(){var c,e,n={703:function(c,e,n){"use strict";var a=n(414);function t(){}function i(){}i.resetWarningCache=t,c.exports=function(){function c(c,e,n,t,i,r){if(r!==a){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function e(){return c}c.isRequired=c;var n={array:c,bigint:c,bool:c,func:c,number:c,object:c,string:c,symbol:c,any:c,arrayOf:e,element:c,elementType:c,instanceOf:e,node:c,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:t};return n.PropTypes=n,n}},697:function(c,e,n){c.exports=n(703)()},414:function(c){"use strict";c.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},448:function(c,e,n){"use strict";var a=n(294),t=n(840);function i(c){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+c,n=1;n