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
db95638a
Commit
db95638a
authored
Aug 09, 2021
by
joseph izang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove comments and refactor components
parent
65b92084
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
90 deletions
+5
-90
plugin-manager-component.js
.../remix-ide/src/app/components/plugin-manager-component.js
+1
-16
InactivePluginCardContainer.tsx
...anager/src/lib/components/InactivePluginCardContainer.tsx
+1
-13
pluginManagerContext.tsx
...lugin-manager/src/lib/components/pluginManagerContext.tsx
+0
-44
rootView.tsx
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
+2
-14
remix-ui-plugin-manager.tsx
...mix-ui/plugin-manager/src/lib/remix-ui-plugin-manager.tsx
+1
-3
No files found.
apps/remix-ide/src/app/components/plugin-manager-component.js
View file @
db95638a
/* eslint-disable no-debugger */
/* eslint-disable no-unused-vars */
import
{
IframePlugin
,
ViewPlugin
,
WebsocketPlugin
}
from
'@remixproject/engine-web'
import
{
ViewPlugin
}
from
'@remixproject/engine-web'
import
{
PluginManagerSettings
}
from
'./plugin-manager-settings'
import
React
from
'react'
// eslint-disable-line
import
ReactDOM
from
'react-dom'
import
{
RemixUiPluginManager
}
from
'@remix-ui/plugin-manager'
// eslint-disable-line
import
*
as
packageJson
from
'../../../../../package.json'
const
yo
=
require
(
'yo-yo'
)
const
csjs
=
require
(
'csjs-inject'
)
const
EventEmitter
=
require
(
'events'
)
// const LocalPlugin = require('./local-plugin') // eslint-disable-line
const
addToolTip
=
require
(
'../ui/tooltip'
)
const
_paq
=
window
.
_paq
=
window
.
_paq
||
[]
const
profile
=
{
...
...
@@ -37,7 +26,6 @@ class PluginManagerComponent extends ViewPlugin {
this
.
appManager
=
appManager
this
.
engine
=
engine
this
.
pluginManagerSettings
=
new
PluginManagerSettings
()
// this.localPlugin = new LocalPlugin()
this
.
htmlElement
=
document
.
createElement
(
'div'
)
this
.
htmlElement
.
setAttribute
(
'id'
,
'pluginManager'
)
this
.
views
=
{
...
...
@@ -91,8 +79,6 @@ class PluginManagerComponent extends ViewPlugin {
this
.
engine
.
register
(
localPlugin
)
this
.
appManager
.
activatePlugin
(
localPlugin
.
profile
.
name
)
this
.
getAndFilterPlugins
()
// this.activateP(localPlugin.profile.name)
// localStorage.setItem('targetLocalPlugin', plugin.name)
localStorage
.
setItem
(
'plugins/local'
,
JSON
.
stringify
(
localPlugin
))
}
}
...
...
@@ -113,7 +99,6 @@ class PluginManagerComponent extends ViewPlugin {
}
onActivation
()
{
// this.getAndFilterPlugins()
this
.
renderComponent
()
}
...
...
libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCardContainer.tsx
View file @
db95638a
...
...
@@ -26,22 +26,10 @@ function InactivePluginCardContainer ({ pluginComponent, setInactiveProfiles, in
}
useEffect
(()
=>
{
const
savedInactiveProfiles
:
Profile
[]
=
JSON
.
parse
(
localStorage
.
getItem
(
'updatedInactives'
))
const
savedLocalPlugins
:
LocalPluginInterface
=
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
const
savedActiveProfiles
:
Profile
[]
=
JSON
.
parse
(
localStorage
.
getItem
(
'newActivePlugins'
))
if
(
savedInactiveProfiles
&&
savedInactiveProfiles
.
length
)
{
if
(
Object
.
keys
(
savedLocalPlugins
).
length
>
0
&&
!
pluginComponent
.
inactivePlugins
.
includes
(
savedLocalPlugins
.
profile
as
Profile
))
{
const
inactiveLocalPlugin
=
savedLocalPlugins
.
profile
localStorage
.
setItem
(
'currentLocalPlugin'
,
inactiveLocalPlugin
.
name
)
savedInactiveProfiles
.
push
(
inactiveLocalPlugin
as
Profile
)
}
// setinactiveProfiles(savedInactiveProfiles)
}
else
if
(
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
length
>
0
)
{
if
(
pluginComponent
.
inactivePlugins
&&
pluginComponent
.
inactivePlugins
.
length
)
{
let
temp
:
Profile
[]
=
[]
if
(
Object
.
keys
(
savedLocalPlugins
).
length
>
0
)
{
const
inactiveLocalPlugin
=
savedLocalPlugins
.
profile
localStorage
.
setItem
(
'currentLocalPlugin'
,
inactiveLocalPlugin
.
name
)
}
if
(
Object
.
keys
(
savedLocalPlugins
).
length
)
{
temp
=
[...
pluginComponent
.
inactivePlugins
,
savedLocalPlugins
.
profile
as
Profile
]
}
else
{
...
...
libs/remix-ui/plugin-manager/src/lib/components/pluginManagerContext.tsx
deleted
100644 → 0
View file @
65b92084
import
{
Profile
}
from
'@remixproject/plugin-utils'
import
React
,
{
createContext
,
useEffect
,
useState
}
from
'react'
import
{
PluginManagerContextProviderProps
}
from
'../../types'
interface
PluginManagerContextInterface
{
trackActiveProfiles
:
Profile
[]
trackInactiveProfiles
:
Profile
[]
setTrackActiveProfiles
:
React
.
Dispatch
<
Profile
[]
>
setTrackInactiveProfiles
:
React
.
Dispatch
<
Profile
[]
>
}
export
const
PluginManagerContext
=
createContext
<
PluginManagerContextInterface
>
(
null
)
function
PluginManagerContextProvider
({
children
,
pluginComponent
}:
PluginManagerContextProviderProps
)
{
const
[
trackActiveProfiles
,
setTrackActiveProfiles
]
=
useState
([])
const
[
trackInactiveProfiles
,
setTrackInactiveProfiles
]
=
useState
([])
useEffect
(()
=>
{
const
checkedActives
=
JSON
.
parse
(
localStorage
.
getItem
(
'newActivePlugins'
))
if
(
checkedActives
&&
checkedActives
.
length
>
0
)
{
setTrackActiveProfiles
([...
trackActiveProfiles
,
...
checkedActives
])
}
else
{
localStorage
.
setItem
(
'newActivePlugins'
,
JSON
.
stringify
(
trackActiveProfiles
))
}
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[
trackActiveProfiles
])
useEffect
(()
=>
{
const
checkedInactives
=
JSON
.
parse
(
localStorage
.
getItem
(
'updatedInactives'
))
if
(
checkedInactives
&&
checkedInactives
.
length
>
0
&&
trackInactiveProfiles
.
length
===
0
)
{
setTrackInactiveProfiles
([...
pluginComponent
.
inactivePlugins
,
...
checkedInactives
])
}
else
{
localStorage
.
setItem
(
'updatedInactives'
,
JSON
.
stringify
(
trackInactiveProfiles
))
}
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[
pluginComponent
.
inactivePlugins
])
return
(
<
PluginManagerContext
.
Provider
value=
{
{
trackActiveProfiles
,
trackInactiveProfiles
,
setTrackActiveProfiles
,
setTrackInactiveProfiles
}
}
>
{
children
}
</
PluginManagerContext
.
Provider
>
)
}
export
default
PluginManagerContextProvider
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
View file @
db95638a
...
...
@@ -35,8 +35,8 @@ function RootView ({ pluginComponent, children }: RootViewProps) {
* Component Local State declaration
*/
const
[
visible
,
setVisible
]
=
useState
<
boolean
>
(
true
)
const
[
plugin
,
setPlugin
]
=
useState
(
initialState
)
const
[
filterPlugins
,
setFilterPlugin
]
=
useState
(
''
)
const
[
plugin
,
setPlugin
]
=
useState
<
FormStateProps
>
(
initialState
)
const
[
filterPlugins
,
setFilterPlugin
]
=
useState
<
string
>
(
''
)
// const { activeProfiles, inactiveProfiles } = useContext(PluginManagerContext)
...
...
@@ -53,18 +53,6 @@ function RootView ({ pluginComponent, children }: RootViewProps) {
const
closeModal
=
()
=>
setVisible
(
true
)
// <-- End Modal Visibility States -->
/**
* Gets the latest list of inactive plugin profiles and persist them
* in local storage
* @param inactivesList Array of inactive plugin profiles
* @returns {void}
*/
// function PersistNewInactivesState (inactivesList: Profile[]) {
// if (inactivesList && inactivesList.length) {
// localStorage.setItem('updatedInactives', JSON.stringify(inactivesList))
// }
// }
useEffect
(()
=>
{
pluginComponent
.
getAndFilterPlugins
(
filterPlugins
)
// eslint-disable-next-line react-hooks/exhaustive-deps
...
...
libs/remix-ui/plugin-manager/src/lib/remix-ui-plugin-manager.tsx
View file @
db95638a
...
...
@@ -12,15 +12,13 @@ export const RemixUiPluginManager = ({ pluginComponent }: RemixUiPluginManagerPr
if
(
JSON
.
parse
(
localStorage
.
getItem
(
'newActivePlugins'
))
===
null
)
{
localStorage
.
setItem
(
'newActivePlugins'
,
'[]'
)
}
if
(
JSON
.
parse
(
localStorage
.
getItem
(
'updatedInactives'
))
===
null
)
{
localStorage
.
setItem
(
'updatedInactives'
,
'[]'
)
}
if
(
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
===
null
)
{
localStorage
.
setItem
(
'plugins/local'
,
'{}'
)
}
if
(
JSON
.
parse
(
localStorage
.
getItem
(
'activatedPluginNames'
)))
{
localStorage
.
setItem
(
'activatedPluginNames'
,
'[]'
)
}
return
(
<
RootView
pluginComponent=
{
pluginComponent
}
>
<
section
data
-
id=
"pluginManagerComponentPluginManagerSection"
>
...
...
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