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

An extension cannot reliably ask Lens to activate a cluster #1759

Closed
stefcameron opened this issue Dec 11, 2020 · 7 comments · Fixed by #2355
Closed

An extension cannot reliably ask Lens to activate a cluster #1759

stefcameron opened this issue Dec 11, 2020 · 7 comments · Fixed by #2355
Assignees
Labels
bug Something isn't working
Milestone

Comments

@stefcameron
Copy link
Contributor

After some hacking, this seems to work, although it doesn't always work (not sure why):

  Store.clusterStore.activeClusterId = clusterId;
  extension.navigate(`/cluster/${clusterId}`);

I noticed that clusterStore does not provide a setActive(clusterId) similar to workspaceStore.setActive(wsId) where the latter, when called, activates the workspace AND switches to it.

On the surface, it would be seem logical to have clusterStore.setActive(clusterId), and when called, Lens activates the cluster AND switches the view to it.

Note that today, just doing Store.clusterStore.activeClusterId = clusterId will only activate (or at least, seem to) the cluster (by putting a white square behind its icon in the left sidebar, like what happens when you click the icon), however it does NOT also navigate to that cluster.

@stefcameron stefcameron added the bug Something isn't working label Dec 11, 2020
@stefcameron
Copy link
Contributor Author

@Nokel81 and @jim-docker FYI

@jim-docker
Copy link
Contributor

Can you set Store.clusterStore.activeClusterId in an extension in 4.0.0? I get

Cannot assign to 'activeClusterId' because it is a read-only property.

@stefcameron
Copy link
Contributor Author

Seems to be working OK: https://github.com/Mirantis/lens-extension-cc/blob/master/src/cc/store/ClusterActionsProvider.js#L356

I haven't noticed that -- but maybe that's a TypeScript error? I'm running JS in this case.

https://github.com/lensapp/lens/blob/master/src/extensions/stores/cluster-store.ts#L20-L29 shows there's a getter and a setter, so not sure why you'd have trouble.

Just doing that alone isn't "enough" for me, though. Still have to call extension.navigate()

@jim-docker
Copy link
Contributor

Ah, I was using rc version of the extensions api, builds with 4.0.2, as you know :)

@Nokel81
Copy link
Collaborator

Nokel81 commented Dec 14, 2020

I have a branch (https://github.com/lensapp/lens/tree/issue-1759) with my changes. I'll be putting up a PR tomorrow some time.

@stefcameron
Copy link
Contributor Author

I have a branch (https://github.com/lensapp/lens/tree/issue-1759) with my changes. I'll be putting up a PR tomorrow some time.

@Nokel81 Reminder about ^^^ 🙂

@Nokel81
Copy link
Collaborator

Nokel81 commented Jan 7, 2021

@stefcameron thanks for the reminder, I was on PTO. There is a few items I want to clean up before making that change directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants