Fix #4963 UI : Lineage Node table with a slash (/) in their name throwing 404 error (#4965)

This commit is contained in:
Sachin Chaurasiya 2022-05-16 14:47:48 +05:30 committed by GitHub
parent c374bc9b17
commit f3c8a67e6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 8 deletions

View File

@ -11,7 +11,10 @@
* limitations under the License.
*/
import { goToAddNewServicePage, testServiceCreationAndIngestion } from '../../common/common';
import {
goToAddNewServicePage,
testServiceCreationAndIngestion,
} from '../../common/common';
describe('Glue Ingestion', () => {
it('add and ingest data', () => {

View File

@ -11,7 +11,10 @@
* limitations under the License.
*/
import { goToAddNewServicePage, testServiceCreationAndIngestion } from '../../common/common';
import {
goToAddNewServicePage,
testServiceCreationAndIngestion,
} from '../../common/common';
describe('Kafka Ingestion', () => {
it('add and ingest data', () => {

View File

@ -11,7 +11,10 @@
* limitations under the License.
*/
import { goToAddNewServicePage, testServiceCreationAndIngestion } from '../../common/common';
import {
goToAddNewServicePage,
testServiceCreationAndIngestion,
} from '../../common/common';
describe('Metabase Ingestion', () => {
it('add and ingest data', () => {

View File

@ -11,7 +11,10 @@
* limitations under the License.
*/
import { goToAddNewServicePage, testServiceCreationAndIngestion } from '../../common/common';
import {
goToAddNewServicePage,
testServiceCreationAndIngestion,
} from '../../common/common';
describe('Superset Ingestion', () => {
it('add and ingest data', () => {

View File

@ -26,6 +26,7 @@ import { Table } from '../../generated/entity/data/table';
import { Topic } from '../../generated/entity/data/topic';
import { getHeaderLabel } from '../../utils/EntityLineageUtils';
import { getEntityOverview, getEntityTags } from '../../utils/EntityUtils';
import { getEncodedFqn } from '../../utils/StringsUtils';
import { getEntityIcon } from '../../utils/TableUtils';
import { showErrorToast } from '../../utils/ToastUtils';
import RichTextEditorPreviewer from '../common/rich-text-editor/RichTextEditorPreviewer';
@ -57,7 +58,7 @@ const EntityInfoDrawer = ({
switch (selectedNode.type) {
case EntityType.TABLE: {
setIsLoading(true);
getTableDetailsByFQN(selectedNode.fqn, [
getTableDetailsByFQN(getEncodedFqn(selectedNode.fqn), [
'tags',
'owner',
'columns',
@ -74,13 +75,16 @@ const EntityInfoDrawer = ({
err,
`Error while getting ${selectedNode.name} details`
);
})
.finally(() => {
setIsLoading(false);
});
break;
}
case EntityType.PIPELINE: {
setIsLoading(true);
getPipelineByFqn(selectedNode.fqn, ['tags', 'owner'])
getPipelineByFqn(getEncodedFqn(selectedNode.fqn), ['tags', 'owner'])
.then((res: AxiosResponse) => {
getServiceById('pipelineServices', res.data.service?.id)
.then((serviceRes: AxiosResponse) => {
@ -100,13 +104,16 @@ const EntityInfoDrawer = ({
err,
`Error while getting ${selectedNode.name} details`
);
})
.finally(() => {
setIsLoading(false);
});
break;
}
case EntityType.DASHBOARD: {
setIsLoading(true);
getDashboardByFqn(selectedNode.fqn, ['tags', 'owner'])
getDashboardByFqn(getEncodedFqn(selectedNode.fqn), ['tags', 'owner'])
.then((res: AxiosResponse) => {
getServiceById('dashboardServices', res.data.service?.id)
.then((serviceRes: AxiosResponse) => {
@ -126,6 +133,9 @@ const EntityInfoDrawer = ({
err,
`Error while getting ${selectedNode.name} details`
);
})
.finally(() => {
setIsLoading(false);
});
break;

View File

@ -852,7 +852,7 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
</ReactFlow>
</ReactFlowProvider>
</div>
{!isEmpty(selectedNode) ? (
{!isEmpty(selectedNode) && !isEditMode ? (
<EntityInfoDrawer
isMainNode={selectedNode.name === lineageData.entity?.name}
selectedNode={selectedNode}

View File

@ -122,3 +122,12 @@ export const getErrorText = (
// if error text is still empty, return the fallback text
return errorText || fallbackText;
};
/**
*
* @param fqn - Value to be encoded
* @returns - Encoded text string as a valid component of a Uniform Resource Identifier (URI).
*/
export const getEncodedFqn = (fqn: string) => {
return encodeURIComponent(fqn);
};