From 546e7527058ff2e1acaf9cd2c363ade94cd48215 Mon Sep 17 00:00:00 2001 From: frikky Date: Wed, 24 Aug 2022 01:01:54 +0200 Subject: [PATCH] Fixed multiple issues with how files are downloaded and uploaded --- backend/go-app/go.mod | 2 +- docker-compose.yml | 76 ++++++++++++------------- frontend/src/components/CreatorGrid.jsx | 3 +- frontend/src/views/Admin.jsx | 27 ++++----- frontend/src/views/Dashboard.jsx | 4 +- frontend/src/views/Search.jsx | 2 +- frontend/src/views/Workflows.jsx | 4 +- 7 files changed, 55 insertions(+), 63 deletions(-) diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index f6c8d495..02bdc660 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -24,7 +24,7 @@ require ( github.com/h2non/filetype v1.1.3 github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.2.79 + github.com/shuffle/shuffle-shared v0.2.87 go4.org v0.0.0-20201209231011-d4a079459e60 // indirect golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce google.golang.org/api v0.65.0 diff --git a/docker-compose.yml b/docker-compose.yml index 7c619ae9..6cde7541 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,43 +1,43 @@ version: '3' services: - #frontend: - # #build: ./frontend - # image: ghcr.io/frikky/shuffle-frontend:nightly - # container_name: shuffle-frontend - # hostname: shuffle-frontend - # ports: - # - "${FRONTEND_PORT}:80" - # - "${FRONTEND_PORT_HTTPS}:443" - # networks: - # - shuffle - # environment: - # - BACKEND_HOSTNAME=${BACKEND_HOSTNAME} - # restart: unless-stopped - # depends_on: - # - backend - #backend: - # #build: ./backend - # image: ghcr.io/frikky/shuffle-backend:nightly - # container_name: shuffle-backend - # hostname: ${BACKEND_HOSTNAME} - # # Here for debugging: - # ports: - # - "${BACKEND_PORT}:5001" - # networks: - # - shuffle - # volumes: - # - /var/run/docker.sock:/var/run/docker.sock - # - ${SHUFFLE_APP_HOTLOAD_LOCATION}:/shuffle-apps:z - # - ${SHUFFLE_FILE_LOCATION}:/shuffle-files:z - # #- ${SHUFFLE_OPENSEARCH_CERTIFICATE_FILE}:/shuffle-files/es_certificate - # env_file: .env - # environment: - # #- DOCKER_HOST=tcp://docker-socket-proxy:2375 - # - SHUFFLE_APP_HOTLOAD_FOLDER=/shuffle-apps - # - SHUFFLE_FILE_LOCATION=/shuffle-files - # restart: unless-stopped - # #depends_on: - # #- opensearch #Not necessary because dependancy is handled within the backend itself instead + frontend: + #build: ./frontend + image: ghcr.io/frikky/shuffle-frontend:nightly + container_name: shuffle-frontend + hostname: shuffle-frontend + ports: + - "${FRONTEND_PORT}:80" + - "${FRONTEND_PORT_HTTPS}:443" + networks: + - shuffle + environment: + - BACKEND_HOSTNAME=${BACKEND_HOSTNAME} + restart: unless-stopped + depends_on: + - backend + backend: + #build: ./backend + image: ghcr.io/frikky/shuffle-backend:nightly + container_name: shuffle-backend + hostname: ${BACKEND_HOSTNAME} + # Here for debugging: + ports: + - "${BACKEND_PORT}:5001" + networks: + - shuffle + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ${SHUFFLE_APP_HOTLOAD_LOCATION}:/shuffle-apps:z + - ${SHUFFLE_FILE_LOCATION}:/shuffle-files:z + #- ${SHUFFLE_OPENSEARCH_CERTIFICATE_FILE}:/shuffle-files/es_certificate + env_file: .env + environment: + #- DOCKER_HOST=tcp://docker-socket-proxy:2375 + - SHUFFLE_APP_HOTLOAD_FOLDER=/shuffle-apps + - SHUFFLE_FILE_LOCATION=/shuffle-files + restart: unless-stopped + #depends_on: + #- opensearch #Not necessary because dependancy is handled within the backend itself instead #- database orborus: image: ghcr.io/frikky/shuffle-orborus:nightly diff --git a/frontend/src/components/CreatorGrid.jsx b/frontend/src/components/CreatorGrid.jsx index e1007749..00e4144e 100644 --- a/frontend/src/components/CreatorGrid.jsx +++ b/frontend/src/components/CreatorGrid.jsx @@ -37,7 +37,6 @@ import { PlayArrow as PlayArrowIcon, } from "@material-ui/icons"; -import WorkflowPaper from "../components/WorkflowPaper.jsx" const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240") const CreatorGrid = props => { @@ -174,7 +173,7 @@ const CreatorGrid = props => { - 10 apps 23 workflows + {data.apps} apps {data.workflows} workflows {data.specialized_apps !== undefined && data.specialized_apps !== null && data.specialized_apps.length > 0 ? diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 5c7d954c..a5ad30da 100644 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -1338,20 +1338,18 @@ const Admin = (props) => { const downloadFile = (file) => { fetch(globalUrl + "/api/v1/files/" + file.id + "/content", { method: "GET", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, credentials: "include", }) - .then((response) => { - if (response.status !== 200) { - console.log("Status not 200 for apps :O!"); - return ""; - } + .then((response) => { + if (response.status !== 200) { + console.log("Status not 200 for apps :O!"); + return ""; + } - return response.text(); - }) + console.log("Resp: ", response) + + return response.blob() + }) .then((respdata) => { if (respdata.length === 0) { alert.error("Failed getting file. Is it deleted?"); @@ -1591,18 +1589,13 @@ const Admin = (props) => { document.title = "Shuffle - admin"; } - console.log("NEWVALUE: ", newValue); - if (newValue === 6) { console.log("Should get apps for categories."); } - console.log("PROPS: ", props); - navigate(`/admin?tab=${views[newValue]}`); - setModalUser({}); - }; + } if (firstRequest) { setFirstRequest(false); diff --git a/frontend/src/views/Dashboard.jsx b/frontend/src/views/Dashboard.jsx index e7b63ebd..6fff22af 100644 --- a/frontend/src/views/Dashboard.jsx +++ b/frontend/src/views/Dashboard.jsx @@ -776,7 +776,9 @@ const UsecaseListComponent = ({keys, isCloud, globalUrl, frameworkData, isLogged var baseTypeInfo = subcase.type !== undefined ? subcase.type : "communication" if (frameworkData !== undefined && frameworkData !== null) { if (frameworkData[baseTypeInfo] !== undefined && frameworkData[baseTypeInfo] !== null && subdata.app !== undefined && subdata.app !== null) { - if (frameworkData[baseTypeInfo].name.toLowerCase().replaceAll("_", " ") === subdata.app.toLowerCase().replaceAll("_", " ")) { + console.log("Name: ", frameworkData[baseTypeInfo], baseTypeInfo) + console.log("Name2: ", subdata.app) + if (frameworkData[baseTypeInfo].name !== undefined && frameworkData[baseTypeInfo].name.toLowerCase().replaceAll("_", " ") === subdata.app.toLowerCase().replaceAll("_", " ")) { highlight = true } } diff --git a/frontend/src/views/Search.jsx b/frontend/src/views/Search.jsx index 9fedc697..b936dccf 100644 --- a/frontend/src/views/Search.jsx +++ b/frontend/src/views/Search.jsx @@ -164,7 +164,7 @@ const Search = (props) => { : curTab === 3 ? - + : null} diff --git a/frontend/src/views/Workflows.jsx b/frontend/src/views/Workflows.jsx index 7f59fe1b..658f2e87 100644 --- a/frontend/src/views/Workflows.jsx +++ b/frontend/src/views/Workflows.jsx @@ -2949,9 +2949,7 @@ const Workflows = (props) => { const WorkflowView = () => { if (workflows.length === 0) { - console.log("USER: ", userdata) - console.log("PROPS: ", props) - if (userdata.tutorials !== undefined && userdata.tutorials !== null && !userdata.tutorials.includes("getting-started")) { + if ((userdata.tutorials !== undefined && userdata.tutorials !== null && !userdata.tutorials.includes("getting-started")) || userdata.tutorials === null) { return ; }