Add org switcher with create, switch, and delete
The sidebar org button was inert: clicking it did nothing. Add a real dropdown menu listing every organization, a "New organization" entry that re-enters onboarding without resetting the database, and a per-org delete affordance with inline confirmation. Active org is now persisted in a single-row app_state table so the snapshot keeps a stable selection across restarts and the renderer drives switching via two new IPC channels (setActiveOrganization, deleteOrganization). - migration 006 adds app_state(id=1, active_org_id, updated_at) - snapshot resolves active org from app_state with the first-org fallback - OrganizationService gains setActive + delete + bootstrap upsert - new OrgSwitcher renderer component keeps Shell.tsx lean
This commit is contained in:
1 parent
060fddf852
commit
f2ac1be5de
14 files changed
+385
-16
No files matched your search
@@ -6,6 +6,14 @@ import type {
|
||||
TaskStatus,
|
||||
} from "./domain";
|
||||
|
||||
export interface SetActiveOrganizationInput {
|
||||
orgId: string;
|
||||
}
|
||||
|
||||
export interface DeleteOrganizationInput {
|
||||
orgId: string;
|
||||
}
|
||||
|
||||
export interface CreateOrganizationInput {
|
||||
organizationName: string;
|
||||
description?: string;
|
||||
|
||||
@@ -15,12 +15,14 @@ import type {
|
||||
CreateSocialAccountInput,
|
||||
CreateTaskInput,
|
||||
DecideApprovalInput,
|
||||
DeleteOrganizationInput,
|
||||
ImportFileInput,
|
||||
ImportSkillDirectoryInput,
|
||||
LaunchSocialLoginInput,
|
||||
ResolveAgentSkillsInput,
|
||||
SaveProviderCredentialInput,
|
||||
SendMessageInput,
|
||||
SetActiveOrganizationInput,
|
||||
SetFilePinnedInput,
|
||||
SetScheduledPostStateInput,
|
||||
UpdateTaskStatusInput,
|
||||
@@ -33,6 +35,8 @@ export interface RendererEvent {
|
||||
export interface DesktopApi {
|
||||
loadSnapshot(): Promise<DesktopResult<AppSnapshot>>;
|
||||
bootstrapOnboarding(input: BootstrapOnboardingInput): Promise<DesktopResult<BootstrapOnboardingSummary>>;
|
||||
setActiveOrganization(input: SetActiveOrganizationInput): Promise<DesktopResult<AppSnapshot>>;
|
||||
deleteOrganization(input: DeleteOrganizationInput): Promise<DesktopResult<AppSnapshot>>;
|
||||
createOrganization(input: CreateOrganizationInput): Promise<DesktopResult<AppSnapshot>>;
|
||||
createAgent(input: CreateAgentInput): Promise<DesktopResult<AppSnapshot>>;
|
||||
createTask(input: CreateTaskInput): Promise<DesktopResult<AppSnapshot>>;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export const IPC_CHANNELS = {
|
||||
loadSnapshot: "agentcompany:load-snapshot",
|
||||
bootstrapOnboarding: "agentcompany:bootstrap-onboarding",
|
||||
setActiveOrganization: "agentcompany:set-active-organization",
|
||||
deleteOrganization: "agentcompany:delete-organization",
|
||||
createOrganization: "agentcompany:create-organization",
|
||||
createAgent: "agentcompany:create-agent",
|
||||
createTask: "agentcompany:create-task",
|
||||
|
||||
Reference in new issue
Block a user