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
Hide 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
React
from
'react'
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
Dispatch
,
useState
}
from
'react'
import
'../remix-ui-plugin-manager.css'
import
'../remix-ui-plugin-manager.css'
import
*
as
_
from
'lodash'
interface
PluginCardProps
{
interface
PluginCardProps
{
// profile: Profile & {
// icon?: string
// }
profile
:
any
profile
:
any
buttonText
:
string
buttonText
:
string
deactivatePlugin
:
(
pluginName
:
string
)
=>
void
deactivatePlugin
:
(
pluginName
:
string
)
=>
void
// setActivePlugins: Dispatch<React.SetStateAction<Profile<any>[]>>
// activePlugins: Profile[]
}
}
// eslint-disable-next-line no-empty-pattern
function
ActivePluginCard
({
function
ActivePluginCard
({
profile
,
profile
,
buttonText
,
buttonText
,
deactivatePlugin
deactivatePlugin
// activePlugins,
// setActivePlugins
}:
PluginCardProps
)
{
}:
PluginCardProps
)
{
return
(
return
(
<
div
className=
"list-group list-group-flush plugins-list-group"
data
-
id=
"pluginManagerComponentActiveTile"
>
<
div
className=
"list-group list-group-flush plugins-list-group"
data
-
id=
"pluginManagerComponentActiveTile"
>
...
@@ -44,13 +33,6 @@ function ActivePluginCard ({
...
@@ -44,13 +33,6 @@ function ActivePluginCard ({
{
<
button
{
<
button
onClick=
{
()
=>
{
onClick=
{
()
=>
{
deactivatePlugin
(
profile
.
name
)
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"
className=
"btn btn-secondary btn-sm"
data
-
id=
{
`pluginManagerComponentDeactivateButton${profile.name}`
}
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
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
Fragment
,
useEffect
,
useState
}
from
'react'
import
React
,
{
Fragment
}
from
'react'
import
{
PluginManagerComponent
}
from
'../../types'
import
{
PluginManagerComponent
}
from
'../../types'
import
ActivePluginCard
from
'./ActivePluginCard'
import
ActivePluginCard
from
'./ActivePluginCard'
import
ModuleHeading
from
'./moduleHeading'
import
ModuleHeading
from
'./moduleHeading'
...
@@ -10,19 +10,10 @@ interface ActivePluginCardContainerProps {
...
@@ -10,19 +10,10 @@ interface ActivePluginCardContainerProps {
activeProfiles
:
Profile
[]
activeProfiles
:
Profile
[]
}
}
function
ActivePluginCardContainer
({
pluginComponent
}:
ActivePluginCardContainerProps
)
{
function
ActivePluginCardContainer
({
pluginComponent
}:
ActivePluginCardContainerProps
)
{
// const [activeProfiles, setActiveProfiles] = useState<Profile[]>()
const
deactivatePlugin
=
(
pluginName
:
string
)
=>
{
const
deactivatePlugin
=
(
pluginName
:
string
)
=>
{
pluginComponent
.
deactivateP
(
pluginName
)
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
(
return
(
<
Fragment
>
<
Fragment
>
{
(
pluginComponent
.
activePlugins
&&
pluginComponent
.
activePlugins
.
length
)
?
<
ModuleHeading
headingLabel=
"Active Modules"
count=
{
pluginComponent
.
activePlugins
.
length
}
/>
:
null
}
{
(
pluginComponent
.
activePlugins
&&
pluginComponent
.
activePlugins
.
length
)
?
<
ModuleHeading
headingLabel=
"Active Modules"
count=
{
pluginComponent
.
activePlugins
.
length
}
/>
:
null
}
...
@@ -33,8 +24,6 @@ function ActivePluginCardContainer ({ pluginComponent }: ActivePluginCardContain
...
@@ -33,8 +24,6 @@ function ActivePluginCardContainer ({ pluginComponent }: ActivePluginCardContain
profile=
{
profile
}
profile=
{
profile
}
deactivatePlugin=
{
deactivatePlugin
}
deactivatePlugin=
{
deactivatePlugin
}
key=
{
idx
}
key=
{
idx
}
// activePlugins=
{
pluginComponent
.
activePlugins
}
// setActivePlugins=
{
setActiveProfiles
}
/>
/>
)
)
})
})
...
...
libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCard.tsx
View file @
12b7feb2
/* eslint-disable no-debugger */
/* eslint-disable no-debugger */
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
useState
}
from
'react'
import
React
from
'react'
import
'../remix-ui-plugin-manager.css'
import
'../remix-ui-plugin-manager.css'
interface
PluginCardProps
{
interface
PluginCardProps
{
profile
:
Profile
&
{
profile
:
Profile
&
{
...
@@ -8,14 +8,8 @@ interface PluginCardProps {
...
@@ -8,14 +8,8 @@ interface PluginCardProps {
}
}
buttonText
:
string
buttonText
:
string
activatePlugin
:
(
plugin
:
string
)
=>
void
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
({
function
InactivePluginCard
({
profile
,
profile
,
buttonText
,
buttonText
,
...
@@ -44,11 +38,6 @@ function InactivePluginCard ({
...
@@ -44,11 +38,6 @@ function InactivePluginCard ({
<
button
<
button
onClick=
{
()
=>
{
onClick=
{
()
=>
{
activatePlugin
(
profile
.
name
)
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"
className=
"btn btn-success btn-sm"
data
-
id=
{
`pluginManagerComponentActivateButton${profile.name}`
}
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
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
Fragment
,
useEffect
}
from
'react'
import
React
,
{
Fragment
}
from
'react'
import
{
PluginManagerComponent
,
PluginManagerProfile
}
from
'../../types'
import
{
PluginManagerComponent
,
PluginManagerProfile
}
from
'../../types'
import
InactivePluginCard
from
'./InactivePluginCard'
import
InactivePluginCard
from
'./InactivePluginCard'
import
ModuleHeading
from
'./moduleHeading'
import
ModuleHeading
from
'./moduleHeading'
...
@@ -11,7 +11,7 @@ interface InactivePluginCardContainerProps {
...
@@ -11,7 +11,7 @@ interface InactivePluginCardContainerProps {
}
}
interface
LocalPluginInterface
{
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
:
{}
activateService
:
{}
requestQueue
:
[]
requestQueue
:
[]
options
:
{
queueTimeout
:
number
}
options
:
{
queueTimeout
:
number
}
...
@@ -20,34 +20,15 @@ interface LocalPluginInterface {
...
@@ -20,34 +20,15 @@ interface LocalPluginInterface {
listener
:
[]
listener
:
[]
iframe
:
{}
iframe
:
{}
}
}
function
InactivePluginCardContainer
({
pluginComponent
,
setInactiveProfiles
,
inactiveProfiles
}:
InactivePluginCardContainerProps
)
{
function
InactivePluginCardContainer
({
pluginComponent
}:
InactivePluginCardContainerProps
)
{
const
activatePlugin
=
(
pluginName
:
string
)
=>
{
const
activatePlugin
=
(
pluginName
:
string
)
=>
{
pluginComponent
.
activateP
(
pluginName
)
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
(
return
(
<
Fragment
>
<
Fragment
>
{
(
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
length
)
?
<
ModuleHeading
headingLabel=
"Inactive Modules"
count=
{
pluginComponent
.
inactivePlugins
.
length
}
/>
:
null
}
{
(
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
length
)
?
<
ModuleHeading
headingLabel=
"Inactive Modules"
count=
{
pluginComponent
.
inactivePlugins
.
length
}
/>
:
null
}
{
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
map
((
profile
,
idx
)
=>
{
{
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
map
((
profile
,
idx
)
=>
{
// console.log('profile: ', profile)
return
(
return
(
<
InactivePluginCard
<
InactivePluginCard
buttonText=
"Activate"
buttonText=
"Activate"
...
...
libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
View file @
12b7feb2
/* eslint-disable no-debugger */
import
React
,
{
useReducer
,
useState
}
from
'react'
import
React
,
{
Dispatch
,
useReducer
,
useState
}
from
'react'
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
import
{
Toaster
}
from
'@remix-ui/toaster'
import
{
Toaster
}
from
'@remix-ui/toaster'
import
{
IframePlugin
,
WebsocketPlugin
}
from
'@remixproject/engine-web'
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) {
...
@@ -38,8 +38,6 @@ function RootView ({ pluginComponent, children }: RootViewProps) {
const
[
plugin
,
setPlugin
]
=
useState
<
FormStateProps
>
(
initialState
)
const
[
plugin
,
setPlugin
]
=
useState
<
FormStateProps
>
(
initialState
)
const
[
filterPlugins
,
setFilterPlugin
]
=
useState
<
string
>
(
''
)
const
[
filterPlugins
,
setFilterPlugin
]
=
useState
<
string
>
(
''
)
// const { activeProfiles, inactiveProfiles } = useContext(PluginManagerContext)
function
pluginChangeHandler
<
P
extends
keyof
FormStateProps
>
(
formProps
:
P
,
value
:
FormStateProps
[
P
])
{
function
pluginChangeHandler
<
P
extends
keyof
FormStateProps
>
(
formProps
:
P
,
value
:
FormStateProps
[
P
])
{
setPlugin
({
...
plugin
,
[
formProps
]:
value
})
setPlugin
({
...
plugin
,
[
formProps
]:
value
})
}
}
...
@@ -51,7 +49,6 @@ function RootView ({ pluginComponent, children }: RootViewProps) {
...
@@ -51,7 +49,6 @@ function RootView ({ pluginComponent, children }: RootViewProps) {
setVisible
(
false
)
setVisible
(
false
)
}
}
const
closeModal
=
()
=>
setVisible
(
true
)
const
closeModal
=
()
=>
setVisible
(
true
)
// <-- End Modal Visibility States -->
useEffect
(()
=>
{
useEffect
(()
=>
{
pluginComponent
.
getAndFilterPlugins
(
filterPlugins
)
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
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
use
Effect
,
use
State
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
RemixUiPluginManagerProps
}
from
'../types'
import
{
RemixUiPluginManagerProps
}
from
'../types'
import
ActivePluginCardContainer
from
'./components/ActivePluginCardContainer'
import
ActivePluginCardContainer
from
'./components/ActivePluginCardContainer'
import
InactivePluginCardContainer
from
'./components/InactivePluginCardContainer'
import
InactivePluginCardContainer
from
'./components/InactivePluginCardContainer'
...
@@ -9,36 +9,7 @@ import './remix-ui-plugin-manager.css'
...
@@ -9,36 +9,7 @@ import './remix-ui-plugin-manager.css'
export
const
RemixUiPluginManager
=
({
pluginComponent
}:
RemixUiPluginManagerProps
)
=>
{
export
const
RemixUiPluginManager
=
({
pluginComponent
}:
RemixUiPluginManagerProps
)
=>
{
const
[
activeProfiles
,
setActiveProfiles
]
=
useState
<
Profile
[]
>
(
pluginComponent
.
activePlugins
)
const
[
activeProfiles
,
setActiveProfiles
]
=
useState
<
Profile
[]
>
(
pluginComponent
.
activePlugins
)
const
[
inactiveProfiles
,
setinactiveProfiles
]
=
useState
<
Profile
[]
>
(
pluginComponent
.
inactivePlugins
)
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
(
return
(
<
RootView
pluginComponent=
{
pluginComponent
}
>
<
RootView
pluginComponent=
{
pluginComponent
}
>
<
section
data
-
id=
"pluginManagerComponentPluginManagerSection"
>
<
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'
import
{
PluginManagerComponent
}
from
'./types'
export
const
defaultActivatedPlugins
=
[
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