Skip to content

Commit

Permalink
shell: Fix bugs found by TypeScript
Browse files Browse the repository at this point in the history
The cockpit.spawn function takes only two arguments (unlike
cockpit.script).

Location.reload() doesn't take any arguments, the "force_reload"
argument is a Firefox extension.

There is no "this.onSelect" in CockpitNav.
  • Loading branch information
mvollmer authored and martinpitt committed Dec 18, 2024
1 parent cb504af commit ad6998b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/shell/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class CockpitNav extends React.Component {
return (
<>
<SearchInput placeholder={_("Search")} value={this.state.search} onChange={(_, search) => this.setState({ search })} onClear={() => this.setState({ search: "" })} className="search" />
<Nav onSelect={this.onSelect} theme="dark">
<Nav theme="dark">
{ groups.map(g =>
<section className="pf-v5-c-nav__section" aria-labelledby={"section-title-" + g.name} key={g.name}>
<div className="nav-group-heading">
Expand Down
4 changes: 2 additions & 2 deletions pkg/shell/shell-modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const AboutCockpitModal = ({ dialogResult }) => {
useInit(() => {
const packages = [];
const cmd = "(set +e; rpm -qa --qf '%{NAME} %{VERSION}\\n'; dpkg-query -f '${Package} ${Version}\n' --show; pacman -Q) 2> /dev/null | grep cockpit | sort";
cockpit.spawn(["bash", "-c", cmd], [], { err: "message" })
cockpit.spawn(["bash", "-c", cmd], { err: "message" })
.then(pkgs =>
pkgs.trim().split("\n")
.forEach(p => {
Expand Down Expand Up @@ -103,7 +103,7 @@ export const LangModal = ({ dialogResult }) => {
const cookie = "CockpitLang=" + encodeURIComponent(selected) + "; path=/; expires=Sun, 16 Jul 3567 06:23:41 GMT";
document.cookie = cookie;
window.localStorage.setItem("cockpit.lang", selected);
window.location.reload(true);
window.location.reload();
}

const manifest = import_ShellManifest(cockpit.manifests.shell || { });
Expand Down

0 comments on commit ad6998b

Please sign in to comment.