diff --git a/src/app/components/local-plugin.js b/src/app/components/local-plugin.js index 660a54eff8..3f9f28f16d 100644 --- a/src/app/components/local-plugin.js +++ b/src/app/components/local-plugin.js @@ -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,32 +57,10 @@ 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`` - : yo`` - return yo`
- ${checkbox} - -
` - } - /** * 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`
${events.map((event, i) => { - return yo`` - })}
` - } + const radioLocations = (label, displayN) => { const radioButton = (this.profile.location === label) ? yo`
@@ -135,14 +84,6 @@ module.exports = class LocalPlugin { ${radioButton}
` } - 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`` - return yo`
@@ -157,18 +98,6 @@ module.exports = class LocalPlugin {
-
- - ${eventsEl}${addEvent} -
-
- - ${profiles.map(({name, events}) => { - return events - .filter(event => !unexposedEvents.includes(event)) - .map(event => this.notificationCheckbox(name, event)) - })} -
Location in remix (required)
${radioLocations('sidePanel', 'Side Panel')}