mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow to specify KubeObjectDetailRegistration priority (#1335)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
1f88c05e82
commit
deb4773b44
@ -9,13 +9,20 @@ export interface KubeObjectDetailRegistration {
|
||||
kind: string;
|
||||
apiVersions: string[];
|
||||
components: KubeObjectDetailComponents;
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
export class KubeObjectDetailRegistry extends BaseRegistry<KubeObjectDetailRegistration> {
|
||||
getItemsForKind(kind: string, apiVersion: string) {
|
||||
return this.items.filter((item) => {
|
||||
const items = this.items.filter((item) => {
|
||||
return item.kind === kind && item.apiVersions.includes(apiVersion)
|
||||
}).map((item) => {
|
||||
if (item.priority === null) {
|
||||
item.priority = 50
|
||||
}
|
||||
return item
|
||||
})
|
||||
return items.sort((a, b) => b.priority - a.priority)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -121,8 +121,6 @@ export class HpaDetails extends React.Component<Props> {
|
||||
<div className="metrics">
|
||||
{this.renderMetrics()}
|
||||
</div>
|
||||
|
||||
<KubeEventDetails object={hpa}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -135,3 +133,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <HpaDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "HorizontalPodAutoscaler",
|
||||
apiVersions: ["autoscaling/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -87,8 +87,6 @@ export class ConfigMapDetails extends React.Component<Props> {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
<KubeEventDetails object={configMap}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -101,3 +99,14 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <ConfigMapDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ConfigMap",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ export class KubeEventDetails extends React.Component<KubeEventDetailsProps> {
|
||||
)
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<DrawerTitle className="flex gaps align-center">
|
||||
<span><Trans>Events</Trans></span>
|
||||
</DrawerTitle>
|
||||
@ -57,7 +57,7 @@ export class KubeEventDetails extends React.Component<KubeEventDetailsProps> {
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,8 +31,6 @@ export class EndpointDetails extends React.Component<Props> {
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
<KubeEventDetails object={endpoint}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -45,3 +43,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <EndpointDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Endpoints",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -127,8 +127,6 @@ export class IngressDetails extends React.Component<Props> {
|
||||
|
||||
<DrawerTitle title={<Trans>Load-Balancer Ingress Points</Trans>}/>
|
||||
{this.renderIngressPoints(ingressPoints)}
|
||||
|
||||
<KubeEventDetails object={ingress}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -141,3 +139,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <IngressDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Ingress",
|
||||
apiVersions: ["extensions/v1beta1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -137,8 +137,6 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
|
||||
<KubeEventDetails object={policy}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -151,3 +149,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <NetworkPolicyDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "NetworkPolicy",
|
||||
apiVersions: ["networking.k8s.io/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -78,8 +78,6 @@ export class ServiceDetails extends React.Component<Props> {
|
||||
<DrawerTitle title={_i18n._(t`Endpoint`)}/>
|
||||
|
||||
<ServiceDetailsEndpoint endpoint={endpoint} />
|
||||
|
||||
<KubeEventDetails object={service}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -92,3 +90,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <ServiceDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Service",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -149,7 +149,6 @@ export class NodeDetails extends React.Component<Props> {
|
||||
maxCpu={node.getCpuCapacity()}
|
||||
maxMemory={node.getMemoryCapacity()}
|
||||
/>
|
||||
<KubeEventDetails object={node}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -162,3 +161,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <NodeDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Node",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -55,8 +55,6 @@ export class StorageClassDetails extends React.Component<Props> {
|
||||
}
|
||||
</>
|
||||
)}
|
||||
|
||||
<KubeEventDetails object={storageClass}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -69,3 +67,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <StorageClassDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "StorageClass",
|
||||
apiVersions: ["storage.k8s.io/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -88,8 +88,6 @@ export class PersistentVolumeClaimDetails extends React.Component<Props> {
|
||||
</Fragment>
|
||||
))}
|
||||
</DrawerItem>
|
||||
|
||||
<KubeEventDetails object={volumeClaim}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -102,3 +100,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <PersistentVolumeClaimDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "PersistentVolumeClaim",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -96,8 +96,6 @@ export class PersistentVolumeDetails extends React.Component<Props> {
|
||||
</DrawerItem>
|
||||
</>
|
||||
)}
|
||||
|
||||
<KubeEventDetails object={volume}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -110,3 +108,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <PersistentVolumeDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "PersistentVolume",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -112,8 +112,6 @@ export class RoleBindingDetails extends React.Component<Props> {
|
||||
</Table>
|
||||
)}
|
||||
|
||||
<KubeEventDetails object={roleBinding}/>
|
||||
|
||||
<AddRemoveButtons
|
||||
onAdd={() => AddRoleBindingDialog.open(roleBinding)}
|
||||
onRemove={selectedSubjects.length ? this.removeSelectedSubjects : null}
|
||||
@ -132,6 +130,16 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <RoleBindingDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "RoleBinding",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ClusterRoleBinding",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
@ -139,3 +147,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <RoleBindingDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ClusterRoleBinding",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -59,8 +59,6 @@ export class RoleDetails extends React.Component<Props> {
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
||||
<KubeEventDetails object={role}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -73,6 +71,14 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <RoleDetails {...props}/>
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Role",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ClusterRole",
|
||||
@ -81,3 +87,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <RoleDetails {...props}/>
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ClusterRole",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props}/>
|
||||
}
|
||||
})
|
||||
|
||||
@ -125,8 +125,6 @@ export class ServiceAccountsDetails extends React.Component<Props> {
|
||||
<div className="secrets">
|
||||
{this.renderSecrets()}
|
||||
</div>
|
||||
|
||||
<KubeEventDetails object={serviceAccount}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -139,3 +137,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <ServiceAccountsDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ServiceAccount",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -81,7 +81,6 @@ export class CronJobDetails extends React.Component<Props> {
|
||||
}
|
||||
</>
|
||||
}
|
||||
<KubeEventDetails object={cronJob}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -94,3 +93,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props) => <CronJobDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "CronJob",
|
||||
apiVersions: ["batch/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -91,7 +91,6 @@ export class DaemonSetDetails extends React.Component<Props> {
|
||||
</DrawerItem>
|
||||
<ResourceMetricsText metrics={metrics}/>
|
||||
<PodDetailsList pods={childPods} owner={daemonSet}/>
|
||||
<KubeEventDetails object={daemonSet}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -104,3 +103,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props: any) => <DaemonSetDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "DaemonSet",
|
||||
apiVersions: ["apps/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props: any) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -116,7 +116,6 @@ export class DeploymentDetails extends React.Component<Props> {
|
||||
<ResourceMetricsText metrics={metrics}/>
|
||||
<ReplicaSets replicaSets={replicaSets}/>
|
||||
<PodDetailsList pods={childPods} owner={deployment}/>
|
||||
<KubeEventDetails object={deployment}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -129,3 +128,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props: any) => <DeploymentDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Deployment",
|
||||
apiVersions: ["apps/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props: any) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -101,7 +101,6 @@ export class JobDetails extends React.Component<Props> {
|
||||
<PodDetailsStatuses pods={childPods}/>
|
||||
</DrawerItem>
|
||||
<PodDetailsList pods={childPods} owner={job}/>
|
||||
<KubeEventDetails object={job}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -114,3 +113,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props: any) => <JobDetails {...props}/>
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Job",
|
||||
apiVersions: ["batch/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props: any) => <KubeEventDetails {...props}/>
|
||||
}
|
||||
})
|
||||
|
||||
@ -215,7 +215,6 @@ export class PodDetails extends React.Component<Props> {
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
<KubeEventDetails object={pod}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -225,6 +224,15 @@ kubeObjectDetailRegistry.add({
|
||||
kind: "Pod",
|
||||
apiVersions: ["v1"],
|
||||
components: {
|
||||
Details: (props: any) => <PodDetails {...props} />
|
||||
Details: (props: KubeObjectDetailsProps<Pod>) => <PodDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Pod",
|
||||
apiVersions: ["v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props: KubeObjectDetailsProps<Pod>) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -91,7 +91,6 @@ export class ReplicaSetDetails extends React.Component<Props> {
|
||||
</DrawerItem>
|
||||
<ResourceMetricsText metrics={metrics}/>
|
||||
<PodDetailsList pods={childPods} owner={replicaSet}/>
|
||||
<KubeEventDetails object={replicaSet}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -104,3 +103,11 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props: any) => <ReplicaSetDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ReplicaSet",
|
||||
apiVersions: ["apps/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props: any) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
@ -89,7 +89,6 @@ export class StatefulSetDetails extends React.Component<Props> {
|
||||
</DrawerItem>
|
||||
<ResourceMetricsText metrics={metrics}/>
|
||||
<PodDetailsList pods={childPods} owner={statefulSet}/>
|
||||
<KubeEventDetails object={statefulSet}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -103,3 +102,12 @@ kubeObjectDetailRegistry.add({
|
||||
Details: (props: any) => <StatefulSetDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "StatefulSet",
|
||||
apiVersions: ["apps/v1"],
|
||||
priority: 5,
|
||||
components: {
|
||||
Details: (props: any) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user