Skip to content

Commit

Permalink
Add Community tag to plugins (#2982)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakkomajuri authored Jan 19, 2021
1 parent 45811dd commit f39877f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions frontend/src/scenes/plugins/CommunityPluginTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'
import { Tag } from 'antd'

export function CommunityPluginTag({ isCommunity }: { isCommunity?: boolean }): JSX.Element {
return (
<Tag
color={isCommunity ? 'green' : 'blue'}
style={{ maxWidth: '30%', position: 'absolute', right: 15, top: 15 }}
>
{isCommunity ? 'Community' : 'Core Team'}
</Tag>
)
}
1 change: 1 addition & 0 deletions frontend/src/scenes/plugins/InstalledPlugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function InstalledPlugins(): JSX.Element {
pluginType={plugin.plugin_type}
pluginConfig={plugin.pluginConfig}
error={plugin.error}
maintainer={plugin.maintainer || 'community'}
/>
)
})}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/scenes/plugins/PluginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { PluginError } from 'scenes/plugins/PluginError'
import { LocalPluginTag } from 'scenes/plugins/LocalPluginTag'
import { PluginInstallationType } from 'scenes/plugins/types'
import { SourcePluginTag } from 'scenes/plugins/SourcePluginTag'
import { CommunityPluginTag } from './CommunityPluginTag'

interface PluginCardProps {
name: string
Expand All @@ -20,6 +21,7 @@ interface PluginCardProps {
pluginType?: PluginInstallationType
pluginId?: number
error?: PluginErrorType
maintainer: string
}

export function PluginCard({
Expand All @@ -30,6 +32,7 @@ export function PluginCard({
pluginConfig,
pluginId,
error,
maintainer,
}: PluginCardProps): JSX.Element {
const { editPlugin, toggleEnabled, installPlugin, resetPluginConfigError } = useActions(pluginsLogic)
const { loading } = useValues(pluginsLogic)
Expand Down Expand Up @@ -60,6 +63,7 @@ export function PluginCard({
style={{ height: '100%', display: 'flex', marginBottom: 20 }}
bodyStyle={{ display: 'flex', flexDirection: 'column', flexGrow: 1 }}
>
{!pluginId && <CommunityPluginTag isCommunity={maintainer === 'community'} />}
{pluginType === 'source' ? (
<SourcePluginTag style={{ position: 'absolute', top: 10, left: 10, cursor: 'pointer' }} />
) : null}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/plugins/Repository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function Repository(): JSX.Element {
name={plugin.name}
url={plugin.url}
description={plugin.description}
maintainer={plugin.maintainer}
/>
)
})}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export interface PluginType {
config_schema: Record<string, PluginConfigSchema> | PluginConfigSchema[]
source?: string
error?: PluginErrorType
maintainer?: string
}

export interface PluginConfigType {
Expand Down

0 comments on commit f39877f

Please sign in to comment.