diff --git a/src/renderer/components/+user-management/+cluster-roles/add-dialog.tsx b/src/renderer/components/+user-management/+cluster-roles/add-dialog.tsx index 03adc6eab7..91ae6dabdd 100644 --- a/src/renderer/components/+user-management/+cluster-roles/add-dialog.tsx +++ b/src/renderer/components/+user-management/+cluster-roles/add-dialog.tsx @@ -37,22 +37,18 @@ interface Props extends Partial { @observer export class AddClusterRoleDialog extends React.Component { - @observable static isOpen = false; + static isOpen = observable.box(false); @observable clusterRoleName = ""; static open() { - AddClusterRoleDialog.isOpen = true; + this.isOpen.set(true); } static close() { - AddClusterRoleDialog.isOpen = false; + this.isOpen.set(false); } - close = () => { - AddClusterRoleDialog.close(); - }; - reset = () => { this.clusterRoleName = ""; }; @@ -63,7 +59,7 @@ export class AddClusterRoleDialog extends React.Component { showDetails(role.selfLink); this.reset(); - this.close(); + AddClusterRoleDialog.close(); } catch (err) { Notifications.error(err.toString()); } @@ -77,10 +73,10 @@ export class AddClusterRoleDialog extends React.Component { - + { } -const dialogState = observable.object({ - isOpen: false, -}); - @observer export class AddRoleDialog extends React.Component { + static isOpen = observable.box(false); + @observable roleName = ""; @observable namespace = ""; @@ -52,11 +50,11 @@ export class AddRoleDialog extends React.Component { } static open() { - dialogState.isOpen = true; + this.isOpen.set(true); } static close() { - dialogState.isOpen = false; + this.isOpen.set(false); } close = () => { @@ -88,7 +86,7 @@ export class AddRoleDialog extends React.Component { diff --git a/src/renderer/components/+user-management/+service-accounts/create-dialog.tsx b/src/renderer/components/+user-management/+service-accounts/create-dialog.tsx index d29731b074..d96a5d8b3f 100644 --- a/src/renderer/components/+user-management/+service-accounts/create-dialog.tsx +++ b/src/renderer/components/+user-management/+service-accounts/create-dialog.tsx @@ -38,12 +38,10 @@ import { serviceAccountsStore } from "./store"; interface Props extends Partial { } -const dialogState = observable.object({ - isOpen: false, -}); - @observer export class CreateServiceAccountDialog extends React.Component { + static isOpen = observable.box(false); + @observable name = ""; @observable namespace = "default"; @@ -53,11 +51,11 @@ export class CreateServiceAccountDialog extends React.Component { } static open() { - dialogState.isOpen = true; + this.isOpen.set(true); } static close() { - dialogState.isOpen = false; + this.isOpen.set(false); } close = () => { @@ -87,7 +85,7 @@ export class CreateServiceAccountDialog extends React.Component { diff --git a/src/renderer/components/+user-management/user-management.tsx b/src/renderer/components/+user-management/user-management.tsx index 892e400aab..6e4694b28d 100644 --- a/src/renderer/components/+user-management/user-management.tsx +++ b/src/renderer/components/+user-management/user-management.tsx @@ -61,30 +61,12 @@ export class UserManagement extends React.Component { }); } - if (isAllowedResource("podsecuritypolicies")) { + if (isAllowedResource("clusterroles")) { tabRoutes.push({ - title: "Pod Security Policies", - component: PodSecurityPolicies, - url: podSecurityPoliciesURL(), - routePath: podSecurityPoliciesRoute.path.toString(), - }); - } - - if (isAllowedResource("rolebindings")) { - tabRoutes.push({ - title: "Role Bindings", - component: RoleBindings, - url: roleBindingsURL(), - routePath: roleBindingsRoute.path.toString(), - }); - } - - if (isAllowedResource("clusterrolebindings")) { - tabRoutes.push({ - title: "Cluster Role Bindings", - component: ClusterRoleBindings, - url: clusterRoleBindingsURL(), - routePath: clusterRoleBindingsRoute.path.toString(), + title: "Cluster Roles", + component: ClusterRoles, + url: clusterRolesURL(), + routePath: clusterRolesRoute.path.toString(), }); } @@ -97,12 +79,30 @@ export class UserManagement extends React.Component { }); } - if (isAllowedResource("clusterroles")) { + if (isAllowedResource("clusterrolebindings")) { tabRoutes.push({ - title: "Cluster Roles", - component: ClusterRoles, - url: clusterRolesURL(), - routePath: clusterRolesRoute.path.toString(), + title: "Cluster Role Bindings", + component: ClusterRoleBindings, + url: clusterRoleBindingsURL(), + routePath: clusterRoleBindingsRoute.path.toString(), + }); + } + + if (isAllowedResource("rolebindings")) { + tabRoutes.push({ + title: "Role Bindings", + component: RoleBindings, + url: roleBindingsURL(), + routePath: roleBindingsRoute.path.toString(), + }); + } + + if (isAllowedResource("podsecuritypolicies")) { + tabRoutes.push({ + title: "Pod Security Policies", + component: PodSecurityPolicies, + url: podSecurityPoliciesURL(), + routePath: podSecurityPoliciesRoute.path.toString(), }); }