-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create StickyNotes DB entity * Add PoC httpApiService for StickyNotes - add slick migration * Add put and delete endpoints, use value classes for ID in stickyNotes model * Add StickyNote PoC to FE * Resize and update StickyNotes * Handle note removal * Remove some unused fragments * Update openApi definition * Resize stickyNote without visual-lag * Disable stickyNotes when scenario is not saved * Show/hide tools on graph actions * Edit stickyNote on graph * Fix some suggestions made by rabbit * Update openApi definitions * Add white characters to textarea in stickyNote markdown editor * Allow focus to stay in markdown editor * Allow switch viewer to editor witgh left mouse click * Add stickyNotes length and count validation, add stickyNotes configuration, fix error method (or did i?) * Remove node specific code from StickyNotePreview, update openApi defs * Add some fixes, improve types, add max width and height for stickyNote * Add STICKY_NOTE_CONSTRAINTS with config values * Reuse common code, restore default color, remove duplicated update method * Restore CSS class, remove unused imports * Remove stickyNotePanel, add stickyNote to creatos panel * Update cypress test * Add Changelog and migrationGuide entries * Updated snapshots (#7275) Co-authored-by: philemone <[email protected]> * remove space * Remove DOMpurify and use XSS instead * Remove StickyNotePreview from ComponentPreview * Rename stickyNotes panel to sticky notes * Fix markdown preview * Change shape of stickyNote, fix 'changed' detection for notes * Add notifications to graph, prevent from making changes to old stickyNotes versions * Revert fix in error notification msg * Fix warn messages * Add strict type for color #xxxxxx, remove unnecessary generated noteId, add more optimistic tests * Update pointer, add cypress tests, remove todo from uncomplete method, remove unused dompurify from package * Add regex in sticky note tests for note id * Change remove tool color and margins, update cypress tests * update cypress tests * Add maxDiffThreshold to flaky cypress test --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: philemone <[email protected]>
- Loading branch information
1 parent
8675c17
commit 16d7ca5
Showing
69 changed files
with
2,898 additions
and
72 deletions.
There are no files selected for viewing
Binary file modified
BIN
+1.94 KB
(120%)
...tron/Linux/Creator toolbar should allow collapse (persist) and filtering #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+70.7 KB
...on/Linux/Sticky notes should add text to note and display it as markdown #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+68.3 KB
...snapshots__/electron/Linux/Sticky notes should allow to drag sticky note #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+69.5 KB
...Linux/Sticky notes should disable sticky note when scenario is not saved #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
describe("Sticky notes", () => { | ||
const seed = "stickyNotes"; | ||
|
||
before(() => { | ||
cy.deleteAllTestProcesses({ filter: seed, force: true }); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.visitNewProcess(seed, "stickyNotes"); | ||
}); | ||
|
||
const screenshotOptions: Cypress.MatchImageOptions = { | ||
screenshotConfig: { clip: { x: 0, y: 0, width: 1400, height: 600 } }, | ||
}; | ||
|
||
it("should allow to drag sticky note", () => { | ||
cy.layoutScenario(); | ||
cy.contains(/^sticky notes$/i) | ||
.should("exist") | ||
.scrollIntoView(); | ||
cy.get("[data-testid='component:sticky note']") | ||
.should("be.visible") | ||
.drag("#nk-graph-main", { | ||
target: { | ||
x: 600, | ||
y: 300, | ||
}, | ||
force: true, | ||
}); | ||
|
||
cy.get("[data-testid=graphPage]").matchImage(screenshotOptions); | ||
}); | ||
|
||
it("should add text to note and display it as markdown", () => { | ||
cy.layoutScenario(); | ||
cy.contains(/^sticky notes$/i) | ||
.should("exist") | ||
.scrollIntoView(); | ||
cy.get("[data-testid='component:sticky note']") | ||
.should("be.visible") | ||
.drag("#nk-graph-main", { | ||
target: { | ||
x: 600, | ||
y: 300, | ||
}, | ||
force: true, | ||
}); | ||
cy.get(".sticky-note-content").dblclick(); | ||
cy.get(".sticky-note-content textarea").type("# Title\n- p1\n- p2\n\n[link](href)"); | ||
cy.get("[model-id='request']").click(); | ||
cy.get("[data-testid=graphPage]").matchImage(screenshotOptions); | ||
}); | ||
|
||
it("should disable sticky note when scenario is not saved", () => { | ||
cy.layoutScenario(); | ||
cy.contains(/^sticky notes$/i) | ||
.should("exist") | ||
.scrollIntoView(); | ||
|
||
cy.dragNode("request", { x: 600, y: 300 }); | ||
|
||
cy.get("[data-testid='component:sticky note']").should("have.class", "tool disabled"); | ||
cy.get("[data-testid=graphPage]").matchImage(screenshotOptions); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"metaData": { | ||
"id": "sticky", | ||
"additionalFields": { | ||
"description": null, | ||
"properties": { | ||
"inputSchema": "{}", | ||
"outputSchema": "{}", | ||
"slug": "sticky" | ||
}, | ||
"metaDataType": "RequestResponseMetaData", | ||
"showDescription": false | ||
} | ||
}, | ||
"nodes": [ | ||
{ | ||
"id": "request", | ||
"ref": { | ||
"typ": "request", | ||
"parameters": [] | ||
}, | ||
"additionalFields": { | ||
"description": null, | ||
"layoutData": { | ||
"x": 0, | ||
"y": 0 | ||
} | ||
}, | ||
"type": "Source" | ||
}, | ||
{ | ||
"id": "response", | ||
"ref": { | ||
"typ": "response", | ||
"parameters": [ | ||
{ | ||
"name": "Raw editor", | ||
"expression": { | ||
"language": "spel", | ||
"expression": "false" | ||
} | ||
} | ||
] | ||
}, | ||
"endResult": null, | ||
"isDisabled": null, | ||
"additionalFields": { | ||
"description": null, | ||
"layoutData": { | ||
"x": 0, | ||
"y": 180 | ||
} | ||
}, | ||
"type": "Sink" | ||
} | ||
], | ||
"additionalBranches": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { LayoutData } from "../types"; | ||
|
||
export type Dimensions = { width: number; height: number }; | ||
export type ColorValueHex = `#${string}`; | ||
|
||
export interface StickyNote { | ||
id?: string; | ||
noteId: number; | ||
content: string; | ||
layoutData: LayoutData; | ||
dimensions: Dimensions; | ||
color: ColorValueHex; | ||
targetEdge?: string; | ||
editedBy: string; | ||
editedAt: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { css, cx } from "@emotion/css"; | ||
import React from "react"; | ||
import { BORDER_RADIUS, CONTENT_PADDING, iconBackgroundSize, iconSize } from "./graph/EspNode/esp"; | ||
import { PreloadedIcon, stickyNoteIconSrc } from "./toolbars/creator/ComponentIcon"; | ||
import { alpha, useTheme } from "@mui/material"; | ||
import { getBorderColor, getStickyNoteBackgroundColor } from "../containers/theme/helpers"; | ||
import { STICKY_NOTE_CONSTRAINTS, STICKY_NOTE_DEFAULT_COLOR } from "./graph/EspNode/stickyNote"; | ||
|
||
const PREVIEW_SCALE = 0.9; | ||
const ACTIVE_ROTATION = 2; | ||
const INACTIVE_SCALE = 1.5; | ||
|
||
export function StickyNotePreview({ isActive, isOver }: { isActive?: boolean; isOver?: boolean }): JSX.Element { | ||
const theme = useTheme(); | ||
const scale = isOver ? 1 : PREVIEW_SCALE; | ||
const rotation = isActive ? (isOver ? -ACTIVE_ROTATION : ACTIVE_ROTATION) : 0; | ||
const finalScale = isActive ? 1 : INACTIVE_SCALE; | ||
|
||
const nodeStyles = css({ | ||
position: "relative", | ||
width: STICKY_NOTE_CONSTRAINTS.DEFAULT_WIDTH, | ||
height: STICKY_NOTE_CONSTRAINTS.DEFAULT_HEIGHT, | ||
borderRadius: BORDER_RADIUS, | ||
boxSizing: "content-box", | ||
display: "inline-flex", | ||
filter: `drop-shadow(0 4px 8px ${alpha(theme.palette.common.black, 0.5)})`, | ||
borderWidth: 0.5, | ||
borderStyle: "solid", | ||
transformOrigin: "80% 50%", | ||
transform: `translate(-80%, -50%) scale(${scale}) rotate(${rotation}deg) scale(${finalScale})`, | ||
opacity: isActive ? undefined : 0, | ||
transition: "all .5s, opacity .3s", | ||
willChange: "transform, opacity, border-color, background-color", | ||
}); | ||
|
||
const colors = css({ | ||
opacity: 0.5, | ||
borderColor: getBorderColor(theme), | ||
backgroundColor: getStickyNoteBackgroundColor(theme, STICKY_NOTE_DEFAULT_COLOR).main, | ||
}); | ||
|
||
const imageStyles = css({ | ||
padding: iconSize / 2 - CONTENT_PADDING / 2, | ||
margin: CONTENT_PADDING / 2, | ||
borderRadius: BORDER_RADIUS, | ||
width: iconBackgroundSize / 2, | ||
height: iconBackgroundSize / 2, | ||
color: theme.palette.common.black, | ||
"> svg": { | ||
height: iconSize, | ||
width: iconSize, | ||
}, | ||
}); | ||
|
||
return ( | ||
<div className={cx(colors, nodeStyles)}> | ||
<div className={cx(imageStyles, colors)}> | ||
<PreloadedIcon src={stickyNoteIconSrc} /> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.