Skip to content

Commit

Permalink
frontend: KubeObject: Set apiVersion in constructor
Browse files Browse the repository at this point in the history
Previously, the apiVersion was not provided in the jsonData object in
the resource table, and apiVersion is necessary for authenticating and
displaying valid row actions. This change sets the apiVersion in the
KubeObject constructor to ensure that valid row actions for the given
KubeObject are visible.

Fixes: #2633

Signed-off-by: Evangelos Skopelitis <[email protected]>
  • Loading branch information
skoeva committed Dec 11, 2024
1 parent 950b977 commit 2150ef0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/lib/k8s/KubeObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export class KubeObject<T extends KubeObjectInterface | KubeEvent = any> {
}

constructor(json: T, cluster?: string) {
this.jsonData = json;
this.jsonData = {
...json,
apiVersion: json?.apiVersion ?? (this.constructor as typeof KubeObject).apiVersion,
};
this._clusterName = cluster || getCluster() || '';
}

Expand Down

0 comments on commit 2150ef0

Please sign in to comment.