mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix configuration page link
This commit is contained in:
parent
e928a2ff95
commit
c143082f63
3 changed files with 27 additions and 5 deletions
21
src/apps/dashboard/features/plugins/api/configurationPage.ts
Normal file
21
src/apps/dashboard/features/plugins/api/configurationPage.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import type { ConfigurationPageInfo } from '@jellyfin/sdk/lib/generated-client/models/configuration-page-info';
|
||||
|
||||
export const findBestConfigurationPage = (
|
||||
configurationPages: ConfigurationPageInfo[],
|
||||
pluginId: string
|
||||
) => {
|
||||
// Find candidates matching the plugin id
|
||||
const candidates = configurationPages.filter(c => c.PluginId === pluginId);
|
||||
|
||||
// If none are found, return undefined
|
||||
if (candidates.length === 0) return;
|
||||
// If only one is found, return it
|
||||
if (candidates.length === 1) return candidates[0];
|
||||
|
||||
// Prefer the first candidate with the EnableInMainMenu flag for consistency
|
||||
const menuCandidate = candidates.find(c => !!c.EnableInMainMenu);
|
||||
if (menuCandidate) return menuCandidate;
|
||||
|
||||
// Fallback to the first match
|
||||
return candidates[0];
|
||||
};
|
|
@ -1,14 +1,14 @@
|
|||
import type { PluginStatus, VersionInfo } from '@jellyfin/sdk/lib/generated-client';
|
||||
import type { ConfigurationPageInfo, PluginStatus, VersionInfo } from '@jellyfin/sdk/lib/generated-client';
|
||||
|
||||
export interface PluginDetails {
|
||||
canUninstall: boolean
|
||||
description?: string
|
||||
hasConfiguration: boolean
|
||||
id: string
|
||||
imageUrl?: string
|
||||
isEnabled: boolean
|
||||
name?: string
|
||||
owner?: string
|
||||
configurationPage?: ConfigurationPageInfo
|
||||
status?: PluginStatus
|
||||
version?: VersionInfo
|
||||
versions: VersionInfo[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue