Added state grouping in async function to make rendering 100000x faster for node clicks <33333

This commit is contained in:
frikky
2022-02-07 22:14:16 +01:00
parent 546f0bd841
commit e950212274
9 changed files with 436 additions and 422 deletions
+4 -4
View File
@@ -61,10 +61,10 @@ SHUFFLE_ELASTIC=true
# DATABASE CONFIGURATIONS # DATABASE CONFIGURATIONS
DATASTORE_EMULATOR_HOST=shuffle-database:8000 DATASTORE_EMULATOR_HOST=shuffle-database:8000
#SHUFFLE_OPENSEARCH_URL=https://shuffle-opensearch:9200 #SHUFFLE_OPENSEARCH_URL=http://shuffle-opensearch:9200
SHUFFLE_OPENSEARCH_URL=http://shuffle-opensearch:9200 SHUFFLE_OPENSEARCH_URL=https://shuffle-opensearch:9200
SHUFFLE_OPENSEARCH_USERNAME= SHUFFLE_OPENSEARCH_USERNAME=admin
SHUFFLE_OPENSEARCH_PASSWORD= SHUFFLE_OPENSEARCH_PASSWORD=admin
SHUFFLE_OPENSEARCH_CERTIFICATE_FILE= SHUFFLE_OPENSEARCH_CERTIFICATE_FILE=
SHUFFLE_OPENSEARCH_APIKEY= SHUFFLE_OPENSEARCH_APIKEY=
SHUFFLE_OPENSEARCH_CLOUDID= SHUFFLE_OPENSEARCH_CLOUDID=
+1 -1
View File
@@ -2321,7 +2321,7 @@ class AppBase:
return True, "" return True, ""
self.logger.info("[DEBUG] Correct branches vs matching branches: %d vs %d" % (correct_branches, matching_branches)) self.logger.info("[DEBUG] Correct branches vs matching branches: %d vs %d" % (correct_branches, matching_branches))
return False, {"success": False, "reason": "Minimum of one branch must be correct. Total: %d of %d" % (correct_branches, matching_branches)} return False, {"success": False, "reason": "Minimum of one branch's conditions must be correct to continue. Total: %d of %d" % (correct_branches, matching_branches)}
#Correct branches vs matching branches: 1 vs 1 #Correct branches vs matching branches: 1 vs 1
#if #if
+2 -2
View File
@@ -2,7 +2,7 @@ module main
go 1.16 go 1.16
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared //replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch //replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
@@ -24,7 +24,7 @@ require (
github.com/h2non/filetype v1.1.3 github.com/h2non/filetype v1.1.3
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.1.95 github.com/shuffle/shuffle-shared v0.1.97
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
google.golang.org/api v0.65.0 google.golang.org/api v0.65.0
+3 -6
View File
@@ -16,7 +16,7 @@ services:
depends_on: depends_on:
- backend - backend
backend: backend:
build: ./backend #build: ./backend
image: ghcr.io/frikky/shuffle-backend:nightly image: ghcr.io/frikky/shuffle-backend:nightly
container_name: shuffle-backend container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME} hostname: ${BACKEND_HOSTNAME}
@@ -50,7 +50,7 @@ services:
- SHUFFLE_WORKER_VERSION=nightly - SHUFFLE_WORKER_VERSION=nightly
- ORG_ID=${ORG_ID} - ORG_ID=${ORG_ID}
- ENVIRONMENT_NAME=${ENVIRONMENT_NAME} - ENVIRONMENT_NAME=${ENVIRONMENT_NAME}
- BASE_URL=https://${OUTER_HOSTNAME}:${BACKEND_PORT} - BASE_URL=http://${OUTER_HOSTNAME}:${BACKEND_PORT}
- DOCKER_API_VERSION=1.40 - DOCKER_API_VERSION=1.40
- SHUFFLE_BASE_IMAGE_NAME=${SHUFFLE_BASE_IMAGE_NAME} - SHUFFLE_BASE_IMAGE_NAME=${SHUFFLE_BASE_IMAGE_NAME}
- SHUFFLE_BASE_IMAGE_REGISTRY=${SHUFFLE_BASE_IMAGE_REGISTRY} - SHUFFLE_BASE_IMAGE_REGISTRY=${SHUFFLE_BASE_IMAGE_REGISTRY}
@@ -69,8 +69,7 @@ services:
container_name: shuffle-opensearch container_name: shuffle-opensearch
environment: environment:
- bootstrap.memory_lock=true - bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms1024m -Xmx1024m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM - "OPENSEARCH_JAVA_OPTS=-Xms2048m -Xmx2048m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
- plugins.security.disabled=true
- cluster.routing.allocation.disk.threshold_enabled=false - cluster.routing.allocation.disk.threshold_enabled=false
- cluster.name=shuffle-cluster - cluster.name=shuffle-cluster
- node.name=shuffle-opensearch - node.name=shuffle-opensearch
@@ -86,8 +85,6 @@ services:
hard: 65536 hard: 65536
volumes: volumes:
- ${DB_LOCATION}:/usr/share/opensearch/data:rw - ${DB_LOCATION}:/usr/share/opensearch/data:rw
ports:
- 9200:9200
networks: networks:
- shuffle - shuffle
restart: unless-stopped restart: unless-stopped
+25 -12
View File
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useLayoutEffect } from "react"; import React, { useState, useEffect, useLayoutEffect } from "react";
import ReactDOM from "react-dom"
import { useInterval } from "react-powerhooks"; import { useInterval } from "react-powerhooks";
import { makeStyles, useTheme } from "@material-ui/core/styles"; import { makeStyles, useTheme } from "@material-ui/core/styles";
@@ -1565,7 +1566,8 @@ const AngularWorkflow = (defaultprops) => {
console.log("RESP: ", responseJson) console.log("RESP: ", responseJson)
if (Object.getOwnPropertyNames(creatorProfile).length === 0) { if (Object.getOwnPropertyNames(creatorProfile).length === 0) {
getUserProfile("frikky") //getUserProfile("frikky")
getUserProfile(responseJson.id)
} }
//{appGroup.map((data, index) => { //{appGroup.map((data, index) => {
@@ -1775,26 +1777,28 @@ const AngularWorkflow = (defaultprops) => {
} }
*/ */
cy.removeListener("select"); //cy.removeListener("select");
cy.on("select", "node", (e) => onNodeSelect(e, appAuthentication)); //cy.on("select", "node", (e) => onNodeSelect(e, appAuthentication));
cy.on("select", "edge", (e) => onEdgeSelect(e)); //cy.on("select", "edge", (e) => onEdgeSelect(e));
// FIXME - check if they have value before overriding like this for no reason. // FIXME - check if they have value before overriding like this for no reason.
// Would save a lot of time (400~ ms -> 30ms) // Would save a lot of time (400~ ms -> 30ms)
//console.log("ACTION: ", selectedAction) //console.log("ACTION: ", selectedAction)
//console.log("APP: ", selectedApp) //console.log("APP: ", selectedApp)
ReactDOM.unstable_batchedUpdates(() => {
setSelectedAction({}); setSelectedAction({});
setSelectedApp({}); setSelectedApp({});
setSelectedTrigger({}); setSelectedTrigger({});
setSelectedComment({}) setSelectedComment({})
//setSelectedEdge({})
// setSelectedTriggerIndex(-1)
//setSelectedActionEnvironment({})
setSelectedEdge({}); setSelectedEdge({});
//setTriggerAuthentication({})
//setSelectedTriggerIndex(-1) setSelectedEdge({})
//setTriggerFolders([]) setSelectedActionEnvironment({})
setTriggerAuthentication({})
setSelectedTriggerIndex(-1)
setTriggerFolders([])
// Can be used for right side view // Can be used for right side view
setRightSideBarOpen(false); setRightSideBarOpen(false);
@@ -1804,9 +1808,11 @@ const AngularWorkflow = (defaultprops) => {
selected: "", selected: "",
}); });
console.timeEnd("UNSELECT"); console.timeEnd("UNSELECT");
})
}; };
const onEdgeSelect = (event) => { const onEdgeSelect = (event) => {
ReactDOM.unstable_batchedUpdates(() => {
setRightSideBarOpen(true); setRightSideBarOpen(true);
setLastSaved(false); setLastSaved(false);
@@ -1847,6 +1853,7 @@ const AngularWorkflow = (defaultprops) => {
setSelectedAction({}); setSelectedAction({});
setSelectedTrigger({}); setSelectedTrigger({});
})
}; };
// Comparing locations between nodes and setting views // Comparing locations between nodes and setting views
@@ -2178,6 +2185,8 @@ const AngularWorkflow = (defaultprops) => {
// https://stackoverflow.com/questions/16677856/cy-onselect-callback-only-once // https://stackoverflow.com/questions/16677856/cy-onselect-callback-only-once
// onNodeClick // onNodeClick
const onNodeSelect = (event, newAppAuth) => { const onNodeSelect = (event, newAppAuth) => {
// Otherwise everything is SUPER slow
ReactDOM.unstable_batchedUpdates(() => {
const data = event.target.data(); const data = event.target.data();
if (data.isButton) { if (data.isButton) {
if (data.buttonType === "delete") { if (data.buttonType === "delete") {
@@ -2526,12 +2535,14 @@ const AngularWorkflow = (defaultprops) => {
} }
setRightSideBarOpen(true); setRightSideBarOpen(true);
setSelectedComment({})
setLastSaved(false); setLastSaved(false);
setScrollConfig({ setScrollConfig({
top: 0, top: 0,
left: 0, left: 0,
selected: "", selected: "",
}); });
})
}; };
const activateApp = (appid) => { const activateApp = (appid) => {
@@ -10590,6 +10601,7 @@ const AngularWorkflow = (defaultprops) => {
//}}>Execute websocket</Button> //}}>Execute websocket</Button>
// //
// Searhc by username, userId, workflow, appId should all work
const getUserProfile = (username) => { const getUserProfile = (username) => {
fetch(`${globalUrl}/api/v1/users/creators/${username}`, { fetch(`${globalUrl}/api/v1/users/creators/${username}`, {
method: "GET", method: "GET",
@@ -10608,6 +10620,7 @@ const AngularWorkflow = (defaultprops) => {
return response.json(); return response.json();
}) })
.then((responseJson) => { .then((responseJson) => {
console.log("Found creator: ", responseJson)
if (responseJson.success !== false) { if (responseJson.success !== false) {
setCreatorProfile(responseJson) setCreatorProfile(responseJson)
} }
@@ -12347,7 +12360,7 @@ const parsedExecutionArgument = () => {
maxZoom={2.0} maxZoom={2.0}
wheelSensitivity={0.25} wheelSensitivity={0.25}
style={{ style={{
width: bodyWidth - leftBarSize - 15, width: bodyWidth - leftBarSize - 25,
height: bodyHeight - appBarSize - 5, height: bodyHeight - appBarSize - 5,
backgroundColor: surfaceColor, backgroundColor: surfaceColor,
}} }}
+4
View File
@@ -225,8 +225,12 @@ const Apps = (props) => {
document.title = "Shuffle - Apps"; document.title = "Shuffle - Apps";
if (!isLoggedIn && isLoaded) { if (!isLoggedIn && isLoaded) {
if (isCloud) {
navigate("/search?tab=apps")
} else {
navigate("/login") navigate("/login")
} }
}
setFirstrequest(false); setFirstrequest(false);
getApps(); getApps();
+1 -1
View File
@@ -856,7 +856,7 @@ const Workflows = (props) => {
console.log("Status not 200 for workflows :O!: ", response.status); console.log("Status not 200 for workflows :O!: ", response.status);
if (isCloud) { if (isCloud) {
window.location.pathname = "/login"; window.location.pathname = "/search?tab=workflows";
} }
alert.info("Failed getting workflows."); alert.info("Failed getting workflows.");
+1 -1
View File
@@ -1,5 +1,5 @@
NAME=shuffle-orborus NAME=shuffle-orborus
VERSION=0.9.51 VERSION=0.9.56
echo "Running docker build with $NAME:$VERSION" echo "Running docker build with $NAME:$VERSION"
#docker rmi frikky/shuffle:$NAME --force #docker rmi frikky/shuffle:$NAME --force
+1 -1
View File
@@ -1,5 +1,5 @@
NAME=shuffle-worker NAME=shuffle-worker
VERSION=0.9.52 VERSION=0.9.55
echo "Running docker build with $NAME:$VERSION" echo "Running docker build with $NAME:$VERSION"
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin . #CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .