BUFIX: Dragged apps spawn in correct location

This commit is contained in:
frikky
2021-05-25 20:31:25 +02:00
parent d3834f52d5
commit c64e24aca9
4 changed files with 218 additions and 198 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ module shuffle
go 1.13
replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared
//replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
@@ -24,7 +24,7 @@ require (
github.com/elastic/go-elasticsearch/v7 v7.12.0 // indirect
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb // indirect
github.com/frikky/kin-openapi v0.39.0
github.com/frikky/shuffle-shared v0.0.49
github.com/frikky/shuffle-shared v0.0.50
github.com/fsouza/go-dockerclient v1.7.2 // indirect
github.com/ghodss/yaml v1.0.0
github.com/go-git/go-billy/v5 v5.0.0
+2
View File
@@ -157,6 +157,8 @@ github.com/frikky/shuffle-shared v0.0.47 h1:fywEmbJGbD/VT9LdkHvLWPGh9HEt8ipFDzoG
github.com/frikky/shuffle-shared v0.0.47/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
github.com/frikky/shuffle-shared v0.0.49 h1:fChF0Nh/bMuXZg67Pt9XXn9+mH4IlKgB3dAzhqwQF5o=
github.com/frikky/shuffle-shared v0.0.49/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
github.com/frikky/shuffle-shared v0.0.50 h1:dQIXf4mwUHuEVsXiMtZaSznz6vWt+C0KjyTAsAgMs3s=
github.com/frikky/shuffle-shared v0.0.50/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc=
github.com/fsouza/go-dockerclient v1.7.2 h1:bBEAcqLTkpq205jooP5RVroUKiVEWgGecHyeZc4OFjo=
github.com/fsouza/go-dockerclient v1.7.2/go.mod h1:+ugtMCVRwnPfY7d8/baCzZ3uwB0BrG5DB8OzbtxaRz8=
github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE=
+2 -2
View File
@@ -2,7 +2,7 @@ version: '3'
services:
frontend:
#build: ./frontend
image: ghcr.io/frikky/shuffle-frontend:0.8.91
image: ghcr.io/frikky/shuffle-frontend:0.8.92
container_name: shuffle-frontend
hostname: shuffle-frontend
ports:
@@ -17,7 +17,7 @@ services:
- backend
backend:
#build: ./backend
image: ghcr.io/frikky/shuffle-backend:0.8.91
image: ghcr.io/frikky/shuffle-backend:0.8.92
container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME}
# Here for debugging:
+39 -21
View File
@@ -3379,8 +3379,30 @@ const AngularWorkflow = (props) => {
}
}
const handleDragStop = (e, app) => {
newNodeId = ""
console.log("STOP!: ", e)
console.log("APP!: ", app)
}
const appScrollStyle = {
overflow: "scroll",
maxHeight: bodyHeight-appBarSize-55-50,
minHeight: bodyHeight-appBarSize-55-50,
marginTop: 1,
overflowY: "auto",
overflowX: "hidden",
}
const AppView = (props) => {
const { allApps, prioritizedApps, filteredApps } = props;
const [visibleApps, setVisibleApps] = React.useState(prioritizedApps.concat(filteredApps.filter(innerapp => !internalIds.includes(innerapp.id))))
const handleAppDrag = (e, app) => {
const cycontainer = cy.container()
console.log("X: ", e.pageX)
console.log("Y: ", e.pageY)
console.log("Height: ", cycontainer.offsetHeight)
// Chrome lol
//if (e.srcElement !== undefined && e.srcElement.localName === "canvas") {
@@ -3391,6 +3413,8 @@ const AngularWorkflow = (props) => {
return
}
console.log("RENDEREDX: ", e.pageX-cycontainer.offsetLeft)
console.log("RENDEREDY: ", e.pageY-cycontainer.offsetTop)
currentnode[0].renderedPosition("x", e.pageX-cycontainer.offsetLeft)
currentnode[0].renderedPosition("y", e.pageY-cycontainer.offsetTop)
} else{
@@ -3459,12 +3483,19 @@ const AngularWorkflow = (props) => {
// FIXME - find the cytoscape offset position
// Can this be done with zoom calculations?
console.log("LAYERX: ", e.layerX)
console.log("LAYERY: ", e.layerY)
console.log("RENDEREDX: ", e.pageX-cycontainer.offsetLeft)
console.log("RENDEREDY: ", e.pageY-cycontainer.offsetTop)
console.log("E: ", e)
const nodeToBeAdded = {
group: "nodes",
data: newAppData,
renderedPosition: {
x: e.layerX,
y: e.layerY,
//x: e.layerX,
//y: e.layerY,
x: e.pageX-cycontainer.offsetLeft,
y: e.pageY-cycontainer.offsetTop,
}
}
@@ -3573,25 +3604,6 @@ const AngularWorkflow = (props) => {
}
}
const handleDragStop = (e, app) => {
newNodeId = ""
console.log("STOP!: ", e)
console.log("APP!: ", app)
}
const appScrollStyle = {
overflow: "scroll",
maxHeight: bodyHeight-appBarSize-55-50,
minHeight: bodyHeight-appBarSize-55-50,
marginTop: 1,
overflowY: "auto",
overflowX: "hidden",
}
const AppView = (props) => {
const { allApps, prioritizedApps, filteredApps } = props;
const [visibleApps, setVisibleApps] = React.useState(prioritizedApps.concat(filteredApps.filter(innerapp => !internalIds.includes(innerapp.id))))
const ParsedAppPaper = (props) => {
const app = props.app
const [hover, setHover] = React.useState(false)
@@ -6845,6 +6857,12 @@ const AngularWorkflow = (props) => {
const elementName = "copy_element_shuffle"
var copyText = document.getElementById(elementName);
if (copyText !== null && copyText !== undefined) {
if (copy.namespace !== undefined && copy.name !== undefined && copy.src !== undefined) {
copy = copy.src
}
console.log("NEW: ", copy)
navigator.clipboard.writeText(JSON.stringify(copy))
copyText.select()
copyText.setSelectionRange(0, 99999) /* For mobile devices */