Skip to content

Commit

Permalink
fixup! fix(LinkToSchemaObject): fix schema link
Browse files Browse the repository at this point in the history
  • Loading branch information
krosy1337 committed Oct 19, 2023
1 parent e29fa11 commit 3890ed8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/LinkToSchemaObject/LinkToSchemaObject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {Location} from 'history';

import {Link, type LinkProps} from '@gravity-ui/uikit';

import {getSchemaObjectPath, parseQuery} from '../../routes';
import {createExternalUILink, parseQuery} from '../../routes';

interface LinkToSchemaObjectProps extends LinkProps {
path: string;
Expand All @@ -11,7 +11,7 @@ interface LinkToSchemaObjectProps extends LinkProps {

export function LinkToSchemaObject({path, location, ...props}: LinkToSchemaObjectProps) {
const queryParams = parseQuery(location);
const pathToSchemaObject = getSchemaObjectPath({
const pathToSchemaObject = createExternalUILink({
...queryParams,
schema: path,
});
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Tenant/Info/ExternalTable/ExternalTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import block from 'bem-cn-lite';

import type {TEvDescribeSchemeResult} from '../../../../types/api/schema';
import {useTypedSelector} from '../../../../utils/hooks';
import {getSchemaObjectPath, parseQuery} from '../../../../routes';
import {createExternalUILink, parseQuery} from '../../../../routes';
import {formatCommonItem} from '../../../../components/InfoViewer/formatters';
import {InfoViewer, InfoViewerItem} from '../../../../components/InfoViewer';
import {ExternalLinkWithIcon} from '../../../../components/ExternalLinkWithIcon/ExternalLinkWithIcon';
Expand Down Expand Up @@ -72,7 +72,7 @@ const ExternalTable = ({data, prepareData}: ExternalTableProps) => {
const location = useLocation();
const query = parseQuery(location);

const pathToDataSource = getSchemaObjectPath({
const pathToDataSource = createExternalUILink({
...query,
schema: data?.PathDescription?.ExternalTableDescription?.DataSourcePath,
});
Expand Down
3 changes: 2 additions & 1 deletion src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function createHref(

// embedded version could be located in some folder (e.g. host/some_folder/app_router_path)
// window.location has the full pathname, while location from router ignores path to project
export const getSchemaObjectPath = (query = {}) =>
// this navigation assumes page reloading
export const createExternalUILink = (query = {}) =>
createHref(window.location.pathname, undefined, query);

export default routes;

0 comments on commit 3890ed8

Please sign in to comment.