@dxos/plugin-registry 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-RGSIE33X.mjs → chunk-CMDU7LPH.mjs} +1 -5
- package/dist/lib/browser/chunk-CMDU7LPH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +12 -31
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-HKWZP7OW.mjs +179 -0
- package/dist/lib/browser/react-surface-HKWZP7OW.mjs.map +7 -0
- package/dist/lib/browser/settings-7LOHS2IV.mjs +27 -0
- package/dist/lib/browser/settings-7LOHS2IV.mjs.map +7 -0
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -179
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/{intent-resolver.d.ts → settings.d.ts} +2 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/PluginList.d.ts +8 -5
- package/dist/types/src/components/PluginList.d.ts.map +1 -1
- package/dist/types/src/components/PluginList.stories.d.ts +1 -6
- package/dist/types/src/components/PluginList.stories.d.ts.map +1 -1
- package/dist/types/src/components/PluginSettings.d.ts +6 -0
- package/dist/types/src/components/PluginSettings.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +0 -9
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/RegistryPlugin.tsx +7 -12
- package/src/capabilities/index.ts +1 -2
- package/src/capabilities/react-surface.tsx +10 -76
- package/src/capabilities/settings.ts +19 -0
- package/src/components/PluginList.stories.tsx +21 -30
- package/src/components/PluginList.tsx +90 -13
- package/src/components/PluginSettings.tsx +112 -0
- package/src/components/index.ts +1 -2
- package/src/meta.ts +0 -4
- package/src/translations.ts +2 -11
- package/dist/lib/browser/app-graph-builder-PPWF5KP5.mjs +0 -164
- package/dist/lib/browser/app-graph-builder-PPWF5KP5.mjs.map +0 -7
- package/dist/lib/browser/chunk-RGSIE33X.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-2JQUQJI5.mjs +0 -23
- package/dist/lib/browser/intent-resolver-2JQUQJI5.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HTHYQQF7.mjs +0 -295
- package/dist/lib/browser/react-surface-HTHYQQF7.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -181
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/PluginDetail.d.ts +0 -9
- package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
- package/dist/types/src/components/PluginDetail.stories.d.ts +0 -8
- package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
- package/dist/types/src/components/PluginItem.d.ts +0 -11
- package/dist/types/src/components/PluginItem.d.ts.map +0 -1
- package/dist/types/src/components/RegistryContainer.d.ts +0 -7
- package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -126
- package/src/capabilities/intent-resolver.ts +0 -27
- package/src/components/PluginDetail.stories.tsx +0 -45
- package/src/components/PluginDetail.tsx +0 -63
- package/src/components/PluginItem.tsx +0 -100
- package/src/components/RegistryContainer.tsx +0 -51
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createIntent, SettingsAction, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
-
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
7
|
-
|
|
8
|
-
import { REGISTRY_ID, REGISTRY_KEY, REGISTRY_PLUGIN } from '../meta';
|
|
9
|
-
|
|
10
|
-
export default (context: PluginsContext) =>
|
|
11
|
-
contributes(Capabilities.AppGraphBuilder, [
|
|
12
|
-
createExtension({
|
|
13
|
-
id: REGISTRY_PLUGIN,
|
|
14
|
-
filter: (node): node is Node<null> => node.id === 'root',
|
|
15
|
-
actions: () => [
|
|
16
|
-
{
|
|
17
|
-
id: REGISTRY_PLUGIN,
|
|
18
|
-
data: async () => {
|
|
19
|
-
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
20
|
-
await dispatch(createIntent(SettingsAction.OpenPluginRegistry));
|
|
21
|
-
},
|
|
22
|
-
properties: {
|
|
23
|
-
label: ['open plugin registry label', { ns: REGISTRY_PLUGIN }],
|
|
24
|
-
icon: 'ph--squares-four--regular',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
}),
|
|
29
|
-
createExtension({
|
|
30
|
-
id: REGISTRY_PLUGIN,
|
|
31
|
-
filter: (node): node is Node<null> => node.id === 'root',
|
|
32
|
-
connector: () => [
|
|
33
|
-
{
|
|
34
|
-
id: REGISTRY_ID,
|
|
35
|
-
type: REGISTRY_PLUGIN,
|
|
36
|
-
properties: {
|
|
37
|
-
label: ['plugin registry label', { ns: REGISTRY_PLUGIN }],
|
|
38
|
-
icon: 'ph--squares-four--regular',
|
|
39
|
-
disposition: 'pin-end',
|
|
40
|
-
testId: 'treeView.pluginRegistry',
|
|
41
|
-
},
|
|
42
|
-
nodes: [
|
|
43
|
-
{
|
|
44
|
-
id: `${REGISTRY_KEY}:all`,
|
|
45
|
-
type: 'category',
|
|
46
|
-
data: `${REGISTRY_KEY}:all`,
|
|
47
|
-
properties: {
|
|
48
|
-
label: ['all plugins label', { ns: REGISTRY_PLUGIN }],
|
|
49
|
-
icon: 'ph--squares-four--regular',
|
|
50
|
-
key: REGISTRY_KEY,
|
|
51
|
-
testId: 'pluginRegistry.all',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: `${REGISTRY_KEY}:installed`,
|
|
56
|
-
type: 'category',
|
|
57
|
-
data: `${REGISTRY_KEY}:installed`,
|
|
58
|
-
properties: {
|
|
59
|
-
label: ['installed plugins label', { ns: REGISTRY_PLUGIN }],
|
|
60
|
-
icon: 'ph--check--regular',
|
|
61
|
-
key: REGISTRY_KEY,
|
|
62
|
-
testId: 'pluginRegistry.installed',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: `${REGISTRY_KEY}:recommended`,
|
|
67
|
-
type: 'category',
|
|
68
|
-
data: `${REGISTRY_KEY}:recommended`,
|
|
69
|
-
properties: {
|
|
70
|
-
label: ['recommended plugins label', { ns: REGISTRY_PLUGIN }],
|
|
71
|
-
icon: 'ph--star--regular',
|
|
72
|
-
key: REGISTRY_KEY,
|
|
73
|
-
testId: 'pluginRegistry.recommended',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: `${REGISTRY_KEY}:experimental`,
|
|
78
|
-
type: 'category',
|
|
79
|
-
data: `${REGISTRY_KEY}:experimental`,
|
|
80
|
-
properties: {
|
|
81
|
-
label: ['experimental plugins label', { ns: REGISTRY_PLUGIN }],
|
|
82
|
-
icon: 'ph--flask--regular',
|
|
83
|
-
key: REGISTRY_KEY,
|
|
84
|
-
testId: 'pluginRegistry.experimental',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
}),
|
|
91
|
-
createExtension({
|
|
92
|
-
id: `${REGISTRY_PLUGIN}/actions`,
|
|
93
|
-
filter: (node): node is Node<null> => node.id === REGISTRY_ID,
|
|
94
|
-
actions: () => [
|
|
95
|
-
{
|
|
96
|
-
id: `${REGISTRY_PLUGIN}/load-by-url`,
|
|
97
|
-
data: async () => {},
|
|
98
|
-
properties: {
|
|
99
|
-
label: ['load by url label', { ns: REGISTRY_PLUGIN }],
|
|
100
|
-
icon: 'ph--cloud-arrow-down--regular',
|
|
101
|
-
disabled: true,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
}),
|
|
106
|
-
createExtension({
|
|
107
|
-
id: `${REGISTRY_PLUGIN}/plugins`,
|
|
108
|
-
resolver: ({ id }) => {
|
|
109
|
-
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
110
|
-
const plugin = manager.plugins.find((plugin) => plugin.meta.id === id.replaceAll(':', '/'));
|
|
111
|
-
if (!plugin) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
id,
|
|
117
|
-
type: 'dxos.org/plugin',
|
|
118
|
-
data: plugin,
|
|
119
|
-
properties: {
|
|
120
|
-
label: plugin.meta.name ?? plugin.meta.id,
|
|
121
|
-
icon: plugin.meta.icon ?? 'ph--circle--regular',
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
126
|
-
]);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
contributes,
|
|
7
|
-
SettingsAction,
|
|
8
|
-
createResolver,
|
|
9
|
-
LayoutAction,
|
|
10
|
-
Capabilities,
|
|
11
|
-
createIntent,
|
|
12
|
-
} from '@dxos/app-framework';
|
|
13
|
-
|
|
14
|
-
import { REGISTRY_ID } from '../meta';
|
|
15
|
-
|
|
16
|
-
export default () =>
|
|
17
|
-
contributes(
|
|
18
|
-
Capabilities.IntentResolver,
|
|
19
|
-
createResolver({
|
|
20
|
-
intent: SettingsAction.OpenPluginRegistry,
|
|
21
|
-
resolve: () => {
|
|
22
|
-
return {
|
|
23
|
-
intents: [createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: REGISTRY_ID })],
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
|
|
9
|
-
import { faker } from '@dxos/random';
|
|
10
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
11
|
-
|
|
12
|
-
import { PluginDetail, type PluginDetailProps } from './PluginDetail';
|
|
13
|
-
import translations from '../translations';
|
|
14
|
-
|
|
15
|
-
const meta: Meta<PluginDetailProps> = {
|
|
16
|
-
title: 'plugins/plugin-registry/PluginDetail',
|
|
17
|
-
component: PluginDetail,
|
|
18
|
-
decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'justify-center' })],
|
|
19
|
-
parameters: {
|
|
20
|
-
translations,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default meta;
|
|
25
|
-
|
|
26
|
-
type Story = StoryObj<PluginDetailProps>;
|
|
27
|
-
|
|
28
|
-
export const Default: Story = {
|
|
29
|
-
args: {
|
|
30
|
-
plugin: {
|
|
31
|
-
meta: {
|
|
32
|
-
id: 'example.com/plugin/test-plugin',
|
|
33
|
-
name: 'Test Plugin',
|
|
34
|
-
description: faker.lorem.paragraphs(2),
|
|
35
|
-
icon: 'ph--bug--regular',
|
|
36
|
-
homePage: 'https://example.com',
|
|
37
|
-
source: 'https://github.com/example/test-plugin',
|
|
38
|
-
screenshots: [
|
|
39
|
-
'https://media.gcflearnfree.org/content/55e073de7dd48174331f51b3_01_17_2014/getting_started_interactive2.png',
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
modules: [],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Plugin } from '@dxos/app-framework';
|
|
8
|
-
import { Icon, Input, Link, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { DeprecatedFormContainer } from '@dxos/react-ui-form';
|
|
10
|
-
|
|
11
|
-
import { REGISTRY_PLUGIN } from '../meta';
|
|
12
|
-
|
|
13
|
-
export type PluginDetailProps = {
|
|
14
|
-
plugin: Plugin;
|
|
15
|
-
enabled?: boolean;
|
|
16
|
-
onEnable?: () => void;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const PluginDetail = ({ plugin, enabled, onEnable }: PluginDetailProps) => {
|
|
20
|
-
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
21
|
-
const { id, name, description, homePage, source, screenshots } = plugin.meta;
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<DeprecatedFormContainer classNames='gap-6'>
|
|
25
|
-
<div role='none' className='flex justify-between items-center'>
|
|
26
|
-
<p>{id}</p>
|
|
27
|
-
<Input.Root>
|
|
28
|
-
<Input.Switch classNames='self-center' checked={enabled} onClick={onEnable} />
|
|
29
|
-
</Input.Root>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
{screenshots && (
|
|
33
|
-
<div role='none'>
|
|
34
|
-
<h1 className='text-lg mb-2'>Preview</h1>
|
|
35
|
-
<img src={screenshots[0]} alt={name} className='aspect-video object-fit' />
|
|
36
|
-
</div>
|
|
37
|
-
)}
|
|
38
|
-
|
|
39
|
-
<div role='none'>
|
|
40
|
-
<p>{description}</p>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div role='none'>
|
|
44
|
-
<h1 className='text-lg mb-2'>Resources</h1>
|
|
45
|
-
<div className='flex gap-2'>
|
|
46
|
-
{homePage && (
|
|
47
|
-
<Link href={homePage} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
|
|
48
|
-
{t('home page label')}
|
|
49
|
-
<Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mli-1' />
|
|
50
|
-
</Link>
|
|
51
|
-
)}
|
|
52
|
-
|
|
53
|
-
{source && (
|
|
54
|
-
<Link href={source} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
|
|
55
|
-
{t('source label')}
|
|
56
|
-
<Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mli-1' />
|
|
57
|
-
</Link>
|
|
58
|
-
)}
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</DeprecatedFormContainer>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Plugin } from '@dxos/app-framework';
|
|
8
|
-
import { Icon, Input, Link, ListItem, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
10
|
-
|
|
11
|
-
import { REGISTRY_PLUGIN } from '../meta';
|
|
12
|
-
|
|
13
|
-
export type PluginItemProps = {
|
|
14
|
-
plugin: Plugin;
|
|
15
|
-
installed?: readonly string[];
|
|
16
|
-
enabled?: readonly string[];
|
|
17
|
-
onClick?: (id: string) => void;
|
|
18
|
-
onChange?: (id: string, enabled: boolean) => void;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const PluginItem = ({ plugin, enabled = [], onClick, onChange }: PluginItemProps) => {
|
|
22
|
-
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
23
|
-
const { id, name, description, homePage, source, icon = 'ph--circle--regular' } = plugin.meta;
|
|
24
|
-
const isEnabled = enabled.includes(id);
|
|
25
|
-
const inputId = `${id}-input`;
|
|
26
|
-
const labelId = `${id}-label`;
|
|
27
|
-
const descriptionId = `${id}-description`;
|
|
28
|
-
const handleClick = useCallback(() => onClick?.(id), [id, onClick]);
|
|
29
|
-
const handleChange = useCallback(
|
|
30
|
-
(event: React.MouseEvent) => {
|
|
31
|
-
event.stopPropagation();
|
|
32
|
-
onChange?.(id, !isEnabled);
|
|
33
|
-
},
|
|
34
|
-
[id, isEnabled, onChange],
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<ListItem.Root
|
|
39
|
-
key={id}
|
|
40
|
-
labelId={labelId}
|
|
41
|
-
data-testid={`pluginList.${id}`}
|
|
42
|
-
aria-describedby={descriptionId}
|
|
43
|
-
classNames='w-full h-full grid grid-cols-[48px_1fr_48px] grid-rows-[40px_1fr] p-1 rounded-md border border-separator'
|
|
44
|
-
onClick={handleClick}
|
|
45
|
-
>
|
|
46
|
-
<Input.Root id={inputId}>
|
|
47
|
-
<div className='flex grow justify-center items-center'>
|
|
48
|
-
<Icon icon={icon} size={8} />
|
|
49
|
-
</div>
|
|
50
|
-
<div className='flex grow items-center'>
|
|
51
|
-
<Input.Label id={labelId} classNames='truncate w-full' style={{ fontSize: 'unset' }}>
|
|
52
|
-
{name ?? id}
|
|
53
|
-
</Input.Label>
|
|
54
|
-
</div>
|
|
55
|
-
<div className='flex grow justify-center items-center'>
|
|
56
|
-
<Input.Switch classNames='self-center' checked={isEnabled} onClick={handleChange} />
|
|
57
|
-
</div>
|
|
58
|
-
</Input.Root>
|
|
59
|
-
|
|
60
|
-
<div />
|
|
61
|
-
{(description || homePage || source) && (
|
|
62
|
-
<div id={descriptionId} className='col-span-2 flex flex-col w-full gap-2 pb-3 overflow-y-scroll'>
|
|
63
|
-
<div className='grow'>
|
|
64
|
-
<p className={mx(descriptionText, 'line-clamp-3 min-w-0')}>{description}</p>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div className='flex gap-2 items-center'>
|
|
68
|
-
{homePage && (
|
|
69
|
-
<Link
|
|
70
|
-
href={homePage}
|
|
71
|
-
target='_blank'
|
|
72
|
-
rel='noreferrer'
|
|
73
|
-
aria-describedby={descriptionId}
|
|
74
|
-
classNames='text-sm text-description'
|
|
75
|
-
onClick={(ev) => ev.stopPropagation()}
|
|
76
|
-
>
|
|
77
|
-
{t('home page label')}
|
|
78
|
-
<Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mli-1' />
|
|
79
|
-
</Link>
|
|
80
|
-
)}
|
|
81
|
-
|
|
82
|
-
{source && (
|
|
83
|
-
<Link
|
|
84
|
-
href={source}
|
|
85
|
-
target='_blank'
|
|
86
|
-
rel='noreferrer'
|
|
87
|
-
aria-describedby={descriptionId}
|
|
88
|
-
classNames='text-sm text-description'
|
|
89
|
-
onClick={(ev) => ev.stopPropagation()}
|
|
90
|
-
>
|
|
91
|
-
{t('source label')}
|
|
92
|
-
<Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mli-1' />
|
|
93
|
-
</Link>
|
|
94
|
-
)}
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
)}
|
|
98
|
-
</ListItem.Root>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { createIntent, LayoutAction, type Plugin, useIntentDispatcher, usePluginManager } from '@dxos/app-framework';
|
|
8
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
9
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
-
|
|
11
|
-
import { PluginList } from './PluginList';
|
|
12
|
-
|
|
13
|
-
const sortByPluginMeta = ({ meta: { name: a = '' } }: Plugin, { meta: { name: b = '' } }: Plugin) => a.localeCompare(b);
|
|
14
|
-
|
|
15
|
-
export const RegistryContainer = ({ id, plugins: _plugins }: { id: string; plugins: Plugin[] }) => {
|
|
16
|
-
const manager = usePluginManager();
|
|
17
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
18
|
-
const plugins = useMemo(() => _plugins.sort(sortByPluginMeta), [_plugins]);
|
|
19
|
-
|
|
20
|
-
// TODO(wittjosiah): Factor out to an intent?
|
|
21
|
-
const handleChange = async (id: string, enabled: boolean) => {
|
|
22
|
-
if (enabled) {
|
|
23
|
-
await manager.enable(id);
|
|
24
|
-
} else {
|
|
25
|
-
await manager.disable(id);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
await dispatch(
|
|
29
|
-
createIntent(ObservabilityAction.SendEvent, {
|
|
30
|
-
name: 'plugins.toggle',
|
|
31
|
-
properties: { plugin: id, enabled },
|
|
32
|
-
}),
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const handleClick = (pluginId: string) =>
|
|
37
|
-
dispatch(
|
|
38
|
-
createIntent(LayoutAction.Open, {
|
|
39
|
-
part: 'main',
|
|
40
|
-
// TODO(wittjosiah): `/` currently is not supported in ids.
|
|
41
|
-
subject: [pluginId.replaceAll('/', ':')],
|
|
42
|
-
options: { pivotId: id, positioning: 'end' },
|
|
43
|
-
}),
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<StackItem.Content toolbar={false} role='article' classNames='overflow-x-hidden overflow-y-auto'>
|
|
48
|
-
<PluginList plugins={plugins} enabled={manager.enabled} onClick={handleClick} onChange={handleChange} />
|
|
49
|
-
</StackItem.Content>
|
|
50
|
-
);
|
|
51
|
-
};
|