mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-24 17:08:28 +00:00
Remove success toast notification! (#4375)
This commit is contained in:
parent
8c60b22180
commit
66a9663763
@ -79,7 +79,7 @@ import { deletePost, getUpdatedThread } from '../../utils/FeedUtils';
|
|||||||
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
||||||
import { getErrorText } from '../../utils/StringsUtils';
|
import { getErrorText } from '../../utils/StringsUtils';
|
||||||
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
|
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
|
||||||
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
|
|
||||||
type ChartType = {
|
type ChartType = {
|
||||||
displayName: string;
|
displayName: string;
|
||||||
@ -638,9 +638,6 @@ const DashboardDetailsPage = () => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
setEntityThread((pre) => [...pre, res.data]);
|
setEntityThread((pre) => [...pre, res.data]);
|
||||||
getEntityFeedCount();
|
getEntityFeedCount();
|
||||||
showSuccessToast(
|
|
||||||
jsonData['api-success-messages']['create-conversation']
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
jsonData['api-error-messages']['unexpected-server-response']
|
jsonData['api-error-messages']['unexpected-server-response']
|
||||||
@ -686,8 +683,6 @@ const DashboardDetailsPage = () => {
|
|||||||
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
showSuccessToast(jsonData['api-success-messages']['delete-message']);
|
|
||||||
})
|
})
|
||||||
.catch((error: AxiosError) => {
|
.catch((error: AxiosError) => {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
|
@ -90,7 +90,7 @@ import {
|
|||||||
} from '../../utils/FeedUtils';
|
} from '../../utils/FeedUtils';
|
||||||
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
||||||
import { getErrorText } from '../../utils/StringsUtils';
|
import { getErrorText } from '../../utils/StringsUtils';
|
||||||
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
|
|
||||||
const DatabaseSchemaPage: FunctionComponent = () => {
|
const DatabaseSchemaPage: FunctionComponent = () => {
|
||||||
const [slashedTableName, setSlashedTableName] = useState<
|
const [slashedTableName, setSlashedTableName] = useState<
|
||||||
@ -438,9 +438,6 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
setEntityThread((pre) => [...pre, res.data]);
|
setEntityThread((pre) => [...pre, res.data]);
|
||||||
getEntityFeedCount();
|
getEntityFeedCount();
|
||||||
showSuccessToast(
|
|
||||||
jsonData['api-success-messages']['create-conversation']
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
jsonData['api-error-messages']['unexpected-server-response']
|
jsonData['api-error-messages']['unexpected-server-response']
|
||||||
@ -486,8 +483,6 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
|||||||
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
showSuccessToast(jsonData['api-success-messages']['delete-message']);
|
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
|
@ -744,9 +744,6 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
setEntityThread((pre) => [...pre, res.data]);
|
setEntityThread((pre) => [...pre, res.data]);
|
||||||
getEntityFeedCount();
|
getEntityFeedCount();
|
||||||
showSuccessToast(
|
|
||||||
jsonData['api-success-messages']['create-conversation']
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
jsonData['api-error-messages']['create-conversation-error']
|
jsonData['api-error-messages']['create-conversation-error']
|
||||||
@ -931,8 +928,6 @@ const DatasetDetailsPage: FunctionComponent = () => {
|
|||||||
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
showSuccessToast(jsonData['api-success-messages']['delete-message']);
|
|
||||||
})
|
})
|
||||||
.catch((error: AxiosError) => {
|
.catch((error: AxiosError) => {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
|
@ -29,7 +29,6 @@ import GithubStarButton from '../../components/GithubStarButton/GithubStarButton
|
|||||||
import Loader from '../../components/Loader/Loader';
|
import Loader from '../../components/Loader/Loader';
|
||||||
import MyData from '../../components/MyData/MyData.component';
|
import MyData from '../../components/MyData/MyData.component';
|
||||||
import {
|
import {
|
||||||
onConfirmText,
|
|
||||||
onErrorText,
|
onErrorText,
|
||||||
onUpdatedConversastionError,
|
onUpdatedConversastionError,
|
||||||
} from '../../constants/feed.constants';
|
} from '../../constants/feed.constants';
|
||||||
@ -42,7 +41,7 @@ import { formatDataResponse } from '../../utils/APIUtils';
|
|||||||
import { deletePost, getUpdatedThread } from '../../utils/FeedUtils';
|
import { deletePost, getUpdatedThread } from '../../utils/FeedUtils';
|
||||||
import { getMyDataFilters } from '../../utils/MyDataUtils';
|
import { getMyDataFilters } from '../../utils/MyDataUtils';
|
||||||
import { getAllServices } from '../../utils/ServiceUtils';
|
import { getAllServices } from '../../utils/ServiceUtils';
|
||||||
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
|
|
||||||
const MyDataPage = () => {
|
const MyDataPage = () => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@ -288,7 +287,6 @@ const MyDataPage = () => {
|
|||||||
const message = error?.message;
|
const message = error?.message;
|
||||||
showErrorToast(message ?? onUpdatedConversastionError);
|
showErrorToast(message ?? onUpdatedConversastionError);
|
||||||
});
|
});
|
||||||
showSuccessToast(onConfirmText);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const message = error?.message;
|
const message = error?.message;
|
||||||
|
@ -77,7 +77,7 @@ import {
|
|||||||
} from '../../utils/PipelineDetailsUtils';
|
} from '../../utils/PipelineDetailsUtils';
|
||||||
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
||||||
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
|
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
|
||||||
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
|
|
||||||
const PipelineDetailsPage = () => {
|
const PipelineDetailsPage = () => {
|
||||||
const USERId = getCurrentUserId();
|
const USERId = getCurrentUserId();
|
||||||
@ -590,9 +590,6 @@ const PipelineDetailsPage = () => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
setEntityThread((pre) => [...pre, res.data]);
|
setEntityThread((pre) => [...pre, res.data]);
|
||||||
getEntityFeedCount();
|
getEntityFeedCount();
|
||||||
showSuccessToast(
|
|
||||||
jsonData['api-success-messages']['create-conversation']
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
jsonData['api-error-messages']['unexpected-server-response']
|
jsonData['api-error-messages']['unexpected-server-response']
|
||||||
@ -638,8 +635,6 @@ const PipelineDetailsPage = () => {
|
|||||||
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
showSuccessToast(jsonData['api-success-messages']['delete-message']);
|
|
||||||
})
|
})
|
||||||
.catch((error: AxiosError) => {
|
.catch((error: AxiosError) => {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
|
@ -57,7 +57,7 @@ import { getEntityFeedLink } from '../../utils/EntityUtils';
|
|||||||
import { deletePost, getUpdatedThread } from '../../utils/FeedUtils';
|
import { deletePost, getUpdatedThread } from '../../utils/FeedUtils';
|
||||||
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
||||||
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
|
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
|
||||||
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
import {
|
import {
|
||||||
getCurrentTopicTab,
|
getCurrentTopicTab,
|
||||||
topicDetailsTabs,
|
topicDetailsTabs,
|
||||||
@ -411,9 +411,6 @@ const TopicDetailsPage: FunctionComponent = () => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
setEntityThread((pre) => [...pre, res.data]);
|
setEntityThread((pre) => [...pre, res.data]);
|
||||||
getEntityFeedCount();
|
getEntityFeedCount();
|
||||||
showSuccessToast(
|
|
||||||
jsonData['api-success-messages']['create-conversation']
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
jsonData['api-error-messages']['create-conversation-error']
|
jsonData['api-error-messages']['create-conversation-error']
|
||||||
@ -461,8 +458,6 @@ const TopicDetailsPage: FunctionComponent = () => {
|
|||||||
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
showSuccessToast(jsonData['api-success-messages']['delete-message']);
|
|
||||||
})
|
})
|
||||||
.catch((error: AxiosError) => {
|
.catch((error: AxiosError) => {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
|
@ -23,7 +23,6 @@ import PageContainerV1 from '../../components/containers/PageContainerV1';
|
|||||||
import Loader from '../../components/Loader/Loader';
|
import Loader from '../../components/Loader/Loader';
|
||||||
import Users from '../../components/Users/Users.component';
|
import Users from '../../components/Users/Users.component';
|
||||||
import {
|
import {
|
||||||
onConfirmText,
|
|
||||||
onErrorText,
|
onErrorText,
|
||||||
onUpdatedConversastionError,
|
onUpdatedConversastionError,
|
||||||
} from '../../constants/feed.constants';
|
} from '../../constants/feed.constants';
|
||||||
@ -32,7 +31,7 @@ import { User } from '../../generated/entity/teams/user';
|
|||||||
import { Paging } from '../../generated/type/paging';
|
import { Paging } from '../../generated/type/paging';
|
||||||
import jsonData from '../../jsons/en';
|
import jsonData from '../../jsons/en';
|
||||||
import { deletePost, getUpdatedThread } from '../../utils/FeedUtils';
|
import { deletePost, getUpdatedThread } from '../../utils/FeedUtils';
|
||||||
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
|
|
||||||
const UserPage = () => {
|
const UserPage = () => {
|
||||||
const { username } = useParams<{ [key: string]: string }>();
|
const { username } = useParams<{ [key: string]: string }>();
|
||||||
@ -154,7 +153,6 @@ const UserPage = () => {
|
|||||||
const message = error?.message;
|
const message = error?.message;
|
||||||
showErrorToast(message ?? onUpdatedConversastionError);
|
showErrorToast(message ?? onUpdatedConversastionError);
|
||||||
});
|
});
|
||||||
showSuccessToast(onConfirmText);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const message = error?.message;
|
const message = error?.message;
|
||||||
|
@ -92,7 +92,7 @@ import {
|
|||||||
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
||||||
import { getErrorText } from '../../utils/StringsUtils';
|
import { getErrorText } from '../../utils/StringsUtils';
|
||||||
import { getOwnerFromId, getUsagePercentile } from '../../utils/TableUtils';
|
import { getOwnerFromId, getUsagePercentile } from '../../utils/TableUtils';
|
||||||
import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils';
|
import { showErrorToast } from '../../utils/ToastUtils';
|
||||||
|
|
||||||
const DatabaseDetails: FunctionComponent = () => {
|
const DatabaseDetails: FunctionComponent = () => {
|
||||||
const [slashedDatabaseName, setSlashedDatabaseName] = useState<
|
const [slashedDatabaseName, setSlashedDatabaseName] = useState<
|
||||||
@ -469,9 +469,6 @@ const DatabaseDetails: FunctionComponent = () => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
setEntityThread((pre) => [...pre, res.data]);
|
setEntityThread((pre) => [...pre, res.data]);
|
||||||
getEntityFeedCount();
|
getEntityFeedCount();
|
||||||
showSuccessToast(
|
|
||||||
jsonData['api-success-messages']['create-conversation']
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
jsonData['api-error-messages']['unexpected-server-response']
|
jsonData['api-error-messages']['unexpected-server-response']
|
||||||
@ -517,8 +514,6 @@ const DatabaseDetails: FunctionComponent = () => {
|
|||||||
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
jsonData['api-error-messages']['fetch-updated-conversation-error']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
showSuccessToast(jsonData['api-success-messages']['delete-message']);
|
|
||||||
})
|
})
|
||||||
.catch((error: AxiosError) => {
|
.catch((error: AxiosError) => {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
|
@ -21,10 +21,12 @@ import { getErrorText } from './StringsUtils';
|
|||||||
* Display an error toast message.
|
* Display an error toast message.
|
||||||
* @param error error text or AxiosError object
|
* @param error error text or AxiosError object
|
||||||
* @param fallbackText Fallback error message to the displayed.
|
* @param fallbackText Fallback error message to the displayed.
|
||||||
|
* @param autoCloseTimer Set the delay in ms to close the toast automatically.
|
||||||
*/
|
*/
|
||||||
export const showErrorToast = (
|
export const showErrorToast = (
|
||||||
error: AxiosError | string,
|
error: AxiosError | string,
|
||||||
fallbackText?: string
|
fallbackText?: string,
|
||||||
|
autoCloseTimer?: number
|
||||||
) => {
|
) => {
|
||||||
let errorMessage;
|
let errorMessage;
|
||||||
if (isString(error)) {
|
if (isString(error)) {
|
||||||
@ -41,26 +43,30 @@ export const showErrorToast = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toast.error(errorMessage);
|
toast.error(errorMessage, {
|
||||||
|
autoClose: autoCloseTimer,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a success toast message.
|
* Display a success toast message.
|
||||||
* @param message success message.
|
* @param message success message.
|
||||||
|
* @param autoCloseTimer Set the delay in ms to close the toast automatically. `Default: 5000`
|
||||||
*/
|
*/
|
||||||
export const showSuccessToast = (message: string) => {
|
export const showSuccessToast = (message: string, autoCloseTimer = 5000) => {
|
||||||
toast.success(message, {
|
toast.success(message, {
|
||||||
autoClose: 10000,
|
autoClose: autoCloseTimer,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an info toast message.
|
* Display an info toast message.
|
||||||
* @param message info message.
|
* @param message info message.
|
||||||
|
* @param autoCloseTimer Set the delay in ms to close the toast automatically. `Default: 5000`
|
||||||
*/
|
*/
|
||||||
export const showInfoToast = (message: string) => {
|
export const showInfoToast = (message: string, autoCloseTimer = 5000) => {
|
||||||
toast.info(message, {
|
toast.info(message, {
|
||||||
autoClose: 10000,
|
autoClose: autoCloseTimer,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user