|
| 1 | +// @ts-ignore — React is used by JSX but react-jsx transform flags it as unused |
| 2 | +import * as React from 'react'; |
| 3 | + |
| 4 | +export type K8sResourceCommon = { |
| 5 | + apiVersion?: string; |
| 6 | + kind?: string; |
| 7 | + metadata?: { |
| 8 | + name?: string; |
| 9 | + namespace?: string; |
| 10 | + labels?: Record<string, string>; |
| 11 | + annotations?: Record<string, string>; |
| 12 | + deletionTimestamp?: string; |
| 13 | + [key: string]: unknown; |
| 14 | + }; |
| 15 | + [key: string]: unknown; |
| 16 | +}; |
| 17 | + |
| 18 | +export const k8sListItems = jest.fn(); |
| 19 | + |
| 20 | +export const K8sResourceConditionStatus = { |
| 21 | + True: 'True', |
| 22 | + False: 'False', |
| 23 | + Unknown: 'Unknown', |
| 24 | +}; |
| 25 | + |
| 26 | +export const getGroupVersionKindForModel = jest.fn( |
| 27 | + (model: any) => `${model.apiGroup || 'core'}~${model.apiVersion}~${model.kind}`, |
| 28 | +); |
| 29 | + |
| 30 | +export const useAccessReview = jest.fn(() => [true, true]); |
| 31 | + |
| 32 | +export type ColoredIconProps = { |
| 33 | + className?: string; |
| 34 | + title?: string; |
| 35 | +}; |
| 36 | + |
| 37 | +export const GreenCheckCircleIcon = ({ className, title }: any) => ( |
| 38 | + <svg data-icon="GreenCheckCircleIcon" className={className} aria-label={title} /> |
| 39 | +); |
| 40 | +export const BlueInfoCircleIcon = ({ className, title }: any) => ( |
| 41 | + <svg data-icon="BlueInfoCircleIcon" className={className} aria-label={title} /> |
| 42 | +); |
| 43 | +export const RedExclamationCircleIcon = ({ className, title }: any) => ( |
| 44 | + <svg data-icon="RedExclamationCircleIcon" className={className} aria-label={title} /> |
| 45 | +); |
| 46 | +export const YellowExclamationTriangleIcon = ({ className, title }: any) => ( |
| 47 | + <svg data-icon="YellowExclamationTriangleIcon" className={className} aria-label={title} /> |
| 48 | +); |
| 49 | + |
| 50 | +export const CamelCaseWrap = ({ value }: { value: string }) => value || ''; |
| 51 | +export const Timestamp = ({ timestamp }: { timestamp: string }) => timestamp || ''; |
| 52 | +export const ResourceLink = ({ kind, name, namespace, groupVersionKind }: any) => |
| 53 | + `[${groupVersionKind ? `${groupVersionKind.kind}` : kind}] ${name}`; |
| 54 | + |
| 55 | +export const k8sUpdate = jest.fn((opts: any) => Promise.resolve(opts.data)); |
| 56 | +export const k8sPatch = jest.fn((opts: any) => Promise.resolve(opts.resource)); |
| 57 | + |
| 58 | +export enum Operator { |
| 59 | + Exists = 'Exists', |
| 60 | + DoesNotExist = 'DoesNotExist', |
| 61 | + In = 'In', |
| 62 | + NotIn = 'NotIn', |
| 63 | + Equals = 'Equals', |
| 64 | + NotEquals = 'NotEquals', |
| 65 | + GreaterThan = 'GreaterThan', |
| 66 | + LessThan = 'LessThan', |
| 67 | + NotEqual = 'NotEqual', |
| 68 | +} |
| 69 | + |
| 70 | +export type K8sModel = any; |
| 71 | +export type Selector = any; |
| 72 | +export type K8sResourceCondition = any; |
| 73 | +export type K8sResourceKind = any; |
| 74 | +export type K8sResourceKindReference = string; |
| 75 | +export type GroupVersionKind = string; |
| 76 | +export type K8sVerb = string; |
| 77 | +export type SetFeatureFlag = (flag: string, value: boolean) => void; |
| 78 | +export type MatchLabels = Record<string, string>; |
| 79 | +export type ObjectMetadata = any; |
| 80 | +export type NodeAddress = any; |
| 81 | +export type NodeCondition = any; |
| 82 | +export type ObjectReference = any; |
| 83 | +export type TaintEffect = string; |
| 84 | +export type OwnerReference = { |
| 85 | + apiVersion: string; |
| 86 | + kind: string; |
| 87 | + name: string; |
| 88 | + uid: string; |
| 89 | +}; |
| 90 | +export type Action = { |
| 91 | + id: string; |
| 92 | + label: string; |
| 93 | + description?: string; |
| 94 | + cta?: () => void; |
| 95 | + disabled?: boolean; |
| 96 | + icon?: any; |
| 97 | + accessReview?: any; |
| 98 | +}; |
| 99 | + |
| 100 | +export enum AllPodStatus { |
| 101 | + Running = 'Running', |
| 102 | + NotReady = 'Not Ready', |
| 103 | + Warning = 'Warning', |
| 104 | + Empty = 'Empty', |
| 105 | + Failed = 'Failed', |
| 106 | + Pending = 'Pending', |
| 107 | + Succeeded = 'Succeeded', |
| 108 | + Terminating = 'Terminating', |
| 109 | + Unknown = 'Unknown', |
| 110 | + ScaledTo0 = 'Scaled to 0', |
| 111 | + Idle = 'Idle', |
| 112 | + AutoScaledTo0 = 'Autoscaled to 0', |
| 113 | + ScalingUp = 'Scaling Up', |
| 114 | + CrashLoopBackOff = 'CrashLoopBackOff', |
| 115 | +} |
0 commit comments