Merge pull request #18327 from awanlin/topic/use-transient-for-info-and-success-alerts

Use transient for info and success alerts
This commit is contained in:
Fredrik Adelöw
2023-06-20 10:28:05 +02:00
committed by GitHub
8 changed files with 25 additions and 2 deletions
@@ -172,7 +172,11 @@ export function AboutCard(props: AboutCardProps) {
const refreshEntity = useCallback(async () => {
try {
await catalogApi.refreshEntity(stringifyEntityRef(entity));
alertApi.post({ message: 'Refresh scheduled', severity: 'info' });
alertApi.post({
message: 'Refresh scheduled',
severity: 'info',
display: 'transient',
});
} catch (e) {
errorApi.post(e);
}
@@ -191,6 +191,7 @@ const generatedColumns: TableColumn[] = [
alertApi.post({
message: 'Jenkins re-build has successfully executed',
severity: 'success',
display: 'transient',
});
} catch (e) {
alertApi.post({
@@ -73,7 +73,11 @@ export const GroupProfileCard = (props: {
const refreshEntity = useCallback(async () => {
await catalogApi.refreshEntity(stringifyEntityRef(group));
alertApi.post({ message: 'Refresh scheduled', severity: 'info' });
alertApi.post({
message: 'Refresh scheduled',
severity: 'info',
display: 'transient',
});
}, [catalogApi, alertApi, group]);
if (!group) {
@@ -167,6 +167,7 @@ describe('EntityPlaylistDialog', () => {
expect(alertApi.post).toHaveBeenCalledWith({
message: 'Entity added to playlist-2',
severity: 'success',
display: 'transient',
});
});
});
@@ -159,6 +159,7 @@ export const EntityPlaylistDialog = (props: EntityPlaylistDialogProps) => {
alertApi.post({
message: `Entity added to ${playlist.name}`,
severity: 'success',
display: 'transient',
});
} catch (e) {
alertApi.post({
+1
View File
@@ -71,6 +71,7 @@ export const AddShortcut = ({
alertApi.post({
message: `Added shortcut '${title}' to your sidebar`,
severity: 'success',
display: 'transient',
});
} catch (error) {
alertApi.post({
+2
View File
@@ -74,6 +74,7 @@ export const EditShortcut = ({
alertApi.post({
message: `Updated shortcut '${title}'`,
severity: 'success',
display: 'transient',
});
} catch (error) {
alertApi.post({
@@ -91,6 +92,7 @@ export const EditShortcut = ({
alertApi.post({
message: `Removed shortcut '${shortcut.title}' from your sidebar`,
severity: 'success',
display: 'transient',
});
} catch (error) {
alertApi.post({