mirror of
https://github.com/immich-app/immich.git
synced 2025-01-26 17:21:29 +02:00
Added error handling notification (#536)
This commit is contained in:
parent
33b810de74
commit
4be9aa091b
@ -22,6 +22,10 @@
|
|||||||
import MenuOption from '../shared-components/context-menu/menu-option.svelte';
|
import MenuOption from '../shared-components/context-menu/menu-option.svelte';
|
||||||
import ThumbnailSelection from './thumbnail-selection.svelte';
|
import ThumbnailSelection from './thumbnail-selection.svelte';
|
||||||
import ControlAppBar from '../shared-components/control-app-bar.svelte';
|
import ControlAppBar from '../shared-components/control-app-bar.svelte';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType
|
||||||
|
} from '../shared-components/notification/notification';
|
||||||
|
|
||||||
export let album: AlbumResponseDto;
|
export let album: AlbumResponseDto;
|
||||||
|
|
||||||
@ -129,7 +133,11 @@
|
|||||||
album = data;
|
album = data;
|
||||||
multiSelectAsset = new Set();
|
multiSelectAsset = new Set();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [album-viewer] [removeAssetFromAlbum]', e);
|
console.error('Error [album-viewer] [removeAssetFromAlbum]', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error removing assets from album, check console for more details'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -179,7 +187,11 @@
|
|||||||
currentAlbumName = album.albumName;
|
currentAlbumName = album.albumName;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log('Error [updateAlbumInfo] ', e);
|
console.error('Error [updateAlbumInfo] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: "Error updating album's name, check console for more details"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +205,11 @@
|
|||||||
|
|
||||||
isShowAssetSelection = false;
|
isShowAssetSelection = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [createAlbumHandler] ', e);
|
console.error('Error [createAlbumHandler] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error creating album, check console for more details'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -209,7 +225,11 @@
|
|||||||
|
|
||||||
isShowShareUserSelection = false;
|
isShowShareUserSelection = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [createAlbumHandler] ', e);
|
console.error('Error [addUserHandler] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error adding users to album, check console for more details'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -227,7 +247,11 @@
|
|||||||
album = data;
|
album = data;
|
||||||
isShowShareInfoModal = false;
|
isShowShareInfoModal = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [sharedUserDeletedHandler] ', e);
|
console.error('Error [sharedUserDeletedHandler] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error deleting share users, check console for more details'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -241,7 +265,11 @@
|
|||||||
await api.albumApi.deleteAlbum(album.id);
|
await api.albumApi.deleteAlbum(album.id);
|
||||||
goto(backUrl);
|
goto(backUrl);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [userDeleteMenu] ', e);
|
console.error('Error [userDeleteMenu] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error deleting album, check console for more details'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -262,7 +290,11 @@
|
|||||||
albumThumbnailAssetId: asset.id
|
albumThumbnailAssetId: asset.id
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [setAlbumThumbnailHandler] ', e);
|
console.error('Error [setAlbumThumbnailHandler] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error setting album thumbnail, check console for more details'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
isShowThumbnailSelection = false;
|
isShowThumbnailSelection = false;
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
import CircleIconButton from '../shared-components/circle-icon-button.svelte';
|
import CircleIconButton from '../shared-components/circle-icon-button.svelte';
|
||||||
import ContextMenu from '../shared-components/context-menu/context-menu.svelte';
|
import ContextMenu from '../shared-components/context-menu/context-menu.svelte';
|
||||||
import MenuOption from '../shared-components/context-menu/menu-option.svelte';
|
import MenuOption from '../shared-components/context-menu/menu-option.svelte';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType
|
||||||
|
} from '../shared-components/notification/notification';
|
||||||
|
|
||||||
export let album: AlbumResponseDto;
|
export let album: AlbumResponseDto;
|
||||||
|
|
||||||
@ -24,6 +28,10 @@
|
|||||||
currentUser = data;
|
currentUser = data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error [share-info-modal] [getAllUsers]', e);
|
console.error('Error [share-info-modal] [getAllUsers]', e);
|
||||||
|
notificationController.show({
|
||||||
|
message: 'Error getting user info, check console for more details',
|
||||||
|
type: NotificationType.Error
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -48,6 +56,10 @@
|
|||||||
dispatch('user-deleted', { userId });
|
dispatch('user-deleted', { userId });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error [share-info-modal] [removeUser]', e);
|
console.error('Error [share-info-modal] [removeUser]', e);
|
||||||
|
notificationController.show({
|
||||||
|
message: 'Error removing user, check console for more details',
|
||||||
|
type: NotificationType.Error
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
import { downloadAssets } from '$lib/stores/download';
|
import { downloadAssets } from '$lib/stores/download';
|
||||||
import VideoViewer from './video-viewer.svelte';
|
import VideoViewer from './video-viewer.svelte';
|
||||||
import { api, AssetResponseDto, AssetTypeEnum } from '@api';
|
import { api, AssetResponseDto, AssetTypeEnum } from '@api';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType
|
||||||
|
} from '../shared-components/notification/notification';
|
||||||
|
|
||||||
export let asset: AssetResponseDto;
|
export let asset: AssetResponseDto;
|
||||||
|
|
||||||
@ -115,7 +119,11 @@
|
|||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error downloading file ', e);
|
console.error('Error downloading file ', e);
|
||||||
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error downloading file, check console for more details.'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
import { createEventDispatcher, onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import LoadingSpinner from '../shared-components/loading-spinner.svelte';
|
import LoadingSpinner from '../shared-components/loading-spinner.svelte';
|
||||||
import { api, AssetResponseDto } from '@api';
|
import { api, AssetResponseDto } from '@api';
|
||||||
|
|
||||||
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
let assetInfo: AssetResponseDto;
|
let assetInfo: AssetResponseDto;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const { data } = await api.assetApi.getAssetById(assetId);
|
const { data } = await api.assetApi.getAssetById(assetId);
|
||||||
assetInfo = data;
|
assetInfo = data;
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
import { api, UserResponseDto } from '@api';
|
import { api, UserResponseDto } from '@api';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import AccountEditOutline from 'svelte-material-icons/AccountEditOutline.svelte';
|
import AccountEditOutline from 'svelte-material-icons/AccountEditOutline.svelte';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType
|
||||||
|
} from '../shared-components/notification/notification';
|
||||||
|
|
||||||
export let user: UserResponseDto;
|
export let user: UserResponseDto;
|
||||||
|
|
||||||
@ -29,7 +33,11 @@
|
|||||||
dispatch('edit-success');
|
dispatch('edit-success');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error updating user ', e);
|
console.error('Error updating user ', e);
|
||||||
|
notificationController.show({
|
||||||
|
message: 'Error updating user, check console for more details',
|
||||||
|
type: NotificationType.Error
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -49,7 +57,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error reseting user password', e);
|
console.error('Error reseting user password', e);
|
||||||
|
notificationController.show({
|
||||||
|
message: 'Error reseting user password, check console for more details',
|
||||||
|
type: NotificationType.Error
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
await api.userApi.getProfileImage(user.id);
|
await api.userApi.getProfileImage(user.id);
|
||||||
shouldShowProfileImage = true;
|
shouldShowProfileImage = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('User does not have a profile image');
|
|
||||||
shouldShowProfileImage = false;
|
shouldShowProfileImage = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -33,10 +32,6 @@
|
|||||||
return text?.charAt(0).toUpperCase();
|
return text?.charAt(0).toUpperCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToAdmin = () => {
|
|
||||||
goto('/admin');
|
|
||||||
};
|
|
||||||
|
|
||||||
const showAccountInfoPanel = () => {
|
const showAccountInfoPanel = () => {
|
||||||
shouldShowAccountInfoPanel = true;
|
shouldShowAccountInfoPanel = true;
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@ export class ImmichNotificationDto {
|
|||||||
/**
|
/**
|
||||||
* Timeout in miliseconds
|
* Timeout in miliseconds
|
||||||
*/
|
*/
|
||||||
timeout = 3000;
|
timeout?: number;
|
||||||
}
|
}
|
||||||
function createNotificationList() {
|
function createNotificationList() {
|
||||||
const notificationList = writable<ImmichNotification[]>([]);
|
const notificationList = writable<ImmichNotification[]>([]);
|
||||||
@ -36,7 +36,7 @@ function createNotificationList() {
|
|||||||
const newNotification = new ImmichNotification();
|
const newNotification = new ImmichNotification();
|
||||||
newNotification.message = notificationInfo.message;
|
newNotification.message = notificationInfo.message;
|
||||||
newNotification.type = notificationInfo.type;
|
newNotification.type = notificationInfo.type;
|
||||||
newNotification.timeout = notificationInfo.timeout;
|
newNotification.timeout = notificationInfo.timeout || 3000;
|
||||||
|
|
||||||
notificationList.update((currentList) => [...currentList, newNotification]);
|
notificationList.update((currentList) => [...currentList, newNotification]);
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
import NavigationBar from '$lib/components/shared-components/navigation-bar.svelte';
|
import NavigationBar from '$lib/components/shared-components/navigation-bar.svelte';
|
||||||
import SideBar from '$lib/components/shared-components/side-bar/side-bar.svelte';
|
import SideBar from '$lib/components/shared-components/side-bar/side-bar.svelte';
|
||||||
import PlusBoxOutline from 'svelte-material-icons/PlusBoxOutline.svelte';
|
import PlusBoxOutline from 'svelte-material-icons/PlusBoxOutline.svelte';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType
|
||||||
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
@ -40,7 +44,11 @@
|
|||||||
|
|
||||||
goto('/albums/' + newAlbum.id);
|
goto('/albums/' + newAlbum.id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [createAlbum] ', e);
|
console.error('Error [createAlbum] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
message: 'Error creating album, check console for more details',
|
||||||
|
type: NotificationType.Error
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -49,7 +57,7 @@
|
|||||||
await api.albumApi.deleteAlbum(album.id);
|
await api.albumApi.deleteAlbum(album.id);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [autoDeleteAlbum] ', e);
|
console.error('Error [autoDeleteAlbum] ', e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -64,7 +72,11 @@
|
|||||||
await api.albumApi.deleteAlbum(targetAlbum.id);
|
await api.albumApi.deleteAlbum(targetAlbum.id);
|
||||||
data.albums = data.albums.filter((a) => a.id !== targetAlbum.id);
|
data.albums = data.albums.filter((a) => a.id !== targetAlbum.id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [userDeleteMenu] ', e);
|
console.error('Error [userDeleteMenu] ', e);
|
||||||
|
notificationController.show({
|
||||||
|
message: 'Error deleting user, check console for more details',
|
||||||
|
type: NotificationType.Error
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
|
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType
|
||||||
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
@ -68,7 +72,10 @@
|
|||||||
pushState(selectedAsset.id);
|
pushState(selectedAsset.id);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error navigating asset forward', e);
|
notificationController.show({
|
||||||
|
type: NotificationType.Info,
|
||||||
|
message: 'You have reached the end'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,7 +87,10 @@
|
|||||||
pushState(selectedAsset.id);
|
pushState(selectedAsset.id);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error navigating asset backward', e);
|
notificationController.show({
|
||||||
|
type: NotificationType.Info,
|
||||||
|
message: 'You have reached the end'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,7 +186,11 @@
|
|||||||
clearMultiSelectAssetAssetHandler();
|
clearMultiSelectAssetAssetHandler();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error deleteSelectedAssetHandler', e);
|
notificationController.show({
|
||||||
|
type: NotificationType.Error,
|
||||||
|
message: 'Error deleting assets, check console for more details'
|
||||||
|
});
|
||||||
|
console.error('Error deleteSelectedAssetHandler', e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { api } from '@api';
|
import { api } from '@api';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType
|
||||||
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
@ -17,6 +21,11 @@
|
|||||||
|
|
||||||
goto('/albums/' + newAlbum.id);
|
goto('/albums/' + newAlbum.id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
notificationController.show({
|
||||||
|
message: 'Error creating album, check console for more details',
|
||||||
|
type: NotificationType.Error
|
||||||
|
});
|
||||||
|
|
||||||
console.log('Error [createAlbum] ', e);
|
console.log('Error [createAlbum] ', e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user