1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/common/k8s-api/endpoints/component-status.api.ts
Sebastian Malton 1031d754f6 convert all KubeApis to injectable with legacy global backups
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-05-04 08:47:19 -04:00

38 lines
928 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { KubeObject } from "../kube-object";
import type { DerivedKubeApiOptions } from "../kube-api";
import { KubeApi } from "../kube-api";
export interface ComponentStatusCondition {
type: string;
status: string;
message: string;
}
export interface ComponentStatus {
conditions: ComponentStatusCondition[];
}
export class ComponentStatus extends KubeObject {
static kind = "ComponentStatus";
static namespaced = false;
static apiBase = "/api/v1/componentstatuses";
getTruthyConditions() {
return this.conditions.filter(c => c.status === "True");
}
}
export class ComponentStatusApi extends KubeApi<ComponentStatus> {
constructor(opts: DerivedKubeApiOptions = {}) {
super({
...opts,
objectConstructor: ComponentStatus,
});
}
}