From 1559c8e2b166daed544e1a42681eca58e72a6e1d Mon Sep 17 00:00:00 2001 From: Joaquim Rocha Date: Thu, 25 Jul 2024 13:57:38 +0100 Subject: [PATCH] plugin-catalog: Fix format/linting issues With npm run lint -- --fix. Signed-off-by: Joaquim Rocha --- .../src/components/plugins/Detail.tsx | 37 +++++++------------ .../src/components/plugins/InstalledList.tsx | 2 +- .../src/components/plugins/List.tsx | 15 ++++---- .../src/components/plugins/PluginCard.tsx | 2 +- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/plugin-catalog/src/components/plugins/Detail.tsx b/plugin-catalog/src/components/plugins/Detail.tsx index 3567028..7246046 100644 --- a/plugin-catalog/src/components/plugins/Detail.tsx +++ b/plugin-catalog/src/components/plugins/Detail.tsx @@ -1,11 +1,11 @@ import { PluginManager, Router } from '@kinvolk/headlamp-plugin/lib'; import { ActionButton, + Link as HeadlampLink, Loader, NameValueTable, SectionBox, SectionHeader, - Link as HeadlampLink, } from '@kinvolk/headlamp-plugin/lib/components/common'; import { Button, CardMedia, Link, Snackbar, Tooltip, Typography } from '@mui/material'; import Markdown from 'markdown-to-jsx'; @@ -141,8 +141,7 @@ export function PurePluginDetail({ `${artifactHubURLBase}&repo=${pluginDetail.repository.name}`, `${artifactHubURLBase}&org=${pluginDetail.repository.organization_name}`, ]; - }, - [pluginDetail]); + }, [pluginDetail]); return ( <> @@ -181,18 +180,14 @@ export function PurePluginDetail({ }} component="img" /> - ) + ), ]} actions={[ currentAction === null ? ( pluginDetail ? ( pluginDetail.isInstalled ? ( <> - - Settings - + Settings {pluginDetail.updateAvailable && ( - {pluginDetail.repository.display_name} - - ) - ) + value: repoUrl && ( + + {pluginDetail.repository.display_name} + + ), }, { name: 'Author', - value: ( - orgUrl && ( - - {pluginDetail.repository.organization_display_name} - - ) - ) + value: orgUrl && ( + + {pluginDetail.repository.organization_display_name} + + ), }, ]} /> diff --git a/plugin-catalog/src/components/plugins/InstalledList.tsx b/plugin-catalog/src/components/plugins/InstalledList.tsx index 8853871..61addb7 100644 --- a/plugin-catalog/src/components/plugins/InstalledList.tsx +++ b/plugin-catalog/src/components/plugins/InstalledList.tsx @@ -54,7 +54,7 @@ export function PurePluginInstalledList({ installedPlugins, error }: PurePluginI getter: plugin => plugin.author, }, ]} - emptyMessage='No plugins installed' + emptyMessage="No plugins installed" data={installedPlugins || []} /> )} diff --git a/plugin-catalog/src/components/plugins/List.tsx b/plugin-catalog/src/components/plugins/List.tsx index 469ab41..5984b84 100644 --- a/plugin-catalog/src/components/plugins/List.tsx +++ b/plugin-catalog/src/components/plugins/List.tsx @@ -120,7 +120,7 @@ async function processPlugins() { let pluginData = []; try { pluginData = await PluginManager.list(); - } catch(err) { + } catch (err) { console.log('plugin-catalog: Failed to list plugins', err); } const installedPlugins = pluginData.map((plugin: any) => plugin.folderName); @@ -131,12 +131,13 @@ async function processPlugins() { new Map(mergedPlugins.map(plugin => [plugin.package_id, plugin])).values() ); - const pluginsWithInstallStatus = uniquePlugins.map((pkg: PluginPackage) => ({ - ...pkg, - isInstalled: installedPlugins.includes(pkg.name), - })) - // Reorder so plugins with logos show first. - .sort((a, b) => (!!b.logo_image_id ? 1 : 0) - (!!a.logo_image_id ? 1 : 0)); + const pluginsWithInstallStatus = uniquePlugins + .map((pkg: PluginPackage) => ({ + ...pkg, + isInstalled: installedPlugins.includes(pkg.name), + })) + // Reorder so plugins with logos show first. + .sort((a, b) => (!!b.logo_image_id ? 1 : 0) - (!!a.logo_image_id ? 1 : 0)); const totalPages = Math.ceil(pluginsWithInstallStatus.length / PAGE_SIZE); diff --git a/plugin-catalog/src/components/plugins/PluginCard.tsx b/plugin-catalog/src/components/plugins/PluginCard.tsx index 927559f..6c33bcd 100644 --- a/plugin-catalog/src/components/plugins/PluginCard.tsx +++ b/plugin-catalog/src/components/plugins/PluginCard.tsx @@ -19,7 +19,7 @@ export interface PluginCardProps { } export function PluginCard(props: PluginCardProps) { - const {plugin} = props; + const { plugin } = props; return (