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
8580b02b
Commit
8580b02b
authored
Nov 01, 2019
by
Grandschtroumpf
Committed by
François
Nov 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for socket plugin in localmode
parent
244ba6c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
25 deletions
+49
-25
local-plugin.js
src/app/components/local-plugin.js
+45
-23
plugin-manager-component.js
src/app/components/plugin-manager-component.js
+4
-2
No files found.
src/app/components/local-plugin.js
View file @
8580b02b
...
@@ -2,6 +2,12 @@
...
@@ -2,6 +2,12 @@
const
yo
=
require
(
'yo-yo'
)
const
yo
=
require
(
'yo-yo'
)
const
modalDialog
=
require
(
'../ui/modaldialog'
)
const
modalDialog
=
require
(
'../ui/modaldialog'
)
const
defaultProfile
=
{
methods
:
[],
location
:
'sidePanel'
,
type
:
'iframe'
,
}
module
.
exports
=
class
LocalPlugin
{
module
.
exports
=
class
LocalPlugin
{
/**
/**
...
@@ -10,7 +16,7 @@ module.exports = class LocalPlugin {
...
@@ -10,7 +16,7 @@ module.exports = class LocalPlugin {
* @returns {Promise<{api: any, profile: any}>} A promise with the new plugin profile
* @returns {Promise<{api: any, profile: any}>} A promise with the new plugin profile
*/
*/
open
(
plugins
)
{
open
(
plugins
)
{
this
.
profile
=
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
||
{
notifications
:
{}
}
this
.
profile
=
JSON
.
parse
(
localStorage
.
getItem
(
'plugins/local'
))
||
defaultProfile
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
onValidation
=
()
=>
{
const
onValidation
=
()
=>
{
try
{
try
{
...
@@ -35,6 +41,7 @@ module.exports = class LocalPlugin {
...
@@ -35,6 +41,7 @@ module.exports = class LocalPlugin {
icon
:
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMjYyIDEwNzVxLTM3IDEyMS0xMzggMTk1dC0yMjggNzQtMjI4LTc0LTEzOC0xOTVxLTgtMjUgNC00OC41dDM4LTMxLjVxMjUtOCA0OC41IDR0MzEuNSAzOHEyNSA4MCA5Mi41IDEyOS41dDE1MS41IDQ5LjUgMTUxLjUtNDkuNSA5Mi41LTEyOS41cTgtMjYgMzItMzh0NDktNCAzNyAzMS41IDQgNDguNXptLTQ5NC00MzVxMCA1My0zNy41IDkwLjV0LTkwLjUgMzcuNS05MC41LTM3LjUtMzcuNS05MC41IDM3LjUtOTAuNSA5MC41LTM3LjUgOTAuNSAzNy41IDM3LjUgOTAuNXptNTEyIDBxMCA1My0zNy41IDkwLjV0LTkwLjUgMzcuNS05MC41LTM3LjUtMzcuNS05MC41IDM3LjUtOTAuNSA5MC41LTM3LjUgOTAuNSAzNy41IDM3LjUgOTAuNXptMjU2IDI1NnEwLTEzMC01MS0yNDguNXQtMTM2LjUtMjA0LTIwNC0xMzYuNS0yNDguNS01MS0yNDguNSA1MS0yMDQgMTM2LjUtMTM2LjUgMjA0LTUxIDI0OC41IDUxIDI0OC41IDEzNi41IDIwNCAyMDQgMTM2LjUgMjQ4LjUgNTEgMjQ4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Ni41IDIwNCAyMDQgMTM2LjUgMjQ4LjUgNTEgMjQ4LjUtNTEgMjA0LTEzNi41IDEzNi41LTIwNCA1MS0yNDguNXptMTI4IDBxMCAyMDktMTAzIDM4NS41dC0yNzkuNSAyNzkuNS0zODUuNSAxMDMtMzg1LjUtMTAzLTI3OS41LTI3OS41LTEwMy0zODUuNSAxMDMtMzg1LjUgMjc5LjUtMjc5LjUgMzg1LjUtMTAzIDM4NS41IDEwMyAyNzkuNSAyNzkuNSAxMDMgMzg1LjV6Ii8+PC9zdmc+'
,
methods
:
[],
methods
:
[],
location
:
'sidePanel'
,
location
:
'sidePanel'
,
type
:
'iframe'
,
...
this
.
profile
,
...
this
.
profile
,
hash
:
`local-
${
this
.
profile
.
name
}
`
hash
:
`local-
${
this
.
profile
.
name
}
`
}
}
...
@@ -57,32 +64,41 @@ module.exports = class LocalPlugin {
...
@@ -57,32 +64,41 @@ module.exports = class LocalPlugin {
this
.
profile
.
displayName
=
target
.
value
this
.
profile
.
displayName
=
target
.
value
}
}
update
Loc
({
target
}
)
{
update
Profile
(
key
,
e
)
{
this
.
profile
.
location
=
target
.
value
this
.
profile
[
key
]
=
e
.
target
.
value
}
}
/**
/** The form to create a local plugin */
* The form to create a local plugin
form
()
{
* @param {ProfileApi[]} plugins Liste of profile of the plugins
*/
form
(
plugins
=
[])
{
const
name
=
this
.
profile
.
name
||
''
const
name
=
this
.
profile
.
name
||
''
const
url
=
this
.
profile
.
url
||
''
const
url
=
this
.
profile
.
url
||
''
const
displayName
=
this
.
profile
.
displayName
||
''
const
displayName
=
this
.
profile
.
displayName
||
''
const
radio
Locations
=
(
label
,
displayN
)
=>
{
const
radio
Selection
=
(
key
,
label
,
message
)
=>
{
const
radioButton
=
(
this
.
profile
.
location
===
label
)
return
this
.
profile
[
key
]
===
label
?
yo
`<div class="radio">
?
yo
`<div class="radio">
<
label for="
${
label
}
"
>
<
input class="form-check-input" type="radio" name="
${
key
}
" onclick="
${
e
=>
this
.
updateProfile
(
key
,
e
)}
" value="
${
label
}
" id="
${
label
}
" checked="checked" /
>
<input type="radio" name="location" onclick="
${
e
=>
this
.
updateLoc
(
e
)}
" value="
${
label
}
" id="
${
label
}
" checked="checked" />
${
displayN
}
</label>
<label class="form-check-label" for="
${
label
}
">
${
message
}
</label>
</div>`
</div>`
:
yo
`<div class="radio">
:
yo
`<div class="radio">
<
label for="
${
label
}
"
>
<
input class="form-check-input" type="radio" name="
${
key
}
" onclick="
${
e
=>
this
.
updateProfile
(
key
,
e
)}
" value="
${
label
}
" id="
${
label
}
" /
>
<input type="radio" name="location" onclick="
${
e
=>
this
.
updateLoc
(
e
)}
" value="
${
label
}
" id="
${
label
}
" />
${
displayN
}
</label>
<label class="form-check-label" for="
${
label
}
">
${
message
}
</label>
</div>`
</div>`
return
yo
`<div>
${
radioButton
}
</div>`
}
}
// const radioLocations = (label, displayN) => {
// const radioButton = (this.profile.location === label)
// ? yo`<div class="radio">
// <label for="${label}">
// <input type="radio" name="location" onclick="${e => this.updateLoc(e)}" value="${label}" id="${label}" checked="checked" />${displayN}</label>
// </div>`
// : yo`<div class="radio">
// <label for="${label}">
// <input type="radio" name="location" onclick="${e => this.updateLoc(e)}" value="${label}" id="${label}" />${displayN}</label>
// </div>`
// return yo`<div>
// ${radioButton}
// </div>`
// }
return
yo
`
return
yo
`
<form id="local-plugin-form">
<form id="local-plugin-form">
<div class="form-group">
<div class="form-group">
...
@@ -97,11 +113,17 @@ module.exports = class LocalPlugin {
...
@@ -97,11 +113,17 @@ module.exports = class LocalPlugin {
<label for="plugin-url">Url <small>(required)</small></label>
<label for="plugin-url">Url <small>(required)</small></label>
<input class="form-control" onchange="
${
e
=>
this
.
updateUrl
(
e
)}
" value="
${
url
}
" id="plugin-url" placeholder="ex: https://localhost:8000">
<input class="form-control" onchange="
${
e
=>
this
.
updateUrl
(
e
)}
" value="
${
url
}
" id="plugin-url" placeholder="ex: https://localhost:8000">
</div>
</div>
<div class="form-group">
<h6>Type of connection <small>(required)</small></h6>
<div class="form-check form-group">
${
radioSelection
(
'type'
,
'iframe'
,
'Iframe'
)}
${
radioSelection
(
'type'
,
'ws'
,
'Websocket'
)}
</div>
<h6>Location in remix <small>(required)</small></h6>
<h6>Location in remix <small>(required)</small></h6>
${
radioLocations
(
'sidePanel'
,
'Side Panel'
)}
<div class="form-check form-group">
${
radioLocations
(
'mainPanel'
,
'Main Panel'
)}
${
radioSelection
(
'location'
,
'sidePanel'
,
'Side Panel'
)}
${
radioLocations
(
'none'
,
'None'
)}
${
radioSelection
(
'location'
,
'mainPanel'
,
'Main Panel'
)}
${
radioSelection
(
'location'
,
'none'
,
'None'
)}
</div>
</form>`
</form>`
}
}
}
}
src/app/components/plugin-manager-component.js
View file @
8580b02b
...
@@ -2,7 +2,7 @@ const yo = require('yo-yo')
...
@@ -2,7 +2,7 @@ const yo = require('yo-yo')
const
csjs
=
require
(
'csjs-inject'
)
const
csjs
=
require
(
'csjs-inject'
)
const
EventEmitter
=
require
(
'events'
)
const
EventEmitter
=
require
(
'events'
)
const
LocalPlugin
=
require
(
'./local-plugin'
)
const
LocalPlugin
=
require
(
'./local-plugin'
)
import
{
ViewPlugin
,
IframePlugin
}
from
'@remixproject/engine'
import
{
ViewPlugin
,
IframePlugin
,
WebsocketPlugin
}
from
'@remixproject/engine'
import
{
PluginManagerSettings
}
from
'./plugin-manager-settings'
import
{
PluginManagerSettings
}
from
'./plugin-manager-settings'
import
*
as
packageJson
from
'../../../package.json'
import
*
as
packageJson
from
'../../../package.json'
const
addToolTip
=
require
(
'../ui/tooltip'
)
const
addToolTip
=
require
(
'../ui/tooltip'
)
...
@@ -130,7 +130,9 @@ class PluginManagerComponent extends ViewPlugin {
...
@@ -130,7 +130,9 @@ class PluginManagerComponent extends ViewPlugin {
if
(
this
.
appManager
.
getIds
().
includes
(
profile
.
name
))
{
if
(
this
.
appManager
.
getIds
().
includes
(
profile
.
name
))
{
throw
new
Error
(
'This name has already been used'
)
throw
new
Error
(
'This name has already been used'
)
}
}
this
.
appManager
.
registerOne
(
new
IframePlugin
(
profile
))
const
plugin
=
profile
.
type
===
'iframe'
?
new
IframePlugin
(
profile
)
:
new
WebsocketPlugin
(
profile
)
this
.
appManager
.
registerOne
(
plugin
)
this
.
appManager
.
activateOne
(
profile
.
name
)
this
.
appManager
.
activateOne
(
profile
.
name
)
}
catch
(
err
)
{
}
catch
(
err
)
{
// TODO : Use an alert to handle this error instead of a console.log
// TODO : Use an alert to handle this error instead of a console.log
...
...
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