Module: lib/util

    Namespaces

    Interfaces

    Type aliases

    DateFormatOptions

    Ƭ DateFormatOptions: "brief" | "mini"

    Defined in

    lib/util.ts:32


    DateParam

    Ƭ DateParam: string | number | Date

    Defined in

    lib/util.ts:30

    Variables

    CLUSTER_ACTION_GRACE_PERIOD

    CLUSTER_ACTION_GRACE_PERIOD: 5000

    Defined in

    lib/util.ts:28

    Functions

    filterResource

    filterResource(item, filter, matchCriteria?): boolean

    Parameters

    Name Type
    item KubeObjectInterface | KubeEvent
    filter FilterState
    matchCriteria? string[]

    Returns

    boolean

    Defined in

    lib/util.ts:142


    getCluster

    getCluster(): string | null

    Returns

    string | null

    Defined in

    lib/util.ts:211


    getClusterPrefixedPath

    getClusterPrefixedPath(path?): string

    Parameters

    Name Type
    path? null | string

    Returns

    string

    Defined in

    lib/util.ts:203


    getPercentStr

    getPercentStr(value, total): null | string

    Parameters

    Name Type
    value number
    total number

    Returns

    null | string

    Defined in

    lib/util.ts:91


    getReadyReplicas

    getReadyReplicas(item): any

    Parameters

    Name Type
    item Workload

    Returns

    any

    Defined in

    lib/util.ts:100


    getResourceMetrics

    getResourceMetrics(item, metrics, resourceType): any[]

    Parameters

    Name Type
    item Node
    metrics KubeMetrics []
    resourceType "cpu" | "memory"

    Returns

    any[]

    Defined in

    lib/util.ts:118


    getResourceStr

    getResourceStr(value, resourceType): string

    Parameters

    Name Type
    value number
    resourceType "cpu" | "memory"

    Returns

    string

    Defined in

    lib/util.ts:108


    getTotalReplicas

    getTotalReplicas(item): any

    Parameters

    Name Type
    item Workload

    Returns

    any

    Defined in

    lib/util.ts:104


    localeDate

    localeDate(date): string

    Parameters

    Name Type
    date DateParam

    Returns

    string

    Defined in

    lib/util.ts:74


    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

    lib/util.ts:45


    useErrorState

    useErrorState(dependentSetter?): any[]

    Parameters

    Name Type
    dependentSetter? (…args: any) => void

    Returns

    any[]

    Defined in

    lib/util.ts:223


    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

    lib/util.ts:198


    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

    lib/util.ts:248

    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>>]

    Defined in

    lib/util.ts:252