Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
12b7feb2
Commit
12b7feb2
authored
Aug 16, 2021
by
joseph izang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more clean up
parent
80bbf4f4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
8 additions
and
102 deletions
+8
-102
ActivePluginCard.tsx
...ui/plugin-manager/src/lib/components/ActivePluginCard.tsx
+1
-19
ActivePluginCardContainer.tsx
...-manager/src/lib/components/ActivePluginCardContainer.tsx
+1
-12
InactivePluginCard.tsx
.../plugin-manager/src/lib/components/InactivePluginCard.tsx
+1
-12
InactivePluginCardContainer.tsx
...anager/src/lib/components/InactivePluginCardContainer.tsx
+3
-22
LocalPluginForm.tsx
...-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
+1
-2
rootView.tsx
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
+0
-3
remix-ui-plugin-manager.tsx
...mix-ui/plugin-manager/src/lib/remix-ui-plugin-manager.tsx
+1
-30
pluginManagerStateMachine.ts
.../remix-ui/plugin-manager/src/pluginManagerStateMachine.ts
+0
-2
No files found.
libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx
View file @
12b7feb2
/* eslint-disable no-debugger */
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
Dispatch
,
useState
}
from
'react'
import
React
from
'react'
import
'../remix-ui-plugin-manager.css'
import
*
as
_
from
'lodash'
interface
PluginCardProps
{
// profile: Profile & {
// icon?: string
// }
profile
:
any
buttonText
:
string
deactivatePlugin
:
(
pluginName
:
string
)
=>
void
// setActivePlugins: Dispatch<React.SetStateAction<Profile<any>[]>>
// activePlugins: Profile[]
}
// eslint-disable-next-line no-empty-pattern
function
ActivePluginCard
({
profile
,
buttonText
,
deactivatePlugin
// activePlugins,
// setActivePlugins
}:
PluginCardProps
)
{
return
(
<
div
className=
"list-group list-group-flush plugins-list-group"
data
-
id=
"pluginManagerComponentActiveTile"
>
...
...
@@ -44,13 +33,6 @@ function ActivePluginCard ({
{
<
button
onClick=
{
()
=>
{
deactivatePlugin
(
profile
.
name
)
// const actives: Profile[] = JSON.parse(localStorage.getItem('newActivePlugins'))
// if (actives && actives.length)
{
// const newList = _.remove(actives, active => active.name !== profile.name)
// // console.log('removed using lodash and this is the result', newList)
// localStorage.setItem('newActivePlugins', JSON.stringify(newList))
// setActivePlugins(newList)
//
}
}
}
className=
"btn btn-secondary btn-sm"
data
-
id=
{
`pluginManagerComponentDeactivateButton${profile.name}`
}
...
...
libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCardContainer.tsx
View file @
12b7feb2
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
Fragment
,
useEffect
,
useState
}
from
'react'
import
React
,
{
Fragment
}
from
'react'
import
{
PluginManagerComponent
}
from
'../../types'
import
ActivePluginCard
from
'./ActivePluginCard'
import
ModuleHeading
from
'./moduleHeading'
...
...
@@ -10,19 +10,10 @@ interface ActivePluginCardContainerProps {
activeProfiles
:
Profile
[]
}
function
ActivePluginCardContainer
({
pluginComponent
}:
ActivePluginCardContainerProps
)
{
// const [activeProfiles, setActiveProfiles] = useState<Profile[]>()
const
deactivatePlugin
=
(
pluginName
:
string
)
=>
{
pluginComponent
.
deactivateP
(
pluginName
)
}
// useEffect(() => {
// const savedActiveProfiles = JSON.parse(localStorage.getItem('newActivePlugins'))
// if (pluginComponent.activePlugins && pluginComponent.activePlugins.length > 0) {
// setActiveProfiles(pluginComponent.activePlugins)
// } else if (savedActiveProfiles && savedActiveProfiles.length > 0 && pluginComponent.activePlugins.length === 0) {
// setActiveProfiles(savedActiveProfiles)
// }
// }, [pluginComponent, pluginComponent.activePlugins])
return
(
<
Fragment
>
{
(
pluginComponent
.
activePlugins
&&
pluginComponent
.
activePlugins
.
length
)
?
<
ModuleHeading
headingLabel=
"Active Modules"
count=
{
pluginComponent
.
activePlugins
.
length
}
/>
:
null
}
...
...
@@ -33,8 +24,6 @@ function ActivePluginCardContainer ({ pluginComponent }: ActivePluginCardContain
profile=
{
profile
}
deactivatePlugin=
{
deactivatePlugin
}
key=
{
idx
}
// activePlugins=
{
pluginComponent
.
activePlugins
}
// setActivePlugins=
{
setActiveProfiles
}
/>
)
})
...
...
libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCard.tsx
View file @
12b7feb2
/* eslint-disable no-debugger */
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
useState
}
from
'react'
import
React
from
'react'
import
'../remix-ui-plugin-manager.css'
interface
PluginCardProps
{
profile
:
Profile
&
{
...
...
@@ -8,14 +8,8 @@ interface PluginCardProps {
}
buttonText
:
string
activatePlugin
:
(
plugin
:
string
)
=>
void
// inactivePlugins: Profile[]
// setInactivePlugins: Dispatch<React.SetStateAction<Profile<any>[]>>
// setActivePlugins: Dispatch<React.SetStateAction<Profile<any>[]>>
// activePlugins: Profile[]
// pluginComponent: PluginManagerComponent
}
// eslint-disable-next-line no-empty-pattern
function
InactivePluginCard
({
profile
,
buttonText
,
...
...
@@ -44,11 +38,6 @@ function InactivePluginCard ({
<
button
onClick=
{
()
=>
{
activatePlugin
(
profile
.
name
)
// const newActives: Profile[] = JSON.parse(localStorage.getItem('newActivePlugins'))
// if (!newActives.includes(profile))
{
// newActives.push(profile)
// localStorage.setItem('newActivePlugins', JSON.stringify(newActives))
//
}
}
}
className=
"btn btn-success btn-sm"
data
-
id=
{
`pluginManagerComponentActivateButton${profile.name}`
}
...
...
libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCardContainer.tsx
View file @
12b7feb2
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
Fragment
,
useEffect
}
from
'react'
import
React
,
{
Fragment
}
from
'react'
import
{
PluginManagerComponent
,
PluginManagerProfile
}
from
'../../types'
import
InactivePluginCard
from
'./InactivePluginCard'
import
ModuleHeading
from
'./moduleHeading'
...
...
@@ -11,7 +11,7 @@ interface InactivePluginCardContainerProps {
}
interface
LocalPluginInterface
{
profile
:
Partial
<
PluginManagerProfile
>
// { name: string, displayName: string, url: string, type: 'iframe' | 'ws', hash: string, methods: string, location: 'sidePanel' | 'mainPanel' | 'none'}
profile
:
Partial
<
PluginManagerProfile
>
activateService
:
{}
requestQueue
:
[]
options
:
{
queueTimeout
:
number
}
...
...
@@ -20,34 +20,15 @@ interface LocalPluginInterface {
listener
:
[]
iframe
:
{}
}
function
InactivePluginCardContainer
({
pluginComponent
,
setInactiveProfiles
,
inactiveProfiles
}:
InactivePluginCardContainerProps
)
{
function
InactivePluginCardContainer
({
pluginComponent
}:
InactivePluginCardContainerProps
)
{
const
activatePlugin
=
(
pluginName
:
string
)
=>
{
pluginComponent
.
activateP
(
pluginName
)
}
// useEffect(() => {
// const savedLocalPlugins: LocalPluginInterface = JSON.parse(localStorage.getItem('plugins/local'))
// const savedActiveProfiles: Profile[] = JSON.parse(localStorage.getItem('newActivePlugins'))
// if (pluginComponent.inactivePlugins && pluginComponent.inactivePlugins.length) {
// let temp: Profile[] = []
// if (Object.keys(savedLocalPlugins).length) {
// temp = [...pluginComponent.inactivePlugins, savedLocalPlugins.profile as Profile]
// } else {
// temp = [...pluginComponent.inactivePlugins]
// }
// const filtered = temp.filter(t => {
// return !savedActiveProfiles.find(active => {
// return active.name === t.name
// })
// })
// setInactiveProfiles(filtered)
// }
// }, [pluginComponent, pluginComponent.inactivePlugins, setInactiveProfiles])
return
(
<
Fragment
>
{
(
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
length
)
?
<
ModuleHeading
headingLabel=
"Inactive Modules"
count=
{
pluginComponent
.
inactivePlugins
.
length
}
/>
:
null
}
{
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
map
((
profile
,
idx
)
=>
{
// console.log('profile: ', profile)
return
(
<
InactivePluginCard
buttonText=
"Activate"
...
...
libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
View file @
12b7feb2
/* eslint-disable no-debugger */
import
React
,
{
Dispatch
,
useReducer
,
useState
}
from
'react'
import
React
,
{
useReducer
,
useState
}
from
'react'
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
import
{
Toaster
}
from
'@remix-ui/toaster'
import
{
IframePlugin
,
WebsocketPlugin
}
from
'@remixproject/engine-web'
...
...
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
View file @
12b7feb2
...
...
@@ -38,8 +38,6 @@ function RootView ({ pluginComponent, children }: RootViewProps) {
const
[
plugin
,
setPlugin
]
=
useState
<
FormStateProps
>
(
initialState
)
const
[
filterPlugins
,
setFilterPlugin
]
=
useState
<
string
>
(
''
)
// const { activeProfiles, inactiveProfiles } = useContext(PluginManagerContext)
function
pluginChangeHandler
<
P
extends
keyof
FormStateProps
>
(
formProps
:
P
,
value
:
FormStateProps
[
P
])
{
setPlugin
({
...
plugin
,
[
formProps
]:
value
})
}
...
...
@@ -51,7 +49,6 @@ function RootView ({ pluginComponent, children }: RootViewProps) {
setVisible
(
false
)
}
const
closeModal
=
()
=>
setVisible
(
true
)
// <-- End Modal Visibility States -->
useEffect
(()
=>
{
pluginComponent
.
getAndFilterPlugins
(
filterPlugins
)
...
...
libs/remix-ui/plugin-manager/src/lib/remix-ui-plugin-manager.tsx
View file @
12b7feb2
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
use
Effect
,
use
State
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
RemixUiPluginManagerProps
}
from
'../types'
import
ActivePluginCardContainer
from
'./components/ActivePluginCardContainer'
import
InactivePluginCardContainer
from
'./components/InactivePluginCardContainer'
...
...
@@ -9,36 +9,7 @@ import './remix-ui-plugin-manager.css'
export
const
RemixUiPluginManager
=
({
pluginComponent
}:
RemixUiPluginManagerProps
)
=>
{
const
[
activeProfiles
,
setActiveProfiles
]
=
useState
<
Profile
[]
>
(
pluginComponent
.
activePlugins
)
const
[
inactiveProfiles
,
setinactiveProfiles
]
=
useState
<
Profile
[]
>
(
pluginComponent
.
inactivePlugins
)
// const [activated] = useState<string[]>(pluginComponent.activeProfiles)
// if (JSON.parse(localStorage.getItem('newActivePlugins')) === null) {
// localStorage.setItem('newActivePlugins', '[]')
// }
// if (JSON.parse(localStorage.getItem('plugins/local')) === null) {
// localStorage.setItem('plugins/local', '{}')
// }
// if (JSON.parse(localStorage.getItem('activatedPluginNames'))) {
// localStorage.setItem('activatedPluginNames', '[]')
// }
// useEffect(() => {
// console.log('first time into use effect the activated state is', activated)
// const checkSolidity = async () => {
// const savedActives: Profile[] = JSON.parse(localStorage.getItem('newActivePlugins'))
// if (activated.includes('solidity') && activated.includes('solidity-logic')) {
// if (savedActives && savedActives.length >= 0) {
// if (!savedActives.find(active => active.name === 'solidity') && !savedActives.find(active => active.name === 'solidity-logic')) {
// const solidity = await pluginComponent.appManager.getProfile('solidity')
// const logic = await pluginComponent.appManager.getProfile('solidity-logic')
// savedActives.push(solidity, logic)
// }
// }
// }
// console.log('Use effect called, activated state is', activated)
// }
// checkSolidity()
// console.log('activated state right at useEffect exit', activated)
// }, [activated, pluginComponent.appManager])
return
(
<
RootView
pluginComponent=
{
pluginComponent
}
>
<
section
data
-
id=
"pluginManagerComponentPluginManagerSection"
>
...
...
libs/remix-ui/plugin-manager/src/pluginManagerStateMachine.ts
View file @
12b7feb2
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
{
useState
}
from
'react'
import
{
PluginManagerComponent
}
from
'./types'
export
const
defaultActivatedPlugins
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment