Skip to content

fix(integrations): show disabled role combobox for readonly members#3958

Closed
waleedlatif1 wants to merge 4 commits intostagingfrom
fix/members-table
Closed

fix(integrations): show disabled role combobox for readonly members#3958
waleedlatif1 wants to merge 4 commits intostagingfrom
fix/members-table

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Re-opening of #3921 — originally merged into staging but lost when the branch was accidentally deleted and recreated from main.

TheodoreSpeaks and others added 4 commits April 3, 2026 15:24
* feat(block): add cloudwatch integration

* Fix bun lock

* Add logger, use execution timeout

* Switch metric dimensions to map style input

* Fix attribute names for dimension map

* Fix import styling

---------

Co-authored-by: Theodore Li <theo@sim.ai>
* feat(analytics): posthog audit — remove noise, add 10 new events

Remove task_marked_read (fires automatically on every task view).

Add workspace_id to task_message_sent for group analytics.

New events:
- search_result_selected: block/tool/trigger/workflow/table/file/
  knowledge_base/workspace/task/page/docs with query_length
- workflow_imported: count + format (json/zip)
- workflow_exported: count + format (json/zip)
- folder_created / folder_deleted
- logs_filter_applied: status/workflow/folder/trigger/time
- knowledge_base_document_deleted
- scheduled_task_created / scheduled_task_deleted

* fix(analytics): use usePostHog + captureEvent in hooks, track custom date range

* fix(analytics): always fire scheduled_task_deleted regardless of workspaceId

* fix(analytics): correct format field logic and add missing useCallback deps
…g billing (#3916)

* feat(knowledge): add Live sync option to KB connector modal for Max/Enterprise users

Adds a "Live" (every 5 min) sync frequency option gated to Max and Enterprise plan users.
Includes client-side badge + disabled state, shared sync intervals constant, and server-side
plan validation on both POST and PATCH connector routes.

* fix(knowledge): record embedding usage cost for KB document processing

Adds billing tracking to the KB embedding pipeline, which was previously
generating OpenAI API calls with no cost recorded. Token counts are now
captured from the actual API response and recorded via recordUsage after
successful embedding insertion. BYOK workspaces are excluded from billing.
Applies to all execution paths: direct, BullMQ, and Trigger.dev.

* fix(knowledge): simplify embedding billing — use calculateCost, return modelName

- Use calculateCost() from @/providers/utils instead of inline formula, consistent
  with how LLM billing works throughout the platform
- Return modelName from GenerateEmbeddingsResult so billing uses the actual model
  (handles custom Azure deployments) instead of a hardcoded fallback string
- Fix docs-chunker.ts empty-path fallback to satisfy full GenerateEmbeddingsResult type

* fix(knowledge): remove dev bypass from hasLiveSyncAccess

* chore(knowledge): rename sync-intervals to consts, fix stale TSDoc comment

* improvement(knowledge): extract MaxBadge component, capture billing config once per document

* fix(knowledge): add knowledge-base to usage_log_source enum, fix docs-chunker type

* fix(knowledge): generate migration for knowledge-base usage_log_source enum value

* fix(knowledge): add knowledge-base to usage_log_source enum via drizzle-kit

* fix(knowledge): fix search embedding test mocks, parallelize billing lookups

* fix(knowledge): warn when embedding model has no pricing entry

* fix(knowledge): call checkAndBillOverageThreshold after embedding usage
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 4, 2026

PR Summary

High Risk
Adds new CloudWatch API/tool surface that handles AWS credentials and introduces new billing/usage accounting for embedding tokens, both of which are security- and money-sensitive. Also touches multiple user-facing flows with new PostHog event emission and subscription-gated connector sync intervals.

Overview
Adds a new AWS CloudWatch integration end-to-end: server routes under /api/tools/cloudwatch/*, shared client utilities (cloudwatch/utils.ts), tool configs/types in tools/cloudwatch/*, selector support for CloudWatch log groups/streams, and a new CloudWatchBlock wired into the blocks/tools registries (plus AWS SDK deps).

Enforces plan-based “live sync” for knowledge-base connectors by rejecting syncIntervalMinutes under 60 minutes unless hasLiveSyncAccess passes, and updates the KB connector UI to offer a new Live (5 min) interval that is disabled/badged when Max access isn’t available.

Refactors embeddings to return { embeddings, totalTokens, isBYOK, modelName }, updates callers accordingly, and adds usage billing for KB document embedding generation when not using BYOK (including a new usage_log_source value knowledge-base).

Expands PostHog analytics: emits new server/client events for folder/schedule/document actions, workflow import/export, logs filter usage, and search result selection; removes the task_marked_read event and adds missing workspace_id to task_message_sent. Also adjusts integrations UI so read-only members see a disabled role combobox instead of a role badge.

Reviewed by Cursor Bugbot for commit 768eda9. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 4, 2026

Greptile Summary

This PR re-lands a previously merged fix (originally #3921) that shows a disabled role Combobox to non-admin members instead of a plain Badge. The change ensures visual consistency in the integrations settings UI — all members see the same role selector component, just with editing locked for non-admins.

  • Moved Combobox for role selection outside the isSelectedAdmin conditional so it always renders for every member row
  • disabled prop correctly uses !isSelectedAdmin || (member.role === 'admin' && adminMemberCount <= 1), guarding both permission and last-admin scenarios
  • Removed <Badge variant='gray-secondary'> display for non-admin viewers (disabled Combobox replaces it visually)
  • Extracted roleComboOptions to module level to avoid re-allocating the array on every render

Confidence Score: 5/5

Safe to merge — focused, single-file UI fix with no logic regressions

Single-file change with a clear, correct intent. The disabled condition properly handles both the permissions guard (!isSelectedAdmin) and the last-admin guard. Grid layout and role-value display are both preserved. Badge import is still used elsewhere in the file. No new issues introduced.

No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/settings/components/integrations/integrations-manager.tsx Moves role Combobox outside isSelectedAdmin guard (disabled for non-admins); removes Badge fallback; extracts roleComboOptions to module level

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Render member row] --> B[Always render Combobox]
    B --> C{isSelectedAdmin?}
    C -- No --> D[disabled = true]
    C -- Yes --> E{Last admin?}
    E -- Yes --> F[disabled = true]
    E -- No --> G[disabled = false]
    D --> H[Render empty div spacer]
    F --> H
    G --> I[Render Remove button]
    I --> J{Last admin?}
    J -- Yes --> K[Remove button disabled]
    J -- No --> L[Remove button enabled]
Loading

Reviews (1): Last reviewed commit: "fix(integrations): show disabled role co..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 deleted the fix/members-table branch April 5, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants