mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow extensions to register kube-object menus + details (#1108)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
91bef77997
commit
99db7aca19
101 files changed
+7858
-1604
No files matched your search
@@ -21,8 +21,8 @@ import { PodCharts, podMetricTabs } from "../+workloads-pods/pod-charts";
|
||||
import { reaction } from "mobx";
|
||||
import { PodDetailsList } from "../+workloads-pods/pod-details-list";
|
||||
import { ReplicaSets } from "../+workloads-replicasets";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { KubeObjectMeta } from "../kube-object/kube-object-meta";
|
||||
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<Deployment> {
|
||||
}
|
||||
@@ -122,6 +122,10 @@ export class DeploymentDetails extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
apiManager.registerViews(deploymentApi, {
|
||||
Details: DeploymentDetails
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Deployment",
|
||||
apiVersions: ["apps/v1"],
|
||||
components: {
|
||||
Details: (props: any) => <DeploymentDetails {...props} />
|
||||
}
|
||||
})
|
||||
@@ -21,7 +21,8 @@ import { cssNames } from "../../utils";
|
||||
import kebabCase from "lodash/kebabCase";
|
||||
import orderBy from "lodash/orderBy";
|
||||
import { KubeEventIcon } from "../+events/kube-event-icon";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { kubeObjectMenuRegistry } from "../../api/kube-object-menu-registry";
|
||||
import { DeploymentDetails } from "./deployment-details";
|
||||
|
||||
enum sortBy {
|
||||
name = "name",
|
||||
@@ -96,15 +97,18 @@ export class Deployments extends React.Component<Props> {
|
||||
export function DeploymentMenu(props: KubeObjectMenuProps<Deployment>) {
|
||||
const { object, toolbar } = props;
|
||||
return (
|
||||
<KubeObjectMenu {...props}>
|
||||
<MenuItem onClick={() => DeploymentScaleDialog.open(object)}>
|
||||
<Icon material="open_with" title={_i18n._(t`Scale`)} interactive={toolbar}/>
|
||||
<span className="title"><Trans>Scale</Trans></span>
|
||||
</MenuItem>
|
||||
</KubeObjectMenu>
|
||||
<MenuItem onClick={() => DeploymentScaleDialog.open(object)}>
|
||||
<Icon material="open_with" title={_i18n._(t`Scale`)} interactive={toolbar}/>
|
||||
<span className="title"><Trans>Scale</Trans></span>
|
||||
</MenuItem>
|
||||
)
|
||||
}
|
||||
|
||||
apiManager.registerViews(deploymentApi, {
|
||||
Menu: DeploymentMenu,
|
||||
});
|
||||
kubeObjectMenuRegistry.add({
|
||||
kind: "Deployment",
|
||||
apiVersions: ["apps/v1"],
|
||||
components: {
|
||||
MenuItem: DeploymentMenu
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user