Change the name of path for Schema Compare versions (#2194)

This commit is contained in:
Robert Azizbekyan 2022-06-27 16:59:00 +04:00 committed by GitHub
parent cc0a98262b
commit d7a3629470
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View file

@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
import {
ClusterSubjectParam,
clusterSchemaEditPageRelativePath,
clusterSchemaSchemaDiffPageRelativePath,
clusterSchemaSchemaComparePageRelativePath,
} from 'lib/paths';
import ClusterContext from 'components/contexts/ClusterContext';
import ConfirmationModal from 'components/common/ConfirmationModal/ConfirmationModal';
@ -90,7 +90,7 @@ const Details: React.FC = () => {
buttonSize="M"
buttonType="primary"
to={{
pathname: clusterSchemaSchemaDiffPageRelativePath,
pathname: clusterSchemaSchemaComparePageRelativePath,
search: `leftVersion=${versions[0]?.version}&rightVersion=${versions[0]?.version}`,
}}
>

View file

@ -1,6 +1,6 @@
import React from 'react';
import { SchemaSubject } from 'generated-sources';
import { clusterSchemaSchemaDiffPath, ClusterSubjectParam } from 'lib/paths';
import { clusterSchemaSchemaComparePath, ClusterSubjectParam } from 'lib/paths';
import PageLoader from 'components/common/PageLoader/PageLoader';
import DiffViewer from 'components/common/DiffViewer/DiffViewer';
import { useNavigate, useLocation } from 'react-router-dom';
@ -86,7 +86,7 @@ const Diff: React.FC<DiffProps> = ({ versions, areVersionsFetched }) => {
}
onChange={(event) => {
navigate(
clusterSchemaSchemaDiffPath(clusterName, subject)
clusterSchemaSchemaComparePath(clusterName, subject)
);
searchParams.set('leftVersion', event.toString());
searchParams.set(
@ -127,7 +127,7 @@ const Diff: React.FC<DiffProps> = ({ versions, areVersionsFetched }) => {
}
onChange={(event) => {
navigate(
clusterSchemaSchemaDiffPath(clusterName, subject)
clusterSchemaSchemaComparePath(clusterName, subject)
);
searchParams.set(
'leftVersion',

View file

@ -2,13 +2,13 @@ import React from 'react';
import Diff, { DiffProps } from 'components/Schemas/Diff/Diff';
import { render, WithRoute } from 'lib/testHelpers';
import { screen } from '@testing-library/react';
import { clusterSchemaSchemaDiffPath } from 'lib/paths';
import { clusterSchemaSchemaComparePath } from 'lib/paths';
import { versions } from './fixtures';
const defaultClusterName = 'defaultClusterName';
const defaultSubject = 'defaultSubject';
const defaultPathName = clusterSchemaSchemaDiffPath(
const defaultPathName = clusterSchemaSchemaComparePath(
defaultClusterName,
defaultSubject
);
@ -30,7 +30,7 @@ describe('Diff', () => {
pathname = `${pathname}?${searchParams.toString()}`;
return render(
<WithRoute path={clusterSchemaSchemaDiffPath()}>
<WithRoute path={clusterSchemaSchemaComparePath()}>
<Diff
versions={props.versions}
areVersionsFetched={props.areVersionsFetched}

View file

@ -72,9 +72,9 @@ export type ClusterGroupParam = {
export const clusterSchemasRelativePath = 'schemas';
export const clusterSchemaNewRelativePath = 'create-new';
export const clusterSchemaEditPageRelativePath = `edit`;
export const clusterSchemaSchemaDiffPageRelativePath = `diff`;
export const clusterSchemaSchemaComparePageRelativePath = `compare`;
export const clusterSchemaEditRelativePath = `${RouteParams.subject}/${clusterSchemaEditPageRelativePath}`;
export const clusterSchemaSchemaDiffRelativePath = `${RouteParams.subject}/${clusterSchemaSchemaDiffPageRelativePath}`;
export const clusterSchemaSchemaDiffRelativePath = `${RouteParams.subject}/${clusterSchemaSchemaComparePageRelativePath}`;
export const clusterSchemasPath = (
clusterName: ClusterName = RouteParams.clusterName
) => `${clusterPath(clusterName)}/schemas`;
@ -89,10 +89,10 @@ export const clusterSchemaEditPath = (
clusterName: ClusterName = RouteParams.clusterName,
subject: SchemaName = RouteParams.subject
) => `${clusterSchemasPath(clusterName)}/${subject}/edit`;
export const clusterSchemaSchemaDiffPath = (
export const clusterSchemaSchemaComparePath = (
clusterName: ClusterName = RouteParams.clusterName,
subject: SchemaName = RouteParams.subject
) => `${clusterSchemaPath(clusterName, subject)}/diff`;
) => `${clusterSchemaPath(clusterName, subject)}/compare`;
export type ClusterSubjectParam = {
subject: string;