From ceb5496f4d6a6d14e2e330b9ba2edf910a5a187c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 9 Sep 2021 19:05:02 +0200 Subject: [PATCH] fix whitespaces and canactivate --- .../plugin-manager/src/lib/components/LocalPluginForm.tsx | 7 ++++--- libs/remix-ui/plugin-manager/src/types.d.ts | 1 + 2 files changed, 5 insertions(+), 3 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 6e768a935e..d7cfe920ff 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 @@ -51,6 +51,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor setMethods(storagePlugin.methods) setType(storagePlugin.type) setDisplayName(storagePlugin.displayName) + setCanactivate(storagePlugin.canActivate) }, []) const handleModalOkClick = async () => { @@ -61,7 +62,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor } if (!location) throw new Error('Plugin should have a location') if (!url) throw new Error('Plugin should have an URL') - const newMethods = typeof methods === 'string' ? methods.split(',').filter(val => val) : [] + const newMethods = typeof methods === 'string' ? methods.split(',').filter(val => val).map(val => { return val.trim() }) : [] const targetPlugin = { name: name, displayName: displayName, @@ -75,7 +76,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor type: type, location: location, icon: 'assets/img/localPlugin.webp', - canActivate: typeof canactivate === 'string' ? canactivate.split(',').filter(val => val) : [] + canActivate: typeof canactivate === 'string' ? canactivate.split(',').filter(val => val).map(val => { return val.trim() }) : [] } const localPlugin = type === 'iframe' ? new IframePlugin(initialState) : new WebsocketPlugin(initialState) localPlugin.profile.hash = `local-${name}` diff --git a/libs/remix-ui/plugin-manager/src/types.d.ts b/libs/remix-ui/plugin-manager/src/types.d.ts index 4e8326832e..ffe425c473 100644 --- a/libs/remix-ui/plugin-manager/src/types.d.ts +++ b/libs/remix-ui/plugin-manager/src/types.d.ts @@ -180,6 +180,7 @@ export interface FormStateProps { hash: string methods: any location: string + canActivate: any } export type PluginManagerProfile = Profile & {