mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-07 16:11:30 +00:00
handle error for datasetdetail page component (#3595)
This commit is contained in:
parent
5309dae08d
commit
dc30614a05
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2021 Collate
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const TEST_DELETE_MSG = 'Test deleted successfully.';
|
|
@ -32,7 +32,6 @@ export const imageTypes = {
|
|||||||
image72: 's72-c',
|
image72: 's72-c',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const COMMON_ERROR_MSG = 'Something went wrong.';
|
|
||||||
export const TOUR_SEARCH_TERM = 'dim_a';
|
export const TOUR_SEARCH_TERM = 'dim_a';
|
||||||
export const ERROR404 = 'No data found';
|
export const ERROR404 = 'No data found';
|
||||||
export const ERROR500 = 'Something went wrong';
|
export const ERROR500 = 'Something went wrong';
|
||||||
|
@ -15,10 +15,18 @@ const jsonData = {
|
|||||||
'api-error-messages': {
|
'api-error-messages': {
|
||||||
'add-glossary-error': 'Error while adding glossary!',
|
'add-glossary-error': 'Error while adding glossary!',
|
||||||
'add-glossary-term-error': 'Error while adding glossary term!',
|
'add-glossary-term-error': 'Error while adding glossary term!',
|
||||||
|
'add-lineage-error': 'Error while adding lineage!',
|
||||||
|
'add-feed-error': 'Error while adding feed!',
|
||||||
|
'add-table-test-error': 'Error while adding table test!',
|
||||||
|
'add-column-test-error': 'Error while adding column test!',
|
||||||
'create-user-error': 'Error while creating user!',
|
'create-user-error': 'Error while creating user!',
|
||||||
|
'create-conversation-error': 'Error while creating conversation!',
|
||||||
'delete-glossary-error': 'Error while deleting glossary!',
|
'delete-glossary-error': 'Error while deleting glossary!',
|
||||||
'delete-glossary-term-error': 'Error while deleting glossary term!',
|
'delete-glossary-term-error': 'Error while deleting glossary term!',
|
||||||
'delete-team-error': 'Error while deleting team!',
|
'delete-team-error': 'Error while deleting team!',
|
||||||
|
'delete-lineage-error': 'Error while deleting edge!',
|
||||||
|
'delete-test-error': 'Error while deleting test!',
|
||||||
|
'delete-message-error': 'Error while deleting message!',
|
||||||
'elastic-search-error': 'Error while fetch data from Elasticsearch!',
|
'elastic-search-error': 'Error while fetch data from Elasticsearch!',
|
||||||
'fetch-data-error': 'Error while fetching data!',
|
'fetch-data-error': 'Error while fetching data!',
|
||||||
'fetch-entity-feed-error': 'Error while fetching entity feeds!',
|
'fetch-entity-feed-error': 'Error while fetching entity feeds!',
|
||||||
@ -28,14 +36,24 @@ const jsonData = {
|
|||||||
'fetch-glossary-list-error': 'Error while fetching glossaries!',
|
'fetch-glossary-list-error': 'Error while fetching glossaries!',
|
||||||
'fetch-glossary-term-error': 'Error while fetching glossary term!',
|
'fetch-glossary-term-error': 'Error while fetching glossary term!',
|
||||||
'fetch-lineage-error': 'Error while fetching lineage data!',
|
'fetch-lineage-error': 'Error while fetching lineage data!',
|
||||||
|
'fetch-lineage-node-error': 'Error while fetching lineage node!',
|
||||||
'fetch-sample-data-error': 'Error while fetching sample data!',
|
'fetch-sample-data-error': 'Error while fetching sample data!',
|
||||||
'fetch-table-details-error': 'Error while fetching table details!',
|
'fetch-table-details-error': 'Error while fetching table details!',
|
||||||
'fetch-table-queries-error': 'Error while fetching table queries!',
|
'fetch-table-queries-error': 'Error while fetching table queries!',
|
||||||
'fetch-tags-error': 'Error while fetching tags!',
|
'fetch-tags-error': 'Error while fetching tags!',
|
||||||
|
'fetch-updated-conversation-error':
|
||||||
|
'Error while fetching updated conversation!',
|
||||||
'update-glossary-term-error': 'Error while updating glossary term!',
|
'update-glossary-term-error': 'Error while updating glossary term!',
|
||||||
'update-description-error': 'Error while updating description!',
|
'update-description-error': 'Error while updating description!',
|
||||||
'update-entity-error': 'Error while updating entity!',
|
'update-entity-error': 'Error while updating entity!',
|
||||||
'update-tags-error': 'Error while updating tags!',
|
'update-tags-error': 'Error while updating tags!',
|
||||||
|
'update-entity-follow-error': 'Error while following entity!',
|
||||||
|
'update-entity-unfollow-error': 'Error while unfollowing entity!',
|
||||||
|
},
|
||||||
|
'api-success-messages': {
|
||||||
|
'create-conversation': 'Conversation created successfully!',
|
||||||
|
'delete-test': 'Test deleted successfully!',
|
||||||
|
'delete-message': 'Message deleted successfully!',
|
||||||
},
|
},
|
||||||
'form-error-messages': {
|
'form-error-messages': {
|
||||||
'empty-email': 'Email is required.',
|
'empty-email': 'Email is required.',
|
||||||
|
@ -53,18 +53,11 @@ import {
|
|||||||
} from '../../components/EntityLineage/EntityLineage.interface';
|
} from '../../components/EntityLineage/EntityLineage.interface';
|
||||||
import Loader from '../../components/Loader/Loader';
|
import Loader from '../../components/Loader/Loader';
|
||||||
import {
|
import {
|
||||||
COMMON_ERROR_MSG,
|
|
||||||
getDatabaseDetailsPath,
|
getDatabaseDetailsPath,
|
||||||
getServiceDetailsPath,
|
getServiceDetailsPath,
|
||||||
getTableTabPath,
|
getTableTabPath,
|
||||||
getVersionPath,
|
getVersionPath,
|
||||||
} from '../../constants/constants';
|
} from '../../constants/constants';
|
||||||
import { TEST_DELETE_MSG } from '../../constants/DatasetDetails.constants';
|
|
||||||
import {
|
|
||||||
onConfirmText,
|
|
||||||
onErrorText,
|
|
||||||
onUpdatedConversastionError,
|
|
||||||
} from '../../constants/feed.constants';
|
|
||||||
import { ColumnTestType } from '../../enums/columnTest.enum';
|
import { ColumnTestType } from '../../enums/columnTest.enum';
|
||||||
import { EntityType, TabSpecificField } from '../../enums/entity.enum';
|
import { EntityType, TabSpecificField } from '../../enums/entity.enum';
|
||||||
import { ServiceCategory } from '../../enums/service.enum';
|
import { ServiceCategory } from '../../enums/service.enum';
|
||||||
@ -185,6 +178,13 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleShowSuccessToast = (message: string) => {
|
||||||
|
showToast({
|
||||||
|
variant: 'success',
|
||||||
|
body: message,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleTestModeChange = (mode: DatasetTestModeType) => {
|
const handleTestModeChange = (mode: DatasetTestModeType) => {
|
||||||
setTestMode(mode);
|
setTestMode(mode);
|
||||||
};
|
};
|
||||||
@ -230,7 +230,13 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
setIsLineageLoading(true);
|
setIsLineageLoading(true);
|
||||||
getLineageByFQN(tableFQN, EntityType.TABLE)
|
getLineageByFQN(tableFQN, EntityType.TABLE)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
setEntityLineage(res.data);
|
if (res.data) {
|
||||||
|
setEntityLineage(res.data);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['fetch-lineage-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const msg =
|
const msg =
|
||||||
@ -248,7 +254,13 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
getAllFeeds(getEntityFeedLink(EntityType.TABLE, tableFQN))
|
getAllFeeds(getEntityFeedLink(EntityType.TABLE, tableFQN))
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const { data } = res.data;
|
const { data } = res.data;
|
||||||
setEntityThread(data);
|
if (data) {
|
||||||
|
setEntityThread(data);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['fetch-entity-feed-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const errMsg =
|
const errMsg =
|
||||||
@ -266,75 +278,82 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
getFields(defaultFields, datasetTableTabs[activeTab - 1].field ?? '')
|
getFields(defaultFields, datasetTableTabs[activeTab - 1].field ?? '')
|
||||||
)
|
)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const {
|
if (res.data) {
|
||||||
description,
|
const {
|
||||||
id,
|
description,
|
||||||
name,
|
id,
|
||||||
columns,
|
name,
|
||||||
database,
|
columns,
|
||||||
deleted,
|
database,
|
||||||
owner,
|
deleted,
|
||||||
usageSummary,
|
owner,
|
||||||
followers,
|
usageSummary,
|
||||||
fullyQualifiedName,
|
followers,
|
||||||
joins,
|
fullyQualifiedName,
|
||||||
tags,
|
joins,
|
||||||
sampleData,
|
tags,
|
||||||
tableProfile,
|
sampleData,
|
||||||
tableType,
|
tableProfile,
|
||||||
version,
|
tableType,
|
||||||
service,
|
version,
|
||||||
serviceType,
|
service,
|
||||||
} = res.data;
|
serviceType,
|
||||||
setTableDetails(res.data);
|
} = res.data;
|
||||||
setTableId(id);
|
setTableDetails(res.data);
|
||||||
setCurrentVersion(version);
|
setTableId(id);
|
||||||
setTier(getTierTags(tags));
|
setCurrentVersion(version);
|
||||||
setTableType(tableType);
|
setTier(getTierTags(tags));
|
||||||
setOwner(owner);
|
setTableType(tableType);
|
||||||
setFollowers(followers);
|
setOwner(owner);
|
||||||
setDeleted(deleted);
|
setFollowers(followers);
|
||||||
setSlashedTableName([
|
setDeleted(deleted);
|
||||||
{
|
setSlashedTableName([
|
||||||
name: service.name,
|
{
|
||||||
url: service.name
|
name: service.name,
|
||||||
? getServiceDetailsPath(
|
url: service.name
|
||||||
service.name,
|
? getServiceDetailsPath(
|
||||||
ServiceCategory.DATABASE_SERVICES
|
service.name,
|
||||||
)
|
ServiceCategory.DATABASE_SERVICES
|
||||||
: '',
|
)
|
||||||
imgSrc: serviceType ? serviceTypeLogo(serviceType) : undefined,
|
: '',
|
||||||
},
|
imgSrc: serviceType ? serviceTypeLogo(serviceType) : undefined,
|
||||||
{
|
},
|
||||||
name: getPartialNameFromFQN(database.name, ['database']),
|
{
|
||||||
url: getDatabaseDetailsPath(database.name),
|
name: getPartialNameFromFQN(database.name, ['database']),
|
||||||
},
|
url: getDatabaseDetailsPath(database.name),
|
||||||
{
|
},
|
||||||
name: name,
|
{
|
||||||
url: '',
|
name: name,
|
||||||
activeTitle: true,
|
url: '',
|
||||||
},
|
activeTitle: true,
|
||||||
]);
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
if (res.data.tableTests && res.data.tableTests.length > 0) {
|
if (res.data.tableTests && res.data.tableTests.length > 0) {
|
||||||
setTableTestCase(res.data.tableTests);
|
setTableTestCase(res.data.tableTests);
|
||||||
|
}
|
||||||
|
|
||||||
|
addToRecentViewed({
|
||||||
|
entityType: EntityType.TABLE,
|
||||||
|
fqn: fullyQualifiedName,
|
||||||
|
serviceType: serviceType,
|
||||||
|
timestamp: 0,
|
||||||
|
});
|
||||||
|
setName(name);
|
||||||
|
|
||||||
|
setDescription(description);
|
||||||
|
setColumns(columns || []);
|
||||||
|
setSampleData(sampleData);
|
||||||
|
setTableProfile(tableProfile || []);
|
||||||
|
setTableTags(getTagsWithoutTier(tags));
|
||||||
|
setUsageSummary(usageSummary);
|
||||||
|
setJoins(joins);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['fetch-table-details-error']
|
||||||
|
);
|
||||||
|
setIsError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
addToRecentViewed({
|
|
||||||
entityType: EntityType.TABLE,
|
|
||||||
fqn: fullyQualifiedName,
|
|
||||||
serviceType: serviceType,
|
|
||||||
timestamp: 0,
|
|
||||||
});
|
|
||||||
setName(name);
|
|
||||||
|
|
||||||
setDescription(description);
|
|
||||||
setColumns(columns || []);
|
|
||||||
setSampleData(sampleData);
|
|
||||||
setTableProfile(tableProfile || []);
|
|
||||||
setTableTags(getTagsWithoutTier(tags));
|
|
||||||
setUsageSummary(usageSummary);
|
|
||||||
setJoins(joins);
|
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
if (err.response?.status === 404) {
|
if (err.response?.status === 404) {
|
||||||
@ -360,8 +379,14 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
setIsSampleDataLoading(true);
|
setIsSampleDataLoading(true);
|
||||||
getTableDetailsByFQN(tableFQN, tabField)
|
getTableDetailsByFQN(tableFQN, tabField)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const { sampleData } = res.data;
|
if (res.data) {
|
||||||
setSampleData(sampleData);
|
const { sampleData } = res.data;
|
||||||
|
setSampleData(sampleData);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['fetch-sample-data-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const errMsg =
|
const errMsg =
|
||||||
@ -394,8 +419,14 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
setIsTableQueriesLoading(true);
|
setIsTableQueriesLoading(true);
|
||||||
getTableDetailsByFQN(tableFQN, tabField)
|
getTableDetailsByFQN(tableFQN, tabField)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const { tableQueries } = res.data;
|
if (res.data) {
|
||||||
setTableQueries(tableQueries);
|
const { tableQueries } = res.data;
|
||||||
|
setTableQueries(tableQueries);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['fetch-table-queries-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const errMsg =
|
const errMsg =
|
||||||
@ -432,8 +463,14 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
const getEntityFeedCount = () => {
|
const getEntityFeedCount = () => {
|
||||||
getFeedCount(getEntityFeedLink(EntityType.TABLE, tableFQN))
|
getFeedCount(getEntityFeedLink(EntityType.TABLE, tableFQN))
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
setFeedCount(res.data.totalCount);
|
if (res.data) {
|
||||||
setEntityFieldThreadCount(res.data.counts);
|
setFeedCount(res.data.totalCount);
|
||||||
|
setEntityFieldThreadCount(res.data.counts);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['fetch-entity-feed-count-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const errMsg =
|
const errMsg =
|
||||||
@ -455,11 +492,17 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
const descriptionUpdateHandler = (updatedTable: Table) => {
|
const descriptionUpdateHandler = (updatedTable: Table) => {
|
||||||
saveUpdatedTableData(updatedTable)
|
saveUpdatedTableData(updatedTable)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const { description, version } = res.data;
|
if (res.data) {
|
||||||
setCurrentVersion(version);
|
const { description, version } = res.data;
|
||||||
setTableDetails(res.data);
|
setCurrentVersion(version);
|
||||||
setDescription(description);
|
setTableDetails(res.data);
|
||||||
getEntityFeedCount();
|
setDescription(description);
|
||||||
|
getEntityFeedCount();
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['update-description-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const msg =
|
const msg =
|
||||||
@ -472,11 +515,17 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
const columnsUpdateHandler = (updatedTable: Table) => {
|
const columnsUpdateHandler = (updatedTable: Table) => {
|
||||||
saveUpdatedTableData(updatedTable)
|
saveUpdatedTableData(updatedTable)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const { columns, version } = res.data;
|
if (res.data) {
|
||||||
setCurrentVersion(version);
|
const { columns, version } = res.data;
|
||||||
setTableDetails(res.data);
|
setCurrentVersion(version);
|
||||||
setColumns(columns);
|
setTableDetails(res.data);
|
||||||
getEntityFeedCount();
|
setColumns(columns);
|
||||||
|
getEntityFeedCount();
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['update-entity-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const msg =
|
const msg =
|
||||||
@ -512,13 +561,19 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
saveUpdatedTableData(updatedTable)
|
saveUpdatedTableData(updatedTable)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const { version, owner, tags } = res.data;
|
if (res.data) {
|
||||||
setCurrentVersion(version);
|
const { version, owner, tags } = res.data;
|
||||||
setTableDetails(res.data);
|
setCurrentVersion(version);
|
||||||
setOwner(owner);
|
setTableDetails(res.data);
|
||||||
setTier(getTierTags(tags));
|
setOwner(owner);
|
||||||
getEntityFeedCount();
|
setTier(getTierTags(tags));
|
||||||
resolve();
|
getEntityFeedCount();
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['update-entity-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
const msg =
|
const msg =
|
||||||
@ -533,26 +588,45 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
// TODO: move all the error from below code to en.ts and use handleShowErrorToast to show error.
|
// TODO: move all the error from below code to en.ts and use handleShowErrorToast to show error.
|
||||||
|
|
||||||
const followTable = () => {
|
const followTable = () => {
|
||||||
addFollower(tableId, USERId).then((res: AxiosResponse) => {
|
addFollower(tableId, USERId)
|
||||||
const { newValue } = res.data.changeDescription.fieldsAdded[0];
|
.then((res: AxiosResponse) => {
|
||||||
|
if (res.data) {
|
||||||
|
const { newValue } = res.data.changeDescription.fieldsAdded[0];
|
||||||
|
|
||||||
setFollowers([...followers, ...newValue]);
|
setFollowers([...followers, ...newValue]);
|
||||||
});
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['update-entity-follow-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err: AxiosError) => {
|
||||||
|
const errMsg =
|
||||||
|
err.response?.data?.message ||
|
||||||
|
jsonData['api-error-messages']['update-entity-follow-error'];
|
||||||
|
handleShowErrorToast(errMsg);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const unfollowTable = () => {
|
const unfollowTable = () => {
|
||||||
removeFollower(tableId, USERId)
|
removeFollower(tableId, USERId)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const { oldValue } = res.data.changeDescription.fieldsDeleted[0];
|
if (res.data) {
|
||||||
|
const { oldValue } = res.data.changeDescription.fieldsDeleted[0];
|
||||||
|
|
||||||
setFollowers(
|
setFollowers(
|
||||||
followers.filter((follower) => follower.id !== oldValue[0].id)
|
followers.filter((follower) => follower.id !== oldValue[0].id)
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['update-entity-unfollow-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: `Error while unfollowing entity.`,
|
jsonData['api-error-messages']['update-entity-unfollow-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -583,13 +657,26 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
|
|
||||||
const loadNodeHandler = (node: EntityReference, pos: LineagePos) => {
|
const loadNodeHandler = (node: EntityReference, pos: LineagePos) => {
|
||||||
setNodeLoading({ id: node.id, state: true });
|
setNodeLoading({ id: node.id, state: true });
|
||||||
getLineageByFQN(node.name, node.type).then((res: AxiosResponse) => {
|
getLineageByFQN(node.name, node.type)
|
||||||
setLeafNode(res.data, pos);
|
.then((res: AxiosResponse) => {
|
||||||
setEntityLineage(getEntityLineage(entityLineage, res.data, pos));
|
if (!res.data) {
|
||||||
setTimeout(() => {
|
setLeafNode(res.data, pos);
|
||||||
setNodeLoading((prev) => ({ ...prev, state: false }));
|
setEntityLineage(getEntityLineage(entityLineage, res.data, pos));
|
||||||
}, 500);
|
} else {
|
||||||
});
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['fetch-lineage-node-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
setNodeLoading((prev) => ({ ...prev, state: false }));
|
||||||
|
}, 500);
|
||||||
|
})
|
||||||
|
.catch((err: AxiosError) => {
|
||||||
|
const errMsg =
|
||||||
|
err.response?.data?.message ||
|
||||||
|
jsonData['api-error-messages']['fetch-lineage-node-error'];
|
||||||
|
handleShowErrorToast(errMsg);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const addLineageHandler = (edge: Edge): Promise<void> => {
|
const addLineageHandler = (edge: Edge): Promise<void> => {
|
||||||
@ -598,11 +685,11 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: `Error while adding adding new edge.`,
|
jsonData['api-error-messages']['add-lineage-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -614,11 +701,11 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
data.fromId,
|
data.fromId,
|
||||||
data.toEntity,
|
data.toEntity,
|
||||||
data.toId
|
data.toId
|
||||||
).catch(() => {
|
).catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: `Error while removing edge.`,
|
jsonData['api-error-messages']['delete-lineage-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -643,109 +730,128 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
getEntityFeedCount();
|
getEntityFeedCount();
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['add-feed-error']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: 'Error while posting feed',
|
jsonData['api-error-messages']['add-feed-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const createThread = (data: CreateThread) => {
|
const createThread = (data: CreateThread) => {
|
||||||
postThread(data)
|
postThread(data)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
setEntityThread((pre) => [...pre, res.data]);
|
if (res.data) {
|
||||||
getEntityFeedCount();
|
setEntityThread((pre) => [...pre, res.data]);
|
||||||
showToast({
|
getEntityFeedCount();
|
||||||
variant: 'success',
|
handleShowSuccessToast(
|
||||||
body: 'Conversation created successfully',
|
jsonData['api-success-messages']['create-conversation']
|
||||||
});
|
);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['create-conversation-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: 'Error while creating the conversation',
|
jsonData['api-error-messages']['create-conversation-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddTableTestCase = (data: CreateTableTest) => {
|
const handleAddTableTestCase = (data: CreateTableTest) => {
|
||||||
addTableTestCase(tableDetails.id, data)
|
addTableTestCase(tableDetails.id, data)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
const { tableTests } = res.data;
|
if (res.data) {
|
||||||
let itsNewTest = true;
|
const { tableTests } = res.data;
|
||||||
const existingData = tableTestCase.map((test) => {
|
let itsNewTest = true;
|
||||||
if (test.name === tableTests[0].name) {
|
const existingData = tableTestCase.map((test) => {
|
||||||
itsNewTest = false;
|
if (test.name === tableTests[0].name) {
|
||||||
|
itsNewTest = false;
|
||||||
|
|
||||||
return tableTests[0];
|
return tableTests[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return test;
|
||||||
|
});
|
||||||
|
if (itsNewTest) {
|
||||||
|
existingData.push(tableTests[0]);
|
||||||
}
|
}
|
||||||
|
setTableTestCase(existingData);
|
||||||
return test;
|
handleShowTestForm(false);
|
||||||
});
|
handleShowSuccessToast(
|
||||||
if (itsNewTest) {
|
`Test ${data.testCase.tableTestType} for ${name} has been ${
|
||||||
existingData.push(tableTests[0]);
|
itsNewTest ? 'added' : 'updated'
|
||||||
|
} successfully.`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['add-table-test-error']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
setTableTestCase(existingData);
|
|
||||||
handleShowTestForm(false);
|
|
||||||
showToast({
|
|
||||||
variant: 'success',
|
|
||||||
body: `Test ${data.testCase.tableTestType} for ${name} has been ${
|
|
||||||
itsNewTest ? 'added' : 'updated'
|
|
||||||
} successfully.`,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: COMMON_ERROR_MSG,
|
jsonData['api-error-messages']['add-table-test-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddColumnTestCase = (data: ColumnTest) => {
|
const handleAddColumnTestCase = (data: ColumnTest) => {
|
||||||
addColumnTestCase(tableDetails.id, data)
|
addColumnTestCase(tableDetails.id, data)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
let itsNewTest = true;
|
if (res.data) {
|
||||||
const columnTestRes = res.data.columns.find(
|
let itsNewTest = true;
|
||||||
(d: Column) => d.name === data.columnName
|
const columnTestRes = res.data.columns.find(
|
||||||
);
|
(d: Column) => d.name === data.columnName
|
||||||
const updatedColumns = columns.map((d) => {
|
);
|
||||||
if (d.name === data.columnName) {
|
const updatedColumns = columns.map((d) => {
|
||||||
const oldTest =
|
if (d.name === data.columnName) {
|
||||||
(d as ModifiedTableColumn)?.columnTests?.filter(
|
const oldTest =
|
||||||
(test) => test.id !== columnTestRes.columnTests[0].id
|
(d as ModifiedTableColumn)?.columnTests?.filter(
|
||||||
) || [];
|
(test) => test.id !== columnTestRes.columnTests[0].id
|
||||||
|
) || [];
|
||||||
|
|
||||||
itsNewTest =
|
itsNewTest =
|
||||||
oldTest.length ===
|
oldTest.length ===
|
||||||
(d as ModifiedTableColumn)?.columnTests?.length;
|
(d as ModifiedTableColumn)?.columnTests?.length;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...d,
|
...d,
|
||||||
columnTests: [...oldTest, columnTestRes.columnTests[0]],
|
columnTests: [...oldTest, columnTestRes.columnTests[0]],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
});
|
});
|
||||||
setColumns(updatedColumns);
|
setColumns(updatedColumns);
|
||||||
handleShowTestForm(false);
|
handleShowTestForm(false);
|
||||||
setSelectedColumn(undefined);
|
setSelectedColumn(undefined);
|
||||||
showToast({
|
handleShowSuccessToast(
|
||||||
variant: 'success',
|
`Test ${data.testCase.columnTestType} for ${
|
||||||
body: `Test ${data.testCase.columnTestType} for ${
|
data.columnName
|
||||||
data.columnName
|
} has been ${itsNewTest ? 'added' : 'updated'} successfully.`
|
||||||
} has been ${itsNewTest ? 'added' : 'updated'} successfully.`,
|
);
|
||||||
});
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages']['add-column-test-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: COMMON_ERROR_MSG,
|
jsonData['api-error-messages']['add-column-test-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -756,16 +862,13 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
(d) => d.testCase.tableTestType !== testType
|
(d) => d.testCase.tableTestType !== testType
|
||||||
);
|
);
|
||||||
setTableTestCase(updatedTest);
|
setTableTestCase(updatedTest);
|
||||||
showToast({
|
handleShowSuccessToast(jsonData['api-success-messages']['delete-test']);
|
||||||
variant: 'success',
|
|
||||||
body: TEST_DELETE_MSG,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: COMMON_ERROR_MSG,
|
jsonData['api-error-messages']['delete-test-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -791,16 +894,13 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
return d;
|
return d;
|
||||||
});
|
});
|
||||||
setColumns(updatedColumns);
|
setColumns(updatedColumns);
|
||||||
showToast({
|
handleShowSuccessToast(jsonData['api-success-messages']['delete-test']);
|
||||||
variant: 'success',
|
|
||||||
body: TEST_DELETE_MSG,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err: AxiosError) => {
|
||||||
showToast({
|
const errMsg =
|
||||||
variant: 'error',
|
err.response?.data?.message ||
|
||||||
body: COMMON_ERROR_MSG,
|
jsonData['api-error-messages']['delete-test-error'];
|
||||||
});
|
handleShowErrorToast(errMsg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -809,36 +909,46 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
getUpdatedThread(threadId)
|
getUpdatedThread(threadId)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
setEntityThread((pre) => {
|
if (data) {
|
||||||
return pre.map((thread) => {
|
setEntityThread((pre) => {
|
||||||
if (thread.id === data.id) {
|
return pre.map((thread) => {
|
||||||
return {
|
if (thread.id === data.id) {
|
||||||
...thread,
|
return {
|
||||||
posts: data.posts.slice(-3),
|
...thread,
|
||||||
postsCount: data.postsCount,
|
posts: data.posts.slice(-3),
|
||||||
};
|
postsCount: data.postsCount,
|
||||||
} else {
|
};
|
||||||
return thread;
|
} else {
|
||||||
}
|
return thread;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
|
handleShowErrorToast(
|
||||||
|
jsonData['api-error-messages'][
|
||||||
|
'fetch-updated-conversation-error'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error: AxiosError) => {
|
||||||
const message = error?.message;
|
const message =
|
||||||
showToast({
|
error?.response?.data?.message ||
|
||||||
variant: 'error',
|
jsonData['api-error-messages'][
|
||||||
body: message ?? onUpdatedConversastionError,
|
'fetch-updated-conversation-error'
|
||||||
});
|
];
|
||||||
|
handleShowErrorToast(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
showToast({
|
handleShowSuccessToast(
|
||||||
variant: 'success',
|
jsonData['api-success-messages']['delete-message']
|
||||||
body: onConfirmText,
|
);
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error: AxiosError) => {
|
||||||
const message = error?.message;
|
const message =
|
||||||
showToast({ variant: 'error', body: message ?? onErrorText });
|
error?.response?.data?.message ||
|
||||||
|
jsonData['api-error-messages']['delete-message-error'];
|
||||||
|
handleShowErrorToast(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user