mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-28 19:45:45 +08:00
36 lines
956 B
CoffeeScript
36 lines
956 B
CoffeeScript
{pluggable} = app
|
|
|
|
exports = module.exports = class SupervisorPlugin extends pluggable.Plugin
|
|
@NAME: 'supervisor'
|
|
@type: 'service'
|
|
@dependencies: ['linux']
|
|
|
|
supervisor = require './supervisor'
|
|
|
|
exports.registerHook 'view.panel.scripts',
|
|
path: '/plugin/supervisor/script/panel.js'
|
|
|
|
exports.registerHook 'view.panel.styles',
|
|
path: '/plugin/supervisor/style/panel.css'
|
|
|
|
exports.registerHook 'view.panel.widgets',
|
|
generator: (req, callback) ->
|
|
exports.render 'widget', req,
|
|
programSummary: supervisor.programSummary
|
|
, callback
|
|
|
|
exports.registerServiceHook 'enable',
|
|
filter: (req, callback) ->
|
|
req.account.update
|
|
$set:
|
|
'pluggable.supervisor.programs': []
|
|
, callback
|
|
|
|
exports.registerServiceHook 'disable',
|
|
filter: (req, callback) ->
|
|
supervisor.removePrograms req.account, ->
|
|
supervisor.updateProgram req.account, null, ->
|
|
callback()
|
|
|
|
app.express.use '/plugin/supervisor', require './router'
|