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

Update redux namespace(s) state to clusters state. #1804

Merged
merged 7 commits into from
Jun 22, 2020
Merged

Conversation

absoludity
Copy link
Contributor

@absoludity absoludity commented Jun 18, 2020

The main change here is just:

export interface IClusterState {
  currentNamespace: string;
  namespaces: string[];
  error?: { action: string; error: Error };
}

interface IClustersMap {
  [cluster: string]: IClusterState;
}

export interface IClustersState {
  currentCluster: string;
  clusters: IClustersMap; 
}

Note that IClusterState (singular) is almost identical to what INamespaceState was (just s/current/currentNamespace). This change allows us to store the state of each cluster separately (including the current namespace which the user was using). The rest of the changes are just refactoring to the new format.

Ref: #1762

Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -55,7 +55,7 @@ class Header extends React.Component<IHeaderProps, IHeaderState> {
public render() {
const {
fetchNamespaces,
namespace,
cluster: cluster,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a lint issue? I would say that it forces this to be cluster,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strangely not, it seems. Updated.

import { IResource } from "../shared/types";
import clusterReducer, { IClustersState } from "./cluster";

describe("namespaceReducer", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clusterReducer

Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if I have to re-review something

Base automatically changed from 1762-mc-ui-2 to master June 22, 2020 00:14
@absoludity absoludity merged commit ad182b5 into master Jun 22, 2020
@absoludity absoludity deleted the 1762-mc-ui-state branch June 22, 2020 01:30
@absoludity
Copy link
Contributor Author

Let me know if I have to re-review something

Nope, there's only two commits since your review:

  • 1ab6f1a - from your feedback
  • 1ab6f1a - adding a similar wait (with a TODO comment) for the CI test based on your debugging last Friday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants