Mark deprecated plugins in the UI
Summary: Changelog: Add a deprecation warning for deprecated plugins. Closes https://github.com/facebook/flipper/issues/2074 Reviewed By: lblasa, antonk52 Differential Revision: D36760209 fbshipit-source-id: 64cf799644f28aeedf88824c949738a6a766b094
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4ed0f1c4b0
commit
59761ecd50
@@ -37,6 +37,8 @@ export interface PluginDetails {
|
|||||||
overview?: boolean;
|
overview?: boolean;
|
||||||
setup?: boolean;
|
setup?: boolean;
|
||||||
};
|
};
|
||||||
|
/** Provided by NPM. Allows developers to deprecated packages. Its value is the deprecation reason. */
|
||||||
|
deprecated?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SupportedDevice {
|
export interface SupportedDevice {
|
||||||
@@ -153,6 +155,7 @@ function getPluginDetailsV1(packageJson: any): PluginDetails {
|
|||||||
supportedDevices: packageJson?.supportedDevices,
|
supportedDevices: packageJson?.supportedDevices,
|
||||||
supportedApps: packageJson?.supportedApps,
|
supportedApps: packageJson?.supportedApps,
|
||||||
engines: packageJson.engines,
|
engines: packageJson.engines,
|
||||||
|
deprecated: packageJson.deprecated,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,6 +184,7 @@ function getPluginDetailsV2(packageJson: any): PluginDetails {
|
|||||||
engines: packageJson.engines,
|
engines: packageJson.engines,
|
||||||
publishedDocs: packageJson.publishedDocs,
|
publishedDocs: packageJson.publishedDocs,
|
||||||
headless: packageJson.headless,
|
headless: packageJson.headless,
|
||||||
|
deprecated: packageJson.deprecated,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import PluginPackageInstaller from './PluginPackageInstaller';
|
|||||||
import {Toolbar} from 'flipper-plugin';
|
import {Toolbar} from 'flipper-plugin';
|
||||||
import {Alert, Button, Input, Tooltip, Typography} from 'antd';
|
import {Alert, Button, Input, Tooltip, Typography} from 'antd';
|
||||||
import {getRenderHostInstance} from '../../RenderHost';
|
import {getRenderHostInstance} from '../../RenderHost';
|
||||||
|
import {WarningOutlined} from '@ant-design/icons';
|
||||||
|
|
||||||
const {Text, Link} = Typography;
|
const {Text, Link} = Typography;
|
||||||
|
|
||||||
@@ -256,7 +257,26 @@ function useNPMSearch(
|
|||||||
key: h.name,
|
key: h.name,
|
||||||
columns: {
|
columns: {
|
||||||
name: {
|
name: {
|
||||||
value: <Text ellipsis>{h.name.replace(/^flipper-plugin-/, '')}</Text>,
|
value: (
|
||||||
|
// Copy-paste from antd/Space. We cannot use Space directly as it wraps children with divs, and we cannot easily set styles fro the wrapper child divs.
|
||||||
|
// Yet, we want to set min-width: 0 for the child with the Text. Otherwise, ellipsis does not work.
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'inline-flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
overflow: 'hidden',
|
||||||
|
gap: theme.space.small,
|
||||||
|
}}>
|
||||||
|
{h.deprecated != null ? (
|
||||||
|
<Tooltip title={h.deprecated || 'Plugin is deprecated'}>
|
||||||
|
<WarningOutlined style={{color: theme.errorColor}} />
|
||||||
|
</Tooltip>
|
||||||
|
) : null}
|
||||||
|
<Text style={{minWidth: 0}} ellipsis>
|
||||||
|
{h.name.replace(/^flipper-plugin-/, '')}
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
version: {
|
version: {
|
||||||
value: <Text ellipsis>{h.version}</Text>,
|
value: <Text ellipsis>{h.version}</Text>,
|
||||||
|
|||||||
@@ -142,13 +142,18 @@ exports[`load PluginInstaller list 1`] = `
|
|||||||
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
width="0"
|
width="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="display: inline-flex; align-items: center; overflow: hidden; gap: 8px;"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
||||||
|
style="min-width: 0;"
|
||||||
>
|
>
|
||||||
hello
|
hello
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
@@ -209,13 +214,18 @@ exports[`load PluginInstaller list 1`] = `
|
|||||||
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
width="0"
|
width="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="display: inline-flex; align-items: center; overflow: hidden; gap: 8px;"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
||||||
|
style="min-width: 0;"
|
||||||
>
|
>
|
||||||
world
|
world
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
@@ -518,13 +528,18 @@ exports[`load PluginInstaller list with one plugin installed 1`] = `
|
|||||||
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
width="0"
|
width="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="display: inline-flex; align-items: center; overflow: hidden; gap: 8px;"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
||||||
|
style="min-width: 0;"
|
||||||
>
|
>
|
||||||
hello
|
hello
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
@@ -585,13 +600,18 @@ exports[`load PluginInstaller list with one plugin installed 1`] = `
|
|||||||
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
class="css-yt4330-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
width="0"
|
width="0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="display: inline-flex; align-items: center; overflow: hidden; gap: 8px;"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line"
|
||||||
|
style="min-width: 0;"
|
||||||
>
|
>
|
||||||
world
|
world
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
class="css-pfp0fy-TableBodyColumnContainer e1pvjj0s0"
|
||||||
title=""
|
title=""
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ test('getPluginDetailsV1', async () => {
|
|||||||
Object {
|
Object {
|
||||||
"bugs": undefined,
|
"bugs": undefined,
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
@@ -83,6 +84,7 @@ test('getPluginDetailsV2', async () => {
|
|||||||
Object {
|
Object {
|
||||||
"bugs": undefined,
|
"bugs": undefined,
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
@@ -130,6 +132,7 @@ test('id used as title if the latter omited', async () => {
|
|||||||
Object {
|
Object {
|
||||||
"bugs": undefined,
|
"bugs": undefined,
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
@@ -176,6 +179,7 @@ test('name without "flipper-plugin-" prefix is used as title if the latter omite
|
|||||||
Object {
|
Object {
|
||||||
"bugs": undefined,
|
"bugs": undefined,
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
@@ -225,6 +229,7 @@ test('flipper-plugin-version is parsed', async () => {
|
|||||||
Object {
|
Object {
|
||||||
"bugs": undefined,
|
"bugs": undefined,
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
@@ -278,6 +283,7 @@ test('plugin type and supported devices parsed', async () => {
|
|||||||
Object {
|
Object {
|
||||||
"bugs": undefined,
|
"bugs": undefined,
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
@@ -347,6 +353,7 @@ test('plugin type and supported apps parsed', async () => {
|
|||||||
Object {
|
Object {
|
||||||
"bugs": undefined,
|
"bugs": undefined,
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
@@ -436,6 +443,7 @@ test('can merge two package.json files', async () => {
|
|||||||
"url": "https://fb.com/groups/flippersupport",
|
"url": "https://fb.com/groups/flippersupport",
|
||||||
},
|
},
|
||||||
"category": undefined,
|
"category": undefined,
|
||||||
|
"deprecated": undefined,
|
||||||
"description": "Description of Test Plugin",
|
"description": "Description of Test Plugin",
|
||||||
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
"dir": "/Users/mock/.flipper/thirdparty/flipper-plugin-test",
|
||||||
"engines": undefined,
|
"engines": undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user