Skip to content

# Class: WorkspaceStore

Stores all workspaces

`beta`

## Hierarchy

- Singleton

↳ WorkspaceStore

## Index

### Properties

- defaultId

### Accessors

- currentWorkspace
- currentWorkspaceId
- enabledWorkspacesList
- workspaces
- workspacesList

### Methods

- addWorkspace
- getById
- getByName
- removeWorkspace
- removeWorkspaceById
- setActive
- setActiveCluster
- updateWorkspace
- getInstance
- resetInstance

## Properties

### `Static` defaultId

▪ defaultId: WorkspaceId = InternalWorkspaceStore.defaultId

Defined in src/extensions/stores/workspace-store.ts:18

Default workspace id, this workspace is always present

## Accessors

### currentWorkspace

• get currentWorkspace(): Workspace

Defined in src/extensions/stores/workspace-store.ts:44

Currently active workspace

Returns: Workspace

### currentWorkspaceId

• get currentWorkspaceId(): string

Defined in src/extensions/stores/workspace-store.ts:23

Currently active workspace id

Returns: string

• set currentWorkspaceId(`id`: string): void

Defined in src/extensions/stores/workspace-store.ts:30

Set active workspace id

Parameters:

Name | Type
--- | ---
`id` | string

Returns: void

### enabledWorkspacesList

• get enabledWorkspacesList(): Workspace[]

Defined in src/extensions/stores/workspace-store.ts:58

Array of all enabled (visible) workspaces

Returns: Workspace[]

### workspaces

• get workspaces(): ObservableMap‹string, Workspace›

Defined in src/extensions/stores/workspace-store.ts:37

Map of all workspaces

Returns: ObservableMap‹string, Workspace›

### workspacesList

• get workspacesList(): Workspace[]

Defined in src/extensions/stores/workspace-store.ts:51

Array of all workspaces

Returns: Workspace[]

## Methods

### addWorkspace

▸ addWorkspace(`workspace`: Workspace): Workspace‹›

Defined in src/extensions/stores/workspace-store.ts:90

Add a workspace to store

Parameters:

Name | Type | Description
--- | --- | ---
`workspace` | Workspace | workspace

Returns: Workspace‹›

### getById

▸ getById(`id`: WorkspaceId): Workspace

Defined in src/extensions/stores/workspace-store.ts:66

Get workspace by id

Parameters:

Name | Type | Description
--- | --- | ---
`id` | WorkspaceId | workspace id

Returns: Workspace

### getByName

▸ getByName(`name`: string): Workspace

Defined in src/extensions/stores/workspace-store.ts:74

Get workspace by name

Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | workspace name

Returns: Workspace

### removeWorkspace

▸ removeWorkspace(`workspace`: Workspace): void

Defined in src/extensions/stores/workspace-store.ts:106

Remove workspace from store

Parameters:

Name | Type | Description
--- | --- | ---
`workspace` | Workspace | workspace

Returns: void

### removeWorkspaceById

▸ removeWorkspaceById(`id`: WorkspaceId): void

Defined in src/extensions/stores/workspace-store.ts:114

Remove workspace by id

Parameters:

Name | Type | Description
--- | --- | ---
`id` | WorkspaceId | workspace

Returns: void

### setActive

▸ setActive(`id`: string): void

Defined in src/extensions/stores/workspace-store.ts:82

Set active workspace

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`id` | string | WorkspaceStore.defaultId | workspace id

Returns: void

### setActiveCluster

▸ setActiveCluster(`clusterOrId`: ClusterId | Cluster): Promise‹void›

Defined in src/extensions/stores/workspace-store.ts:122

Sets the cluster and its workspace as active

Parameters:

Name | Type | Description
--- | --- | ---
`clusterOrId` | ClusterId | Cluster | the cluster's ID or instance to set as the active cluster

Returns: Promise‹void›

### updateWorkspace

▸ updateWorkspace(`workspace`: Workspace): void

Defined in src/extensions/stores/workspace-store.ts:98

Update a workspace in store

Parameters:

Name | Type | Description
--- | --- | ---
`workspace` | Workspace | workspace

Returns: void

### `Static` getInstance

▸ getInstance‹T›(...`args`: ConstructorParameters‹Constructor‹T››): T

Inherited from ExtensionStore.getInstance

Defined in src/common/utils/singleton.ts:15

Type parameters:

▪ T

Parameters:

Name | Type
--- | ---
`...args` | ConstructorParameters‹Constructor‹T››

Returns: T

### `Static` resetInstance

▸ resetInstance(): void

Inherited from ExtensionStore.resetInstance

Defined in src/common/utils/singleton.ts:23

Returns: void