mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Move LogItem component to be under features
This commit is contained in:
parent
4c757fea77
commit
4134683eb5
3 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@ import type { AxiosRequestConfig } from 'axios';
|
|||
import type { Api } from '@jellyfin/sdk';
|
||||
import { getActivityLogApi } from '@jellyfin/sdk/lib/utils/api/activity-log-api';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { useApi } from 'hooks/useApi';
|
||||
|
||||
const fetchLogEntries = async (
|
||||
|
|
40
src/apps/dashboard/features/logs/components/LogItem.tsx
Normal file
40
src/apps/dashboard/features/logs/components/LogItem.tsx
Normal file
|
@ -0,0 +1,40 @@
|
|||
import type { LogFile } from '@jellyfin/sdk/lib/generated-client/models/log-file';
|
||||
import LinkButton from 'elements/emby-button/LinkButton';
|
||||
import { useApi } from 'hooks/useApi';
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import datetime from 'scripts/datetime';
|
||||
|
||||
type LogItemProps = {
|
||||
logFile: LogFile;
|
||||
};
|
||||
|
||||
const LogItem: FunctionComponent<LogItemProps> = ({ logFile }: LogItemProps) => {
|
||||
const { api } = useApi();
|
||||
|
||||
const getLogFileUrl = () => {
|
||||
if (!api) return;
|
||||
|
||||
let url = api.basePath + '/System/Logs/Log';
|
||||
|
||||
url += '?name=' + encodeURIComponent(String(logFile.Name));
|
||||
url += '&api_key=' + encodeURIComponent(api.accessToken);
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
const getDate = () => {
|
||||
const date = datetime.parseISO8601Date(logFile.DateModified, true);
|
||||
return datetime.toLocaleDateString(date) + ' ' + datetime.getDisplayTime(date);
|
||||
};
|
||||
|
||||
return (
|
||||
<LinkButton href={getLogFileUrl()} target='_blank' rel='noreferrer' className='listItem listItem-border' style={{ color: 'inherit' }}>
|
||||
<div className='listItemBody two-line'>
|
||||
<h3 className='listItemBodyText' dir='ltr' style={{ textAlign: 'left' }}>{logFile.Name}</h3>
|
||||
<div className='listItemBodyText secondary'>{getDate()}</div>
|
||||
</div>
|
||||
</LinkButton>
|
||||
);
|
||||
};
|
||||
|
||||
export default LogItem;
|
|
@ -1,6 +1,6 @@
|
|||
import React, { ChangeEvent, useCallback, useEffect, useState } from 'react';
|
||||
import { getConfigurationApi } from '@jellyfin/sdk/lib/utils/api/configuration-api';
|
||||
import LogItem from 'components/dashboard/logs/LogItem';
|
||||
import LogItem from 'apps/dashboard/features/logs/components/LogItem';
|
||||
import Loading from 'components/loading/LoadingComponent';
|
||||
import Page from 'components/Page';
|
||||
import globalize from 'lib/globalize';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue