Skip to content

Commit

Permalink
shell: Add dummy jump prop to host selector's CockpitNav
Browse files Browse the repository at this point in the history
The property is required, and from the component's PoV that is right as
it gets called unconditionally. In the host selector we don't use
jumps/links, but React's property check cannot know that.

To quiesce these warnings, add a dummy jump property to the host
selector instantiation.
  • Loading branch information
martinpitt committed Oct 19, 2023
1 parent 769602c commit 4e00e50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 10 additions & 2 deletions pkg/shell/hosts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class CockpitHosts extends React.Component {
return null;
}

// HACK: using HTMl rather than Select PF4 component as:
// HACK: using HTML rather than Select PF4 component as:
// 1. It does not change the arrow when opened/closed
// 2. It closes the dropdown even when trying to search... and cannot tell it not to
render() {
Expand Down Expand Up @@ -197,7 +197,15 @@ export class CockpitHosts extends React.Component {
{ this.state.opened &&
<HostsSelector>
<PageSidebar isSidebarOpen={this.props.opened} theme="dark" className={"sidebar-hosts" + (this.state.editing ? " edit-hosts" : "")}>
<CockpitNav selector={this.props.selector} groups={groups} item_render={render} sorting={(a, b) => true} filtering={this.filterHosts} current={label} />
<CockpitNav
selector={this.props.selector}
groups={groups}
item_render={render}
sorting={(a, b) => true}
filtering={this.filterHosts}
current={label}
jump={() => console.error("internal error: jump not supported in hosts selector")}
/>
<div className="nav-hosts-actions">
{this.props.machines.list.length > 1 && <Button variant="secondary" onClick={this.onEditHosts}>{this.state.editing ? _("Stop editing hosts") : _("Edit hosts")}</Button>}
<Button variant="secondary" onClick={this.onAddNewHost}>{_("Add new host")}</Button>
Expand Down
1 change: 0 additions & 1 deletion test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,6 @@ def login_and_go(self, path: Optional[str] = None, user: Optional[str] = None, h
# HACK: Fix these ASAP, these are major bugs
"Warning: validateDOMNesting.*cannot appear as a",
"Warning: Failed.*type.*prop Invalid prop",
"Warning: Failed.*type:.*is marked as required in.*but its value is `undefined`",
"Warning: React does not recognize the.*prop on a DOM element",
"Warning: .*prop on .* should not be null",
# HACK: this should be fixed, it's completely expected on OSes without tracer
Expand Down

0 comments on commit 4e00e50

Please sign in to comment.