From 20ecd904e7060c3cf90f2605740bb349b2a3e6ed Mon Sep 17 00:00:00 2001 From: Diego Imbert <70353967+diegoimbert@users.noreply.github.com> Date: Mon, 11 May 2026 20:36:34 +0200 Subject: [PATCH] feat(operators): allow operators to access assets page (#9095) * feat(operators): allow operators to access assets page Adds the "assets" key to workspace operator_settings (defaulting to true for existing and new workspaces) and toggles the frontend default so the assets page is visible to operators by default. Co-Authored-By: Claude Opus 4.7 (1M context) * nit: remove settings btn when not available --------- Co-authored-by: Claude Opus 4.7 (1M context) --- ...5_add_assets_to_operator_settings.down.sql | 19 +++++++++++++ ...225_add_assets_to_operator_settings.up.sql | 21 ++++++++++++++ .../settings/WorkspaceOperatorSettings.svelte | 2 +- .../components/sidebar/SidebarContent.svelte | 1 - .../(root)/(logged)/assets/+page.svelte | 28 ++++++++++++------- 5 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 backend/migrations/20260511075225_add_assets_to_operator_settings.down.sql create mode 100644 backend/migrations/20260511075225_add_assets_to_operator_settings.up.sql diff --git a/backend/migrations/20260511075225_add_assets_to_operator_settings.down.sql b/backend/migrations/20260511075225_add_assets_to_operator_settings.down.sql new file mode 100644 index 0000000000..c38c2a1e42 --- /dev/null +++ b/backend/migrations/20260511075225_add_assets_to_operator_settings.down.sql @@ -0,0 +1,19 @@ +-- Remove "assets" key from operator_settings +UPDATE workspace_settings +SET operator_settings = operator_settings - 'assets' +WHERE operator_settings IS NOT NULL + AND operator_settings ? 'assets'; + +-- Revert the column default +ALTER TABLE workspace_settings +ALTER COLUMN operator_settings SET DEFAULT '{ + "runs": true, + "groups": true, + "folders": true, + "workers": true, + "triggers": true, + "resources": true, + "schedules": true, + "variables": true, + "audit_logs": true +}'; diff --git a/backend/migrations/20260511075225_add_assets_to_operator_settings.up.sql b/backend/migrations/20260511075225_add_assets_to_operator_settings.up.sql new file mode 100644 index 0000000000..96aba860ec --- /dev/null +++ b/backend/migrations/20260511075225_add_assets_to_operator_settings.up.sql @@ -0,0 +1,21 @@ +-- Add "assets": true to operator_settings for all workspaces that have operator_settings +-- but don't already have an "assets" key +UPDATE workspace_settings +SET operator_settings = operator_settings || '{"assets": true}'::jsonb +WHERE operator_settings IS NOT NULL + AND NOT operator_settings ? 'assets'; + +-- Update the column default to include assets +ALTER TABLE workspace_settings +ALTER COLUMN operator_settings SET DEFAULT '{ + "runs": true, + "groups": true, + "folders": true, + "workers": true, + "triggers": true, + "resources": true, + "schedules": true, + "variables": true, + "audit_logs": true, + "assets": true +}'; diff --git a/frontend/src/lib/components/settings/WorkspaceOperatorSettings.svelte b/frontend/src/lib/components/settings/WorkspaceOperatorSettings.svelte index 6aaa69cc53..ba8f42cba7 100644 --- a/frontend/src/lib/components/settings/WorkspaceOperatorSettings.svelte +++ b/frontend/src/lib/components/settings/WorkspaceOperatorSettings.svelte @@ -17,7 +17,7 @@ schedules: true, resources: true, variables: true, - assets: false, + assets: true, triggers: true, audit_logs: true, groups: true, diff --git a/frontend/src/lib/components/sidebar/SidebarContent.svelte b/frontend/src/lib/components/sidebar/SidebarContent.svelte index c2a790264a..f95d242657 100644 --- a/frontend/src/lib/components/sidebar/SidebarContent.svelte +++ b/frontend/src/lib/components/sidebar/SidebarContent.svelte @@ -303,7 +303,6 @@ label: 'Assets', href: `${base}/assets`, icon: Pyramid, - disabled: $userStore?.operator, aiId: 'sidebar-menu-link-assets', aiDescription: 'Button to navigate to assets' }, diff --git a/frontend/src/routes/(root)/(logged)/assets/+page.svelte b/frontend/src/routes/(root)/(logged)/assets/+page.svelte index 50ed6f041b..2873140fea 100644 --- a/frontend/src/routes/(root)/(logged)/assets/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/assets/+page.svelte @@ -12,7 +12,13 @@ type AssetKind, type ListAssetsResponse } from '$lib/gen' - import { userStore, workspaceStore, userWorkspaces, globalDbManagerDrawer } from '$lib/stores' + import { + userStore, + workspaceStore, + userWorkspaces, + globalDbManagerDrawer, + superadmin + } from '$lib/stores' import { parseDbInputFromAssetSyntax, pluralize, truncate } from '$lib/utils' import ExploreAssetButton, { assetCanBeExplored @@ -182,15 +188,17 @@ > See documentation -