Skip to content

# Class: NamespaceStore

Renderer.K8sApi.NamespaceStore

## Hierarchy

- KubeObjectStore<Namespace>

↳ NamespaceStore

## Table of contents

### Constructors

- constructor

### Properties

- api
- bufferSize
- eventsBuffer
- failedLoading
- isLoaded
- isLoading
- items
- limit
- selectedItemsIds
- defaultContext

### Accessors

- allowedNamespaces
- context
- contextItems
- contextNamespaces
- contextReady
- hasAllContexts
- namespacesReady
- query
- selectedItems
- selectedNamespaces

### Methods

- [iterator]
- bindWatchEventsUpdater
- clearSelected
- create
- createItem
- defaultSorting
- filterItemsOnLoad
- getAllByNs
- getById
- getByLabel
- getByName
- getByPath
- getIndexById
- getItems
- getStatuses
- getTotalCount
- hasContext
- isSelected
- isSelectedAll
- load
- loadAll
- loadFromPath
- loadItem
- loadItems
- mergeItems
- onContextChange
- reloadAll
- remove
- removeItem
- removeSelectedItems
- reset
- resetOnError
- resetSelection
- select
- selectNamespaces
- sortItems
- subscribe
- toggleAll
- toggleContext
- toggleSelection
- toggleSelectionAll
- toggleSingle
- unselect
- update
- updateFromEventsBuffer
- updateItem

## Constructors

### constructor

• new NamespaceStore()

#### Overrides

KubeObjectStore.constructor

## Properties

### api

• api: KubeApi<Namespace>

#### Overrides

KubeObjectStore.api

### bufferSize

• `Readonly` bufferSize: `number` = 50000

#### Inherited from

KubeObjectStore.bufferSize

### eventsBuffer

• `Protected` eventsBuffer: `IObservableArray`<IKubeWatchEvent<KubeJsonApiData>>

#### Inherited from

KubeObjectStore.eventsBuffer

### failedLoading

• failedLoading: `boolean` = false

#### Inherited from

KubeObjectStore.failedLoading

### isLoaded

• isLoaded: `boolean` = false

#### Inherited from

KubeObjectStore.isLoaded

### isLoading

• isLoading: `boolean` = false

#### Inherited from

KubeObjectStore.isLoading

### items

• items: `IObservableArray`<Namespace>

#### Inherited from

KubeObjectStore.items

### limit

• `Optional` `Readonly` limit: `number`

#### Inherited from

KubeObjectStore.limit

### selectedItemsIds

• selectedItemsIds: `ObservableMap`<string, boolean>

#### Inherited from

KubeObjectStore.selectedItemsIds

### defaultContext

▪ `Static` defaultContext: `IObservableValue`<ClusterContext>

#### Inherited from

KubeObjectStore.defaultContext

## Accessors

### allowedNamespaces

• `get` allowedNamespaces(): `string`[]

#### Returns

`string`[]

### context

• `get` context(): `ClusterContext`

#### Returns

`ClusterContext`

### contextItems

• `get` contextItems(): `T`[]

#### Returns

`T`[]

### contextNamespaces

• `get` contextNamespaces(): `string`[]

#### Returns

`string`[]

### contextReady

• `get` contextReady(): `Promise` & { `cancel`: () => `void` }

#### Returns

`Promise` & { `cancel`: () => `void` }

### hasAllContexts

• `get` hasAllContexts(): `boolean`

#### Returns

`boolean`

### namespacesReady

• `get` namespacesReady(): `Promise` & { `cancel`: () => `void` }

#### Returns

`Promise` & { `cancel`: () => `void` }

### query

• `get` query(): `IKubeApiQueryParams`

#### Returns

`IKubeApiQueryParams`

### selectedItems

• `get` selectedItems(): `T`[]

#### Returns

`T`[]

### selectedNamespaces

• `get` selectedNamespaces(): `string`[]

#### Returns

`string`[]

## Methods

### [iterator]

▸ [iterator](): `Generator`<Namespace, void, undefined>

#### Returns

`Generator`<Namespace, void, undefined>

#### Inherited from

KubeObjectStore.[iterator]

### bindWatchEventsUpdater

▸ `Protected` bindWatchEventsUpdater(`delay?`): `void`

#### Parameters

Name | Type | Default value
--- | --- | ---
`delay` | `number` | 1000

#### Returns

`void`

#### Inherited from

KubeObjectStore.bindWatchEventsUpdater

### clearSelected

▸ clearSelected(`namespaces?`): `void`

#### Parameters

Name | Type
--- | ---
`namespaces?` | `string` | `string`[]

#### Returns

`void`

### create

▸ create(`params`, `data?`): `Promise`<Namespace>

#### Parameters

Name | Type
--- | ---
`params` | `Object`
`params.name` | `string`
`params.namespace?` | `string`
`data?` | `Partial`<Namespace>

#### Returns

`Promise`<Namespace>

#### Inherited from

KubeObjectStore.create

### createItem

▸ `Protected` createItem(`params`, `data?`): `Promise`<Namespace>

#### Parameters

Name | Type
--- | ---
`params` | `Object`
`params.name` | `string`
`params.namespace?` | `string`
`data?` | `Partial`<Namespace>

#### Returns

`Promise`<Namespace>

#### Inherited from

KubeObjectStore.createItem

### defaultSorting

▸ `Protected` defaultSorting(`item`): `string`

#### Parameters

Name | Type
--- | ---
`item` | `T`

#### Returns

`string`

#### Inherited from

KubeObjectStore.defaultSorting

### filterItemsOnLoad

▸ `Protected` filterItemsOnLoad(`items`): Namespace[]

#### Parameters

Name | Type
--- | ---
`items` | Namespace[]

#### Returns

Namespace[]

#### Inherited from

KubeObjectStore.filterItemsOnLoad

### getAllByNs

▸ getAllByNs(`namespace`, `strict?`): Namespace[]

#### Parameters

Name | Type | Default value
--- | --- | ---
`namespace` | `string` | `string`[] | `undefined`
`strict` | `boolean` | false

#### Returns

Namespace[]

#### Inherited from

KubeObjectStore.getAllByNs

### getById

▸ getById(`id`): Namespace

#### Parameters

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

#### Returns

Namespace

#### Inherited from

KubeObjectStore.getById

### getByLabel

▸ getByLabel(`labels`): Namespace[]

#### Parameters

Name | Type
--- | ---
`labels` | `string`[] | { [label: string]: `string`; }

#### Returns

Namespace[]

#### Inherited from

KubeObjectStore.getByLabel

### getByName

▸ getByName(`name`, `namespace?`): Namespace

#### Parameters

Name | Type
--- | ---
`name` | `string`
`namespace?` | `string`

#### Returns

Namespace

#### Inherited from

KubeObjectStore.getByName

### getByPath

▸ getByPath(`path`): Namespace

#### Parameters

Name | Type
--- | ---
`path` | `string`

#### Returns

Namespace

#### Inherited from

KubeObjectStore.getByPath

### getIndexById

▸ getIndexById(`id`): `number`

#### Parameters

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

#### Returns

`number`

#### Inherited from

KubeObjectStore.getIndexById

### getItems

▸ getItems(): Namespace[]

#### Returns

Namespace[]

#### Inherited from

KubeObjectStore.getItems

### getStatuses

▸ `Optional` getStatuses(`items`): `Record`<string, number>

#### Parameters

Name | Type
--- | ---
`items` | Namespace[]

#### Returns

`Record`<string, number>

#### Inherited from

KubeObjectStore.getStatuses

### getTotalCount

▸ getTotalCount(): `number`

#### Returns

`number`

#### Inherited from

KubeObjectStore.getTotalCount

### hasContext

▸ hasContext(`namespaces`): `boolean`

#### Parameters

Name | Type
--- | ---
`namespaces` | `string` | `string`[]

#### Returns

`boolean`

### isSelected

▸ isSelected(`item`): `boolean`

#### Parameters

Name | Type
--- | ---
`item` | Namespace

#### Returns

`boolean`

#### Inherited from

KubeObjectStore.isSelected

### isSelectedAll

▸ isSelectedAll(`visibleItems?`): `boolean`

#### Parameters

Name | Type
--- | ---
`visibleItems` | Namespace[]

#### Returns

`boolean`

#### Inherited from

KubeObjectStore.isSelectedAll

### load

▸ load(`params`): `Promise`<Namespace>

#### Parameters

Name | Type
--- | ---
`params` | `Object`
`params.name` | `string`
`params.namespace?` | `string`

#### Returns

`Promise`<Namespace>

#### Inherited from

KubeObjectStore.load

### loadAll

▸ loadAll(`options?`): `Promise`<void | Namespace[]>

#### Parameters

Name | Type
--- | ---
`options` | `Object`
`options.merge?` | `boolean`
`options.namespaces?` | `string`[]
`options.reqInit?` | `RequestInit`

#### Returns

`Promise`<void | Namespace[]>

#### Inherited from

KubeObjectStore.loadAll

### loadFromPath

▸ loadFromPath(`resourcePath`): `Promise`<Namespace>

#### Parameters

Name | Type
--- | ---
`resourcePath` | `string`

#### Returns

`Promise`<Namespace>

#### Inherited from

KubeObjectStore.loadFromPath

### loadItem

▸ `Protected` loadItem(`params`): `Promise`<Namespace>

#### Parameters

Name | Type
--- | ---
`params` | `Object`
`params.name` | `string`
`params.namespace?` | `string`

#### Returns

`Promise`<Namespace>

#### Inherited from

KubeObjectStore.loadItem

### loadItems

▸ `Protected` loadItems(`params`): `Promise`<any[]>

#### Parameters

Name | Type
--- | ---
`params` | `KubeObjectStoreLoadingParams`

#### Returns

`Promise`<any[]>

#### Overrides

KubeObjectStore.loadItems

### mergeItems

▸ `Protected` mergeItems(`partialItems`, `__namedParameters?`): Namespace[]

#### Parameters

Name | Type
--- | ---
`partialItems` | Namespace[]
`__namedParameters` | `Object`
`__namedParameters.filter` |
`__namedParameters.replace` |
`__namedParameters.sort` |
`__namedParameters.updateStore` |

#### Returns

Namespace[]

#### Inherited from

KubeObjectStore.mergeItems

### onContextChange

▸ onContextChange(`callback`, `opts?`): `IReactionDisposer`

#### Parameters

Name | Type
--- | ---
`callback` | (`namespaces`: `string`[]) => `void`
`opts` | `IReactionOptions`

#### Returns

`IReactionDisposer`

### reloadAll

▸ reloadAll(`opts?`): `Promise`<void | Namespace[]>

#### Parameters

Name | Type
--- | ---
`opts` | `Object`
`opts.force?` | `boolean`
`opts.merge?` | `boolean`
`opts.namespaces?` | `string`[]

#### Returns

`Promise`<void | Namespace[]>

#### Inherited from

KubeObjectStore.reloadAll

### remove

▸ remove(`item`): `Promise`<void>

#### Parameters

Name | Type
--- | ---
`item` | Namespace

#### Returns

`Promise`<void>

#### Overrides

KubeObjectStore.remove

### removeItem

▸ `Protected` removeItem(`item`, `request`): `Promise`<void>

#### Parameters

Name | Type
--- | ---
`item` | Namespace
`request` | () => `Promise`<any>

#### Returns

`Promise`<void>

#### Inherited from

KubeObjectStore.removeItem

### removeSelectedItems

▸ removeSelectedItems(): `Promise`<void[]>

#### Returns

`Promise`<void[]>

#### Inherited from

KubeObjectStore.removeSelectedItems

### reset

▸ reset(): `void`

#### Returns

`void`

#### Inherited from

KubeObjectStore.reset

### resetOnError

▸ `Protected` resetOnError(`error`): `void`

#### Parameters

Name | Type
--- | ---
`error` | `any`

#### Returns

`void`

#### Inherited from

KubeObjectStore.resetOnError

### resetSelection

▸ resetSelection(): `void`

#### Returns

`void`

#### Inherited from

KubeObjectStore.resetSelection

### select

▸ select(`item`): `void`

#### Parameters

Name | Type
--- | ---
`item` | Namespace

#### Returns

`void`

#### Inherited from

KubeObjectStore.select

### selectNamespaces

▸ selectNamespaces(`namespace`): `void`

#### Parameters

Name | Type
--- | ---
`namespace` | `string` | `string`[]

#### Returns

`void`

### sortItems

▸ `Protected` sortItems(`items?`, `sorting?`, `order?`): Namespace[]

Return `items` sorted by the given ordering functions. If two elements of `items` are sorted to the same "index" then the next sorting function is used to determine where to place them relative to each other. Once the `sorting` functions have been all exhausted then the order is unchanged (ie a stable sort).

#### Parameters

Name | Type | Description
--- | --- | ---
`items` | Namespace[] | the items to be sorted (default: the current items in this store)
`sorting` | (`item`: Namespace) => `any`[] | list of functions to determine sort order (default: sorting by name)
`order?` | `"desc"` | `"asc"` | whether to sort from least to greatest (`"asc"` (default)) or vice-versa (`"desc"`)

#### Returns

Namespace[]

#### Inherited from

KubeObjectStore.sortItems

### subscribe

▸ subscribe(): (...`args`: `T`) => `void`

#### Returns

`fn`

▸ <T>(...`args`): `void`

A function that does nothing

##### Type parameters

Name | Type
--- | ---
`T` | `T`: `any`[]

##### Parameters

Name | Type
--- | ---
`...args` | `T`

##### Returns

`void`

#### Overrides

KubeObjectStore.subscribe

### toggleAll

▸ toggleAll(`showAll?`): `void`

#### Parameters

Name | Type
--- | ---
`showAll?` | `boolean`

#### Returns

`void`

### toggleContext

▸ toggleContext(`namespaces`): `void`

#### Parameters

Name | Type
--- | ---
`namespaces` | `string` | `string`[]

#### Returns

`void`

### toggleSelection

▸ toggleSelection(`item`): `void`

#### Parameters

Name | Type
--- | ---
`item` | Namespace

#### Returns

`void`

#### Inherited from

KubeObjectStore.toggleSelection

### toggleSelectionAll

▸ toggleSelectionAll(`visibleItems?`): `void`

#### Parameters

Name | Type
--- | ---
`visibleItems` | Namespace[]

#### Returns

`void`

#### Inherited from

KubeObjectStore.toggleSelectionAll

### toggleSingle

▸ toggleSingle(`namespace`): `void`

#### Parameters

Name | Type
--- | ---
`namespace` | `string`

#### Returns

`void`

### unselect

▸ unselect(`item`): `void`

#### Parameters

Name | Type
--- | ---
`item` | Namespace

#### Returns

`void`

#### Inherited from

KubeObjectStore.unselect

### update

▸ update(`item`, `data`): `Promise`<Namespace>

#### Parameters

Name | Type
--- | ---
`item` | Namespace
`data` | `Partial`<Namespace>

#### Returns

`Promise`<Namespace>

#### Inherited from

KubeObjectStore.update

### updateFromEventsBuffer

▸ `Protected` updateFromEventsBuffer(): `void`

#### Returns

`void`

#### Inherited from

KubeObjectStore.updateFromEventsBuffer

### updateItem

▸ `Protected` updateItem(`item`, `request`): `Promise`<Namespace>

#### Parameters

Name | Type
--- | ---
`item` | Namespace
`request` | () => `Promise`<Namespace>

#### Returns

`Promise`<Namespace>

#### Inherited from

KubeObjectStore.updateItem