Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd: Open path in terminal followup fixes #21284

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/systemd/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
{
"matches": ["console", "command", "bash", "shell"]
}
]
],
"capabilities": ["path"]
}
},

Expand Down
8 changes: 4 additions & 4 deletions pkg/systemd/terminal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,25 +272,25 @@ const _ = cockpit.gettext;
</div>
<div className="ct-terminal-dir-alert">
{this.state.pathError && <Alert isInline
title={_("Error opening directory")}
title={_("Unable to open directory")}
variant="warning"
actionClose={<AlertActionCloseButton onClose={this.dismiss} />}>
<p>{_(this.state.pathError)}</p>
</Alert>
}

{this.state.changePathBusy && <Alert isInline
title={_("Change directory?")}
title={_("Running process prevents directory change")}
variant="danger"
actionClose={<AlertActionCloseButton onClose={() =>
this.setState({ changePathBusy: false })} />}
actionLinks={
<>
<Button variant="secondary" size="sm" onClick={this.forceChangeDirectory}>{_("Continue")}</Button>
<Button variant="danger" size="sm" onClick={this.forceChangeDirectory}>{_("Change directory")}</Button>
<AlertActionLink onClick={this.dismiss}>{_("Cancel")}</AlertActionLink>
</>
}>
{_("There is still a process running in this terminal. Changing the directory will kill it.")}
{_("Changing the directory will forcefully stop the currently running process. The process can also be stopped manually in the terminal before continuing.")}
</Alert>
}
</div>
Expand Down
7 changes: 3 additions & 4 deletions test/verify/check-system-terminal
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,8 @@ PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/
b.input_text("sh -c 'echo busybusybusy; echo $$; exec sleep infinity'\n")
b.wait_in_text(line_sel(8), 'busybusybusy')
pid = b.text(line_sel(9))
# m.execute(["false"])
b.go("#/?path=/tmp")
b.wait_in_text(".pf-v5-c-alert.pf-m-danger", "still a process running")
b.wait_in_text(".pf-v5-c-alert.pf-m-danger", "Running process prevents directory change")
# Cancel change
b.click("button:contains('Cancel')")
b.wait_not_present(".pf-v5-c-alert")
Expand All @@ -327,8 +326,8 @@ PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/
b.wait_in_text(line_sel(8), 'busybusybusy')
# Confirm change
b.go("#/?path=/var")
b.wait_in_text(".pf-v5-c-alert.pf-m-danger", "still a process running")
b.click("button:contains('Continue')")
b.wait_in_text(".pf-v5-c-alert.pf-m-danger", "Running process prevents directory change")
b.click("button:contains('Change directory')")
b.wait_not_present(".pf-v5-c-alert.pf-m-danger")
self.wait_line(1, "disconnected")
self.clear_terminal()
Expand Down