mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
fix(web): statusbox re-rendering and nav bar when trashing assets (#6581)
* fix: issues on web * fix: description in shared album * fix: remove unused api request * revert * fix: linter
This commit is contained in:
parent
f97f23d149
commit
74f1000e83
2 changed files with 12 additions and 11 deletions
|
@ -12,7 +12,7 @@
|
||||||
export let menuItem = false;
|
export let menuItem = false;
|
||||||
export let force = !$featureFlags.trash;
|
export let force = !$featureFlags.trash;
|
||||||
|
|
||||||
const { getOwnedAssets } = getAssetControlContext();
|
const { clearSelect, getOwnedAssets } = getAssetControlContext();
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{
|
const dispatch = createEventDispatcher<{
|
||||||
escape: void;
|
escape: void;
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
.filter((a) => !a.isExternal)
|
.filter((a) => !a.isExternal)
|
||||||
.map((a) => a.id);
|
.map((a) => a.id);
|
||||||
await deleteAssets(force, onAssetDelete, ids);
|
await deleteAssets(force, onAssetDelete, ids);
|
||||||
|
clearSelect();
|
||||||
isShowConfirmation = false;
|
isShowConfirmation = false;
|
||||||
loading = false;
|
loading = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,22 +2,22 @@
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
import { locale } from '$lib/stores/preferences.store';
|
import { locale } from '$lib/stores/preferences.store';
|
||||||
import { websocketStore } from '$lib/stores/websocket';
|
import { websocketStore } from '$lib/stores/websocket';
|
||||||
import { type UserResponseDto, api } from '@api';
|
import { api } from '@api';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { asByteUnitString } from '../../utils/byte-units';
|
import { asByteUnitString } from '../../utils/byte-units';
|
||||||
import LoadingSpinner from './loading-spinner.svelte';
|
import LoadingSpinner from './loading-spinner.svelte';
|
||||||
import { mdiChartPie, mdiDns } from '@mdi/js';
|
import { mdiChartPie, mdiDns } from '@mdi/js';
|
||||||
import { serverInfoStore } from '$lib/stores/server-info.store';
|
import { serverInfoStore } from '$lib/stores/server-info.store';
|
||||||
|
import { user } from '$lib/stores/user.store';
|
||||||
|
|
||||||
const { serverVersion, connected } = websocketStore;
|
const { serverVersion, connected } = websocketStore;
|
||||||
|
|
||||||
let userInfo: UserResponseDto;
|
|
||||||
let usageClasses = '';
|
let usageClasses = '';
|
||||||
|
|
||||||
$: version = $serverVersion ? `v${$serverVersion.major}.${$serverVersion.minor}.${$serverVersion.patch}` : null;
|
$: version = $serverVersion ? `v${$serverVersion.major}.${$serverVersion.minor}.${$serverVersion.patch}` : null;
|
||||||
$: hasQuota = userInfo?.quotaSizeInBytes !== null;
|
$: hasQuota = $user?.quotaSizeInBytes !== null;
|
||||||
$: availableBytes = (hasQuota ? userInfo?.quotaSizeInBytes : $serverInfoStore.diskSizeRaw) || 0;
|
$: availableBytes = (hasQuota ? $user?.quotaSizeInBytes : $serverInfoStore?.diskSizeRaw) || 0;
|
||||||
$: usedBytes = (hasQuota ? userInfo?.quotaUsageInBytes : $serverInfoStore.diskUseRaw) || 0;
|
$: usedBytes = (hasQuota ? $user?.quotaUsageInBytes : $serverInfoStore?.diskUseRaw) || 0;
|
||||||
$: usedPercentage = Math.round((usedBytes / availableBytes) * 100);
|
$: usedPercentage = Math.round((usedBytes / availableBytes) * 100);
|
||||||
|
|
||||||
const onUpdate = () => {
|
const onUpdate = () => {
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
return 'bg-immich-primary dark:bg-immich-dark-primary';
|
return 'bg-immich-primary dark:bg-immich-dark-primary';
|
||||||
};
|
};
|
||||||
|
|
||||||
$: userInfo && onUpdate();
|
$: $user && onUpdate();
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await refresh();
|
await refresh();
|
||||||
|
@ -44,10 +44,10 @@
|
||||||
|
|
||||||
const refresh = async () => {
|
const refresh = async () => {
|
||||||
try {
|
try {
|
||||||
[$serverInfoStore, userInfo] = await Promise.all([
|
if (!$serverInfoStore) {
|
||||||
api.serverInfoApi.getServerInfo().then(({ data }) => data),
|
const { data } = await api.serverInfoApi.getServerInfo();
|
||||||
api.userApi.getMyUserInfo().then(({ data }) => data),
|
$serverInfoStore = data;
|
||||||
]);
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error [StatusBox] [onMount]');
|
console.log('Error [StatusBox] [onMount]');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue