Module: lib/util
Namespaces
Interfaces
Type aliases
DateFormatOptions
Ƭ DateFormatOptions: "brief"
| "mini"
Defined in
DateParam
Ƭ DateParam: string
| number
| Date
Defined in
Variables
CLUSTER_ACTION_GRACE_PERIOD
• CLUSTER_ACTION_GRACE_PERIOD: 5000
Defined in
Functions
filterResource
▸ filterResource(item
, filter
, matchCriteria?
): boolean
Parameters
Name | Type |
---|---|
item |
KubeObjectInterface
|
KubeEvent
|
filter |
FilterState
|
matchCriteria? |
string [] |
Returns
boolean
Defined in
getCluster
▸ getCluster(): string
| null
Returns
string
| null
Defined in
getClusterPrefixedPath
▸ getClusterPrefixedPath(path?
): string
Parameters
Name | Type |
---|---|
path? |
null | string |
Returns
string
Defined in
getPercentStr
▸ getPercentStr(value
, total
): null
| string
Parameters
Name | Type |
---|---|
value |
number |
total |
number |
Returns
null
| string
Defined in
getReadyReplicas
▸ getReadyReplicas(item
): any
Parameters
Name | Type |
---|---|
item |
Workload
|
Returns
any
Defined in
getResourceMetrics
▸ getResourceMetrics(item
, metrics
, resourceType
): any
[]
Parameters
Name | Type |
---|---|
item |
Node
|
metrics |
KubeMetrics
[] |
resourceType |
"cpu" | "memory" |
Returns
any
[]
Defined in
getResourceStr
▸ getResourceStr(value
, resourceType
): string
Parameters
Name | Type |
---|---|
value |
number |
resourceType |
"cpu" | "memory" |
Returns
string
Defined in
getTotalReplicas
▸ getTotalReplicas(item
): any
Parameters
Name | Type |
---|---|
item |
Workload
|
Returns
any
Defined in
localeDate
▸ localeDate(date
): string
Parameters
Name | Type |
---|---|
date |
DateParam
|
Returns
string
Defined in
timeAgo
▸ timeAgo(date
, options?
): string
Show the time passed since the given date, in the desired format.
Parameters
Name | Type | Description |
---|---|---|
date |
DateParam
|
The date since which to calculate the duration. |
options |
TimeAgoOptions
|
format takes “brief” or “mini”. “brief” rounds the date and uses the largest suitable unit (e.g. “4 weeks”). “mini” uses something like “4w” (for 4 weeks). |
Returns
string
The formatted date.
Defined in
useErrorState
▸ useErrorState(dependentSetter?
): any
[]
Parameters
Name | Type |
---|---|
dependentSetter? |
(…args : any ) => void |
Returns
any
[]
Defined in
useFilterFunc
▸ useFilterFunc(matchCriteria?
): (item
:
KubeObjectInterface
|
KubeEvent
) => boolean
Parameters
Name | Type |
---|---|
matchCriteria? |
string [] |
Returns
fn
▸ (item
): boolean
Parameters
Name | Type |
---|---|
item |
KubeObjectInterface
|
KubeEvent
|
Returns
boolean
Defined in
useURLState
▸ useURLState(key
, defaultValue
): [number
, React.Dispatch
<React.SetStateAction
<number
>>]
A hook to manage a state variable that is also stored in the URL.
Parameters
Name | Type | Description |
---|---|---|
key |
string |
The name of the key in the URL. If empty, then the hook behaves like useState. |
defaultValue |
number |
- |
Returns
[number
, React.Dispatch
<React.SetStateAction
<number
>>]
Defined in
▸ useURLState(key
, valueOrParams
): [number
, React.Dispatch
<React.SetStateAction
<number
>>]
A hook to manage a state variable that is also stored in the URL.
Parameters
Name | Type | Description |
---|---|---|
key |
string |
The name of the key in the URL. If empty, then the hook behaves like useState. |
valueOrParams |
number | URLStateParams <number > |
- |
Returns
[number
, React.Dispatch
<React.SetStateAction
<number
>>]