Add non-canvas element management with controller and service integration#574
Add non-canvas element management with controller and service integration#574stijnpotters1 wants to merge 5 commits into
Conversation
…ler integration and improved frontend according to feedback
…s non-canvas components
|
|
|
||
| const handleDragLeave = () => { | ||
| if (!isComponentDrag) return | ||
| dragDepth.current -= 1 |
There was a problem hiding this comment.
No preventDefault() needed here?
There was a problem hiding this comment.
Maybe sub components defined here should be in their own files
| const aIsRoot = a.relativePath.split(/[/\\]/).pop()?.toLowerCase() === 'configuration.xml' | ||
| const bIsRoot = b.relativePath.split(/[/\\]/).pop()?.toLowerCase() === 'configuration.xml' |
There was a problem hiding this comment.
Are these paths not normalised at this point?
If so then you wont have to check for both / and \ all the time
| String updatedContent = XmlConfigurationUtils.convertNodeToString(configurationDocument); | ||
| fileSystemStorage.writeFile(absolutePath.toString(), updatedContent); | ||
| } catch (TransformerException | IOException exception) { | ||
| throw new ApiException("Failed to write configuration: " + exception.getMessage(), HttpStatus.BAD_REQUEST); |
There was a problem hiding this comment.
How is this a bed request? Something went wrong on the server, not because of the client
| String repairedContent = XmlConfigurationUtils.repairFlowNamespace(content); | ||
| return XmlSecurityUtils.createSecureDocumentBuilder().parse(new InputSource(new StringReader(repairedContent))); | ||
| } catch (IOException | ParserConfigurationException | SAXException exception) { | ||
| throw new ApiException("Failed to read configuration: " + exception.getMessage(), HttpStatus.BAD_REQUEST); |
There was a problem hiding this comment.
Same here, if the file is not found then yes its on the client, but any other error is the fault on the server side
| for (const name of getFirstLevelElementsForType(xsdDocument, rootType)) collect(name) | ||
| } | ||
|
|
||
| return [...addableNames].toSorted((first, second) => first.localeCompare(second)) |
There was a problem hiding this comment.
toSorted already makes a new array copy, no need to spread onto a new array first
| {restKeys.length > 0 && ( | ||
| <div className="pt-4"> | ||
| <Button onClick={() => setShowAll((previous) => !previous)} className="w-full"> | ||
| {showAll ? 'Hide empty attributes' : 'Show all attributes'} | ||
| </Button> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="border-t-border bg-background border-t p-4"> | ||
| <div className="flex w-full items-center justify-between"> | ||
| <Button | ||
| onClick={handleSave} | ||
| disabled={!canSave || isSaving} | ||
| className="disabled:text-foreground-muted w-auto disabled:cursor-not-allowed disabled:opacity-50" | ||
| > | ||
| {isSaving ? 'Saving...' : 'Save & Close'} | ||
| </Button> | ||
|
|
||
| <Button className="w-auto" onClick={mode === 'edit' ? handleDelete : onClose} disabled={isSaving}> | ||
| Delete | ||
| </Button> | ||
| </div> | ||
|
|
||
| {errorMessage && <p className="text-error mt-2 text-sm">{errorMessage}</p>} |
There was a problem hiding this comment.
This is similar to how its done in the studio right?
Cant parts of that logic be its own component and reused here?





Uh oh!
There was an error while loading. Please reload this page.