diff --git a/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_DOWNLOAD/FLOJOY_CLOUD_DOWNLOAD.py b/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_DOWNLOAD/FLOJOY_CLOUD_DOWNLOAD.py index 4e3009774..9ab654644 100644 --- a/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_DOWNLOAD/FLOJOY_CLOUD_DOWNLOAD.py +++ b/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_DOWNLOAD/FLOJOY_CLOUD_DOWNLOAD.py @@ -16,7 +16,7 @@ @node_preflight def preflight(): - api_key = get_env_var("FLOJOY_CLOUD_KEY") + api_key = get_env_var("FLOJOY_CLOUD_WORKSPACE_SECRET") if api_key is None: raise KeyError( @@ -41,7 +41,7 @@ def FLOJOY_CLOUD_DOWNLOAD( The downloaded DataContainer will be returned as it is. """ - api_key = get_env_var("FLOJOY_CLOUD_KEY") + api_key = get_env_var("FLOJOY_CLOUD_WORKSPACE_SECRET") if api_key is None: raise KeyError( diff --git a/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_UPLOAD/FLOJOY_CLOUD_UPLOAD.py b/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_UPLOAD/FLOJOY_CLOUD_UPLOAD.py index a1d676b3c..7c0d7f0c5 100644 --- a/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_UPLOAD/FLOJOY_CLOUD_UPLOAD.py +++ b/blocks/ETL/LOAD/CLOUD_DATABASE/FLOJOY_CLOUD_UPLOAD/FLOJOY_CLOUD_UPLOAD.py @@ -26,7 +26,7 @@ @node_preflight def preflight(): - api_key = get_env_var("FLOJOY_CLOUD_KEY") + api_key = get_env_var("FLOJOY_CLOUD_WORKSPACE_SECRET") if api_key is None: raise KeyError( @@ -65,7 +65,7 @@ def FLOJOY_CLOUD_UPLOAD( The input DataContainer will be returned as it is. """ - api_key = get_env_var("FLOJOY_CLOUD_KEY") + api_key = get_env_var("FLOJOY_CLOUD_WORKSPACE_SECRET") if api_key is None: raise KeyError( diff --git a/captain/routes/cloud.py b/captain/routes/cloud.py index bf0dfcbab..e7728d268 100644 --- a/captain/routes/cloud.py +++ b/captain/routes/cloud.py @@ -1,8 +1,8 @@ import json from fastapi import APIRouter, Response -from flojoy_cloud.client import FlojoyCloud from flojoy.env_var import get_env_var +from flojoy_cloud.client import FlojoyCloud router = APIRouter(tags=["cloud"]) @@ -12,11 +12,11 @@ async def get_cloud_projects(): """ Get all projects from the Flojoy Cloud. """ - workspace_secret = get_env_var("FLOJOY_CLOUD_KEY") + workspace_secret = get_env_var("FLOJOY_CLOUD_WORKSPACE_SECRET") if workspace_secret is None: return Response(status_code=401, content=json.dumps([])) - cloud = FlojoyCloud(workspace_secret=get_env_var("FLOJOY_CLOUD_KEY")) + cloud = FlojoyCloud(workspace_secret=workspace_secret) projects = cloud.get_all_projects( "" diff --git a/captain/utils/test_sequencer/run_test_sequence.py b/captain/utils/test_sequencer/run_test_sequence.py index 17a705fc2..abd1b4c1f 100644 --- a/captain/utils/test_sequencer/run_test_sequence.py +++ b/captain/utils/test_sequencer/run_test_sequence.py @@ -300,7 +300,9 @@ def _case_test_upload(node: TestNode, hardware_id: str, project_id: str) -> Extr if node.completion_time is None: raise Exception(f"{node.id}: Can't upload a test that wasn't run") if node.export_to_cloud: - cloud = FlojoyCloud(workspace_secret=get_env_var("FLOJOY_CLOUD_KEY")) + cloud = FlojoyCloud( + workspace_secret=get_env_var("FLOJOY_CLOUD_WORKSPACE_SECRET") + ) def reverse_id(test_name) -> str: tests = cloud.get_all_tests_by_project_id(project_id) diff --git a/playwright-test/10_env_modal.spec.ts b/playwright-test/10_env_modal.spec.ts index 466e913b1..b1c4d168d 100644 --- a/playwright-test/10_env_modal.spec.ts +++ b/playwright-test/10_env_modal.spec.ts @@ -58,8 +58,10 @@ test.describe("Environment modal", () => { await window.getByTestId(Selectors.flojoyCloudApiSubmit).click(); try { - // Expect "FLOJOY_CLOUD_KEY" to be listed in the modal - await expect(window.getByText("FLOJOY_CLOUD_KEY")).toBeVisible({ + // Expect "FLOJOY_CLOUD_WORKSPACE_SECRET" to be listed in the modal + await expect( + window.getByText("FLOJOY_CLOUD_WORKSPACE_SECRET"), + ).toBeVisible({ timeout: 20000, }); } catch (error) { diff --git a/src/renderer/index.tsx b/src/renderer/index.tsx index 4cb5e8dfb..d1a86bd4a 100644 --- a/src/renderer/index.tsx +++ b/src/renderer/index.tsx @@ -14,8 +14,10 @@ import { HashRouter } from "react-router-dom"; import { AuthContextProvider } from "./context/auth.context"; import { ThemeProvider } from "./providers/theme-provider"; import { TestSequencerWSProvider } from "./context/testSequencerWS.context"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; const root = createRoot(document.getElementById("root") as HTMLElement); +const queryClient = new QueryClient(); function fallbackRender({ error, resetErrorBoundary }) { return ; @@ -26,11 +28,13 @@ root.render( - - - - - + + + + + + + , diff --git a/src/renderer/routes/flow_chart/views/env-var/EnvVarModal.tsx b/src/renderer/routes/flow_chart/views/env-var/EnvVarModal.tsx index 6bf7c3c24..030fb0353 100644 --- a/src/renderer/routes/flow_chart/views/env-var/EnvVarModal.tsx +++ b/src/renderer/routes/flow_chart/views/env-var/EnvVarModal.tsx @@ -100,23 +100,21 @@ const EnvVarModal = () => { const handleSetCloudKey = async () => { if (flojoyCloudKey === "") { - toast("Please enter your Flojoy Cloud API key"); + toast("Please enter your Flojoy Cloud workspace secret"); return; } const res = await postEnvironmentVariable({ - key: "FLOJOY_CLOUD_KEY", + key: "FLOJOY_CLOUD_WORKSPACE_SECRET", value: flojoyCloudKey, }); res.match( () => { - toast( - "Successfully set your Flojoy Cloud API key, let's stream some data to the cloud!", - ); + toast("Successfully set your Flojoy Cloud workspace secret!"); setFlojoyCloudKey(""); fetchCredentials(); }, (e) => { - toast("Error adding your Flojoy Cloud API key", { + toast("Error adding your Flojoy Cloud workspace secret", { description: e.message, }); }, @@ -140,7 +138,7 @@ const EnvVarModal = () => { target="_blank" className="text-sm underline" > - Get your Flojoy Cloud API key + Get your Flojoy Cloud workspace secret (in your workspace settings)
@@ -150,7 +148,7 @@ const EnvVarModal = () => { onChange={(e) => setFlojoyCloudKey(e.target.value)} className="bg-modal" data-testid="flojoy-cloud-api-input" - placeholder="Paste your Flojoy Cloud API key here :)" + placeholder="Paste your Flojoy Cloud workspace secret here :)" /> + ); + } return (
@@ -75,24 +123,18 @@ export function CloudPanel() { - {projects.length === 0 && ( + {projectsQuery.data.length === 0 && (
No projects found -

Did you forget to set Flojoy Cloud API key?

-
- - -
+
)} - {projects.map((option) => ( + {projectsQuery.data.map((option) => ( {option.label}