1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Toast on log copy

This commit is contained in:
Niels van Velzen 2025-02-23 21:57:41 +01:00
parent e741bd5e0a
commit 3a9534c5ba
3 changed files with 5 additions and 8 deletions

View file

@ -5,20 +5,14 @@ import { useApi } from 'hooks/useApi';
import type { AxiosRequestConfig } from 'axios'; import type { AxiosRequestConfig } from 'axios';
const fetchServerLog = async ( const fetchServerLog = async (
api?: Api, api: Api | undefined,
name?: string, name: string,
options?: AxiosRequestConfig options?: AxiosRequestConfig
) => { ) => {
if (!api) { if (!api) {
console.error('[useServerLog] No API instance available'); console.error('[useServerLog] No API instance available');
return; return;
} }
if (!name) {
console.error('[useServerLog] Name is required');
return;
}
const response = await getSystemApi(api).getLogFile({ name }, options); const response = await getSystemApi(api).getLogFile({ name }, options);
// FIXME: TypeScript SDK thinks it is returning a File but in reality it is a string // FIXME: TypeScript SDK thinks it is returning a File but in reality it is a string

View file

@ -15,6 +15,7 @@ import {
} from '@mui/material'; } from '@mui/material';
import { ContentCopy, FileDownload } from '@mui/icons-material'; import { ContentCopy, FileDownload } from '@mui/icons-material';
import globalize from 'lib/globalize'; import globalize from 'lib/globalize';
import toast from 'components/toast/toast';
export const Component = () => { export const Component = () => {
const { file: fileName } = useParams(); const { file: fileName } = useParams();
@ -30,6 +31,7 @@ export const Component = () => {
const copyToClipboard = useCallback(async () => { const copyToClipboard = useCallback(async () => {
if ('clipboard' in navigator && log) { if ('clipboard' in navigator && log) {
await navigator.clipboard.writeText(log); await navigator.clipboard.writeText(log);
toast({ text: globalize.translate('CopyLogSuccess') });
} }
}, [log]); }, [log]);

View file

@ -188,6 +188,7 @@
"CopyFailed": "Could not copy", "CopyFailed": "Could not copy",
"CopyStreamURL": "Copy Stream URL", "CopyStreamURL": "Copy Stream URL",
"CopyStreamURLSuccess": "URL copied successfully.", "CopyStreamURLSuccess": "URL copied successfully.",
"CopyLogSuccess": "Log contents copied successfully.",
"CoverArtist": "Cover artist", "CoverArtist": "Cover artist",
"Creator": "Creator", "Creator": "Creator",
"CriticRating": "Critics rating", "CriticRating": "Critics rating",