Skip to content

# Class: Workspace

Workspace

`beta`

## Hierarchy

- Workspace

## Implements

- WorkspaceModel
- WorkspaceState

## Index

### Constructors

- constructor

### Properties

- #activeClusterId
- [updateFromModel]
- description
- id
- name
- ownerRef

### Accessors

- activeCluster
- activeClusterId
- enabled
- isManaged

### Methods

- clearActiveCluster
- getState
- pushState
- setActiveCluster
- setState
- toJSON
- tryClearAsActiveCluster

## Constructors

### constructor

+ new Workspace(`model`: WorkspaceModel): Workspace

Defined in src/common/workspace-store.ts:78

Parameters:

Name | Type
--- | ---
`model` | WorkspaceModel

Returns: Workspace

## Properties

### #activeClusterId

• #activeClusterId: IObservableValue‹string› = observable.box()

Defined in src/common/workspace-store.ts:74

The active cluster within this workspace

### [updateFromModel]

• [updateFromModel]: (Anonymous function) & IAction = action((model: WorkspaceModel) => { this.id = model.id; this.name = model.name; this.description = model.description; this.ownerRef = model.ownerRef; this.setActiveCluster(model.activeClusterId); })

Defined in src/common/workspace-store.ts:214

### `Optional` description

• description? : string

Implementation of WorkspaceModel.description

Defined in src/common/workspace-store.ts:59

Workspace description

`observable`

### id

• id: WorkspaceId

Implementation of WorkspaceModel.id

Defined in src/common/workspace-store.ts:47

Unique id for workspace

`observable`

### name

• name: string

Implementation of WorkspaceModel.name

Defined in src/common/workspace-store.ts:53

Workspace name

`observable`

### `Optional` ownerRef

• ownerRef? : string

Implementation of WorkspaceModel.ownerRef

Defined in src/common/workspace-store.ts:67

Workspace owner reference

If extension sets ownerRef then it needs to explicitly mark workspace as enabled onActivate (or when workspace is saved)

`observable`

## Accessors

### activeCluster

• get activeCluster(): Cluster | undefined

Defined in src/common/workspace-store.ts:114

Returns: Cluster | undefined

### activeClusterId

• get activeClusterId(): string

Defined in src/common/workspace-store.ts:76

Returns: string

### enabled

• get enabled(): boolean

Defined in src/common/workspace-store.ts:97

Is workspace enabled

Workspaces that don't have ownerRef will be enabled by default. Workspaces with ownerRef need to explicitly enable a workspace.

`computed`

Returns: boolean

• set enabled(`enabled`: boolean): void

Defined in src/common/workspace-store.ts:101

Is workspace enabled

Workspaces that don't have ownerRef will be enabled by default. Workspaces with ownerRef need to explicitly enable a workspace.

Parameters:

Name | Type
--- | ---
`enabled` | boolean

Returns: void

### isManaged

• get isManaged(): boolean

Defined in src/common/workspace-store.ts:110

Is workspace managed by an extension

`computed`

Returns: boolean

## Methods

### clearActiveCluster

▸ clearActiveCluster(): void

Defined in src/common/workspace-store.ts:181

Returns: void

### getState

▸ getState(): WorkspaceState

Defined in src/common/workspace-store.ts:189

Get workspace state

Returns: WorkspaceState

### pushState

▸ pushState(`state`: WorkspaceState): void

Defined in src/common/workspace-store.ts:201

Push state

`internal`

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`state` | WorkspaceState | this.getState() | workspace state

Returns: void

### setActiveCluster

▸ setActiveCluster(`clusterOrId?`: ClusterId | Cluster): void

Defined in src/common/workspace-store.ts:150

Sets workspace's active cluster to resolved `clusterOrId`. As long as it is valid

Parameters:

Name | Type | Description
--- | --- | ---
`clusterOrId?` | ClusterId | Cluster | the cluster instance or its ID

Returns: void

### setState

▸ setState(`state`: WorkspaceState): void

Defined in src/common/workspace-store.ts:210

Parameters:

Name | Type | Description
--- | --- | ---
`state` | WorkspaceState | workspace state

Returns: void

### toJSON

▸ toJSON(): WorkspaceModel

Defined in src/common/workspace-store.ts:222

Returns: WorkspaceModel

### tryClearAsActiveCluster

▸ tryClearAsActiveCluster(`clusterOrId`: ClusterId | Cluster): boolean

Defined in src/common/workspace-store.ts:167

Tries to clear the cluster as this workspace's activeCluster.

Parameters:

Name | Type | Description
--- | --- | ---
`clusterOrId` | ClusterId | Cluster | the cluster instance or its ID

Returns: boolean

true if it matches the `activeClusterId` (and is thus cleared) else false