1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+config-runtime-classes/runtime-classes-details-tolerations.tsx
Piotr Roszatycki 79efe1be29
Add Runtime Classes views (#6294)
* Show runtimeClassName in pods view

Signed-off-by: Piotr Roszatycki <piotr.roszatycki@gmail.com>

* Runtime Classes view

Signed-off-by: Piotr Roszatycki <piotr.roszatycki@gmail.com>

* Reverted formatting

Signed-off-by: Piotr Roszatycki <piotr.roszatycki@gmail.com>

Signed-off-by: Piotr Roszatycki <piotr.roszatycki@gmail.com>
2022-10-05 08:12:16 -04:00

33 lines
1.1 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import "./runtime-classes-details-tolerations.scss";
import React from "react";
import { DrawerParamToggler, DrawerItem } from "../drawer";
import type { Toleration, KubeObject } from "../../../common/k8s-api/kube-object";
import { RuntimeClassTolerations } from "./runtime-classes-tolerations";
export interface KubeObjectWithTolerations extends KubeObject {
getTolerations(): Toleration[];
}
export interface RuntimeClassDetailsTolerationsProps {
runtimeClass: KubeObjectWithTolerations;
}
export function RuntimeClassDetailsTolerations({ runtimeClass: runtimeClass }: RuntimeClassDetailsTolerationsProps) {
const tolerations = runtimeClass.getTolerations();
if (!tolerations.length) return null;
return (
<DrawerItem name="Tolerations" className="RuntimeClassDetailsTolerations">
<DrawerParamToggler label={tolerations.length}>
<RuntimeClassTolerations tolerations={tolerations} />
</DrawerParamToggler>
</DrawerItem>
);
}