Class: NamespaceStore#
Renderer.K8sApi.NamespaceStore
Hierarchy#
↳ NamespaceStore
Table of contents#
Constructors#
Properties#
- api
- bufferSize
- eventsBuffer
- failedLoading
- isLoaded
- isLoading
- items
- limit
- selectedItemsIds
- defaultContext
Accessors#
- allowedNamespaces
- areAllSelectedImplicitly
- context
- contextItems
- contextNamespaces
- contextReady
- hasAllContexts
- namespacesReady
- query
- selectedItems
- selectedNames
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
- patch
- pickOnlySelected
- reloadAll
- remove
- removeItem
- removeItems
- removeSelectedItems
- reset
- resetOnError
- resetSelection
- select
- selectAll
- selectNamespaces
- selectSingle
- sortItems
- subscribe
- toggleAll
- toggleContext
- toggleSelection
- toggleSelectionAll
- toggleSingle
- unselect
- update
- updateFromEventsBuffer
- updateItem
Constructors#
constructor#
• new NamespaceStore(dependencies)
Parameters#
| Name | Type |
|---|---|
dependencies |
Dependencies |
Overrides#
Properties#
api#
• api: NamespaceApi = namespacesApi
Overrides#
bufferSize#
• Readonly bufferSize: number = 50000
Inherited from#
eventsBuffer#
• Protected eventsBuffer: IObservableArray<IKubeWatchEvent<KubeJsonApiData>>
Inherited from#
failedLoading#
• failedLoading: boolean = false
Inherited from#
isLoaded#
• isLoaded: boolean = false
Inherited from#
isLoading#
• isLoading: boolean = false
Inherited from#
items#
• items: IObservableArray<Namespace>
Inherited from#
limit#
• Optional Readonly limit: number
Inherited from#
selectedItemsIds#
• selectedItemsIds: ObservableSet<string>
Inherited from#
KubeObjectStore.selectedItemsIds
defaultContext#
▪ Static defaultContext: IObservableValue<ClusterContext>
Inherited from#
KubeObjectStore.defaultContext
Accessors#
allowedNamespaces#
• get allowedNamespaces(): string[]
Returns#
string[]
areAllSelectedImplicitly#
• get areAllSelectedImplicitly(): boolean
Is true when the the set of namespace names selected is implicitly all
Namely, this will be true if the user has deselected all namespaces from the filter or if the user has clicked the "All Namespaces" option
Returns#
boolean
context#
• get context(): ClusterContext
Returns#
ClusterContext
Inherited from#
KubeObjectStore.context
contextItems#
• get contextItems(): T[]
Returns#
T[]
Inherited from#
KubeObjectStore.contextItems
contextNamespaces#
• get contextNamespaces(): string[]
The list of selected namespace names (for filtering)
Returns#
string[]
contextReady#
• get contextReady(): Promise<void> & { cancel: () => void }
Returns#
Promise<void> & { cancel: () => void }
Inherited from#
KubeObjectStore.contextReady
hasAllContexts#
• get hasAllContexts(): boolean
Is true if all available namespaces are selected, otherwise false
Returns#
boolean
namespacesReady#
• get namespacesReady(): Promise<void> & { cancel: () => void }
Returns#
Promise<void> & { cancel: () => void }
Inherited from#
KubeObjectStore.namespacesReady
query#
• get query(): IKubeApiQueryParams
Returns#
IKubeApiQueryParams
Inherited from#
KubeObjectStore.query
selectedItems#
• get selectedItems(): Item[]
Returns#
Item[]
Inherited from#
KubeObjectStore.selectedItems
selectedNames#
• get selectedNames(): Set<string>
The set of select namespace names (for filtering)
Returns#
Set<string>
Methods#
[iterator]#
▸ [iterator](): Generator<Namespace, void, undefined>
Returns#
Generator<Namespace, void, undefined>
Inherited from#
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#
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#
defaultSorting#
▸ Protected defaultSorting(item): string
Parameters#
| Name | Type |
|---|---|
item |
Item |
Returns#
string
Inherited from#
KubeObjectStore.defaultSorting
filterItemsOnLoad#
▸ Protected filterItemsOnLoad(items): Namespace[]
Parameters#
| Name | Type |
|---|---|
items |
Namespace[] |
Returns#
Inherited from#
KubeObjectStore.filterItemsOnLoad
getAllByNs#
▸ getAllByNs(namespace, strict?): Namespace[]
Parameters#
| Name | Type | Default value |
|---|---|---|
namespace |
string | string[] |
undefined |
strict |
boolean |
false |
Returns#
Inherited from#
getById#
▸ getById(id): Namespace
Parameters#
| Name | Type |
|---|---|
id |
string |
Returns#
Inherited from#
getByLabel#
▸ getByLabel(labels): Namespace[]
Parameters#
| Name | Type |
|---|---|
labels |
string[] | { [label: string]: string; } |
Returns#
Inherited from#
getByName#
▸ getByName(name, namespace?): Namespace
Parameters#
| Name | Type |
|---|---|
name |
string |
namespace? |
string |
Returns#
Inherited from#
getByPath#
▸ getByPath(path): Namespace
Parameters#
| Name | Type |
|---|---|
path |
string |
Returns#
Inherited from#
getIndexById#
▸ getIndexById(id): number
Parameters#
| Name | Type |
|---|---|
id |
string |
Returns#
number
Inherited from#
getItems#
▸ getItems(): Namespace[]
Returns#
Inherited from#
getStatuses#
▸ Optional getStatuses(items): Record<string, number>
Parameters#
| Name | Type |
|---|---|
items |
Namespace[] |
Returns#
Record<string, number>
Inherited from#
getTotalCount#
▸ getTotalCount(): number
Returns#
number
Inherited from#
hasContext#
▸ hasContext(namespaces): boolean
Checks if namespace names are selected for filtering
Parameters#
| Name | Type | Description |
|---|---|---|
namespaces |
string | string[] |
One or several names of namespaces to check if they are selected |
Returns#
boolean
true if all the provided names are selected
isSelected#
▸ isSelected(item): boolean
Parameters#
| Name | Type |
|---|---|
item |
Namespace |
Returns#
boolean
Inherited from#
isSelectedAll#
▸ isSelectedAll(visibleItems?): boolean
Parameters#
| Name | Type |
|---|---|
visibleItems |
Namespace[] |
Returns#
boolean
Inherited from#
load#
▸ load(params): Promise<Namespace>
Parameters#
| Name | Type |
|---|---|
params |
Object |
params.name |
string |
params.namespace? |
string |
Returns#
Promise<Namespace>
Inherited from#
loadAll#
▸ loadAll(__namedParameters?): Promise<Namespace[]>
Parameters#
| Name | Type |
|---|---|
__namedParameters |
KubeObjectStoreLoadAllParams |
Returns#
Promise<Namespace[]>
Inherited from#
loadFromPath#
▸ loadFromPath(resourcePath): Promise<Namespace>
Parameters#
| Name | Type |
|---|---|
resourcePath |
string |
Returns#
Promise<Namespace>
Inherited from#
loadItem#
▸ Protected loadItem(params): Promise<Namespace>
Parameters#
| Name | Type |
|---|---|
params |
Object |
params.name |
string |
params.namespace? |
string |
Returns#
Promise<Namespace>
Inherited from#
loadItems#
▸ Protected loadItems(params): Promise<Namespace[]>
Parameters#
| Name | Type |
|---|---|
params |
KubeObjectStoreLoadingParams |
Returns#
Promise<Namespace[]>
Overrides#
mergeItems#
▸ Protected mergeItems(partialItems, __namedParameters): Namespace[]
Parameters#
| Name | Type |
|---|---|
partialItems |
Namespace[] |
__namedParameters |
MergeItemsOptions |
Returns#
Inherited from#
onContextChange#
▸ onContextChange(callback, opts?): IReactionDisposer
Parameters#
| Name | Type |
|---|---|
callback |
(namespaces: string[]) => void |
opts |
Object |
opts.fireImmediately? |
boolean |
Returns#
IReactionDisposer
patch#
▸ patch(item, patch): Promise<Namespace>
Parameters#
| Name | Type |
|---|---|
item |
Namespace |
patch |
Patch |
Returns#
Promise<Namespace>
Inherited from#
pickOnlySelected#
▸ pickOnlySelected(items): Namespace[]
Parameters#
| Name | Type |
|---|---|
items |
Namespace[] |
Returns#
Inherited from#
KubeObjectStore.pickOnlySelected
reloadAll#
▸ reloadAll(opts?): Promise<Namespace[]>
Parameters#
| Name | Type |
|---|---|
opts |
Object |
opts.force? |
boolean |
opts.merge? |
boolean |
opts.namespaces? |
string[] |
Returns#
Promise<Namespace[]>
Inherited from#
remove#
▸ remove(item): Promise<void>
Parameters#
| Name | Type |
|---|---|
item |
Namespace |
Returns#
Promise<void>
Overrides#
removeItem#
▸ Protected removeItem(item, request): Promise<void>
Parameters#
| Name | Type |
|---|---|
item |
Namespace |
request |
() => Promise<any> |
Returns#
Promise<void>
Inherited from#
removeItems#
▸ removeItems(items): Promise<void>
Parameters#
| Name | Type |
|---|---|
items |
Namespace[] |
Returns#
Promise<void>
Inherited from#
removeSelectedItems#
▸ removeSelectedItems(): Promise<void[]>
Returns#
Promise<void[]>
Inherited from#
KubeObjectStore.removeSelectedItems
reset#
▸ reset(): void
Returns#
void
Inherited from#
resetOnError#
▸ Protected resetOnError(error): void
Parameters#
| Name | Type |
|---|---|
error |
any |
Returns#
void
Inherited from#
resetSelection#
▸ resetSelection(): void
Returns#
void
Inherited from#
KubeObjectStore.resetSelection
select#
▸ select(item): void
Parameters#
| Name | Type |
|---|---|
item |
Namespace |
Returns#
void
Inherited from#
selectAll#
▸ selectAll(): void
Selects all available namespaces.
Note: If new namespaces appear in the future those will be selected too
Returns#
void
selectNamespaces#
▸ selectNamespaces(namespace): void
Parameters#
| Name | Type |
|---|---|
namespace |
string | string[] |
Returns#
void
selectSingle#
▸ selectSingle(namespace): void
Makes the given namespace the sole selected namespace
Parameters#
| Name | Type |
|---|---|
namespace |
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#
Inherited from#
subscribe#
▸ subscribe(): args: T) => void
Returns#
fn
▸ <T>(...args): void
A function that does nothing
Type parameters#
| Name | Type |
|---|---|
T |
extends any[] |
Parameters#
| Name | Type |
|---|---|
...args |
T |
Returns#
void
Overrides#
toggleAll#
▸ toggleAll(selectAll?): void
This function selects all namespaces implicitly.
NOTE: does not toggle any namespaces
deprecated Use NamespaceStore.selectAll instead.
Parameters#
| Name | Type | Description |
|---|---|---|
selectAll? |
boolean |
NOT USED |
Returns#
void
toggleContext#
▸ toggleContext(namespaces): void
Acts like toggleSingle but can work on several at a time
Parameters#
| Name | Type | Description |
|---|---|---|
namespaces |
string | string[] |
One or many names of namespaces to select |
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
Toggles the selection state of namespace. Namely, if it was previously
specifically or implicitly selected then after this call it will be
explicitly deselected.
Parameters#
| Name | Type | Description |
|---|---|---|
namespace |
string |
The name of a namespace |
Returns#
void
unselect#
▸ unselect(item): void
Parameters#
| Name | Type |
|---|---|
item |
Namespace |
Returns#
void
Inherited from#
update#
▸ update(item, data): Promise<Namespace>
Parameters#
| Name | Type |
|---|---|
item |
Namespace |
data |
Partial<Namespace> |
Returns#
Promise<Namespace>
Inherited from#
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>