Fixed frontend routing (#1745)
* Revert "Issue-1184: fix logo link and remove redundant path segment "ui" (#1658)"
This reverts commit b08e22915d
.
* changing them dashboard logo from an anchor tag to a react-router dom link
* Dashboard element redirect to the same place
This commit is contained in:
parent
634406ac91
commit
6a1053b2f4
15 changed files with 52 additions and 43 deletions
|
@ -86,8 +86,12 @@ const App: React.FC = () => {
|
|||
/>
|
||||
{areClustersFulfilled ? (
|
||||
<Switch>
|
||||
<Route exact path={['/', '/clusters']} component={Dashboard} />
|
||||
<Route path="/clusters/:clusterName" component={ClusterPage} />
|
||||
<Route
|
||||
exact
|
||||
path={['/', '/ui', '/ui/clusters']}
|
||||
component={Dashboard}
|
||||
/>
|
||||
<Route path="/ui/clusters/:clusterName" component={ClusterPage} />
|
||||
</Switch>
|
||||
) : (
|
||||
<PageLoader />
|
||||
|
|
|
@ -99,8 +99,8 @@ const Cluster: React.FC = () => {
|
|||
/>
|
||||
)}
|
||||
<Redirect
|
||||
from="/clusters/:clusterName"
|
||||
to="/clusters/:clusterName/brokers"
|
||||
from="/ui/clusters/:clusterName"
|
||||
to="/ui/clusters/:clusterName/brokers"
|
||||
/>
|
||||
</Switch>
|
||||
</ClusterContext.Provider>
|
||||
|
|
|
@ -29,7 +29,7 @@ jest.mock('components/KsqlDb/KsqlDb', () => () => <div>KsqlDb</div>);
|
|||
describe('Cluster', () => {
|
||||
const renderComponent = (pathname: string) =>
|
||||
render(
|
||||
<Route path="/clusters/:clusterName">
|
||||
<Route path="/ui/clusters/:clusterName">
|
||||
<Cluster />
|
||||
</Route>,
|
||||
{ pathname, store }
|
||||
|
|
|
@ -145,7 +145,7 @@ exports[`Actions view matches snapshot 1`] = `
|
|||
</span>
|
||||
</button>
|
||||
<a
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
|
@ -338,7 +338,7 @@ exports[`Actions view matches snapshot when deleting connector 1`] = `
|
|||
</span>
|
||||
</button>
|
||||
<a
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
|
@ -516,7 +516,7 @@ exports[`Actions view matches snapshot when failed 1`] = `
|
|||
</span>
|
||||
</button>
|
||||
<a
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
|
@ -709,7 +709,7 @@ exports[`Actions view matches snapshot when paused 1`] = `
|
|||
</span>
|
||||
</button>
|
||||
<a
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
|
@ -902,7 +902,7 @@ exports[`Actions view matches snapshot when running connector action 1`] = `
|
|||
</span>
|
||||
</button>
|
||||
<a
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
|
@ -1080,7 +1080,7 @@ exports[`Actions view matches snapshot when unassigned 1`] = `
|
|||
</span>
|
||||
</button>
|
||||
<a
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/edit"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<button
|
||||
|
|
|
@ -94,7 +94,7 @@ exports[`Details view matches snapshot 1`] = `
|
|||
<a
|
||||
aria-current="page"
|
||||
className="is-active"
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector"
|
||||
onClick={[Function]}
|
||||
style={Object {}}
|
||||
>
|
||||
|
@ -102,14 +102,14 @@ exports[`Details view matches snapshot 1`] = `
|
|||
</a>
|
||||
<a
|
||||
aria-current={null}
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/tasks"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/tasks"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Tasks
|
||||
</a>
|
||||
<a
|
||||
aria-current={null}
|
||||
href="/clusters/my-cluster/connects/my-connect/connectors/my-connector/config"
|
||||
href="/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector/config"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Config
|
||||
|
@ -126,7 +126,7 @@ exports[`Details view matches snapshot 1`] = `
|
|||
Object {
|
||||
"hash": "",
|
||||
"key": "test",
|
||||
"pathname": "/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
"pathname": "/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
"search": "",
|
||||
},
|
||||
],
|
||||
|
@ -139,7 +139,7 @@ exports[`Details view matches snapshot 1`] = `
|
|||
"location": Object {
|
||||
"hash": "",
|
||||
"key": "test",
|
||||
"pathname": "/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
"pathname": "/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
"search": "",
|
||||
},
|
||||
"push": [Function],
|
||||
|
@ -150,7 +150,7 @@ exports[`Details view matches snapshot 1`] = `
|
|||
Object {
|
||||
"hash": "",
|
||||
"key": "test",
|
||||
"pathname": "/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
"pathname": "/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
"search": "",
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ exports[`Details view matches snapshot 1`] = `
|
|||
"connectName": "my-connect",
|
||||
"connectorName": "my-connector",
|
||||
},
|
||||
"path": "/clusters/:clusterName/connects/:connectName/connectors/:connectorName",
|
||||
"url": "/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
"path": "/ui/clusters/:clusterName/connects/:connectName/connectors/:connectorName",
|
||||
"url": "/ui/clusters/my-cluster/connects/my-connect/connectors/my-connector",
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
|
|
@ -27,7 +27,7 @@ jest.mock('components/Connect/Edit/EditContainer', () => () => (
|
|||
describe('Connect', () => {
|
||||
const renderComponent = (pathname: string) =>
|
||||
render(
|
||||
<Route path="/clusters/:clusterName">
|
||||
<Route path="/ui/clusters/:clusterName">
|
||||
<Connect />
|
||||
</Route>,
|
||||
{ pathname, store }
|
||||
|
|
|
@ -25,16 +25,16 @@ const ConsumerGroups: React.FC = () => {
|
|||
<Switch>
|
||||
<BreadcrumbRoute
|
||||
exact
|
||||
path="/clusters/:clusterName/consumer-groups"
|
||||
path="/ui/clusters/:clusterName/consumer-groups"
|
||||
component={List}
|
||||
/>
|
||||
<BreadcrumbRoute
|
||||
exact
|
||||
path="/clusters/:clusterName/consumer-groups/:consumerGroupID"
|
||||
path="/ui/clusters/:clusterName/consumer-groups/:consumerGroupID"
|
||||
component={Details}
|
||||
/>
|
||||
<BreadcrumbRoute
|
||||
path="/clusters/:clusterName/consumer-groups/:consumerGroupID/reset-offsets"
|
||||
path="/ui/clusters/:clusterName/consumer-groups/:consumerGroupID/reset-offsets"
|
||||
component={ResetOffsets}
|
||||
/>
|
||||
</Switch>
|
||||
|
|
|
@ -4,7 +4,7 @@ import KsqlDb from 'components/KsqlDb/KsqlDb';
|
|||
import { StaticRouter } from 'react-router';
|
||||
|
||||
describe('KsqlDb Component', () => {
|
||||
const pathname = `clusters/local/ksql-db`;
|
||||
const pathname = `ui/clusters/local/ksql-db`;
|
||||
|
||||
describe('KsqlDb', () => {
|
||||
const setupComponent = () => (
|
||||
|
|
|
@ -5,7 +5,7 @@ exports[`KsqlDb Component KsqlDb matches snapshot 1`] = `
|
|||
context={Object {}}
|
||||
location={
|
||||
Object {
|
||||
"pathname": "clusters/local/ksql-db",
|
||||
"pathname": "ui/clusters/local/ksql-db",
|
||||
}
|
||||
}
|
||||
>
|
||||
|
@ -21,7 +21,7 @@ exports[`KsqlDb Component KsqlDb matches snapshot 1`] = `
|
|||
"listen": [Function],
|
||||
"location": Object {
|
||||
"hash": "",
|
||||
"pathname": "clusters/local/ksql-db",
|
||||
"pathname": "ui/clusters/local/ksql-db",
|
||||
"search": "",
|
||||
},
|
||||
"push": [Function],
|
||||
|
|
|
@ -131,10 +131,10 @@ describe('List', () => {
|
|||
const mockDeleteTopics = jest.fn();
|
||||
const mockClearTopicsMessages = jest.fn();
|
||||
jest.useFakeTimers();
|
||||
const pathname = '/clusters/local/topics';
|
||||
const pathname = '/ui/clusters/local/topics';
|
||||
const component = mount(
|
||||
<StaticRouter location={{ pathname }}>
|
||||
<Route path="/clusters/:clusterName">
|
||||
<Route path="/ui/clusters/:clusterName">
|
||||
<ClusterContext.Provider
|
||||
value={{
|
||||
isReadOnly: false,
|
||||
|
|
|
@ -94,7 +94,10 @@ const Details: React.FC<Props> = ({
|
|||
<div>
|
||||
<PageHeading text={topicName}>
|
||||
<HeaderControlsWrapper>
|
||||
<Route exact path="/clusters/:clusterName/topics/:topicName/messages">
|
||||
<Route
|
||||
exact
|
||||
path="/ui/clusters/:clusterName/topics/:topicName/messages"
|
||||
>
|
||||
<Button
|
||||
buttonSize="M"
|
||||
buttonType="primary"
|
||||
|
@ -105,7 +108,7 @@ const Details: React.FC<Props> = ({
|
|||
</Button>
|
||||
</Route>
|
||||
{!isReadOnly && !isInternal && (
|
||||
<Route path="/clusters/:clusterName/topics/:topicName">
|
||||
<Route path="/ui/clusters/:clusterName/topics/:topicName">
|
||||
<Dropdown label={<VerticalElipsisIcon />} right>
|
||||
<DropdownItem
|
||||
onClick={() =>
|
||||
|
@ -200,22 +203,22 @@ const Details: React.FC<Props> = ({
|
|||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path="/clusters/:clusterName/topics/:topicName/messages"
|
||||
path="/ui/clusters/:clusterName/topics/:topicName/messages"
|
||||
component={Messages}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/clusters/:clusterName/topics/:topicName/settings"
|
||||
path="/ui/clusters/:clusterName/topics/:topicName/settings"
|
||||
component={SettingsContainer}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/clusters/:clusterName/topics/:topicName"
|
||||
path="/ui/clusters/:clusterName/topics/:topicName"
|
||||
component={OverviewContainer}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/clusters/:clusterName/topics/:topicName/consumer-groups"
|
||||
path="/ui/clusters/:clusterName/topics/:topicName/consumer-groups"
|
||||
component={TopicConsumerGroupsContainer}
|
||||
/>
|
||||
</Switch>
|
||||
|
|
|
@ -35,16 +35,16 @@ const Topic: React.FC<TopicProps> = ({
|
|||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path="/clusters/:clusterName/topics/:topicName/edit"
|
||||
path="/ui/clusters/:clusterName/topics/:topicName/edit"
|
||||
component={EditContainer}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/clusters/:clusterName/topics/:topicName/message"
|
||||
path="/ui/clusters/:clusterName/topics/:topicName/message"
|
||||
component={SendMessage}
|
||||
/>
|
||||
<Route
|
||||
path="/clusters/:clusterName/topics/:topicName"
|
||||
path="/ui/clusters/:clusterName/topics/:topicName"
|
||||
component={DetailsContainer}
|
||||
/>
|
||||
</Switch>
|
||||
|
|
|
@ -4,11 +4,11 @@ import { BreadcrumbProvider } from 'components/common/Breadcrumb/Breadcrumb.prov
|
|||
import { BreadcrumbRoute } from 'components/common/Breadcrumb/Breadcrumb.route';
|
||||
import { render } from 'lib/testHelpers';
|
||||
|
||||
const createTopicPath = '/clusters/local/topics/create-new';
|
||||
const createTopicRoutePath = '/clusters/:clusterName/topics/create-new';
|
||||
const createTopicPath = '/ui/clusters/local/topics/create-new';
|
||||
const createTopicRoutePath = '/ui/clusters/:clusterName/topics/create-new';
|
||||
|
||||
const topicPath = '/clusters/secondLocal/topics/topic-name';
|
||||
const topicRoutePath = '/clusters/:clusterName/topics/:topicName';
|
||||
const topicPath = '/ui/clusters/secondLocal/topics/topic-name';
|
||||
const topicRoutePath = '/ui/clusters/:clusterName/topics/:topicName';
|
||||
|
||||
describe('Breadcrumb component', () => {
|
||||
const setupComponent = (pathname: string, routePath: string) =>
|
||||
|
|
|
@ -15,7 +15,9 @@ describe('Paths', () => {
|
|||
);
|
||||
});
|
||||
it('clusterPath', () => {
|
||||
expect(paths.clusterPath(clusterName)).toEqual(`/clusters/${clusterName}`);
|
||||
expect(paths.clusterPath(clusterName)).toEqual(
|
||||
`/ui/clusters/${clusterName}`
|
||||
);
|
||||
});
|
||||
it('clusterBrokersPath', () => {
|
||||
expect(paths.clusterBrokersPath(clusterName)).toEqual(
|
||||
|
|
|
@ -12,7 +12,7 @@ export const gitCommitPath = (commit: string) =>
|
|||
`${GIT_REPO_LINK}/commit/${commit}`;
|
||||
|
||||
export const clusterPath = (clusterName: ClusterName) =>
|
||||
`/clusters/${clusterName}`;
|
||||
`/ui/clusters/${clusterName}`;
|
||||
|
||||
// Brokers
|
||||
export const clusterBrokersPath = (clusterName: ClusterName) =>
|
||||
|
|
Loading…
Add table
Reference in a new issue