mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix cluster role dialog
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
809611aaf4
commit
40a1b2e288
@ -6,8 +6,10 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import { action } from "mobx";
|
import { action } from "mobx";
|
||||||
import addClusterRoleDialogStateInjectable from "./state.injectable";
|
import addClusterRoleDialogStateInjectable from "./state.injectable";
|
||||||
|
|
||||||
const openAddClusterRoleDialogStateInjectable = getInjectable({
|
export type OpenAddClusterRoleDialog = () => void;
|
||||||
id: "open-add-cluster-role-dialog-state",
|
|
||||||
|
const openAddClusterRoleDialogInjectable = getInjectable({
|
||||||
|
id: "open-add-cluster-role-dialog",
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const state = di.inject(addClusterRoleDialogStateInjectable);
|
const state = di.inject(addClusterRoleDialogStateInjectable);
|
||||||
|
|
||||||
@ -18,4 +20,4 @@ const openAddClusterRoleDialogStateInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default openAddClusterRoleDialogStateInjectable;
|
export default openAddClusterRoleDialogInjectable;
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import { KubeObjectAge } from "../../kube-object/age";
|
|||||||
import type { ClusterRoleStore } from "./store";
|
import type { ClusterRoleStore } from "./store";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import clusterRoleStoreInjectable from "./store.injectable";
|
import clusterRoleStoreInjectable from "./store.injectable";
|
||||||
|
import type { OpenAddClusterRoleDialog } from "./add-dialog/open.injectable";
|
||||||
|
import openAddClusterRoleDialogInjectable from "./add-dialog/open.injectable";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -24,18 +26,24 @@ enum columnId {
|
|||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
clusterRoleStore: ClusterRoleStore;
|
clusterRoleStore: ClusterRoleStore;
|
||||||
|
openAddClusterRoleDialog: OpenAddClusterRoleDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
class NonInjectedClusterRoles extends React.Component<Dependencies> {
|
class NonInjectedClusterRoles extends React.Component<Dependencies> {
|
||||||
render() {
|
render() {
|
||||||
|
const {
|
||||||
|
openAddClusterRoleDialog,
|
||||||
|
clusterRoleStore,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SiblingsInTabLayout>
|
<SiblingsInTabLayout>
|
||||||
<KubeObjectListLayout
|
<KubeObjectListLayout
|
||||||
isConfigurable
|
isConfigurable
|
||||||
tableId="access_cluster_roles"
|
tableId="access_cluster_roles"
|
||||||
className="ClusterRoles"
|
className="ClusterRoles"
|
||||||
store={this.props.clusterRoleStore}
|
store={clusterRoleStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.name]: clusterRole => clusterRole.getName(),
|
[columnId.name]: clusterRole => clusterRole.getName(),
|
||||||
[columnId.age]: clusterRole => -clusterRole.getCreationTimestamp(),
|
[columnId.age]: clusterRole => -clusterRole.getCreationTimestamp(),
|
||||||
@ -55,7 +63,7 @@ class NonInjectedClusterRoles extends React.Component<Dependencies> {
|
|||||||
<KubeObjectAge key="age" object={clusterRole} />,
|
<KubeObjectAge key="age" object={clusterRole} />,
|
||||||
]}
|
]}
|
||||||
addRemoveButtons={{
|
addRemoveButtons={{
|
||||||
onAdd: () => AddClusterRoleDialog.open(),
|
onAdd: () => openAddClusterRoleDialog(),
|
||||||
addTooltip: "Create new ClusterRole",
|
addTooltip: "Create new ClusterRole",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -69,5 +77,6 @@ export const ClusterRoles = withInjectables<Dependencies>(NonInjectedClusterRole
|
|||||||
getProps: (di, props) => ({
|
getProps: (di, props) => ({
|
||||||
...props,
|
...props,
|
||||||
clusterRoleStore: di.inject(clusterRoleStoreInjectable),
|
clusterRoleStore: di.inject(clusterRoleStoreInjectable),
|
||||||
|
openAddClusterRoleDialog: di.inject(openAddClusterRoleDialogInjectable),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user