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
b342b575
Commit
b342b575
authored
Aug 25, 2021
by
joseph izang
Browse files
Options
Browse Files
Download
Plain Diff
resolved merge conflict in permissionsSettings.tsx
parents
d713d9fc
d6b431b0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
47 deletions
+19
-47
plugin-manager-component.js
.../remix-ide/src/app/components/plugin-manager-component.js
+1
-1
LocalPluginForm.tsx
...-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
+15
-6
permissionsSettings.tsx
...plugin-manager/src/lib/components/permissionsSettings.tsx
+3
-1
rootView.tsx
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
+0
-1
useLocalStorage.ts
...ui/plugin-manager/src/lib/custom-hooks/useLocalStorage.ts
+0
-37
remix-ui-plugin-manager.tsx
...mix-ui/plugin-manager/src/lib/remix-ui-plugin-manager.tsx
+0
-1
No files found.
apps/remix-ide/src/app/components/plugin-manager-component.js
View file @
b342b575
...
@@ -67,7 +67,7 @@ class PluginManagerComponent extends ViewPlugin {
...
@@ -67,7 +67,7 @@ class PluginManagerComponent extends ViewPlugin {
this
.
engine
.
register
(
localPlugin
)
this
.
engine
.
register
(
localPlugin
)
this
.
appManager
.
activatePlugin
(
localPlugin
.
profile
.
name
)
this
.
appManager
.
activatePlugin
(
localPlugin
.
profile
.
name
)
this
.
getAndFilterPlugins
()
this
.
getAndFilterPlugins
()
localStorage
.
setItem
(
'plugins/local'
,
JSON
.
stringify
(
localPlugin
))
localStorage
.
setItem
(
'plugins/local'
,
JSON
.
stringify
(
localPlugin
.
profile
))
}
}
}
}
...
...
libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
View file @
b342b575
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import
React
,
{
useReducer
,
useState
}
from
'react'
import
React
,
{
use
Effect
,
use
Reducer
,
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'
...
@@ -35,7 +35,6 @@ const defaultProfile = {
...
@@ -35,7 +35,6 @@ const defaultProfile = {
function
LocalPluginForm
({
closeModal
,
visible
,
pluginManager
}:
LocalPluginFormProps
)
{
function
LocalPluginForm
({
closeModal
,
visible
,
pluginManager
}:
LocalPluginFormProps
)
{
const
[
errorMsg
,
dispatchToastMsg
]
=
useReducer
(
localPluginToastReducer
,
''
)
const
[
errorMsg
,
dispatchToastMsg
]
=
useReducer
(
localPluginToastReducer
,
''
)
const
[
defaultPlugin
]
=
useState
<
FormStateProps
>
(
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
||
defaultProfile
)
const
[
name
,
setName
]
=
useState
<
string
>
(
''
)
const
[
name
,
setName
]
=
useState
<
string
>
(
''
)
const
[
displayName
,
setDisplayName
]
=
useState
<
string
>
(
''
)
const
[
displayName
,
setDisplayName
]
=
useState
<
string
>
(
''
)
const
[
url
,
setUrl
]
=
useState
<
string
>
(
''
)
const
[
url
,
setUrl
]
=
useState
<
string
>
(
''
)
...
@@ -43,6 +42,16 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
...
@@ -43,6 +42,16 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
const
[
location
,
setLocation
]
=
useState
<
'sidePanel'
|
'mainPanel'
|
'none'
>
(
'sidePanel'
)
const
[
location
,
setLocation
]
=
useState
<
'sidePanel'
|
'mainPanel'
|
'none'
>
(
'sidePanel'
)
const
[
methods
,
setMethods
]
=
useState
<
string
>
(
''
)
const
[
methods
,
setMethods
]
=
useState
<
string
>
(
''
)
useEffect
(()
=>
{
const
storagePlugin
:
FormStateProps
=
localStorage
.
getItem
(
'plugins/local'
)
?
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
:
defaultProfile
setName
(
storagePlugin
.
name
)
setUrl
(
storagePlugin
.
url
)
setLocation
(
storagePlugin
.
location
as
'sidePanel'
|
'mainPanel'
|
'none'
)
setMethods
(
storagePlugin
.
methods
)
setType
(
storagePlugin
.
type
)
setDisplayName
(
storagePlugin
.
displayName
)
},
[])
const
handleModalOkClick
=
async
()
=>
{
const
handleModalOkClick
=
async
()
=>
{
try
{
try
{
if
(
!
name
)
throw
new
Error
(
'Plugin should have a name'
)
if
(
!
name
)
throw
new
Error
(
'Plugin should have a name'
)
...
@@ -97,7 +106,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
...
@@ -97,7 +106,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
<
input
<
input
className=
"form-control"
className=
"form-control"
onChange=
{
e
=>
setName
(
e
.
target
.
value
)
}
onChange=
{
e
=>
setName
(
e
.
target
.
value
)
}
value=
{
name
||
defaultPlugin
.
name
}
value=
{
name
}
id=
"plugin-name"
id=
"plugin-name"
data
-
id=
"localPluginName"
data
-
id=
"localPluginName"
placeholder=
"Should be camelCase"
/>
placeholder=
"Should be camelCase"
/>
...
@@ -107,7 +116,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
...
@@ -107,7 +116,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
<
input
<
input
className=
"form-control"
className=
"form-control"
onChange=
{
e
=>
setDisplayName
(
e
.
target
.
value
)
}
onChange=
{
e
=>
setDisplayName
(
e
.
target
.
value
)
}
value=
{
displayName
||
defaultPlugin
.
displayName
}
value=
{
displayName
}
id=
"plugin-displayname"
id=
"plugin-displayname"
data
-
id=
"localPluginDisplayName"
data
-
id=
"localPluginDisplayName"
placeholder=
"Name in the header"
/>
placeholder=
"Name in the header"
/>
...
@@ -117,7 +126,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
...
@@ -117,7 +126,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
<
input
<
input
className=
"form-control"
className=
"form-control"
onChange=
{
e
=>
setMethods
(
e
.
target
.
value
)
}
onChange=
{
e
=>
setMethods
(
e
.
target
.
value
)
}
value=
{
methods
||
defaultPlugin
.
methods
}
value=
{
methods
}
id=
"plugin-methods"
id=
"plugin-methods"
data
-
id=
"localPluginMethods"
data
-
id=
"localPluginMethods"
placeholder=
"Name in the header"
/>
placeholder=
"Name in the header"
/>
...
@@ -128,7 +137,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
...
@@ -128,7 +137,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
<
input
<
input
className=
"form-control"
className=
"form-control"
onChange=
{
e
=>
setUrl
(
e
.
target
.
value
)
}
onChange=
{
e
=>
setUrl
(
e
.
target
.
value
)
}
value=
{
url
||
defaultPlugin
.
url
}
value=
{
url
}
id=
"plugin-url"
id=
"plugin-url"
data
-
id=
"localPluginUrl"
data
-
id=
"localPluginUrl"
placeholder=
"ex: https://localhost:8000"
/>
placeholder=
"ex: https://localhost:8000"
/>
...
...
libs/remix-ui/plugin-manager/src/lib/components/permissionsSettings.tsx
View file @
b342b575
...
@@ -19,7 +19,7 @@ function PermisssionsSettings ({ pluginSettings }: PermissionSettingsProps) {
...
@@ -19,7 +19,7 @@ function PermisssionsSettings ({ pluginSettings }: PermissionSettingsProps) {
const
[
checkBoxState
,
setCheckBoxState
]
=
useState
<
boolean
[]
>
([])
const
[
checkBoxState
,
setCheckBoxState
]
=
useState
<
boolean
[]
>
([])
const
closeModal
=
()
=>
setModalVisibility
(
true
)
const
closeModal
=
()
=>
setModalVisibility
(
true
)
const
openModal
=
()
=>
{
const
openModal
=
()
=>
{
const
currentValue
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'plugins/permissions'
))
const
currentValue
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'plugins/permissions'
)
||
'{}'
)
setPermissions
(
currentValue
)
setPermissions
(
currentValue
)
setModalVisibility
(
!
modalVisibility
)
setModalVisibility
(
!
modalVisibility
)
}
}
...
@@ -63,6 +63,8 @@ function PermisssionsSettings ({ pluginSettings }: PermissionSettingsProps) {
...
@@ -63,6 +63,8 @@ function PermisssionsSettings ({ pluginSettings }: PermissionSettingsProps) {
setCheckBoxState
(
newStates
)
setCheckBoxState
(
newStates
)
},
[])
},
[])
useEffect
(()
=>
{
},
[
Object
.
keys
(
permissions
).
length
])
function
clearAllPersmissions
(
pluginName
:
string
,
topLevelPluginName
:
string
,
funcName
:
string
)
{
function
clearAllPersmissions
(
pluginName
:
string
,
topLevelPluginName
:
string
,
funcName
:
string
)
{
const
permissionsCopy
=
permissions
// don't mutate state
const
permissionsCopy
=
permissions
// don't mutate state
if
(
permissionsCopy
[
topLevelPluginName
]
&&
permissionsCopy
[
topLevelPluginName
][
funcName
])
{
if
(
permissionsCopy
[
topLevelPluginName
]
&&
permissionsCopy
[
topLevelPluginName
][
funcName
])
{
...
...
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
View file @
b342b575
...
@@ -33,7 +33,6 @@ function RootView ({ pluginComponent, pluginManagerSettings, children }: RootVie
...
@@ -33,7 +33,6 @@ function RootView ({ pluginComponent, pluginManagerSettings, children }: RootVie
useEffect
(()
=>
{
useEffect
(()
=>
{
pluginComponent
.
getAndFilterPlugins
(
filterPlugins
)
pluginComponent
.
getAndFilterPlugins
(
filterPlugins
)
},
[
filterPlugins
])
},
[
filterPlugins
])
// console.log('This is the state of pluginSettings instance passed from pluginmanager', pluginComponent.pluginSettings)
return
(
return
(
<
Fragment
>
<
Fragment
>
<
div
id=
"pluginManager"
data
-
id=
"pluginManagerComponentPluginManager"
>
<
div
id=
"pluginManager"
data
-
id=
"pluginManagerComponentPluginManager"
>
...
...
libs/remix-ui/plugin-manager/src/lib/custom-hooks/useLocalStorage.ts
View file @
b342b575
// import { useState } from 'react'
// // Hook
// export const useLocalStorage = (key: string, initialValue: any) => {
// // State to store our value
// // Pass initial state function to useState so logic is only executed once
// const [storedValue, setStoredValue] = useState<any>(() => {
// try {
// // Get from local storage by key
// const item = window.localStorage.getItem(key)
// // Parse stored json or if none return initialValue
// return item ? JSON.parse(item) : initialValue
// } catch (error) {
// // If error also return initialValue
// console.log(error)
// return initialValue
// }
// })
// // Return a wrapped version of useState's setter function that ...
// // ... persists the new value to localStorage.
// const setValue = (value: any | ((val: any) => any)) => {
// try {
// // Allow value to be a function so we have same API as useState
// const valueToStore =
// value instanceof Function ? value(storedValue) : value
// // Save state
// setStoredValue(valueToStore)
// // Save to local storage
// window.localStorage.setItem(key, JSON.stringify(valueToStore))
// } catch (error) {
// // A more advanced implementation would handle the error case
// console.log(error)
// }
// }
// return [storedValue, setValue] as const
// }
import
{
Dispatch
,
SetStateAction
,
useEffect
,
useState
}
from
'react'
import
{
Dispatch
,
SetStateAction
,
useEffect
,
useState
}
from
'react'
type
SetValue
<
T
>
=
Dispatch
<
SetStateAction
<
T
>>
type
SetValue
<
T
>
=
Dispatch
<
SetStateAction
<
T
>>
...
...
libs/remix-ui/plugin-manager/src/lib/remix-ui-plugin-manager.tsx
View file @
b342b575
...
@@ -10,7 +10,6 @@ import './remix-ui-plugin-manager.css'
...
@@ -10,7 +10,6 @@ import './remix-ui-plugin-manager.css'
export
const
RemixUiPluginManager
=
({
pluginComponent
,
pluginManagerSettings
}:
RemixUiPluginManagerProps
)
=>
{
export
const
RemixUiPluginManager
=
({
pluginComponent
,
pluginManagerSettings
}:
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
)
// console.log('This is the state of pluginSettings at the root of the components', pluginComponent.pluginSettings)
return
(
return
(
<
RootView
pluginComponent=
{
pluginComponent
}
pluginManagerSettings=
{
pluginManagerSettings
}
>
<
RootView
pluginComponent=
{
pluginComponent
}
pluginManagerSettings=
{
pluginManagerSettings
}
>
<
section
data
-
id=
"pluginManagerComponentPluginManagerSection"
>
<
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