diff --git a/backend/Cargo.lock b/backend/Cargo.lock index b1b383e32c..60915c22ff 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -4095,7 +4095,7 @@ dependencies = [ [[package]] name = "windmill-api" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "argon2", @@ -4146,7 +4146,7 @@ dependencies = [ [[package]] name = "windmill-api-client" -version = "1.56.1" +version = "1.57.0" dependencies = [ "base64", "chrono", @@ -4161,7 +4161,7 @@ dependencies = [ [[package]] name = "windmill-audit" -version = "1.56.1" +version = "1.57.0" dependencies = [ "chrono", "serde", @@ -4174,7 +4174,7 @@ dependencies = [ [[package]] name = "windmill-common" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "axum", @@ -4198,7 +4198,7 @@ dependencies = [ [[package]] name = "windmill-parser" -version = "1.56.1" +version = "1.57.0" dependencies = [ "serde", "serde_json", @@ -4206,7 +4206,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "itertools", @@ -4220,7 +4220,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "itertools", @@ -4232,7 +4232,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "itertools", @@ -4247,7 +4247,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "deno_core", @@ -4261,7 +4261,7 @@ dependencies = [ [[package]] name = "windmill-queue" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "chrono", @@ -4284,7 +4284,7 @@ dependencies = [ [[package]] name = "windmill-worker" -version = "1.56.1" +version = "1.57.0" dependencies = [ "anyhow", "async-recursion", diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index d257fa44df..27bc940344 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -1436,7 +1436,10 @@ paths: required: true content: application/json: - schema: {} + schema: + type: object + properties: + value: {} responses: "200": description: resource value updated diff --git a/backend/windmill-api/src/resources.rs b/backend/windmill-api/src/resources.rs index b59b78c49f..5219d632f8 100644 --- a/backend/windmill-api/src/resources.rs +++ b/backend/windmill-api/src/resources.rs @@ -403,18 +403,23 @@ async fn update_resource( Ok(format!("resource {} updated (npath: {:?})", path, npath)) } +#[derive(FromRow, Serialize, Deserialize)] +struct UpdateResource { + value: Option, +} + async fn update_resource_value( authed: Authed, Extension(user_db): Extension, Path((w_id, path)): Path<(String, StripPath)>, - Json(nv): Json, + Json(nv): Json, ) -> Result { let path = path.to_path(); let mut tx = user_db.begin(&authed).await?; sqlx::query!( "UPDATE resource SET value = $1 WHERE path = $2 AND workspace_id = $3", - nv, + nv.value, path, w_id ) diff --git a/deno-client/mod.ts b/deno-client/mod.ts index 44d298f3b2..52ed882ec5 100644 --- a/deno-client/mod.ts +++ b/deno-client/mod.ts @@ -72,7 +72,7 @@ export async function setResource(value: any, path?: string, initializeToTypeIfN path = path ?? getStatePath() const workspace = getWorkspace() if (await ResourceService.existsResource({ workspace, path })) { - await ResourceService.updateResourceValue({ workspace, path, requestBody: value }) + await ResourceService.updateResourceValue({ workspace, path, requestBody: { value } }) } else if (initializeToTypeIfNotExist) { await ResourceService.createResource({ workspace, requestBody: { path, value, resource_type: initializeToTypeIfNotExist } }) } else { diff --git a/frontend/src/lib/components/PageHeader.svelte b/frontend/src/lib/components/PageHeader.svelte index d09c1daf51..627d37df18 100644 --- a/frontend/src/lib/components/PageHeader.svelte +++ b/frontend/src/lib/components/PageHeader.svelte @@ -8,7 +8,7 @@
{#if primary} - +

{title}

{#if tooltip} {tooltip} diff --git a/frontend/src/lib/components/home/ItemsList.svelte b/frontend/src/lib/components/home/ItemsList.svelte index b15303dd74..67300180bc 100644 --- a/frontend/src/lib/components/home/ItemsList.svelte +++ b/frontend/src/lib/components/home/ItemsList.svelte @@ -227,8 +227,8 @@ /> -
-
+
+
All @@ -252,7 +252,7 @@
-
+
{/if} -
+
{#if !$userStore?.operator} diff --git a/frontend/src/routes/(root)/(logged)/resources/+page.svelte b/frontend/src/routes/(root)/(logged)/resources/+page.svelte index 153a5aa068..4e75c1ef33 100644 --- a/frontend/src/routes/(root)/(logged)/resources/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/resources/+page.svelte @@ -277,7 +277,7 @@ title="Resources" tooltip="Save and permission rich objects (JSON) including credentials obtained through OAuth." > -
+
diff --git a/frontend/src/routes/(root)/(logged)/variables/+page.svelte b/frontend/src/routes/(root)/(logged)/variables/+page.svelte index e301a4027d..e94f55ec9b 100644 --- a/frontend/src/routes/(root)/(logged)/variables/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/variables/+page.svelte @@ -108,9 +108,11 @@ title="Variables" tooltip="Save and permission strings to be reused in Scripts and Flows." > - +
+ +
diff --git a/go-client/windmill.go b/go-client/windmill.go index b153fcaeb4..8f90bf0896 100644 --- a/go-client/windmill.go +++ b/go-client/windmill.go @@ -73,7 +73,10 @@ func SetResource(path string, value interface{}) error { if err != nil { return err } - res, err := client.Client.UpdateResourceValueWithResponse(context.Background(), client.Workspace, path, value) + res, err := client.Client.UpdateResourceValueWithResponse( + context.Background(), + client.Workspace, path, + api.UpdateResourceValueJSONRequestBody{Value: &value}) if err != nil { return err } diff --git a/python-client/wmill/wmill/client.py b/python-client/wmill/wmill/client.py index e423824ba4..5ce4098d45 100644 --- a/python-client/wmill/wmill/client.py +++ b/python-client/wmill/wmill/client.py @@ -203,6 +203,9 @@ def set_resource( Set the resource at a given path as a string, creating it if it does not exist """ from windmill_api.models.create_resource_json_body import CreateResourceJsonBody + from windmill_api.models.update_resource_value_json_body import ( + UpdateResourceValueJsonBody, + ) from windmill_api.api.resource import ( exists_resource, update_resource_value, @@ -227,7 +230,7 @@ def set_resource( workspace=get_workspace(), client=client, path=path, - json_body=value, + json_body=UpdateResourceValueJsonBody(value=value), )