-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix being able to view clusters outside the current workspace #2355
Conversation
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.
LGTM
src/common/workspace-store.ts
Outdated
@@ -152,16 +241,24 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> { | |||
private static stateRequestChannel = "workspace:states"; | |||
|
|||
@observable currentWorkspaceId = WorkspaceStore.defaultId; | |||
|
|||
#seenWorkspaces = observable.set<WorkspaceId>(); |
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.
Why do we use private fields here btw?
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.
Do you mean instead of typescript's private
modifier? I felt that this was a better way to prevent outside consumers from using the raw values
Hopefully this can be in rc.2 |
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 is a lot of refactoring to introduce between 4.2.0-rc.1 and rc.2. Did you consider doing just a surgical fix for the issue now, and saving this for 4.2.1 (or even 4.3)?
I did consider a more patchwork fix, we could push this to 4.2.1 depending on how other people feel about this. I think that if we test it enough it should be fine to put it into rc.2 though. |
|
||
@observer | ||
export class LandingPage extends React.Component { | ||
private static storage = createStorage<WorkspaceId[]>("landing_page", []); |
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 will persist, nice, great idea.
I have moved this to target 4.2.1 |
this will be a known issue for 4.2.0 then? |
Yes in the final release notes I'll add that. |
LandingPage | ||
.storage | ||
.get() | ||
.filter(id => workspaceStore.getById(id)) |
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.
slick!
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
@stefcameron I think it will be as simple as |
Signed-off-by: Sebastian Malton <sebastian@malton.name>
@stefcameron Done, I have added it. I don't know why the You need to do the following: import { Store } from "@k8slens/extensions";
...
const cluster = ...;
await Store.workspaceStore.setActiveCluster(cluster); // or cluster ID |
Thanks for following-up on this, @Nokel81 ! I will watch for this in 4.2.1 (unless I get to it off Based on the call, the cluster doesn't have to be in the active workspace. Could be in some other workspace, and Lens will also activate the workspace as a result? Of course, this means Lens now ensures (maybe it always has; I haven't specifically tested) that all clusters have unique IDs... |
No that call will update the active workspace too. Though now that I think about it. I think we should instead have it be |
But I need to think about it. I only mention this because workspace are going away and I would prefer if what I told you will also work in 5.0 |
Whaaaaat? 😉 OK, I'd like to know a way that will survive, though if workspaces disappear, that will definitely impact my extension. BTW, |
@stefcameron So as we discussed, I am going to leave this API as is since putting more work into this is misplaced effort. |
You mean it will be |
Yeah that. |
Signed-off-by: Sebastian Malton <sebastian@malton.name>
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.
LGTM
Signed-off-by: Sebastian Malton sebastian@malton.name
fixes #2348
future work:
New look:
Screen.Recording.2021-03-17.at.4.30.55.PM.mov