Skip to content

Commit

Permalink
Change routes of operators to be consistent (#1626)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Martinez Gotor authored Apr 2, 2020
1 parent 96fab2a commit 7165fa4
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CustomResourceListItem extends React.Component<ICustomResourceListItemProp
return (
<InfoCard
key={resource.metadata.name}
link={`/operators-instances/ns/${resource.metadata.namespace}/${csv.metadata.name}/${crd.name}/${resource.metadata.name}`}
link={`/ns/${resource.metadata.namespace}/operators-instances/${csv.metadata.name}/${crd.name}/${resource.metadata.name}`}
title={resource.metadata.name}
icon={icon}
info={`${resource.kind} v${csv.spec.version || "-"}`}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/Catalog/CatalogItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ context("when the item is a catalog", () => {
it("has the proper link", () => {
const wrapper = shallow(<CatalogItem item={catalogItem} />);
expect(wrapper.find(InfoCard).prop("link")).toEqual(
"/operators-instances/ns/kubeapps/new/foo-cluster/foo1",
"/ns/kubeapps/operators-instances/new/foo-cluster/foo1",
);
});
});
2 changes: 1 addition & 1 deletion dashboard/src/components/Catalog/CatalogItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const CatalogItem: React.SFC<ICatalogItemProps> = props => {
// Cosmetic change, remove the version from the csv name
const csvName = csv?.split(".v")[0];
tag1 = <span>{csvName}</span>;
link = `/operators-instances/ns/${namespace}/new/${csv}/${id}`;
link = `/ns/${namespace}/operators-instances/new/${csv}/${id}`;
subIcon = operatorIcon;
}
const descriptionC = (
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/Header/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("settings", () => {
const expectedItems = [
{ children: "App Repositories", to: "/config/ns/default/repos" },
{ children: "Service Brokers", to: "/config/brokers" },
{ children: "Operators", to: "/operators/ns/default" },
{ children: "Operators", to: "/ns/default/operators" },
];
items.forEach((item, index) => {
expect(item.children).toBe(expectedItems[index].children);
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Header extends React.Component<IHeaderProps, IHeaderState> {
</li>
{this.props.featureFlags.operators && (
<li role="none">
<NavLink to={`/operators/ns/${namespace.current}`}>Operators</NavLink>
<NavLink to={`/ns/${namespace.current}/operators`}>Operators</NavLink>
</li>
)}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class DeploymentFormBody extends React.Component<
const created = await createResource(namespace, resource.apiVersion, resourceType, resource);
if (created) {
push(
`/operators-instances/ns/${namespace}/${csv.metadata.name}/${crd.name}/${resource.metadata.name}`,
`/ns/${namespace}/operators-instances/${csv.metadata.name}/${crd.name}/${resource.metadata.name}`,
);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class DeploymentFormBody extends React.Component<
resource,
);
if (created) {
push(`/operators-instances/ns/${namespace}/${csvName}/${crdName}/${resourceName}`);
push(`/ns/${namespace}/operators-instances/${csvName}/${crdName}/${resourceName}`);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ exports[`render the operator list with installed operators 1`] = `
icon="api/v1/namespaces/default/operator/foo/logo"
info="v1.0.0"
key="foo"
link="/operators/ns/default/foo"
link="/ns/default/operators/foo"
tag1Content="security"
tag2Content="kubeapps"
title="foo"
Expand Down Expand Up @@ -115,7 +115,7 @@ exports[`render the operator list without installed operators 1`] = `
icon="api/v1/namespaces/default/operator/foo/logo"
info="v1.0.0"
key="foo"
link="/operators/ns/default/foo"
link="/ns/default/operators/foo"
tag1Content="security"
tag2Content="kubeapps"
title="foo"
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/OperatorView/OperatorHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class OperatorHeader extends React.Component<IOperatorHeaderProps> {
<h5 className="subtitle margin-b-normal">
{/* TODO(andresmgot): Filter by provider */}
<span>{version} - Provided by </span>
<Link to={`/operators/ns/${namespace}`}>{provider}</Link>
<Link to={`/ns/${namespace}/operators`}>{provider}</Link>
</h5>
<h5 className="subtitle margin-b-reset">{description}</h5>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`renders the header 1`] = `
- Provided by
</span>
<Link
to="/operators/ns/kubeapps"
to="/ns/kubeapps/operators"
>
Kubeapps
</Link>
Expand Down
10 changes: 5 additions & 5 deletions dashboard/src/containers/RoutesContainer/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class Routes extends React.Component<IRoutesProps> {
if (this.props.featureFlags.operators) {
// Add routes related to operators
Object.assign(privateRoutes, {
"/operators/ns/:namespace": OperatorsListContainer,
"/operators/ns/:namespace/:operator": OperatorViewContainer,
"/operators-instances/ns/:namespace/new/:csv/:crd": OperatorInstanceCreateContainer,
"/operators-instances/ns/:namespace/:csv/:crd/:instanceName": OperatorInstanceViewContainer,
"/operators-instances/ns/:namespace/:csv/:crd/update/:instanceName": OperatorInstanceUpdateContainer,
"/ns/:namespace/operators": OperatorsListContainer,
"/ns/:namespace/operators/:operator": OperatorViewContainer,
"/ns/:namespace/operators-instances/new/:csv/:crd": OperatorInstanceCreateContainer,
"/ns/:namespace/operators-instances/:csv/:crd/:instanceName": OperatorInstanceViewContainer,
"/ns/:namespace/operators-instances/:csv/:crd/:instanceName/update": OperatorInstanceUpdateContainer,
});
}
return (
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/shared/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export const app = {
`/charts/${cv.relationships.chart.data.repo.name}/${cv.relationships.chart.data.name}/versions/${cv.attributes.version}`,
},
operators: {
view: (namespace: string, name: string) => `/operators/ns/${namespace}/${name}`,
view: (namespace: string, name: string) => `/ns/${namespace}/operators/${name}`,
},
operatorInstances: {
update: (namespace: string, csvName: string, crdName: string, instanceName: string) =>
`/operators-instances/ns/${namespace}/${csvName}/${crdName}/update/${instanceName}`,
`/ns/${namespace}/operators-instances/${csvName}/${crdName}/${instanceName}/update`,
},
};

Expand Down

0 comments on commit 7165fa4

Please sign in to comment.