1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix review comments

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-06-08 19:28:00 -04:00
parent f988ea95b1
commit 738cf564a0
4 changed files with 13 additions and 8 deletions

View File

@ -198,9 +198,12 @@ export class ClusterRoleBindingDialog extends React.Component<Props> {
isDisabled={this.isEditing} isDisabled={this.isEditing}
options={this.clusterRoleRefoptions} options={this.clusterRoleRefoptions}
value={this.selectedRoleRef} value={this.selectedRoleRef}
onChange={({ value }) => { onChange={({ value }: SelectOption<ClusterRole> ) => {
if (this.bindingName === this.selectedRoleRef.getName()) {
this.bindingName = value.getName();
}
this.selectedRoleRef = value; this.selectedRoleRef = value;
this.bindingName = this.selectedRoleRef.getName();
}} }}
/> />
@ -254,7 +257,7 @@ export class ClusterRoleBindingDialog extends React.Component<Props> {
render() { render() {
const { ...dialogProps } = this.props; const { ...dialogProps } = this.props;
const [action, nextLabel] = this.isEditing ? ["Edit", "Update"] : ["Add", "Create"]; const [action, nextLabel] = this.isEditing ? ["Edit", "Update"] : ["Add", "Create"];
const disableNext = !this.selectedRoleRef || !this.selectedBindings.length; const disableNext = !this.selectedRoleRef || !this.selectedBindings.length || !this.bindingName;
return ( return (
<Dialog <Dialog

View File

@ -217,13 +217,15 @@ export class RoleBindingDialog extends React.Component<Props> {
options={this.roleRefOptions} options={this.roleRefOptions}
value={this.selectedRoleRef} value={this.selectedRoleRef}
onChange={({ value }) => { onChange={({ value }) => {
if (this.bindingName === this.selectedRoleRef.getName()) {
this.bindingName = value.getName();
}
this.selectedRoleRef = value; this.selectedRoleRef = value;
if (this.selectedRoleRef.kind === "Role") { if (this.selectedRoleRef.kind === "Role") {
this.bindingNamespace = this.selectedRoleRef.getNs(); this.bindingNamespace = this.selectedRoleRef.getNs();
} }
this.bindingName = this.selectedRoleRef.getName();
}} }}
/> />
@ -276,7 +278,7 @@ export class RoleBindingDialog extends React.Component<Props> {
render() { render() {
const { ...dialogProps } = this.props; const { ...dialogProps } = this.props;
const [action, nextLabel] = this.isEditing ? ["Edit", "Update"] : ["Add", "Create"]; const [action, nextLabel] = this.isEditing ? ["Edit", "Update"] : ["Add", "Create"];
const disableNext = !this.selectedRoleRef || !this.selectedBindings.length; const disableNext = !this.selectedRoleRef || !this.selectedBindings.length || !this.bindingNamespace || !this.bindingName;
return ( return (
<Dialog <Dialog

View File

@ -75,7 +75,7 @@ export class RoleBindings extends React.Component<Props> {
renderTableContents={(binding: RoleBinding) => [ renderTableContents={(binding: RoleBinding) => [
binding.getName(), binding.getName(),
<KubeObjectStatusIcon key="icon" object={binding} />, <KubeObjectStatusIcon key="icon" object={binding} />,
binding.getNs() || "-", binding.getNs(),
binding.getSubjectNames(), binding.getSubjectNames(),
binding.getAge(), binding.getAge(),
]} ]}

View File

@ -1,4 +1,4 @@
.ClusterRoleDetails { .RoleDetails {
.rule { .rule {
display: grid; display: grid;
grid-template-columns: min-content auto; grid-template-columns: min-content auto;