Skip to content

Commit

Permalink
update marketplace plugin to use catalog api
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikjeeyar committed Dec 9, 2024
1 parent 43ba96c commit 7721395
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
14 changes: 7 additions & 7 deletions workspaces/marketplace/plugins/marketplace-common/report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,10 @@ export interface MarketplacePluginLink {

// @public (undocumented)
export interface MarketplacePluginMetadata {
// (undocumented)
abstract?: string;
// (undocumented)
annotations?: Record<string, string>;
// (undocumented)
categories?: string[];
// (undocumented)
developer?: string;
// (undocumented)
icon?: string;
description?: string;
// (undocumented)
labels?: Record<string, string>;
// (undocumented)
Expand All @@ -49,11 +43,17 @@ export interface MarketplacePluginMetadata {

// @public (undocumented)
export interface MarketplacePluginSpec {
// (undocumented)
categories?: string[];
// (undocumented)
description?: string;
// (undocumented)
developer?: string;
// (undocumented)
highlights?: string[];
// (undocumented)
icon?: string;
// (undocumented)
installation?: {
markdown?: string;
appconfig?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class MarketplaceClient implements MarketplaceApi {

async getPlugins(): Promise<MarketplacePluginEntry[]> {
const baseUrl = await this.discoveryApi.getBaseUrl('catalog');
const url = `${baseUrl}/entities?filter=kind=plugin`;
const url = `${baseUrl}/entities?filter=kind=marketplace`;

const response = await this.fetchApi.fetch(url);
if (!response.ok) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import { usePlugins } from '../hooks/usePlugins';
import { detailsRouteRef, rootRouteRef } from '../routes';

const Icon = ({ entry }: { entry: MarketplacePluginEntry }) =>
entry.metadata.icon ? (
entry.spec?.icon ? (
<CardMedia
image={entry.metadata.icon}
image={entry.spec.icon}
sx={{ width: 80, height: 80, flexShrink: 0 }}
/>
) : null;
Expand Down Expand Up @@ -111,49 +111,45 @@ const Entry = ({ entry }: { entry: MarketplacePluginEntry }) => {
<Typography variant="subtitle1" style={{ fontWeight: '500' }}>
{entry.metadata.title}
</Typography>
{entry.metadata.developer ? (
{entry.spec?.developer ? (
<Typography
variant="subtitle2"
style={{ fontWeight: 'normal' }}
>
{' by '}
<Link
to={withSearchParameter(
'developer',
entry.metadata.developer,
)}
to={withSearchParameter('developer', entry.spec.developer)}
color="primary"
onClick={e => e.stopPropagation()}
>
{entry.metadata.developer}
{entry.spec.developer}
</Link>
</Typography>
) : null}
{entry.metadata.categories &&
entry.metadata.categories.length > 0 ? (
{entry.spec?.categories && entry.spec.categories.length > 0 ? (
<Typography
variant="subtitle2"
style={{ fontWeight: 'normal' }}
>
<LinkButton
to={withSearchParameter(
'category',
entry.metadata.categories[0],
entry.spec.categories[0],
)}
variant="outlined"
style={{ fontWeight: 'normal', padding: '2px 6px' }}
onClick={e => e.stopPropagation()}
>
{entry.metadata.categories[0]}
{entry.spec.categories[0]}
</LinkButton>
</Typography>
) : null}
</Stack>
</Stack>

{entry.metadata.abstract ? (
{entry.metadata.description ? (
<Typography variant="subtitle2" style={{ fontWeight: 'normal' }}>
{entry.metadata.abstract}
{entry.metadata.description}
</Typography>
) : null}
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import { usePlugins } from '../hooks/usePlugins';
import { rootRouteRef } from '../routes';

const Icon = ({ entry }: { entry: MarketplacePluginEntry }) =>
entry.metadata.icon ? (
entry.spec?.icon ? (
<CardMedia
image={entry.metadata.icon}
image={entry.spec.icon}
sx={{ width: 80, height: 80, flexShrink: 0 }}
/>
) : null;
Expand Down Expand Up @@ -108,18 +108,18 @@ const EntryContent = ({ entry }: { entry: MarketplacePluginEntry }) => {
<Typography variant="subtitle1" style={{ fontWeight: '500' }}>
{entry.metadata.title}
</Typography>
{entry.metadata.developer ? (
{entry.spec?.developer ? (
<Typography variant="subtitle2" style={{ fontWeight: 'normal' }}>
{' by '}
<Link
to={withSearchParameter('developer', entry.metadata.developer)}
to={withSearchParameter('developer', entry.spec.developer)}
color="primary"
>
{entry.metadata.developer}
{entry.spec.developer}
</Link>
</Typography>
) : null}
{entry.metadata.categories?.map(category => (
{entry.spec?.categories?.map(category => (
<Typography variant="subtitle2" style={{ fontWeight: 'normal' }}>
<LinkButton
to={withSearchParameter('category', category)}
Expand Down Expand Up @@ -159,9 +159,9 @@ const EntryContent = ({ entry }: { entry: MarketplacePluginEntry }) => {
<Typography variant="subtitle1" sx={{ fontWeight: 'bold' }}>
About
</Typography>
{entry.metadata.abstract ? (
{entry.metadata.description ? (
<Typography variant="subtitle2" style={{ fontWeight: 'normal' }}>
{entry.metadata.abstract}
{entry.metadata.description}
</Typography>
) : null}
</Grid>
Expand Down

0 comments on commit 7721395

Please sign in to comment.