mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-26 18:06:03 +00:00
minor: show request method for api endpoint (#17241)
This commit is contained in:
parent
62c51e284d
commit
a6b63aabaa
@ -82,13 +82,17 @@ import {
|
|||||||
export const ExtraInfoLabel = ({
|
export const ExtraInfoLabel = ({
|
||||||
label,
|
label,
|
||||||
value,
|
value,
|
||||||
|
dataTestId,
|
||||||
}: {
|
}: {
|
||||||
label: string;
|
label: string;
|
||||||
value: string | number;
|
value: string | number;
|
||||||
|
dataTestId?: string;
|
||||||
}) => (
|
}) => (
|
||||||
<>
|
<>
|
||||||
<Divider className="self-center" type="vertical" />
|
<Divider className="self-center" type="vertical" />
|
||||||
<Typography.Text className="self-center text-xs whitespace-nowrap">
|
<Typography.Text
|
||||||
|
className="self-center text-xs whitespace-nowrap"
|
||||||
|
data-testid={dataTestId}>
|
||||||
{!isEmpty(label) && (
|
{!isEmpty(label) && (
|
||||||
<span className="text-grey-muted">{`${label}: `}</span>
|
<span className="text-grey-muted">{`${label}: `}</span>
|
||||||
)}
|
)}
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { EntityType } from '../../../enums/entity.enum';
|
import { EntityType } from '../../../enums/entity.enum';
|
||||||
|
import {
|
||||||
|
APIEndpoint,
|
||||||
|
APIRequestMethod,
|
||||||
|
} from '../../../generated/entity/data/apiEndpoint';
|
||||||
import { Container } from '../../../generated/entity/data/container';
|
import { Container } from '../../../generated/entity/data/container';
|
||||||
import { MOCK_TIER_DATA } from '../../../mocks/TableData.mock';
|
import { MOCK_TIER_DATA } from '../../../mocks/TableData.mock';
|
||||||
import { getContainerByName } from '../../../rest/storageAPI';
|
import { getContainerByName } from '../../../rest/storageAPI';
|
||||||
@ -140,4 +144,25 @@ describe('DataAssetsHeader component', () => {
|
|||||||
|
|
||||||
expect(screen.getByTestId('Tier')).toContainHTML('label.no-entity');
|
expect(screen.getByTestId('Tier')).toContainHTML('label.no-entity');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render the request method if entityType is apiEndpoint', () => {
|
||||||
|
render(
|
||||||
|
<DataAssetsHeader
|
||||||
|
{...mockProps}
|
||||||
|
dataAsset={
|
||||||
|
{
|
||||||
|
name: 'testAPIEndpoint',
|
||||||
|
id: 'testAPIEndpointId',
|
||||||
|
endpointURL: 'testAPIEndpointURL',
|
||||||
|
requestMethod: APIRequestMethod.Get,
|
||||||
|
} as APIEndpoint
|
||||||
|
}
|
||||||
|
entityType={EntityType.API_ENDPOINT}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
screen.getByTestId('api-endpoint-request-method')
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "antwort",
|
"reply-lowercase": "antwort",
|
||||||
"reply-lowercase-plural": "antworten",
|
"reply-lowercase-plural": "antworten",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "Tag-Anfragen",
|
"request-tag-plural": "Tag-Anfragen",
|
||||||
"requirement-plural": "Anforderungen",
|
"requirement-plural": "Anforderungen",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "reply",
|
"reply-lowercase": "reply",
|
||||||
"reply-lowercase-plural": "replies",
|
"reply-lowercase-plural": "replies",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "Request Tags",
|
"request-tag-plural": "Request Tags",
|
||||||
"requirement-plural": "Requirements",
|
"requirement-plural": "Requirements",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "respuesta",
|
"reply-lowercase": "respuesta",
|
||||||
"reply-lowercase-plural": "respuestas",
|
"reply-lowercase-plural": "respuestas",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "Etiquetas de solicitud",
|
"request-tag-plural": "Etiquetas de solicitud",
|
||||||
"requirement-plural": "Requisitos",
|
"requirement-plural": "Requisitos",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "réponse",
|
"reply-lowercase": "réponse",
|
||||||
"reply-lowercase-plural": "réponses",
|
"reply-lowercase-plural": "réponses",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "Demander l'ajout de tags",
|
"request-tag-plural": "Demander l'ajout de tags",
|
||||||
"requirement-plural": "Critères",
|
"requirement-plural": "Critères",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "תגובה",
|
"reply-lowercase": "תגובה",
|
||||||
"reply-lowercase-plural": "תגובות",
|
"reply-lowercase-plural": "תגובות",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "בקשת תגיות",
|
"request-tag-plural": "בקשת תגיות",
|
||||||
"requirement-plural": "דרישות",
|
"requirement-plural": "דרישות",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "返信",
|
"reply-lowercase": "返信",
|
||||||
"reply-lowercase-plural": "返信",
|
"reply-lowercase-plural": "返信",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "タグをリクエスト",
|
"request-tag-plural": "タグをリクエスト",
|
||||||
"requirement-plural": "Requirements",
|
"requirement-plural": "Requirements",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "antwoord",
|
"reply-lowercase": "antwoord",
|
||||||
"reply-lowercase-plural": "antwoorden",
|
"reply-lowercase-plural": "antwoorden",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "Aanvraagtags",
|
"request-tag-plural": "Aanvraagtags",
|
||||||
"requirement-plural": "Vereisten",
|
"requirement-plural": "Vereisten",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "resposta",
|
"reply-lowercase": "resposta",
|
||||||
"reply-lowercase-plural": "respostas",
|
"reply-lowercase-plural": "respostas",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "Solicitar Tags",
|
"request-tag-plural": "Solicitar Tags",
|
||||||
"requirement-plural": "Requisitos",
|
"requirement-plural": "Requisitos",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "ответить",
|
"reply-lowercase": "ответить",
|
||||||
"reply-lowercase-plural": "ответы",
|
"reply-lowercase-plural": "ответы",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "Теги запроса",
|
"request-tag-plural": "Теги запроса",
|
||||||
"requirement-plural": "Требования",
|
"requirement-plural": "Требования",
|
||||||
|
@ -944,6 +944,7 @@
|
|||||||
"reply-lowercase": "回复",
|
"reply-lowercase": "回复",
|
||||||
"reply-lowercase-plural": "回复",
|
"reply-lowercase-plural": "回复",
|
||||||
"request": "Request",
|
"request": "Request",
|
||||||
|
"request-method": "Request Method",
|
||||||
"request-schema-field": "Request Schema Field",
|
"request-schema-field": "Request Schema Field",
|
||||||
"request-tag-plural": "请求补充标签",
|
"request-tag-plural": "请求补充标签",
|
||||||
"requirement-plural": "需求",
|
"requirement-plural": "需求",
|
||||||
|
@ -24,7 +24,7 @@ import NextPrevious from '../../components/common/NextPrevious/NextPrevious';
|
|||||||
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
import { NextPreviousProps } from '../../components/common/NextPrevious/NextPrevious.interface';
|
||||||
import RichTextEditorPreviewer from '../../components/common/RichTextEditor/RichTextEditorPreviewer';
|
import RichTextEditorPreviewer from '../../components/common/RichTextEditor/RichTextEditorPreviewer';
|
||||||
import TableAntd from '../../components/common/Table/Table';
|
import TableAntd from '../../components/common/Table/Table';
|
||||||
import { PAGE_SIZE } from '../../constants/constants';
|
import { NO_DATA, PAGE_SIZE } from '../../constants/constants';
|
||||||
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
||||||
import { EntityType } from '../../enums/entity.enum';
|
import { EntityType } from '../../enums/entity.enum';
|
||||||
import { APICollection } from '../../generated/entity/data/apiCollection';
|
import { APICollection } from '../../generated/entity/data/apiCollection';
|
||||||
@ -75,7 +75,7 @@ function APIEndpointsTab({
|
|||||||
title: t('label.name'),
|
title: t('label.name'),
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
width: 500,
|
width: 400,
|
||||||
render: (_, record: APIEndpoint) => {
|
render: (_, record: APIEndpoint) => {
|
||||||
return (
|
return (
|
||||||
<div className="d-inline-flex w-max-90">
|
<div className="d-inline-flex w-max-90">
|
||||||
@ -92,6 +92,15 @@ function APIEndpointsTab({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t('label.request-method'),
|
||||||
|
dataIndex: 'requestMethod',
|
||||||
|
key: 'requestMethod',
|
||||||
|
|
||||||
|
render: (requestMethod: APIEndpoint['requestMethod']) => {
|
||||||
|
return <Typography.Text>{requestMethod || NO_DATA}</Typography.Text>;
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t('label.description'),
|
title: t('label.description'),
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
|
@ -441,6 +441,13 @@ export const getDataAssetsHeaderInfo = (
|
|||||||
|
|
||||||
returnData.extraInfo = (
|
returnData.extraInfo = (
|
||||||
<>
|
<>
|
||||||
|
{apiEndpoint.requestMethod && (
|
||||||
|
<ExtraInfoLabel
|
||||||
|
dataTestId="api-endpoint-request-method"
|
||||||
|
label={t('label.request-method')}
|
||||||
|
value={apiEndpoint.requestMethod}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{apiEndpoint.endpointURL && (
|
{apiEndpoint.endpointURL && (
|
||||||
<ExtraInfoLink
|
<ExtraInfoLink
|
||||||
href={apiEndpoint.endpointURL}
|
href={apiEndpoint.endpointURL}
|
||||||
|
@ -996,6 +996,15 @@ const getApiEndpointOverview = (apiEndpoint: APIEndpoint) => {
|
|||||||
DRAWER_NAVIGATION_OPTIONS.lineage,
|
DRAWER_NAVIGATION_OPTIONS.lineage,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: i18next.t('label.request-method'),
|
||||||
|
value: apiEndpoint.requestMethod || NO_DATA,
|
||||||
|
isLink: false,
|
||||||
|
visible: [
|
||||||
|
DRAWER_NAVIGATION_OPTIONS.explore,
|
||||||
|
DRAWER_NAVIGATION_OPTIONS.lineage,
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return overview;
|
return overview;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user