-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
shell: Make it all reacty #21012
shell: Make it all reacty #21012
Conversation
ef20c0f
to
c06e5df
Compare
The host switcher mockups are so old, they used PF3 and had the dashboard: (And the dashboard was where we edited machines prior.) For PF4, if we're doing a 1:1 port, we should consider doing popovers and having a modal show up when you add or edit without dismissing the popover. (It will look different from these mockups for sure.) |
c06e5df
to
40bd4da
Compare
f845f71
to
08db4e9
Compare
test/verify/check-pages
Outdated
@@ -71,6 +71,8 @@ class TestPages(testlib.MachineCase): | |||
m = self.machine | |||
b = self.browser | |||
|
|||
m.upload(["/home/mvo/work/cockpit/dist/shell"], "/usr/share/cockpit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^_^
fd4891c
to
566ddbc
Compare
hosts_sel.appendChild(this.el); | ||
} | ||
|
||
componentWillUnmount() { | ||
const hosts_sel = document.getElementById("nav-hosts"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like an easy split off PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but it's only necessary here because '#nav-hosts' doesn't exist yet (in this PR only) when the file is loaded. Also, I hope we can get rid of this DOM manipulation completely in this PR. Eventually.
@@ -307,7 +306,6 @@ export class CockpitHosts extends React.Component { | |||
item_render={render} | |||
sorting={(a, b) => true} | |||
filtering={this.filterHosts} | |||
current={label} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems CockpitNav does not use current
at all, can we then split this removal off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that was a mistake unfortunately. It uses current
to notice when navigation has happened, and then resets the search field.
This might be a good example of hard to understand magic that we want to get rid of. There might be a signal on the ShellState that announces navigation, or we might have a navigation_counter
, or something more obvious.
b5f4113
to
39ba1c5
Compare
39ba1c5
to
7bb403f
Compare
3c98dcc
to
7be28f6
Compare
8ec067c
to
13770f8
Compare
2d3f8aa
to
7819c2a
Compare
551ed93
to
f13e171
Compare
a2d9927
to
8d6214e
Compare
8d6214e
to
d4b3297
Compare
d4b3297
to
69289fb
Compare
8894552
to
17bd0ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for starting to untangle this mess! It's a lot easier to follow now.
I don't want to block this much -- I have two comments which I'd consider a blocker (bringing back the "yaya ssh dangerous" warning and the ensure_frame()
comment spelling), but both of them should be trivial. The rest is just thinking aloud or follow-up material, and thus optional.
.catch(e => { | ||
if (e.message.indexOf("GetUInt not available") === -1) | ||
console.warn(e.message); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up: This was introduced so long ago that we can just count on it now.
17bd0ad
to
b9296b2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers! 🚀 from my POV, let's do the rest in all these follow-ups.
And rewrite much of the state handling to make it easier to understand. Specifically, the old Index and MachineIndex classes and their complicated interactions have been replaced with a hopefully much more straightforward ShellState class. However, the existing React components such as CockpitHosts and TopNav have not been significantly touched. The API for launching the HostModal dialogs has been changed to make it more suitable for a later rewrite with Dialogs.run() ala pkg/lib/cockpit-connect-ssh.
b9296b2
to
cd23324
Compare
Thanks for the review! I have decided to include #21074 here, after all. It only affects frames.jsx. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/me reacts with 👍
frame, | ||
active, | ||
selected: active, | ||
displayName: frame.host === "localhost" ? "/" + frame.path : frame.host + ":/" + frame.path, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
if (machine.restarting) { | ||
title = _("The machine is rebooting"); | ||
message = ""; | ||
} else if (connecting) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 4 added lines are not executed by any test.
if (frame.ready && iframe.getAttribute("data-ready") == null) | ||
iframe.setAttribute("data-ready", "1"); | ||
else if (!frame.ready && iframe.getAttribute("data-ready")) | ||
iframe.removeAttribute("data-ready"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
if (frame.loaded && iframe.getAttribute("data-loaded") == null) | ||
iframe.setAttribute("data-loaded", "1"); | ||
else if (!frame.loaded && iframe.getAttribute("data-loaded")) | ||
iframe.removeAttribute("data-loaded"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
style === "auto") || | ||
style === "dark") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test.
self.search = function(prop, value) { | ||
for (const x in self.items) { | ||
if (self.items[x][prop] === value) | ||
return self.items[x]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 4 added lines are not executed by any test.
function component_checksum(machine, path) { | ||
const parts = path.split("/"); | ||
const pkg = parts[0]; | ||
if (machine.manifests && machine.manifests[pkg] && machine.manifests[pkg][".checksum"]) | ||
return "$" + machine.manifests[pkg][".checksum"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 5 added lines are not executed by any test.
export function compute_frame_url(machine, path) { | ||
let base, checksum; | ||
if (machine.manifests && machine.manifests[".checksum"]) | ||
checksum = "$" + machine.manifests[".checksum"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
if (checksum && checksum == component_checksum(machine, path)) { | ||
if (machine.connection_string === "localhost") | ||
base = ".."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 added lines are not executed by any test.
if (machine.connection_string === "localhost") | ||
base = ".."; | ||
else | ||
base = "../../" + checksum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
Notes to reviewers:
Ideas for followups:
current_manifest
to ShellState and use that in TopNav to get at the parent field. (TopNav uses the full path to look up the manifest itself, but should really only use the first component.) shell: Take docs from the correct manifest item #21072