Skip to content

Commit

Permalink
Revert unnecessary changes to operator containers.
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Nelson <minelson@vmware.com>
  • Loading branch information
absoludity committed Jul 12, 2023
1 parent 55cef03 commit dfe2a96
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ import { ThunkDispatch } from "redux-thunk";
import { IStoreState } from "shared/types";
import actions from "../../actions";
import OperatorInstanceForm from "../../components/OperatorInstanceForm";
import { useParams } from "react-router-dom";

interface IRouteProps {
csv: string;
crd: string;
match: {
params: {
csv: string;
crd: string;
};
};
}

function mapStateToProps({
operators,
clusters: { currentCluster, clusters },
config,
}: IStoreState) {
const { csv, crd } = useParams<IRouteProps>();
function mapStateToProps(
{ operators, clusters: { currentCluster, clusters }, config }: IStoreState,
{ match: { params } }: IRouteProps,
) {
return {
cluster: currentCluster,
namespace: clusters[currentCluster].currentNamespace,
Expand All @@ -31,8 +32,8 @@ function mapStateToProps({
fetch: operators.errors.csv.fetch,
create: operators.errors.resource.create,
},
csvName: csv,
crdName: crd,
csvName: params.csv,
crdName: params.crd,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,31 @@ import { ThunkDispatch } from "redux-thunk";
import { IStoreState } from "shared/types";
import actions from "../../actions";
import OperatorInstanceUpdateForm from "../../components/OperatorInstanceUpdateForm";
import { useParams } from "react-router-dom";

interface IRouteProps {
csv: string;
crd: string;
instanceName: string;
match: {
params: {
csv: string;
crd: string;
instanceName: string;
};
};
}

function mapStateToProps({
operators,
clusters: { currentCluster, clusters },
config,
}: IStoreState) {
const { csv, crd, instanceName } = useParams<IRouteProps>();
function mapStateToProps(
{ operators, clusters: { currentCluster, clusters }, config }: IStoreState,
{ match: { params } }: IRouteProps,
) {
return {
cluster: currentCluster,
namespace: clusters[currentCluster].currentNamespace,
kubeappsCluster: config.kubeappsCluster,
isFetching: operators.isFetching,
csv: operators.csv,
errors: operators.errors.resource,
csvName: csv,
crdName: crd,
resourceName: instanceName,
csvName: params.csv,
crdName: params.crd,
resourceName: params.instanceName,
resource: operators.resource,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ import { ThunkDispatch } from "redux-thunk";
import { IResource, IStoreState } from "shared/types";
import actions from "../../actions";
import OperatorInstance from "../../components/OperatorInstance";
import { useParams } from "react-router-dom";

interface IRouteProps {
csv: string;
crd: string;
instanceName: string;
match: {
params: {
csv: string;
crd: string;
instanceName: string;
};
};
}
function mapStateToProps({
clusters: { currentCluster, clusters },
config,
operators,
}: IStoreState) {
const { csv, crd, instanceName } = useParams<IRouteProps>();
function mapStateToProps(
{ clusters: { currentCluster, clusters }, config, operators }: IStoreState,
{ match: { params } }: IRouteProps,
) {
return {
cluster: currentCluster,
namespace: clusters[currentCluster].currentNamespace,
kubeappsCluster: config.kubeappsCluster,
csvName: csv,
crdName: crd,
instanceName: instanceName,
csvName: params.csv,
crdName: params.crd,
instanceName: params.instanceName,
isFetching: operators.isFetching,
resource: operators.resource,
csv: operators.csv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,27 @@ import { ThunkDispatch } from "redux-thunk";
import { IStoreState } from "shared/types";
import actions from "../../actions";
import OperatorNew from "../../components/OperatorNew";
import { useParams } from "react-router-dom";

interface IRouteProps {
operator: string;
match: {
params: {
operator: string;
};
};
}

function mapStateToProps({
operators,
clusters: { currentCluster, clusters },
config,
}: IStoreState) {
const { operator } = useParams<IRouteProps>();
function mapStateToProps(
{ operators, clusters: { currentCluster, clusters }, config }: IStoreState,
{ match: { params } }: IRouteProps,
) {
return {
cluster: currentCluster,
namespace: clusters[currentCluster].currentNamespace,
kubeappsCluster: config.kubeappsCluster,
isFetching: operators.isFetching,
operator: operators.operator,
errors: operators.errors.operator,
operatorName: operator,
operatorName: params.operator,
} as Partial<IOperatorNewProps>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ import { ThunkDispatch } from "redux-thunk";
import { IStoreState } from "shared/types";
import actions from "../../actions";
import OperatorView from "../../components/OperatorView";
import { useParams } from "react-router-dom";

interface IRouteProps {
operator: string;
match: {
params: {
operator: string;
};
};
}

function mapStateToProps({
operators,
clusters: { currentCluster, clusters },
config,
}: IStoreState) {
const { operator } = useParams<IRouteProps>();
function mapStateToProps(
{ operators, clusters: { currentCluster, clusters }, config }: IStoreState,
{ match: { params } }: IRouteProps,
) {
return {
cluster: currentCluster,
namespace: clusters[currentCluster].currentNamespace,
kubeappsCluster: config.kubeappsCluster,
isFetching: operators.isFetching,
operator: operators.operator,
error: operators.errors.operator.fetch,
operatorName: operator,
operatorName: params.operator,
csv: operators.csv,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@

import qs from "qs";
import { connect } from "react-redux";
import { useLocation } from "react-router-dom";
import { RouteComponentProps } from "react-router-dom";
import { Action } from "redux";
import { ThunkDispatch } from "redux-thunk";
import { IStoreState } from "shared/types";
import actions from "../../actions";
import OperatorList from "../../components/OperatorList";

function mapStateToProps({
operators,
clusters: { currentCluster, clusters },
config,
}: IStoreState) {
const location = useLocation();
function mapStateToProps(
{ operators, clusters: { currentCluster, clusters }, config }: IStoreState,
{ location }: RouteComponentProps<{}>,
) {
return {
cluster: currentCluster,
namespace: clusters[currentCluster].currentNamespace,
Expand Down

0 comments on commit dfe2a96

Please sign in to comment.