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
b910bd84
Unverified
Commit
b910bd84
authored
Aug 13, 2019
by
Liana Husikyan
Committed by
GitHub
Aug 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove events and notifications from local plugin create page
parent
67c15b2c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
72 deletions
+1
-72
local-plugin.js
src/app/components/local-plugin.js
+1
-72
No files found.
src/app/components/local-plugin.js
View file @
b910bd84
...
...
@@ -2,8 +2,6 @@
const
yo
=
require
(
'yo-yo'
)
const
modalDialog
=
require
(
'../ui/modaldialog'
)
const
unexposedEvents
=
[
'statusChanged'
]
module
.
exports
=
class
LocalPlugin
{
/**
...
...
@@ -40,8 +38,6 @@ module.exports = class LocalPlugin {
...
this
.
profile
,
hash
:
`local-
${
this
.
profile
.
name
}
`
}
profile
.
events
=
(
profile
.
events
||
[]).
filter
(
item
=>
item
!==
''
)
if
(
!
profile
.
location
)
throw
new
Error
(
'Plugin should have a location'
)
if
(
!
profile
.
name
)
throw
new
Error
(
'Plugin should have a name'
)
if
(
!
profile
.
url
)
throw
new
Error
(
'Plugin should have an URL'
)
...
...
@@ -49,23 +45,6 @@ module.exports = class LocalPlugin {
return
profile
}
/**
* Add or remove a notification to/from the profile
* @param {Event} e The event when checkbox changes
* @param {string} pluginName The name of the plugin
* @param {string} eventName The name of the event to listen on
*/
toggleNotification
(
e
,
pluginName
,
eventName
)
{
const
{
checked
}
=
e
.
target
if
(
checked
)
{
if
(
!
this
.
profile
.
notifications
[
pluginName
])
this
.
profile
.
notifications
[
pluginName
]
=
[]
this
.
profile
.
notifications
[
pluginName
].
push
(
eventName
)
}
else
{
this
.
profile
.
notifications
[
pluginName
].
splice
(
this
.
profile
.
notifications
[
pluginName
].
indexOf
(
eventName
),
1
)
if
(
this
.
profile
.
notifications
[
pluginName
].
length
===
0
)
delete
this
.
profile
.
notifications
[
pluginName
]
}
}
updateName
({
target
})
{
this
.
profile
.
name
=
target
.
value
}
...
...
@@ -78,33 +57,11 @@ module.exports = class LocalPlugin {
this
.
profile
.
displayName
=
target
.
value
}
updateEvents
({
target
},
index
)
{
if
(
this
.
profile
.
events
[
index
]
!==
undefined
)
{
this
.
profile
.
events
[
index
]
=
target
.
value
}
}
updateLoc
({
target
})
{
this
.
profile
.
location
=
target
.
value
}
/**
* The checkbox for a couple module / event
* @param {string} plugin The name of the plugin
* @param {string} event The name of the event exposed by the plugin
*/
notificationCheckbox
(
plugin
,
event
)
{
const
notifications
=
this
.
profile
.
notifications
||
{}
const
checkbox
=
notifications
[
plugin
]
&&
notifications
[
plugin
].
includes
(
event
)
?
yo
`<input id="
${
plugin
}${
event
}
" type="checkbox" checked onchange="
${
e
=>
this
.
toggleNotification
(
e
,
plugin
,
event
)}
">`
:
yo
`<input id="
${
plugin
}${
event
}
" type="checkbox" onchange="
${
e
=>
this
.
toggleNotification
(
e
,
plugin
,
event
)}
">`
return
yo
`<div>
${
checkbox
}
<label for="
${
plugin
}${
event
}
">
${
plugin
}
-
${
event
}
</label>
</div>`
}
/**
* The form to create a local plugin
* @param {ProfileApi[]} plugins Liste of profile of the plugins
*/
...
...
@@ -112,15 +69,7 @@ module.exports = class LocalPlugin {
const
name
=
this
.
profile
.
name
||
''
const
url
=
this
.
profile
.
url
||
''
const
displayName
=
this
.
profile
.
displayName
||
''
const
profiles
=
plugins
.
filter
(({
profile
})
=>
profile
.
events
&&
profile
.
events
.
length
>
0
)
.
map
(({
profile
})
=>
profile
)
const
eventsForm
=
(
events
)
=>
{
return
yo
`<div>
${
events
.
map
((
event
,
i
)
=>
{
return
yo
`<input class="form-control" onchange="
${
e
=>
this
.
updateEvents
(
e
,
i
)}
" value="
${
event
}
" />`
})}
</div>`
}
const
radioLocations
=
(
label
,
displayN
)
=>
{
const
radioButton
=
(
this
.
profile
.
location
===
label
)
?
yo
`<div class="radio">
...
...
@@ -135,14 +84,6 @@ module.exports = class LocalPlugin {
${
radioButton
}
</div>`
}
const
eventsEl
=
eventsForm
(
this
.
profile
.
events
||
[])
const
pushEvent
=
()
=>
{
if
(
!
this
.
profile
.
events
)
this
.
profile
.
events
=
[]
this
.
profile
.
events
.
push
(
''
)
yo
.
update
(
eventsEl
,
eventsForm
(
this
.
profile
.
events
))
}
const
addEvent
=
yo
`<button type="button" class="btn btn-sm btn-light" onclick="
${()
=>
pushEvent
()}
">Add an event</button>`
return
yo
`
<form id="local-plugin-form">
<div class="form-group">
...
...
@@ -158,18 +99,6 @@ module.exports = class LocalPlugin {
<input class="form-control" onchange="
${
e
=>
this
.
updateUrl
(
e
)}
" value="
${
url
}
" id="plugin-url" placeholder="ex: https://localhost:8000">
</div>
<div class="form-group">
<label>Events</label>
${
eventsEl
}${
addEvent
}
</div>
<div class="form-group">
<label>Notifications</label>
${
profiles
.
map
(({
name
,
events
})
=>
{
return
events
.
filter
(
event
=>
!
unexposedEvents
.
includes
(
event
))
.
map
(
event
=>
this
.
notificationCheckbox
(
name
,
event
))
})}
</div>
<div class="form-group">
<h6>Location in remix <small>(required)</small></h6>
${
radioLocations
(
'sidePanel'
,
'Side Panel'
)}
${
radioLocations
(
'mainPanel'
,
'Main Panel'
)}
...
...
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