Turn on strict mode in tsconfig.json, some helpful lints, and required cleanup where strictness necessitates it (#5195)

* Turn on strict mode in tsconfig.json

- Add route, clusterRoute, and payloadValidatedClusterRoute helper
  functions to improve types with backend routes

- Turn on the following new lints:
  - react/jsx-first-prop-new-line
  - react/jsx-wrap-multilines
  - react/jsx-one-expression-per-line
  - react/jsx-max-props-per-line
  - react/jsx-indent
  - react/jsx-indent-props

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix build

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Replace KubeObject scope strings with enum

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert package.json version changes

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* revert move hostedCluster(Id)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* change some type param names to be not single letters

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove copy-extension-themes

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* add new make clean action

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix build to not use webpack for generating types

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube-object-menu.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix select.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* revert move fileNameMigration to index

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix ref logic error

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix log-resource-selector.test.tsx tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-store.test.ts test by overriding createStorage to not touch file system

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cluster.test.ts tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube=api.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fixed hotbar-store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kubeconfig-manager.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cluster-role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix pods.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix delete-cluster-dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix daemonset.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix replicaset.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix statefulsets/dialog/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix replicasets/scale-dialog/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix deployments.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix deployments/scale/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cronjob.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix stateful-set.api.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix deployment.api.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix api-manager.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix statefulset.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix job.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix pods.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix scroll-spy.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix hotbar-remove-command.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog-entity-registry.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix welcome.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix verify-that-all-routes-have-route-component.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix pod-tolerations.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* better fix for previous 3 fixes, plus also select.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube-object-menu.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix app-paths.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-tabs.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix isReactNode typing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix sub-title.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix drawer.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix list-layout.tsx and header.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix error-boundary.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix upgrade-chart/store.ts and dock-tab.store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix install-chart/store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix edit-resource/store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix create-resource/store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix namespace-select.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix namespace-select-filter.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix crd-list.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix wrong types for extensions

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix circular dependency

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix circular dependency on catalogCategoryRegistry

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix api-kube

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix type errors, most <Select /> errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fixing more type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* some more fixing type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* convert all KubeApis to injectable with legacy global backups

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* factor out into a common file all the exports

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* convert all KubeObjectStores to injectable with legacy global backups

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove unused legacy KubeApi globals

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix bad previous commit

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* more crash fixing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* try and fix behavioural tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix sidebar-and-tab-navigation-for-core.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix sidebar-and-tab-navigation-for-extensions.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-using-application-menu.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Make ThemeStore non-singleton and fix navigation-to-terminal-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* extensions.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog-entity-registry.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-using-application-menu.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix log-resource-selector.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-tabs.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix delete-cluster-dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-kubernetes-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-editor-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-proxy-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-using-application-menu.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-application-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix select.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix hotbar-remove-command.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cluster-role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-extension-specific-preferences.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-telemetry-preferences.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix closing-preferences.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-editor-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-proxy-preferences.test.ts

- Fix other type errors too

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* final tweaks

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add more tsconfig files, fix bug in <Catalog>

- Make all of history, navigation injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Convert all of kube-details-params/ and navigate/ to injectable

- This fixes a runtime error that was encountered during testing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix runtime errors on renderer

- remove all static uses of `createPageParam` (and then removed the
  legacy global)
- Made LensRendererExtension and LensMainExtension just used
  dependencies and not the getLegacyDi
- Fixed circular dep in extension-loader

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Move registerStore calls to after injectMany

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* replace all the rest of the legacy uses of apiManager

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix stack overflow and cycles in DI

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix NamespaceSelectFilter not opening

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix WizardStep and AddNamespaceDialog

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix KubeApi's not being registered

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* cleanup WindowManager

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Proper fix for Wizard, fix NamespaceStore.subscribe

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Rewrite withTooltip to be more type correct

- Fixes mobx related "too many recursive actions" error

- Change all the uses of withTooltips to be functional components

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add e2e test to cover kube api registration

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* cleanup internal-commands

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove cast in <Animate>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix command-palette e2e test

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix type error after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix test name

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix code to help CodeQL scanner

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* update intree extension lock files

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix build-extensions picking wrong @types/react

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix tests from rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix type error

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Make KubeconfigSyncManager more injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix crash in test mode for Dialog

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* make Select snapshots deterministic

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix new type error

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube-object.store.test.ts typing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix merge build issues

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix snapshots after merge

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix lint after merge

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* reexport BaseKubeJsonApiObjectMetadata

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix typo in terminalSpawningPool

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove duplicate license header

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix typo to waitUntilDefined

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove iter use from getLegacyGlobalDiForExtensionApi

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove complex createStorage override

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* override logger with mocks only when needed for tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove specialized overrideStore flags for getDiForUnitTesting

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove unnecessary | undefined types from the exactOptionalFieldTypes experiment

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* use more descriptive name for local test mocks

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove unnecessary addition to 'make clean' target

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove oddity of KubeObjectStore.getById(undefined) being allowed

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* rename KubeObject.getDescriptor in favour of name without fundemental JS meaning

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Simplify legacyRegisterApi when working in behaviour unit tests

- Don't emit within main environment as there should be no auto
  registering there

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* change confusing variable name in ReactiveDuration

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* make visitor pattern more explicit for Entity contextMenuOpen

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* toggleDetails -> toggleKubeDetailsPane is more specific

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove outdated comment

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix bug where LensExtension dependencies are not set

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests from the revert of react 18

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix more tests from merge

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix typings with new is-compatible-extension tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* more type fixing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert in-tree extension versions

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Improve name of guarding injectable for stores and apis

- New name better implies that it is just a guard state and does not do
  anything

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add helper for <Select>.isMulti for storing in a Set<Value>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix is-compatible-extension.test.ts types

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-05-16 07:17:57 -04:00
1 parent 381d77c633
commit dfcb7c3330
1062 files changed
+26512 -28689

No files matched your search

@@ -5,8 +5,8 @@
import React from "react";
import { Link } from "react-router-dom";
import type { PodVolumeVariants, Pod, SecretReference } from "../../../../../common/k8s-api/endpoints";
import type { KubeApi } from "../../../../../common/k8s-api/kube-api";
import type { LocalObjectReference, KubeObject } from "../../../../../common/k8s-api/kube-object";
import type { KubeApiQueryParams, ResourceDescriptor } from "../../../../../common/k8s-api/kube-api";
import type { LocalObjectReference } from "../../../../../common/k8s-api/kube-object";
import { DrawerItem } from "../../../drawer";
import { getDetailsUrl } from "../../../kube-detail-params";
@@ -18,11 +18,15 @@ export interface PodVolumeVariantSpecificProps<Kind extends keyof PodVolumeVaria
export type VolumeVariantComponent<Kind extends keyof PodVolumeVariants> = React.FunctionComponent<PodVolumeVariantSpecificProps<Kind>>;
export interface LocalRefPropsApi {
getUrl(desc?: Partial<ResourceDescriptor>, query?: Partial<KubeApiQueryParams>): string;
}
export interface LocalRefProps {
pod: Pod;
title: string;
kubeRef: LocalObjectReference | SecretReference | undefined;
api: KubeApi<KubeObject>;
api: LocalRefPropsApi;
}
export const LocalRef = ({ pod, title, kubeRef: ref, api }: LocalRefProps) => {
@@ -4,7 +4,7 @@
*/
import React from "react";
import type { Pod, PodVolume, PodVolumeKind } from "../../../../../common/k8s-api/endpoints";
import type { Pod, PodSpecVolume, PodVolumeKind } from "../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../drawer";
import { Icon } from "../../../icon";
import { AwsElasticBlockStore } from "./variants/aws-elastic-block-store";
@@ -47,7 +47,7 @@ const deprecatedVolumeTypes = new Set<PodVolumeKind>([
interface VolumeVariantProps {
pod: Pod;
volume: PodVolume;
volume: PodSpecVolume;
}
interface VolumeVariantRender {
@@ -59,210 +59,330 @@ function renderVolumeVariant({ pod, volume }: VolumeVariantProps): VolumeVariant
if (volume.awsElasticBlockStore) {
return {
kind: "awsElasticBlockStore",
element: <AwsElasticBlockStore variant={volume.awsElasticBlockStore} pod={pod} volumeName={volume.name} />,
element: <AwsElasticBlockStore
variant={volume.awsElasticBlockStore}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.azureDisk) {
return {
kind: "azureDisk",
element: <AzureDisk variant={volume.azureDisk} pod={pod} volumeName={volume.name} />,
element: <AzureDisk
variant={volume.azureDisk}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.azureFile) {
return {
kind: "azureFile",
element: <AzureFile variant={volume.azureFile} pod={pod} volumeName={volume.name} />,
element: <AzureFile
variant={volume.azureFile}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.cephfs) {
return {
kind: "cephfs",
element: <CephFs variant={volume.cephfs} pod={pod} volumeName={volume.name} />,
element: <CephFs
variant={volume.cephfs}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.cinder) {
return {
kind: "cinder",
element: <Cinder variant={volume.cinder} pod={pod} volumeName={volume.name} />,
element: <Cinder
variant={volume.cinder}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.configMap) {
return {
kind: "configMap",
element: <ConfigMap variant={volume.configMap} pod={pod} volumeName={volume.name} />,
element: <ConfigMap
variant={volume.configMap}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.csi) {
return {
kind: "csi",
element: <ContainerStorageInterface variant={volume.csi} pod={pod} volumeName={volume.name} />,
element: <ContainerStorageInterface
variant={volume.csi}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.downwardAPI) {
return {
kind: "downwardAPI",
element: <DownwardAPI variant={volume.downwardAPI} pod={pod} volumeName={volume.name} />,
element: <DownwardAPI
variant={volume.downwardAPI}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.emptyDir) {
return {
kind: "emptyDir",
element: <EmptyDir variant={volume.emptyDir} pod={pod} volumeName={volume.name} />,
element: <EmptyDir
variant={volume.emptyDir}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.ephemeral) {
return {
kind: "ephemeral",
element: <Ephemeral variant={volume.ephemeral} pod={pod} volumeName={volume.name} />,
element: <Ephemeral
variant={volume.ephemeral}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.fc) {
return {
kind: "fc",
element: <FiberChannel variant={volume.fc} pod={pod} volumeName={volume.name} />,
element: <FiberChannel
variant={volume.fc}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.flexVolume) {
return {
kind: "flexVolume",
element: <FlexVolume variant={volume.flexVolume} pod={pod} volumeName={volume.name} />,
element: <FlexVolume
variant={volume.flexVolume}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.flocker) {
return {
kind: "flocker",
element: <Flocker variant={volume.flocker} pod={pod} volumeName={volume.name} />,
element: <Flocker
variant={volume.flocker}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.gcePersistentDisk) {
return {
kind: "gcePersistentDisk",
element: <GcePersistentDisk variant={volume.gcePersistentDisk} pod={pod} volumeName={volume.name} />,
element: <GcePersistentDisk
variant={volume.gcePersistentDisk}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.gitRepo) {
return {
kind: "gitRepo",
element: <GitRepo variant={volume.gitRepo} pod={pod} volumeName={volume.name} />,
element: <GitRepo
variant={volume.gitRepo}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.glusterfs) {
return {
kind: "glusterfs",
element: <GlusterFs variant={volume.glusterfs} pod={pod} volumeName={volume.name} />,
element: <GlusterFs
variant={volume.glusterfs}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.hostPath) {
return {
kind: "hostPath",
element: <HostPath variant={volume.hostPath} pod={pod} volumeName={volume.name} />,
element: <HostPath
variant={volume.hostPath}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.iscsi) {
return {
kind: "iscsi",
element: <IScsi variant={volume.iscsi} pod={pod} volumeName={volume.name} />,
element: <IScsi
variant={volume.iscsi}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.local) {
return {
kind: "local",
element: <Local variant={volume.local} pod={pod} volumeName={volume.name} />,
element: <Local
variant={volume.local}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.nfs) {
return {
kind: "nfs",
element: <NetworkFs variant={volume.nfs} pod={pod} volumeName={volume.name} />,
element: <NetworkFs
variant={volume.nfs}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.persistentVolumeClaim) {
return {
kind: "persistentVolumeClaim",
element: <PersistentVolumeClaim variant={volume.persistentVolumeClaim} pod={pod} volumeName={volume.name} />,
element: <PersistentVolumeClaim
variant={volume.persistentVolumeClaim}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.photonPersistentDisk) {
return {
kind: "photonPersistentDisk",
element: <PhotonPersistentDisk variant={volume.photonPersistentDisk} pod={pod} volumeName={volume.name} />,
element: <PhotonPersistentDisk
variant={volume.photonPersistentDisk}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.portworxVolume) {
return {
kind: "portworxVolume",
element: <PortworxVolume variant={volume.portworxVolume} pod={pod} volumeName={volume.name} />,
element: <PortworxVolume
variant={volume.portworxVolume}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.projected) {
return {
kind: "projected",
element: <Projected variant={volume.projected} pod={pod} volumeName={volume.name} />,
element: <Projected
variant={volume.projected}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.quobyte) {
return {
kind: "quobyte",
element: <Quobyte variant={volume.quobyte} pod={pod} volumeName={volume.name} />,
element: <Quobyte
variant={volume.quobyte}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.rbd) {
return {
kind: "rbd",
element: <RadosBlockDevice variant={volume.rbd} pod={pod} volumeName={volume.name} />,
element: <RadosBlockDevice
variant={volume.rbd}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.scaleIO) {
return {
kind: "scaleIO",
element: <ScaleIo variant={volume.scaleIO} pod={pod} volumeName={volume.name} />,
element: <ScaleIo
variant={volume.scaleIO}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.secret) {
return {
kind: "secret",
element: <Secret variant={volume.secret} pod={pod} volumeName={volume.name} />,
element: <Secret
variant={volume.secret}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.storageos) {
return {
kind: "storageos",
element: <StorageOs variant={volume.storageos} pod={pod} volumeName={volume.name} />,
element: <StorageOs
variant={volume.storageos}
pod={pod}
volumeName={volume.name}
/>,
};
}
if (volume.vsphereVolume) {
return {
kind: "vsphereVolume",
element: <VsphereVolume variant={volume.vsphereVolume} pod={pod} volumeName={volume.name} />,
element: <VsphereVolume
variant={volume.vsphereVolume}
pod={pod}
volumeName={volume.name}
/>,
};
}
@@ -4,7 +4,7 @@
*/
import React from "react";
import { secretsApi } from "../../../../../../common/k8s-api/endpoints";
import { secretApi } from "../../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
@@ -30,7 +30,7 @@ export const CephFs: VolumeVariantComponent<"cephfs"> = (
pod={pod}
title="Secret"
kubeRef={secretRef}
api={secretsApi}
api={secretApi}
/>
)
: (
@@ -4,7 +4,7 @@
*/
import React from "react";
import { secretsApi } from "../../../../../../common/k8s-api/endpoints";
import { secretApi } from "../../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
@@ -36,25 +36,25 @@ export const ContainerStorageInterface: VolumeVariantComponent<"csi"> = ({
pod={pod}
title="Controller Publish Secret"
kubeRef={controllerPublishSecretRef}
api={secretsApi}
api={secretApi}
/>
<LocalRef
pod={pod}
title="Controller Expand Secret"
kubeRef={controllerExpandSecretRef}
api={secretsApi}
api={secretApi}
/>
<LocalRef
pod={pod}
title="Node Publish Secret"
kubeRef={nodePublishSecretRef}
api={secretsApi}
api={secretApi}
/>
<LocalRef
pod={pod}
title="Node Stage Secret"
kubeRef={nodeStageSecretRef}
api={secretsApi}
api={secretApi}
/>
{
Object.entries(volumeAttributes)
@@ -8,18 +8,18 @@ import { DrawerItem, DrawerItemLabels } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
export const Ephemeral: VolumeVariantComponent<"ephemeral"> = (
({ pod, volumeName, variant: { volumeClaimTemplate: { metadata, spec }}}) => (
({ pod, volumeName, variant: { volumeClaimTemplate: { metadata = {}, spec }}}) => (
<>
<DrawerItem name="PVC Template Name">
{pod.getName()}-{volumeName}
{`${pod.getName()}-${volumeName}`}
</DrawerItem>
<DrawerItemLabels
name="Template Labels"
labels={metadata.labels}
labels={metadata.labels ?? {}}
/>
<DrawerItemLabels
name="Template Annotations"
labels={metadata.annotations}
labels={metadata.annotations ?? {}}
/>
<DrawerItem name="Template PVC Spec">
{dump(spec)}
@@ -4,13 +4,13 @@
*/
import React from "react";
import { secretsApi } from "../../../../../../common/k8s-api/endpoints";
import { secretApi } from "../../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
export const FlexVolume: VolumeVariantComponent<"flexVolume"> = (
({ pod, variant: { driver, fsType, secretRef, readOnly = false, options }}) => (
({ pod, variant: { driver, fsType, secretRef, readOnly = false, options = {}}}) => (
<>
<DrawerItem name="Driver">
{driver}
@@ -22,7 +22,7 @@ export const FlexVolume: VolumeVariantComponent<"flexVolume"> = (
pod={pod}
title="Secret"
kubeRef={secretRef}
api={secretsApi}
api={secretApi}
/>
<DrawerItem name="Readonly">
{readOnly.toString()}
@@ -4,7 +4,7 @@
*/
import React from "react";
import { pvcApi } from "../../../../../../common/k8s-api/endpoints";
import { persistentVolumeClaimApi } from "../../../../../../common/k8s-api/endpoints";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
@@ -14,7 +14,7 @@ export const PersistentVolumeClaim: VolumeVariantComponent<"persistentVolumeClai
pod={pod}
title="Name"
kubeRef={{ name: claimName }}
api={pvcApi}
api={persistentVolumeClaimApi}
/>
)
);
@@ -11,7 +11,7 @@ export const Projected: VolumeVariantComponent<"projected"> = (
({ variant: { sources, defaultMode }}) => (
<>
<DrawerItem name="Default Mount Mode">
0o{defaultMode.toString(8)}
{`0o${defaultMode.toString(8)}`}
</DrawerItem>
<DrawerItem name="Sources">
{
@@ -27,7 +27,7 @@ export const Projected: VolumeVariantComponent<"projected"> = (
<ul>
{secret.items?.map(({ key, path }) => (
<li key={key}>
{key} ⇢ {path}
{`${key}⇢${path}`}
</li>
))}
</ul>
@@ -58,7 +58,7 @@ export const Projected: VolumeVariantComponent<"projected"> = (
<ul>
{configMap.items?.map(({ key, path }) => (
<li key={key}>
{key} ⇢ {path}
{`${key}⇢${path}`}
</li>
))}
</ul>
@@ -72,7 +72,7 @@ export const Projected: VolumeVariantComponent<"projected"> = (
{serviceAccountToken.audience}
</DrawerItem>
<DrawerItem name="Expiration">
{String(serviceAccountToken.expirationSeconds || (60*60 /* an hour */))}s
{`${serviceAccountToken.expirationSeconds ?? 60*60 /* an hour */}s`}
</DrawerItem>
<DrawerItem name="Path">
{serviceAccountToken.path}
@@ -4,7 +4,7 @@
*/
import React from "react";
import { secretsApi } from "../../../../../../common/k8s-api/endpoints";
import { secretApi } from "../../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
@@ -36,7 +36,7 @@ export const RadosBlockDevice: VolumeVariantComponent<"rbd"> = (
pod={pod}
title="Authentication Secret"
kubeRef={secretRef}
api={secretsApi}
api={secretApi}
/>
)
: (
@@ -4,7 +4,7 @@
*/
import React from "react";
import { secretsApi } from "../../../../../../common/k8s-api/endpoints";
import { secretApi } from "../../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
@@ -22,7 +22,7 @@ export const ScaleIo: VolumeVariantComponent<"scaleIO"> = (
pod={pod}
title="Name"
kubeRef={secretRef}
api={secretsApi}
api={secretApi}
/>
<DrawerItem name="SSL Enabled">
{sslEnabled.toString()}
@@ -4,7 +4,7 @@
*/
import React from "react";
import { secretsApi } from "../../../../../../common/k8s-api/endpoints";
import { secretApi } from "../../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
@@ -16,7 +16,7 @@ export const Secret: VolumeVariantComponent<"secret"> = (
pod={pod}
title="Name"
kubeRef={{ name: secretName }}
api={secretsApi}
api={secretApi}
/>
<DrawerItem name="Items" hidden={items.length === 0}>
<ul>
@@ -24,7 +24,7 @@ export const Secret: VolumeVariantComponent<"secret"> = (
</ul>
</DrawerItem>
<DrawerItem name="Default File Mode">
0o{defaultMode.toString(8)}
{`0o${defaultMode.toString(8)}`}
</DrawerItem>
<DrawerItem name="Optional">
{optional.toString()}
@@ -4,7 +4,7 @@
*/
import React from "react";
import { secretsApi } from "../../../../../../common/k8s-api/endpoints";
import { secretApi } from "../../../../../../common/k8s-api/endpoints";
import { DrawerItem } from "../../../../drawer";
import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
@@ -32,7 +32,7 @@ export const StorageOs: VolumeVariantComponent<"storageos"> = (
pod={pod}
title="Secret"
kubeRef={secretRef}
api={secretsApi}
api={secretApi}
/>
</>
)