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
ba8b4ccf
Commit
ba8b4ccf
authored
Aug 04, 2021
by
joseph izang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed console messages. minor fixes
parent
0164aff4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
36 deletions
+51
-36
pluginManager.spec.ts
apps/remix-ide-e2e/src/tests/pluginManager.spec.ts
+3
-3
plugin-manager-component.js
.../remix-ide/src/app/components/plugin-manager-component.js
+0
-5
LocalPluginForm.tsx
...-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
+46
-26
rootView.tsx
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
+1
-1
types.d.ts
libs/remix-ui/plugin-manager/src/types.d.ts
+1
-1
No files found.
apps/remix-ide-e2e/src/tests/pluginManager.spec.ts
View file @
ba8b4ccf
...
@@ -133,9 +133,9 @@ module.exports = {
...
@@ -133,9 +133,9 @@ module.exports = {
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalFooter-react"]'
)
.
click
(
'*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalFooter-react"]'
)
// .modalFooterOKClick()
// .modalFooterOKClick()
.
pause
(
5000
)
.
pause
(
5000
)
//
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)')
.
waitForElementVisible
(
'*[data-shared="tooltipPopup"]:nth-last-of-type(1)'
)
//
.pause(2000)
.
pause
(
2000
)
//
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Cannot create Plugin : This name has already been used')
.
assert
.
containsText
(
'*[data-shared="tooltipPopup"]:nth-last-of-type(1)'
,
'Cannot create Plugin : This name has already been used'
)
},
},
'Should load back installed plugins after reload'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should load back installed plugins after reload'
:
function
(
browser
:
NightwatchBrowser
)
{
...
...
apps/remix-ide/src/app/components/plugin-manager-component.js
View file @
ba8b4ccf
...
@@ -87,17 +87,12 @@ class PluginManagerComponent extends ViewPlugin {
...
@@ -87,17 +87,12 @@ class PluginManagerComponent extends ViewPlugin {
* @param {string} name name of Plugin
* @param {string} name name of Plugin
*/
*/
deactivateP
(
name
)
{
deactivateP
(
name
)
{
console
.
log
(
'deactivateP has just been called'
)
this
.
call
(
'manager'
,
'deactivatePlugin'
,
name
)
this
.
call
(
'manager'
,
'deactivatePlugin'
,
name
)
this
.
appManager
.
event
.
on
(
'deactivate'
,
()
=>
{
this
.
appManager
.
event
.
on
(
'deactivate'
,
()
=>
{
console
.
log
(
'this.call HAS JUST BEEN CALLED'
)
this
.
getAndFilterPlugins
()
this
.
getAndFilterPlugins
()
console
.
log
(
'GETANDFILTERPLUGINS HAS JUST BEEN CALLED!'
)
this
.
triggerEngineEventListener
()
this
.
triggerEngineEventListener
()
console
.
log
(
'TRIGGERENGINEEVENTLISTENER HAS JUST BEEN CALLED'
)
})
})
_paq
.
push
([
'trackEvent'
,
'manager'
,
'deactivate'
,
name
])
_paq
.
push
([
'trackEvent'
,
'manager'
,
'deactivate'
,
name
])
console
.
log
(
'MATOMO TRACKING IS DONE!'
)
}
}
onActivation
()
{
onActivation
()
{
...
...
libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
View file @
ba8b4ccf
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
import
{
Toaster
}
from
'@remix-ui/toaster'
import
{
IframePlugin
,
WebsocketPlugin
}
from
'@remixproject/engine-web'
import
{
IframePlugin
,
WebsocketPlugin
}
from
'@remixproject/engine-web'
import
React
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
FormStateProps
,
PluginManagerComponent
}
from
'../../types'
import
{
FormStateProps
,
PluginManagerComponent
}
from
'../../types'
interface
LocalPluginFormProps
{
interface
LocalPluginFormProps
{
...
@@ -12,28 +13,51 @@ interface LocalPluginFormProps {
...
@@ -12,28 +13,51 @@ interface LocalPluginFormProps {
}
}
function
LocalPluginForm
({
changeHandler
,
plugin
,
closeModal
,
visible
,
pluginManager
}:
LocalPluginFormProps
)
{
function
LocalPluginForm
({
changeHandler
,
plugin
,
closeModal
,
visible
,
pluginManager
}:
LocalPluginFormProps
)
{
return
(
const
[
errorMsg
,
setErrorMsg
]
=
useState
(
''
)
<
ModalDialog
const
handleModalOkClick
=
async
()
=>
{
handleHide=
{
closeModal
}
try
{
id=
"pluginManagerLocalPluginModalDialog"
hide=
{
visible
}
title=
"Local Plugin"
okLabel=
"OK"
okFn=
{
()
=>
{
const
profile
=
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
||
plugin
const
profile
=
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
||
plugin
// eslint-disable-next-line no-debugger
debugger
if
(
!
profile
)
return
if
(
!
profile
)
return
if
(
pluginManager
.
appManager
.
getIds
().
includes
(
profile
.
pname
))
{
if
(
profile
.
profile
)
{
if
(
pluginManager
.
appManager
.
getIds
().
includes
(
profile
.
profile
.
name
))
{
throw
new
Error
(
'This name has already been used'
)
}
// if (!profile.profile.location) throw new Error('Plugin should have a location')
// if (!profile.profile.pname) throw new Error('Plugin should have a name')
// if (!profile.profile.url) throw new Error('Plugin should have an URL')
// const localPlugin = profile.profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile)
// localPlugin.profile.hash = `local-${profile.profile.pname}`
// localStorage.setItem('plugins/local', JSON.stringify(localPlugin))
// pluginManager.engine.register(localPlugin)
// await pluginManager.appManager.activatePlugin(localPlugin.name)
}
else
{
if
(
pluginManager
.
appManager
.
getIds
().
includes
(
profile
.
name
))
{
throw
new
Error
(
'This name has already been used'
)
throw
new
Error
(
'This name has already been used'
)
}
}
if
(
!
profile
.
location
)
throw
new
Error
(
'Plugin should have a location'
)
if
(
!
profile
.
location
)
throw
new
Error
(
'Plugin should have a location'
)
if
(
!
profile
.
p
name
)
throw
new
Error
(
'Plugin should have a name'
)
if
(
!
profile
.
name
)
throw
new
Error
(
'Plugin should have a name'
)
if
(
!
profile
.
url
)
throw
new
Error
(
'Plugin should have an URL'
)
if
(
!
profile
.
url
)
throw
new
Error
(
'Plugin should have an URL'
)
const
localPlugin
=
profile
.
type
===
'iframe'
?
new
IframePlugin
(
profile
)
:
new
WebsocketPlugin
(
profile
)
const
localPlugin
=
profile
.
type
===
'iframe'
?
new
IframePlugin
(
profile
)
:
new
WebsocketPlugin
(
profile
)
localPlugin
.
profile
.
hash
=
`local-${profile.pname}`
localPlugin
.
profile
.
hash
=
`local-
${
profile
.
name
}
`
localStorage
.
setItem
(
'plugins/local'
,
JSON
.
stringify
(
localPlugin
))
pluginManager
.
engine
.
register
(
localPlugin
)
pluginManager
.
engine
.
register
(
localPlugin
)
pluginManager
.
appManager
.
activatePlugin
(
localPlugin
.
name
)
await
pluginManager
.
appManager
.
activatePlugin
(
localPlugin
.
profile
.
name
)
}
}
localStorage
.
setItem
(
'plugins/local'
,
JSON
.
stringify
(
localPlugin
))
}
}
catch
(
error
)
{
console
.
error
(
error
)
setErrorMsg
(
error
.
message
)
}
}
return
(
<><
ModalDialog
handleHide=
{
closeModal
}
id=
"pluginManagerLocalPluginModalDialog"
hide=
{
visible
}
title=
"Local Plugin"
okLabel=
"OK"
okFn=
{
handleModalOkClick
}
cancelLabel=
"Cancel"
cancelLabel=
"Cancel"
cancelFn=
{
closeModal
}
cancelFn=
{
closeModal
}
>
>
...
@@ -42,12 +66,11 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
...
@@ -42,12 +66,11 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
<
label
htmlFor=
"plugin-name"
>
Plugin Name
<
small
>
(required)
</
small
></
label
>
<
label
htmlFor=
"plugin-name"
>
Plugin Name
<
small
>
(required)
</
small
></
label
>
<
input
<
input
className=
"form-control"
className=
"form-control"
onChange=
{
e
=>
changeHandler
(
'
p
name'
,
e
.
target
.
value
)
}
onChange=
{
e
=>
changeHandler
(
'name'
,
e
.
target
.
value
)
}
value=
{
plugin
.
p
name
}
value=
{
plugin
.
name
}
id=
"plugin-name"
id=
"plugin-name"
data
-
id=
"localPluginName"
data
-
id=
"localPluginName"
placeholder=
"Should be camelCase"
placeholder=
"Should be camelCase"
/>
/>
</
div
>
</
div
>
<
div
className=
"form-group"
>
<
div
className=
"form-group"
>
<
label
htmlFor=
"plugin-displayname"
>
Display Name
</
label
>
<
label
htmlFor=
"plugin-displayname"
>
Display Name
</
label
>
...
@@ -57,8 +80,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
...
@@ -57,8 +80,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
value=
{
plugin
.
displayName
}
value=
{
plugin
.
displayName
}
id=
"plugin-displayname"
id=
"plugin-displayname"
data
-
id=
"localPluginDisplayName"
data
-
id=
"localPluginDisplayName"
placeholder=
"Name in the header"
placeholder=
"Name in the header"
/>
/>
</
div
>
</
div
>
<
div
className=
"form-group"
>
<
div
className=
"form-group"
>
<
label
htmlFor=
"plugin-methods"
>
Api (comma separated list of methods name)
</
label
>
<
label
htmlFor=
"plugin-methods"
>
Api (comma separated list of methods name)
</
label
>
...
@@ -68,8 +90,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
...
@@ -68,8 +90,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
value=
{
plugin
.
methods
}
value=
{
plugin
.
methods
}
id=
"plugin-methods"
id=
"plugin-methods"
data
-
id=
"localPluginMethods"
data
-
id=
"localPluginMethods"
placeholder=
"Name in the header"
placeholder=
"Name in the header"
/>
/>
</
div
>
</
div
>
<
div
className=
"form-group"
>
<
div
className=
"form-group"
>
...
@@ -80,8 +101,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
...
@@ -80,8 +101,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
value=
{
plugin
.
url
}
value=
{
plugin
.
url
}
id=
"plugin-url"
id=
"plugin-url"
data
-
id=
"localPluginUrl"
data
-
id=
"localPluginUrl"
placeholder=
"ex: https://localhost:8000"
placeholder=
"ex: https://localhost:8000"
/>
/>
</
div
>
</
div
>
<
h6
>
Type of connection
<
small
>
(required)
</
small
></
h6
>
<
h6
>
Type of connection
<
small
>
(required)
</
small
></
h6
>
<
div
className=
"form-check form-group"
>
<
div
className=
"form-check form-group"
>
...
@@ -150,7 +170,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
...
@@ -150,7 +170,7 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
</
div
>
</
div
>
</
div
>
</
div
>
</
form
>
</
form
>
</
ModalDialog
>
</
ModalDialog
>
<
Toaster
message=
{
`Cannot create Plugin : ${errorMsg}`
}
timeOut=
{
3000
}
/></>
)
)
}
}
...
...
libs/remix-ui/plugin-manager/src/lib/components/rootView.tsx
View file @
ba8b4ccf
...
@@ -6,7 +6,7 @@ import { Profile } from '@remixproject/plugin-utils'
...
@@ -6,7 +6,7 @@ import { Profile } from '@remixproject/plugin-utils'
import
LocalPluginForm
from
'./LocalPluginForm'
import
LocalPluginForm
from
'./LocalPluginForm'
const
initialState
:
FormStateProps
=
{
const
initialState
:
FormStateProps
=
{
p
name
:
'test'
,
name
:
'test'
,
displayName
:
'test'
,
displayName
:
'test'
,
url
:
''
,
url
:
''
,
type
:
'iframe'
,
type
:
'iframe'
,
...
...
libs/remix-ui/plugin-manager/src/types.d.ts
View file @
ba8b4ccf
...
@@ -190,7 +190,7 @@ export interface DefaultLocalPlugin extends Profile {
...
@@ -190,7 +190,7 @@ export interface DefaultLocalPlugin extends Profile {
}
}
export
interface
FormStateProps
{
export
interface
FormStateProps
{
p
name
:
string
name
:
string
displayName
:
string
displayName
:
string
url
:
string
url
:
string
type
:
string
type
:
string
...
...
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