From 39a662376b67119ac02fd637dac8162c32b1bbca Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 9 Sep 2021 16:31:12 +0200 Subject: [PATCH] change local plugin form --- .../src/lib/components/LocalPluginForm.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx b/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx index 71ddb5b7ff..ebd95c025c 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx @@ -5,7 +5,7 @@ import { Toaster } from '@remix-ui/toaster' import { IframePlugin, WebsocketPlugin } from '@remixproject/engine-web' import { localPluginReducerActionType, localPluginToastReducer } from '../reducers/pluginManagerReducer' -import { FormStateProps, PluginManagerComponent } from '../../types' +import { canActivate, FormStateProps, PluginManagerComponent } from '../../types' interface LocalPluginFormProps { closeModal: () => void @@ -41,6 +41,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor const [type, setType] = useState<'iframe' | 'ws'>('iframe') const [location, setLocation] = useState<'sidePanel' | 'mainPanel' | 'none'>('sidePanel') const [methods, setMethods] = useState('') + const [canactivate, setCanactivate] = useState('') useEffect(() => { const storagePlugin:FormStateProps = localStorage.getItem('plugins/local') ? JSON.parse(localStorage.getItem('plugins/local')) : defaultProfile @@ -73,7 +74,8 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor url: url, type: type, location: location, - icon: 'assets/img/localPlugin.webp' + icon: 'assets/img/localPlugin.webp', + canActivate: typeof canactivate === 'string' ? canactivate.split(',').filter(val => val) : [] } const localPlugin = type === 'iframe' ? new IframePlugin(initialState) : new WebsocketPlugin(initialState) localPlugin.profile.hash = `local-${name}` @@ -122,14 +124,24 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor placeholder="Name in the header" />
- + setMethods(e.target.value)} value={ methods } id="plugin-methods" data-id="localPluginMethods" - placeholder="Name in the header" /> + placeholder="Methods" /> +
+
+ + setCanactivate(e.target.value)} + value={ canactivate } + id="plugin-canactivate" + data-id="localPluginCanActivate" + placeholder="Plugin names" />