Comparing version 1.0.2 to 1.0.3
@@ -6,3 +6,2 @@ var http = require('http'), | ||
path = require('path'), | ||
_ = require('underscore'), | ||
util = require('util'), | ||
@@ -14,3 +13,9 @@ url = require('url'), | ||
exports.Server = function(paths, config) { | ||
exports.createServer = function (paths, options) { | ||
return new Server(paths, options); | ||
}; | ||
function Server (paths, config) { | ||
var me = this, | ||
@@ -36,6 +41,6 @@ options = config.server; | ||
util.inherits(exports.Server, events.EventEmitter); | ||
util.inherits(Server, events.EventEmitter); | ||
exports.Server.prototype.start = function() { | ||
Server.prototype.start = function () { | ||
// create authenticator | ||
@@ -73,11 +78,6 @@ this.httpAuth = require('http-auth')({ | ||
exports.createServer = function(paths, options) { | ||
return new exports.Server(paths, options); | ||
}; | ||
exports.Server.prototype.handleWebRequest = function(request, response) { | ||
Server.prototype.handleWebRequest = function (request, response) { | ||
var me = this; | ||
me.httpAuth.apply(request, response, function(username) { | ||
me.httpAuth.apply(request, response, function () { | ||
me.handleRequest(request, response); | ||
@@ -87,3 +87,3 @@ }); | ||
exports.Server.prototype.handleRequest = function(request, response) { | ||
Server.prototype.handleRequest = function (request, response) { | ||
var me = this; | ||
@@ -93,8 +93,8 @@ | ||
request.addListener('data', function(chunk) { | ||
request.addListener('data', function (chunk) { | ||
request.content += chunk; | ||
}); | ||
request.addListener('end', function() { | ||
request.urlInfo = url.parse(request.url) | ||
request.addListener('end', function () { | ||
request.urlInfo = url.parse(request.url); | ||
request.path = request.urlInfo.pathname.substr(1).split('/'); | ||
@@ -131,3 +131,3 @@ console.log(request.method+' '+request.url); | ||
exports.Server.prototype.close = function(options, error) { | ||
Server.prototype.close = function () { | ||
console.log('Shutting down management server...'); | ||
@@ -142,2 +142,2 @@ | ||
} | ||
}; | ||
}; |
var _ = require('underscore'), | ||
util = require('util'), | ||
fs = require('fs'), | ||
path = require('path'), | ||
events = require('events'); | ||
exports.ServicesController = function(sites, config) { | ||
exports.createServices = function (sites, config) { | ||
return new ServicesController(sites, config); | ||
}; | ||
function ServicesController (sites, config) { | ||
var me = this, | ||
options = config.services; | ||
options = config.services; | ||
@@ -50,3 +55,3 @@ me.sites = sites; | ||
me.services = {}; | ||
_.each(me.options.plugins, function(plugin, name) { | ||
_.each(me.options.plugins, function (plugin, name) { | ||
console.log('Loading service: '+name); | ||
@@ -64,3 +69,3 @@ | ||
// auto-start service plugins | ||
_.each(me.services, function(service, name) { | ||
_.each(me.services, function (service, name) { | ||
if (service.options.autoStart) { | ||
@@ -73,6 +78,6 @@ console.log('Autostarting service: '+name); | ||
util.inherits(exports.ServicesController, events.EventEmitter); | ||
util.inherits(ServicesController, events.EventEmitter); | ||
exports.ServicesController.prototype.handleRequest = function(request, response, server) { | ||
ServicesController.prototype.handleRequest = function (request) { | ||
var me = this; | ||
@@ -89,3 +94,3 @@ | ||
_.each(me.services, function(service, name) { | ||
_.each(me.services, function (service) { | ||
statusData.services.push(service.getStatus()); | ||
@@ -100,3 +105,3 @@ }); | ||
exports.ServicesController.prototype.handleServiceRequest = function(request, response, server) { | ||
ServicesController.prototype.handleServiceRequest = function (request) { | ||
var me = this, | ||
@@ -132,5 +137,1 @@ service = me.services[request.path[1]]; | ||
}; | ||
exports.createServices = function(sites, config) { | ||
return new exports.ServicesController(sites, config); | ||
}; |
@@ -1,11 +0,10 @@ | ||
var _ = require('underscore') | ||
,util = require('util') | ||
,events = require('events'); | ||
var util = require('util'), | ||
events = require('events'); | ||
exports.AbstractService = function(name, controller, options) { | ||
function AbstractService (name, controller, options) { | ||
var me = this; | ||
// call events constructor | ||
exports.AbstractService.super_.apply(me, arguments); | ||
AbstractService.super_.apply(me, arguments); | ||
@@ -22,21 +21,23 @@ // initialize options and apply defaults | ||
util.inherits(exports.AbstractService, events.EventEmitter); | ||
util.inherits(AbstractService, events.EventEmitter); | ||
module.exports = AbstractService; | ||
exports.AbstractService.prototype.getStatus = function() { | ||
AbstractService.prototype.getStatus = function () { | ||
return { | ||
name: this.name | ||
,status: this.status | ||
name: this.name, | ||
status: this.status | ||
}; | ||
} | ||
}; | ||
exports.AbstractService.prototype.start = function() { | ||
AbstractService.prototype.start = function () { | ||
throw new Error('start() not implemented in '+this.name); | ||
}; | ||
exports.AbstractService.prototype.stop = function() { | ||
AbstractService.prototype.stop = function () { | ||
throw new Error('start() not implemented in '+this.name); | ||
}; | ||
exports.AbstractService.prototype.restart = function() { | ||
AbstractService.prototype.restart = function () { | ||
if (this.stop()) { | ||
@@ -47,2 +48,2 @@ return this.start(); | ||
} | ||
}; | ||
}; |
var _ = require('underscore'), | ||
fs = require('fs'), | ||
path = require('path'), | ||
util = require('util'), | ||
@@ -11,7 +10,9 @@ spawn = require('child_process').spawn, | ||
exports.createService = function(name, controller, options) { | ||
return new exports.MysqlService(name, controller, options); | ||
exports.createService = function (name, controller, options) { | ||
return new MysqlService(name, controller, options); | ||
}; | ||
exports.MysqlService = function(name, controller, options) { | ||
function MysqlService (name, controller) { | ||
var me = this, | ||
@@ -21,3 +22,3 @@ versionMatch; | ||
// call parent constructor | ||
exports.MysqlService.super_.apply(me, arguments); | ||
MysqlService.super_.apply(me, arguments); | ||
@@ -72,7 +73,6 @@ // default options | ||
util.inherits(exports.MysqlService, require('./abstract.js').AbstractService); | ||
util.inherits(MysqlService, require('./abstract.js')); | ||
exports.MysqlService.prototype.start = function(firstRun) { | ||
MysqlService.prototype.start = function (firstRun) { | ||
var me = this; | ||
@@ -110,7 +110,7 @@ | ||
if (semver.lt(me.mysqldVersion, '5.7.6') || me.mysqldIsMaria) { | ||
exec('mysql_install_db --defaults-file='+me.options.configPath, function(error, stdout, stderr) { | ||
exec('mysql_install_db --defaults-file='+me.options.configPath, function () { | ||
me.start(true); | ||
}); | ||
} else { | ||
exec('mysqld --initialize-insecure --user=mysql --datadir='+me.options.dataDir, function(error, stdout, stderr) { | ||
exec('mysqld --initialize-insecure --user=mysql --datadir='+me.options.dataDir, function () { | ||
me.start(true); | ||
@@ -162,4 +162,3 @@ }); | ||
exports.MysqlService.prototype.stop = function() { | ||
MysqlService.prototype.stop = function () { | ||
var me = this; | ||
@@ -184,3 +183,3 @@ | ||
exports.MysqlService.prototype.restart = function() { | ||
MysqlService.prototype.restart = function () { | ||
var me = this, | ||
@@ -209,7 +208,7 @@ now; | ||
exports.MysqlService.prototype.writeConfig = function() { | ||
MysqlService.prototype.writeConfig = function () { | ||
fs.writeFileSync(this.options.configPath, this.makeConfig()); | ||
}; | ||
exports.MysqlService.prototype.makeConfig = function() { | ||
MysqlService.prototype.makeConfig = function () { | ||
var me = this, | ||
@@ -225,3 +224,3 @@ config = []; | ||
'pid-file = '+me.options.pidPath, | ||
// 'log-error = '+me.options.errorLogPath, // disabled due to http://bugs.mysql.com/bug.php?id=65592 -- errors output to STDIN will usually go into emergence-kernel's log | ||
// 'log-error = '+me.options.errorLogPath, // disabled due to http://bugs.mysql.com/bug.php?id=65592 -- errors output to STDIN will usually go into emergence-kernel's log | ||
'basedir = /usr', | ||
@@ -237,3 +236,3 @@ 'datadir = '+me.options.dataDir, | ||
'myisam_sort_buffer_size = 8M', | ||
// 'lc-messages-dir = /usr/local/share/mysql', | ||
// 'lc-messages-dir = /usr/local/share/mysql', | ||
@@ -277,3 +276,3 @@ 'log-bin = mysqld-bin', | ||
exports.MysqlService.prototype.secureInstallation = function() { | ||
MysqlService.prototype.secureInstallation = function () { | ||
var me = this, | ||
@@ -312,3 +311,3 @@ sql = ''; | ||
connection.query(sql, function(error) { | ||
connection.query(sql, function (error) { | ||
connection.end(); | ||
@@ -324,4 +323,3 @@ | ||
exports.MysqlService.prototype.onSiteCreated = function(siteData, requestData, callbacks) { | ||
MysqlService.prototype.onSiteCreated = function (siteData, requestData, callbacks) { | ||
var me = this, | ||
@@ -343,3 +341,3 @@ sql = '', | ||
me.executeSQL(sql, function(error, results) { | ||
me.executeSQL(sql, function (error) { | ||
if (error) { | ||
@@ -356,3 +354,3 @@ console.log(me.name+': failed to setup database `'+siteData.handle+'`: '+error); | ||
// populate tables | ||
me.createSkeletonTables(siteData, function() { | ||
me.createSkeletonTables(siteData, function () { | ||
if (callbacks.databaseReady) { | ||
@@ -365,5 +363,3 @@ callbacks.databaseReady(dbConfig, siteData, requestData); | ||
exports.MysqlService.prototype.createSkeletonTables = function(siteData, callback) { | ||
MysqlService.prototype.createSkeletonTables = function (siteData, callback) { | ||
var me = this, | ||
@@ -407,3 +403,3 @@ sql = ''; | ||
// run tables | ||
me.executeSQL(sql, function(error, results) { | ||
me.executeSQL(sql, function (error) { | ||
if (error) { | ||
@@ -420,5 +416,3 @@ console.log(me.name+': failed to setup skeleton tables on `'+siteData.handle+'`: '+error); | ||
exports.MysqlService.prototype.executeSQL = function(sql, callback) { | ||
MysqlService.prototype.executeSQL = function (sql, callback) { | ||
var connection = mysql.createConnection({ | ||
@@ -431,3 +425,3 @@ socketPath: this.options.socketPath, | ||
connection.query(sql, function(err, results) { | ||
connection.query(sql, function (err, results) { | ||
connection.end(); | ||
@@ -437,2 +431,2 @@ | ||
}); | ||
}; | ||
}; |
var _ = require('underscore'), | ||
fs = require('fs'), | ||
path = require('path'), | ||
util = require('util'), | ||
spawn = require('child_process').spawn; | ||
exports.createService = function(name, controller, options) { | ||
return new exports.NginxService(name, controller, options); | ||
exports.createService = function (name, controller, options) { | ||
return new NginxService(name, controller, options); | ||
}; | ||
exports.NginxService = function(name, controller, options) { | ||
function NginxService (name, controller) { | ||
var me = this; | ||
// call parent constructor | ||
exports.NginxService.super_.apply(me, arguments); | ||
NginxService.super_.apply(me, arguments); | ||
@@ -53,7 +54,6 @@ // default options | ||
util.inherits(exports.NginxService, require('./abstract.js').AbstractService); | ||
util.inherits(NginxService, require('./abstract.js')); | ||
exports.NginxService.prototype.start = function() { | ||
NginxService.prototype.start = function () { | ||
var me = this; | ||
@@ -87,3 +87,3 @@ | ||
console.log(me.name+': failed to find pid after launching, waiting 1000ms and trying again...'); | ||
setTimeout(function() { | ||
setTimeout(function () { | ||
@@ -120,4 +120,3 @@ if (fs.existsSync(me.options.pidPath)) { | ||
exports.NginxService.prototype.stop = function() { | ||
NginxService.prototype.stop = function () { | ||
var me = this; | ||
@@ -141,4 +140,3 @@ | ||
exports.NginxService.prototype.restart = function() { | ||
NginxService.prototype.restart = function () { | ||
var me = this; | ||
@@ -164,8 +162,7 @@ | ||
exports.NginxService.prototype.writeConfig = function() { | ||
NginxService.prototype.writeConfig = function () { | ||
fs.writeFileSync(this.options.configPath, this.makeConfig()); | ||
}; | ||
exports.NginxService.prototype.makeConfig = function() { | ||
NginxService.prototype.makeConfig = function () { | ||
var me = this, | ||
@@ -253,3 +250,3 @@ phpSocketPath = me.controller.services['php'].options.socketPath, | ||
' server_tokens off;' | ||
/* | ||
/* | ||
@@ -264,3 +261,3 @@ ' server {', | ||
_.each(me.controller.sites.sites, function(site, handle) { | ||
_.each(me.controller.sites.sites, function (site, handle) { | ||
var hostnames = site.hostnames.slice(), | ||
@@ -319,3 +316,3 @@ siteDir = me.controller.sites.options.sitesDir+'/'+handle, | ||
site.hostnames.forEach(function(hostname) { | ||
site.hostnames.forEach(function (hostname) { | ||
sslHostnames[hostname] = site.ssl; | ||
@@ -352,5 +349,4 @@ }); | ||
exports.NginxService.prototype.onSiteCreated = function(siteData) { | ||
NginxService.prototype.onSiteCreated = function () { | ||
this.restart(); | ||
}; |
@@ -8,11 +8,13 @@ var _ = require('underscore'), | ||
exports.createService = function(name, controller, options) { | ||
return new exports.PhpFpmService(name, controller, options); | ||
exports.createService = function (name, controller, options) { | ||
return new PhpFpmService(name, controller, options); | ||
}; | ||
exports.PhpFpmService = function(name, controller, options) { | ||
function PhpFpmService (name, controller) { | ||
var me = this; | ||
// call parent constructor | ||
exports.PhpFpmService.super_.apply(me, arguments); | ||
PhpFpmService.super_.apply(me, arguments); | ||
@@ -52,7 +54,6 @@ // default options | ||
util.inherits(exports.PhpFpmService, require('./abstract.js').AbstractService); | ||
util.inherits(PhpFpmService, require('./abstract.js')); | ||
exports.PhpFpmService.prototype.start = function() { | ||
PhpFpmService.prototype.start = function () { | ||
var me = this; | ||
@@ -106,6 +107,6 @@ | ||
return true; | ||
} | ||
}; | ||
exports.PhpFpmService.prototype.stop = function() { | ||
PhpFpmService.prototype.stop = function () { | ||
var me = this; | ||
@@ -130,3 +131,3 @@ | ||
exports.PhpFpmService.prototype.restart = function() { | ||
PhpFpmService.prototype.restart = function () { | ||
var me = this; | ||
@@ -153,7 +154,7 @@ | ||
exports.PhpFpmService.prototype.writeConfig = function() { | ||
PhpFpmService.prototype.writeConfig = function () { | ||
fs.writeFileSync(this.options.configPath, this.makeConfig()); | ||
}; | ||
exports.PhpFpmService.prototype.makeConfig = function() { | ||
PhpFpmService.prototype.makeConfig = function () { | ||
var me = this, | ||
@@ -205,3 +206,3 @@ config = []; | ||
exports.PhpFpmService.prototype.onSiteUpdated = function(siteData) { | ||
PhpFpmService.prototype.onSiteUpdated = function (siteData) { | ||
var me = this, | ||
@@ -225,3 +226,3 @@ siteRoot = me.controller.sites.options.sitesDir + '/' + siteData.handle, | ||
] | ||
}, function(err, output, phpErrors) { | ||
}, function (err, output, phpErrors) { | ||
if (err == 99) console.error('PHPFPM server error'); | ||
@@ -228,0 +229,0 @@ console.log(output); |
@@ -13,9 +13,10 @@ var _ = require('underscore'), | ||
exports.createSites = function(config) { | ||
return new exports.Sites(config); | ||
exports.createSites = function (config) { | ||
return new Sites(config); | ||
}; | ||
exports.Sites = function(config) { | ||
function Sites (config) { | ||
var me = this, | ||
options = config.sites; | ||
options = config.sites; | ||
@@ -42,3 +43,3 @@ // call events constructor | ||
me.sites = {}; | ||
_.each(fs.readdirSync(me.options.sitesDir), function(handle) { | ||
_.each(fs.readdirSync(me.options.sitesDir), function (handle) { | ||
try { | ||
@@ -55,6 +56,6 @@ me.sites[handle] = JSON.parse(fs.readFileSync(me.options.sitesDir+'/'+handle+'/site.json', 'ascii')); | ||
util.inherits(exports.Sites, events.EventEmitter); | ||
util.inherits(Sites, events.EventEmitter); | ||
exports.Sites.prototype.handleRequest = function(request, response, server) { | ||
Sites.prototype.handleRequest = function (request, response) { | ||
var me = this; | ||
@@ -155,7 +156,7 @@ | ||
phpProc.stderr.on('data', function(data) { | ||
phpProc.stderr.on('data', function (data) { | ||
console.log('php-cli stderr: ' + data); | ||
}); | ||
phpProc.stdout.on('data', function(data) { | ||
phpProc.stdout.on('data', function (data) { | ||
console.log('php-cli stdout: ' + data); | ||
@@ -188,7 +189,7 @@ | ||
phpProc.stdout.on('data', function(data) { | ||
phpProc.stdout.on('data', function (data) { | ||
console.log('php-cli stdout: ' + data); | ||
response.write(data); | ||
}); | ||
phpProc.stderr.on('data', function(data) { console.log('php-cli stderr: ' + data); }); | ||
phpProc.stderr.on('data', function (data) { console.log('php-cli stderr: ' + data); }); | ||
@@ -237,3 +238,3 @@ requestData.AccountLevel = 'Developer'; | ||
me.emit('siteCreated', cfgResult.site, requestData, { | ||
databaseReady: function() { | ||
databaseReady: function () { | ||
// execute onSiteCreated within site's container | ||
@@ -243,6 +244,6 @@ console.log('Executing Site::onSiteCreated() via php-cli'); | ||
phpProc.stdout.on('data', function(data) { console.log('php-cli stdout: ' + data); }); | ||
phpProc.stderr.on('data', function(data) { console.log('php-cli stderr: ' + data); }); | ||
phpProc.stdout.on('data', function (data) { console.log('php-cli stdout: ' + data); }); | ||
phpProc.stderr.on('data', function (data) { console.log('php-cli stderr: ' + data); }); | ||
function _phpExec(code) { | ||
function _phpExec (code) { | ||
//console.log('php> '+code); | ||
@@ -281,4 +282,3 @@ phpProc.stdin.write(code+'\n'); | ||
exports.Sites.prototype.writeSiteConfig = function(requestData) { | ||
Sites.prototype.writeSiteConfig = function (requestData) { | ||
var me = this, | ||
@@ -353,3 +353,3 @@ siteData = _.clone(requestData); | ||
exports.Sites.prototype.updateSiteConfig = function(handle, changes) { | ||
Sites.prototype.updateSiteConfig = function (handle, changes) { | ||
var me = this, | ||
@@ -373,4 +373,3 @@ siteDir = me.options.sitesDir+'/'+handle, | ||
exports.generatePassword = exports.Sites.prototype.generatePassword = function(length) { | ||
Sites.prototype.generatePassword = function (length) { | ||
length = length || 16; | ||
@@ -387,1 +386,4 @@ | ||
}; | ||
exports.generatePassword = Sites.prototype.generatePassword; |
// enable and configure loader | ||
Ext.Loader.setConfig({ | ||
enabled:true | ||
,paths:{ | ||
Ext: '//extjs.cachefly.net/ext/gpl/5.0.0/src' | ||
} | ||
enabled:true, | ||
paths:{ | ||
Ext: '//extjs.cachefly.net/ext/gpl/5.0.0/src' | ||
} | ||
}); | ||
Ext.application({ | ||
name: 'eMan' | ||
,appFolder: 'app' | ||
,controllers: ['Viewport', 'Services', 'Sites', 'Log'] | ||
,autoCreateViewport: false | ||
,launch: function() { | ||
eMan.app = this; | ||
eMan.log = Ext.bind(eMan.app.log, eMan.app); | ||
this.viewport = Ext.create('eMan.view.Viewport'); | ||
this.viewport.setLoading(true); | ||
Ext.Ajax.request({ | ||
url: '/server-config' | ||
,success: function(response) { | ||
var r = Ext.decode(response.responseText); | ||
eMan.app.serverConfig = r; | ||
eMan.app.viewport.setLoading(false); | ||
} | ||
}); | ||
this.fireEvent('log', 'Emergence Manager ready.'); | ||
} | ||
,log: function(message) { | ||
this.fireEvent('log', message); | ||
} | ||
name: 'eMan', | ||
appFolder: 'app', | ||
controllers: ['Viewport', 'Services', 'Sites', 'Log'], | ||
autoCreateViewport: false, | ||
launch: function () { | ||
eMan.app = this; | ||
eMan.log = Ext.bind(eMan.app.log, eMan.app); | ||
this.viewport = Ext.create('eMan.view.Viewport'); | ||
this.viewport.setLoading(true); | ||
Ext.Ajax.request({ | ||
url: '/server-config', | ||
success: function (response) { | ||
var r = Ext.decode(response.responseText); | ||
eMan.app.serverConfig = r; | ||
eMan.app.viewport.setLoading(false); | ||
} | ||
}); | ||
this.fireEvent('log', 'Emergence Manager ready.'); | ||
}, | ||
log: function (message) { | ||
this.fireEvent('log', message); | ||
} | ||
}); |
Ext.define('eMan.controller.Log', { | ||
extend: 'Ext.app.Controller' | ||
extend: 'Ext.app.Controller', | ||
,views: ['log.Grid'] | ||
,stores: ['Log'] | ||
,models: ['LogEntry'] | ||
views: ['log.Grid'], | ||
stores: ['Log'], | ||
models: ['LogEntry'], | ||
,init: function() { | ||
this.control({ | ||
'loggrid': { | ||
afterrender: function(grid) { | ||
eMan.app.on('log', function(message, type) { | ||
this.getLogStore().insert(0, { | ||
timestamp: new Date() | ||
,message: message | ||
}); | ||
}, this); | ||
} | ||
,scope: this | ||
} | ||
}); | ||
} | ||
}); | ||
init: function () { | ||
this.control({ | ||
'loggrid': { | ||
afterrender: function () { | ||
eMan.app.on('log', function (message) { | ||
this.getLogStore().insert(0, { | ||
timestamp: new Date(), | ||
message: message | ||
}); | ||
}, this); | ||
}, | ||
scope: this | ||
} | ||
}); | ||
} | ||
}); |
Ext.define('eMan.controller.Services', { | ||
extend: 'Ext.app.Controller' | ||
extend: 'Ext.app.Controller', | ||
,views: ['services.Grid'] | ||
,stores: ['Services'] | ||
,models: ['Service'] | ||
views: ['services.Grid'], | ||
stores: ['Services'], | ||
models: ['Service'], | ||
,init: function() { | ||
init: function () { | ||
this.startServiceBtn = new Ext.create('Ext.menu.Item', { | ||
text: 'Start Service' | ||
,scope: this | ||
,handler: this.onStartPress | ||
}); | ||
this.startServiceBtn = new Ext.create('Ext.menu.Item', { | ||
text: 'Start Service', | ||
scope: this, | ||
handler: this.onStartPress | ||
}); | ||
this.restartServiceBtn = new Ext.create('Ext.menu.Item', { | ||
text: 'Restart Service' | ||
,scope: this | ||
,handler: this.onRestartPress | ||
}); | ||
this.restartServiceBtn = new Ext.create('Ext.menu.Item', { | ||
text: 'Restart Service', | ||
scope: this, | ||
handler: this.onRestartPress | ||
}); | ||
this.stopServiceBtn = new Ext.create('Ext.menu.Item', { | ||
text: 'Stop Service' | ||
,scope: this | ||
,handler: this.onStopPress | ||
}); | ||
this.stopServiceBtn = new Ext.create('Ext.menu.Item', { | ||
text: 'Stop Service', | ||
scope: this, | ||
handler: this.onStopPress | ||
}); | ||
this.servicesContextMenu = Ext.create('Ext.menu.Menu', { | ||
items: [this.startServiceBtn, this.restartServiceBtn, this.stopServiceBtn] | ||
}); | ||
this.servicesContextMenu = Ext.create('Ext.menu.Menu', { | ||
items: [this.startServiceBtn, this.restartServiceBtn, this.stopServiceBtn] | ||
}); | ||
this.control({ | ||
'servicesgrid gridview': { | ||
scope: this | ||
,cellclick: function(view, cellEl, colIndex, record, rowEl, rowIndex, ev) { | ||
if(colIndex == 1) | ||
this.showServiceMenu(view, cellEl, record); | ||
this.control({ | ||
'servicesgrid gridview': { | ||
scope: this, | ||
cellclick: function (view, cellEl, colIndex, record) { | ||
if (colIndex == 1) | ||
this.showServiceMenu(view, cellEl, record); | ||
} | ||
} | ||
,'servicesgrid tool[type=refresh]': { | ||
scope: this | ||
,click: function() { | ||
this.getServicesStore().load(); | ||
} | ||
} | ||
}); | ||
} | ||
}, | ||
'servicesgrid tool[type=refresh]': { | ||
scope: this, | ||
click: function () { | ||
this.getServicesStore().load(); | ||
} | ||
} | ||
}); | ||
}, | ||
,showServiceMenu: function(view, cellEl, service) { | ||
if(service.get('status') == 'offline') | ||
{ | ||
this.startServiceBtn.show(); | ||
this.restartServiceBtn.hide(); | ||
this.stopServiceBtn.hide(); | ||
} | ||
else | ||
{ | ||
this.startServiceBtn.hide(); | ||
this.restartServiceBtn.show(); | ||
this.stopServiceBtn.show(); | ||
} | ||
this.servicesContextMenu.contextRecord = service; | ||
this.servicesContextMenu.showBy(cellEl); | ||
} | ||
,onStartPress: function(btn, ev) { | ||
var service = btn.parentMenu.contextRecord; | ||
eMan.log('Starting service '+service.get('name')+'...'); | ||
service.set('status', 'starting...'); | ||
showServiceMenu: function (view, cellEl, service) { | ||
if (service.get('status') == 'offline') | ||
{ | ||
this.startServiceBtn.show(); | ||
this.restartServiceBtn.hide(); | ||
this.stopServiceBtn.hide(); | ||
} | ||
else | ||
{ | ||
this.startServiceBtn.hide(); | ||
this.restartServiceBtn.show(); | ||
this.stopServiceBtn.show(); | ||
} | ||
Ext.Ajax.request({ | ||
url: '/services/'+service.get('name')+'/!start' | ||
,method: 'POST' | ||
,scope: this | ||
,success: function(response) { | ||
var r = Ext.decode(response.responseText); | ||
this.servicesContextMenu.contextRecord = service; | ||
this.servicesContextMenu.showBy(cellEl); | ||
}, | ||
eMan.log((r.success?'Successfully started service ':'Failed to start service')+service.get('name')); | ||
if(r.status) | ||
{ | ||
service.set(r.status); | ||
service.commit(); | ||
} | ||
} | ||
}); | ||
} | ||
onStartPress: function (btn) { | ||
var service = btn.parentMenu.contextRecord; | ||
,onStopPress: function(btn, ev) { | ||
var service = btn.parentMenu.contextRecord; | ||
eMan.log('Stopping service '+service.get('name')+'...'); | ||
service.set('status', 'stopping...'); | ||
eMan.log('Starting service '+service.get('name')+'...'); | ||
service.set('status', 'starting...'); | ||
Ext.Ajax.request({ | ||
url: '/services/'+service.get('name')+'/!stop' | ||
,method: 'POST' | ||
,scope: this | ||
,success: function(response) { | ||
var r = Ext.decode(response.responseText); | ||
Ext.Ajax.request({ | ||
url: '/services/'+service.get('name')+'/!start', | ||
method: 'POST', | ||
scope: this, | ||
success: function (response) { | ||
var r = Ext.decode(response.responseText); | ||
eMan.log((r.success?'Successfully stopped service ':'Failed to stop service ')+service.get('name')); | ||
if(r.status) | ||
{ | ||
service.set(r.status); | ||
service.commit(); | ||
} | ||
} | ||
}); | ||
} | ||
eMan.log((r.success?'Successfully started service ':'Failed to start service')+service.get('name')); | ||
,onRestartPress: function(btn, ev) { | ||
var service = btn.parentMenu.contextRecord; | ||
eMan.log('Restarting service '+service.get('name')+'...'); | ||
service.set('status', 'restarting...'); | ||
if (r.status) | ||
{ | ||
service.set(r.status); | ||
service.commit(); | ||
} | ||
} | ||
}); | ||
}, | ||
Ext.Ajax.request({ | ||
url: '/services/'+service.get('name')+'/!restart' | ||
,method: 'POST' | ||
,scope: this | ||
,success: function(response) { | ||
var r = Ext.decode(response.responseText); | ||
onStopPress: function (btn) { | ||
var service = btn.parentMenu.contextRecord; | ||
eMan.log((r.success?'Successfully restarted service ':'Failed to restart service ')+service.get('name')); | ||
if(r.status) | ||
{ | ||
service.set(r.status); | ||
service.commit(); | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
eMan.log('Stopping service '+service.get('name')+'...'); | ||
service.set('status', 'stopping...'); | ||
Ext.Ajax.request({ | ||
url: '/services/'+service.get('name')+'/!stop', | ||
method: 'POST', | ||
scope: this, | ||
success: function (response) { | ||
var r = Ext.decode(response.responseText); | ||
eMan.log((r.success?'Successfully stopped service ':'Failed to stop service ')+service.get('name')); | ||
if (r.status) | ||
{ | ||
service.set(r.status); | ||
service.commit(); | ||
} | ||
} | ||
}); | ||
}, | ||
onRestartPress: function (btn) { | ||
var service = btn.parentMenu.contextRecord; | ||
eMan.log('Restarting service '+service.get('name')+'...'); | ||
service.set('status', 'restarting...'); | ||
Ext.Ajax.request({ | ||
url: '/services/'+service.get('name')+'/!restart', | ||
method: 'POST', | ||
scope: this, | ||
success: function (response) { | ||
var r = Ext.decode(response.responseText); | ||
eMan.log((r.success?'Successfully restarted service ':'Failed to restart service ')+service.get('name')); | ||
if (r.status) | ||
{ | ||
service.set(r.status); | ||
service.commit(); | ||
} | ||
} | ||
}); | ||
} | ||
}); |
Ext.define('eMan.controller.Sites', { | ||
extend: 'Ext.app.Controller' | ||
,requires: ['Ext.Ajax', 'Ext.window.Window'] | ||
extend: 'Ext.app.Controller', | ||
requires: ['Ext.Ajax', 'Ext.window.Window'], | ||
,views: ['site.Grid', 'site.CreateForm', 'site.DeveloperForm', 'site.Menu'] | ||
,stores: ['Sites','Skeletons'] | ||
,models: ['Site'] | ||
views: ['site.Grid', 'site.CreateForm', 'site.DeveloperForm', 'site.Menu'], | ||
stores: ['Sites','Skeletons'], | ||
models: ['Site'], | ||
,refs: [{ | ||
ref: 'siteMenu' | ||
,selector: 'sitemenu' | ||
,autoCreate: true | ||
,xtype: 'sitemenu' | ||
},{ | ||
ref: 'createForm' | ||
,selector: 'sitecreate' | ||
,autoCreate: true | ||
,xtype: 'sitecreate' | ||
},{ | ||
ref: 'developerWindow' | ||
,selector: 'window#developer-create' | ||
,autoCreate: true | ||
refs: [{ | ||
ref: 'siteMenu', | ||
selector: 'sitemenu', | ||
autoCreate: true, | ||
xtype: 'sitemenu' | ||
},{ | ||
ref: 'createForm', | ||
selector: 'sitecreate', | ||
autoCreate: true, | ||
xtype: 'sitecreate' | ||
},{ | ||
ref: 'developerWindow', | ||
selector: 'window#developer-create', | ||
autoCreate: true, | ||
,xtype: 'window' | ||
,itemId: 'developer' | ||
,title: 'Create developer user' | ||
,width: 400 | ||
,modal: true | ||
,items: { | ||
xtype: 'developerform' | ||
} | ||
}] | ||
xtype: 'window', | ||
itemId: 'developer', | ||
title: 'Create developer user', | ||
width: 400, | ||
modal: true, | ||
items: { | ||
xtype: 'developerform' | ||
} | ||
}], | ||
,init: function() { | ||
var me = this | ||
,skeletonsStore = me.getSkeletonsStore(); | ||
init: function () { | ||
var me = this, | ||
skeletonsStore = me.getSkeletonsStore(); | ||
this.control({ | ||
'sitegrid': { | ||
itemcontextmenu: me.onSiteContextMenu | ||
} | ||
,'sitegrid button[action=create]': { | ||
click: me.onCreateClick | ||
} | ||
,'sitemenu menuitem[action=create-inheriting]': { | ||
this.control({ | ||
'sitegrid': { | ||
itemcontextmenu: me.onSiteContextMenu | ||
}, | ||
'sitegrid button[action=create]': { | ||
click: me.onCreateClick | ||
}, | ||
'sitemenu menuitem[action=create-inheriting]': { | ||
click: me.onCreateInheritingClick | ||
} | ||
,'sitemenu menuitem[action=create-developer]': { | ||
}, | ||
'sitemenu menuitem[action=create-developer]': { | ||
click: me.onCreateDeveloperClick | ||
}, | ||
'sitecreate button[action=save]': { | ||
click: me.createSite | ||
}, | ||
'sitecreate button[action=cancel]': { | ||
click: me.cancelCreateSite | ||
}, | ||
'developerform button[action=save]': { | ||
click: 'onDeveloperSaveClick' | ||
}, | ||
'developerform button[action=cancel]': { | ||
click: 'onDeveloperCancelClick' | ||
} | ||
,'sitecreate button[action=save]': { | ||
click: me.createSite | ||
} | ||
,'sitecreate button[action=cancel]': { | ||
click: me.cancelCreateSite | ||
} | ||
,'developerform button[action=save]': { | ||
click: 'onDeveloperSaveClick' | ||
} | ||
,'developerform button[action=cancel]': { | ||
click: 'onDeveloperCancelClick' | ||
} | ||
}); | ||
}); | ||
// load and check that at least skeleton-v1 is in the store | ||
skeletonsStore.load(function(records) { | ||
// load and check that at least skeleton-v1 is in the store | ||
skeletonsStore.load(function (records) { | ||
if (!records.length) { | ||
@@ -74,5 +74,5 @@ skeletonsStore.add({hostname: 'skeleton.emr.ge', key: '8U6kydil36bl3vlJ'}); | ||
Ext.Ajax.request({ | ||
method: 'GET' | ||
,url: 'http://emr.ge/skeletons.json' | ||
,success: function(response) { | ||
method: 'GET', | ||
url: 'http://emr.ge/skeletons.json', | ||
success: function (response) { | ||
var data = Ext.decode(response.responseText, true); | ||
@@ -85,68 +85,68 @@ if (data) { | ||
}); | ||
}); | ||
} | ||
}); | ||
}, | ||
,showCreateForm: function(siteRecord, animateTarget) { | ||
showCreateForm: function (siteRecord, animateTarget) { | ||
this.editingSite = siteRecord; | ||
this.editingSite = siteRecord; | ||
this.getCreateForm().loadRecord(this.editingSite); | ||
this.getCreateForm().loadRecord(this.editingSite); | ||
this.createWindow = Ext.create('Ext.window.Window', { | ||
title: 'Create a new site' | ||
,width: 400 | ||
,modal: true | ||
,layout: 'fit' | ||
,items: this.getCreateForm() | ||
,listeners: { | ||
scope: this | ||
,show: { | ||
fn: function() { | ||
this.getCreateForm().getForm().findField('label').focus(); | ||
} | ||
,delay: 500 | ||
} | ||
} | ||
}); | ||
this.createWindow = Ext.create('Ext.window.Window', { | ||
title: 'Create a new site', | ||
width: 400, | ||
modal: true, | ||
layout: 'fit', | ||
items: this.getCreateForm(), | ||
listeners: { | ||
scope: this, | ||
show: { | ||
fn: function () { | ||
this.getCreateForm().getForm().findField('label').focus(); | ||
}, | ||
delay: 500 | ||
} | ||
} | ||
}); | ||
this.createWindow.show(animateTarget); | ||
} | ||
this.createWindow.show(animateTarget); | ||
}, | ||
,createSite: function() { | ||
var data = this.getCreateForm().getValues(); | ||
createSite: function () { | ||
var data = this.getCreateForm().getValues(); | ||
if(data.user_username || data.user_password || data.user_email || data.user_first || data.user_last) | ||
{ | ||
if(!(data.user_username && data.user_password && data.user_email && data.user_first && data.user_last)) | ||
{ | ||
Ext.Msg.alert('Incomplete user', 'Please fill out all fields for a first user'); | ||
return false; | ||
} | ||
if (data.user_username || data.user_password || data.user_email || data.user_first || data.user_last) | ||
{ | ||
if (!(data.user_username && data.user_password && data.user_email && data.user_first && data.user_last)) | ||
{ | ||
Ext.Msg.alert('Incomplete user', 'Please fill out all fields for a first user'); | ||
return false; | ||
} | ||
data.create_user = { | ||
Username: data.user_username | ||
,Password: data.user_password | ||
,Email: data.user_email | ||
,FirstName: data.user_first | ||
,LastName: data.user_last | ||
}; | ||
data.create_user = { | ||
Username: data.user_username, | ||
Password: data.user_password, | ||
Email: data.user_email, | ||
FirstName: data.user_first, | ||
LastName: data.user_last | ||
}; | ||
delete data.user_email; | ||
delete data.user_password; | ||
delete data.user_email; | ||
delete data.user_first; | ||
delete data.user_last; | ||
} | ||
delete data.user_email; | ||
delete data.user_password; | ||
delete data.user_email; | ||
delete data.user_first; | ||
delete data.user_last; | ||
} | ||
this.editingSite.set(data); | ||
this.getSitesStore().add(this.editingSite); | ||
this.createWindow.close(); | ||
} | ||
this.editingSite.set(data); | ||
this.getSitesStore().add(this.editingSite); | ||
this.createWindow.close(); | ||
}, | ||
,cancelCreateSite: function() { | ||
this.createWindow.close(); | ||
} | ||
cancelCreateSite: function () { | ||
this.createWindow.close(); | ||
}, | ||
,onSiteContextMenu: function(tree, record, item, index, ev) { | ||
onSiteContextMenu: function (tree, record, item, index, ev) { | ||
ev.stopEvent(); | ||
@@ -158,68 +158,68 @@ | ||
menu.showAt(ev.getXY()); | ||
} | ||
}, | ||
,onCreateClick: function(btn) { | ||
var siteRecord = Ext.create('eMan.model.Site'); | ||
this.showCreateForm(siteRecord, btn.el) | ||
} | ||
onCreateClick: function (btn) { | ||
var siteRecord = Ext.create('eMan.model.Site'); | ||
this.showCreateForm(siteRecord, btn.el); | ||
}, | ||
,onCreateInheritingClick: function(menuItem) { | ||
onCreateInheritingClick: function (menuItem) { | ||
var parentSite = menuItem.parentMenu.siteRecord; | ||
var siteRecord = Ext.create('eMan.model.Site', { | ||
parent_hostname: parentSite.get('primary_hostname') | ||
,parent_key: parentSite.get('inheritance_key') | ||
}); | ||
var siteRecord = Ext.create('eMan.model.Site', { | ||
parent_hostname: parentSite.get('primary_hostname'), | ||
parent_key: parentSite.get('inheritance_key') | ||
}); | ||
this.showCreateForm(siteRecord, menuItem.el); | ||
} | ||
this.showCreateForm(siteRecord, menuItem.el); | ||
}, | ||
,onCreateDeveloperClick: function(menuItem) { | ||
onCreateDeveloperClick: function (menuItem) { | ||
var developerWindow = this.getDeveloperWindow(), | ||
developerForm = developerWindow.down('developerform'), | ||
site = menuItem.parentMenu.siteRecord; | ||
developerForm = developerWindow.down('developerform'), | ||
site = menuItem.parentMenu.siteRecord; | ||
developerForm.setSite(site); | ||
developerWindow.setTitle(developerWindow.getInitialConfig('title') + ' for ' + site.get('handle')); | ||
developerWindow.show(); | ||
developerForm.getForm().findField('Email').focus(); | ||
} | ||
developerForm.setSite(site); | ||
developerWindow.setTitle(developerWindow.getInitialConfig('title') + ' for ' + site.get('handle')); | ||
developerWindow.show(); | ||
developerForm.getForm().findField('Email').focus(); | ||
}, | ||
,onDeveloperCancelClick: function() { | ||
var developerWindow = this.getDeveloperWindow(); | ||
onDeveloperCancelClick: function () { | ||
var developerWindow = this.getDeveloperWindow(); | ||
developerWindow.down('developerform').reset(); | ||
developerWindow.close(); | ||
} | ||
developerWindow.down('developerform').reset(); | ||
developerWindow.close(); | ||
}, | ||
,onDeveloperSaveClick: function() { | ||
onDeveloperSaveClick: function () { | ||
var developerWindow = this.getDeveloperWindow(), | ||
developerForm = developerWindow.down('developerform'); | ||
developerForm = developerWindow.down('developerform'); | ||
developerWindow.setLoading('Creating developer…'); | ||
Ext.Ajax.request({ | ||
method: 'POST', | ||
url: '/sites/'+developerForm.getSite().get('handle')+'/developers', | ||
jsonData: developerForm.getValues(), | ||
callback: function(operation, success, response) { | ||
var responseData = success && Ext.decode(response.responseText), | ||
errorMessage = 'Failed to create developer'; | ||
developerWindow.setLoading('Creating developer…'); | ||
Ext.Ajax.request({ | ||
method: 'POST', | ||
url: '/sites/'+developerForm.getSite().get('handle')+'/developers', | ||
jsonData: developerForm.getValues(), | ||
callback: function (operation, success, response) { | ||
var responseData = success && Ext.decode(response.responseText), | ||
errorMessage = 'Failed to create developer'; | ||
developerWindow.setLoading(false); | ||
developerWindow.setLoading(false); | ||
if (!success || !responseData || !responseData.success || !responseData.data.ID) { | ||
if (responseData.errors) { | ||
errorMessage += ':<ul><li>'+Ext.Object.getValues(responseData.errors).join('</li><li>')+'</li></ul>'; | ||
} | ||
if (!success || !responseData || !responseData.success || !responseData.data.ID) { | ||
if (responseData.errors) { | ||
errorMessage += ':<ul><li>'+Ext.Object.getValues(responseData.errors).join('</li><li>')+'</li></ul>'; | ||
} | ||
Ext.Msg.alert('Developer not created', errorMessage); | ||
} else { | ||
Ext.Msg.alert('Developer created', 'Created user #'+responseData.data.ID); | ||
developerForm.reset(); | ||
developerWindow.close(); | ||
} | ||
} | ||
}) | ||
} | ||
}); | ||
Ext.Msg.alert('Developer not created', errorMessage); | ||
} else { | ||
Ext.Msg.alert('Developer created', 'Created user #'+responseData.data.ID); | ||
developerForm.reset(); | ||
developerWindow.close(); | ||
} | ||
} | ||
}); | ||
} | ||
}); |
Ext.define('eMan.controller.Viewport', { | ||
extend: 'Ext.app.Controller' | ||
extend: 'Ext.app.Controller', | ||
,views: ['Viewport'] | ||
views: ['Viewport'] | ||
}); | ||
}); |
Ext.define('eMan.model.LogEntry', { | ||
extend: 'Ext.data.Model' | ||
extend: 'Ext.data.Model', | ||
,fields: [{ | ||
name: 'timestamp' | ||
,type: 'date' | ||
},{ | ||
name: 'message' | ||
,type: 'string' | ||
}] | ||
}); | ||
fields: [{ | ||
name: 'timestamp', | ||
type: 'date' | ||
},{ | ||
name: 'message', | ||
type: 'string' | ||
}] | ||
}); |
Ext.define('eMan.model.Service', { | ||
extend: 'Ext.data.Model' | ||
extend: 'Ext.data.Model', | ||
,fields: ['name','status'] | ||
,idProperty: 'name' | ||
,proxy: { | ||
type: 'rest' | ||
,url: '/services' | ||
,reader: { | ||
type: 'json' | ||
,root: 'services' | ||
} | ||
} | ||
}); | ||
fields: ['name','status'], | ||
idProperty: 'name', | ||
proxy: { | ||
type: 'rest', | ||
url: '/services', | ||
reader: { | ||
type: 'json', | ||
root: 'services' | ||
} | ||
} | ||
}); |
Ext.define('eMan.model.Site', { | ||
extend: 'Ext.data.Model' | ||
extend: 'Ext.data.Model', | ||
,fields: [ | ||
{name: 'id', persist: false} | ||
,{name: 'handle', type: 'string'} | ||
,{name: 'primary_hostname', type: 'string'} | ||
,{name: 'hostnames'} | ||
,{name: 'label', type: 'string', useNull: true} | ||
,{name: 'parent_hostname', type: 'string', useNull: true} | ||
,{name: 'parent_key', type: 'string', useNull: true} | ||
,{name: 'inheritance_key', type: 'string'} | ||
,{name: 'create_user', useNull: true} | ||
] | ||
,proxy: { | ||
type: 'rest' | ||
,url: '/sites' | ||
,reader: { | ||
type: 'json' | ||
,root: 'data' | ||
} | ||
,writer: { | ||
type: 'json' | ||
} | ||
} | ||
fields: [ | ||
{name: 'id', persist: false}, | ||
{name: 'handle', type: 'string'}, | ||
{name: 'primary_hostname', type: 'string'}, | ||
{name: 'hostnames'}, | ||
{name: 'label', type: 'string', useNull: true}, | ||
{name: 'parent_hostname', type: 'string', useNull: true}, | ||
{name: 'parent_key', type: 'string', useNull: true}, | ||
{name: 'inheritance_key', type: 'string'}, | ||
{name: 'create_user', useNull: true} | ||
], | ||
proxy: { | ||
type: 'rest', | ||
url: '/sites', | ||
reader: { | ||
type: 'json', | ||
root: 'data' | ||
}, | ||
writer: { | ||
type: 'json' | ||
} | ||
} | ||
}); |
Ext.define('eMan.model.Skeleton', { | ||
extend: 'Ext.data.Model' | ||
extend: 'Ext.data.Model', | ||
,fields: [ | ||
{name: 'hostname', type: 'string'} | ||
,{name: 'key', type: 'string'} | ||
] | ||
fields: [ | ||
{name: 'hostname', type: 'string'}, | ||
{name: 'key', type: 'string'} | ||
] | ||
}); |
Ext.define('eMan.store.Log', { | ||
extend: 'Ext.data.Store' | ||
extend: 'Ext.data.Store', | ||
,model: 'eMan.model.LogEntry' | ||
}); | ||
model: 'eMan.model.LogEntry' | ||
}); |
Ext.define('eMan.store.Services', { | ||
extend: 'Ext.data.Store' | ||
extend: 'Ext.data.Store', | ||
,model: 'eMan.model.Service' | ||
,autoLoad: true | ||
}); | ||
model: 'eMan.model.Service', | ||
autoLoad: true | ||
}); |
Ext.define('eMan.store.Sites', { | ||
extend: 'Ext.data.Store' | ||
extend: 'Ext.data.Store', | ||
,model: 'eMan.model.Site' | ||
,autoSync: true | ||
,autoLoad: true | ||
model: 'eMan.model.Site', | ||
autoSync: true, | ||
autoLoad: true | ||
}); |
Ext.define('eMan.store.Skeletons', { | ||
extend: 'Ext.data.Store' | ||
,requires: [ | ||
'eMan.model.Skeleton' | ||
,'Ext.data.proxy.LocalStorage' | ||
] | ||
extend: 'Ext.data.Store', | ||
requires: [ | ||
'eMan.model.Skeleton', | ||
'Ext.data.proxy.LocalStorage' | ||
], | ||
,model: 'eMan.model.Skeleton' | ||
model: 'eMan.model.Skeleton', | ||
,proxy: { | ||
type: 'localstorage' | ||
,id: 'emergence-skeletons' | ||
} | ||
proxy: { | ||
type: 'localstorage', | ||
id: 'emergence-skeletons' | ||
} | ||
}); |
Ext.define('eMan.view.log.Grid', { | ||
extend: 'Ext.grid.Panel' | ||
,alias: 'widget.loggrid' | ||
extend: 'Ext.grid.Panel', | ||
alias: 'widget.loggrid', | ||
,title: 'System Log' | ||
,store: 'Log' | ||
,viewConfig: { | ||
emptyText: 'No activity' | ||
} | ||
,initComponent: function() { | ||
this.columns = [{ | ||
xtype: 'datecolumn' | ||
,text: 'Timestamp' | ||
,dataIndex: 'timestamp' | ||
,format: 'Y-m-d h:i:s' | ||
,width: 120 | ||
},{ | ||
text: 'Message' | ||
,dataIndex: 'message' | ||
,flex: 1 | ||
}]; | ||
title: 'System Log', | ||
store: 'Log', | ||
viewConfig: { | ||
emptyText: 'No activity' | ||
}, | ||
this.callParent(arguments); | ||
} | ||
initComponent: function () { | ||
}); | ||
this.columns = [{ | ||
xtype: 'datecolumn', | ||
text: 'Timestamp', | ||
dataIndex: 'timestamp', | ||
format: 'Y-m-d h:i:s', | ||
width: 120 | ||
},{ | ||
text: 'Message', | ||
dataIndex: 'message', | ||
flex: 1 | ||
}]; | ||
this.callParent(arguments); | ||
} | ||
}); |
Ext.define('eMan.view.services.Grid', { | ||
extend: 'Ext.grid.Panel' | ||
,alias: 'widget.servicesgrid' | ||
extend: 'Ext.grid.Panel', | ||
alias: 'widget.servicesgrid', | ||
,title: 'System Services' | ||
,store: 'Services' | ||
,viewConfig: { | ||
emptyText: 'No sites loaded' | ||
} | ||
,initComponent: function() { | ||
this.tools = [{ | ||
type: 'refresh' | ||
,tooltip: 'Refresh services status' | ||
}]; | ||
this.columns = [{ | ||
text: 'Name' | ||
,dataIndex: 'name' | ||
,flex: 1 | ||
},{ | ||
text: 'Status' | ||
,dataIndex: 'status' | ||
,width: 100 | ||
}]; | ||
title: 'System Services', | ||
store: 'Services', | ||
viewConfig: { | ||
emptyText: 'No sites loaded' | ||
}, | ||
this.callParent(arguments); | ||
} | ||
initComponent: function () { | ||
}); | ||
this.tools = [{ | ||
type: 'refresh', | ||
tooltip: 'Refresh services status' | ||
}]; | ||
this.columns = [{ | ||
text: 'Name', | ||
dataIndex: 'name', | ||
flex: 1 | ||
},{ | ||
text: 'Status', | ||
dataIndex: 'status', | ||
width: 100 | ||
}]; | ||
this.callParent(arguments); | ||
} | ||
}); |
Ext.define('eMan.view.site.CreateForm', { | ||
extend: 'Ext.form.Panel' | ||
,alias: 'widget.sitecreate' | ||
extend: 'Ext.form.Panel', | ||
alias: 'widget.sitecreate', | ||
,bodyPadding: 15 | ||
,autoScroll: true | ||
,border: false | ||
,defaultType: 'textfield' | ||
,fieldDefaults: { | ||
anchor: '100%' | ||
,labelAlign: 'right' | ||
,labelWidth: 110 | ||
} | ||
bodyPadding: 15, | ||
autoScroll: true, | ||
border: false, | ||
defaultType: 'textfield', | ||
fieldDefaults: { | ||
anchor: '100%', | ||
labelAlign: 'right', | ||
labelWidth: 110 | ||
}, | ||
,initComponent: function() { | ||
initComponent: function () { | ||
this.buttons = [{ | ||
xtype: 'button' | ||
,text: 'Cancel' | ||
,action: 'cancel' | ||
},{ | ||
xtype: 'button' | ||
,text: 'Save Site »' | ||
,formBind: true | ||
//,disabled: true | ||
,action: 'save' | ||
}]; | ||
this.buttons = [{ | ||
xtype: 'button', | ||
text: 'Cancel', | ||
action: 'cancel' | ||
},{ | ||
xtype: 'button', | ||
text: 'Save Site »', | ||
formBind: true, | ||
//,disabled: true | ||
action: 'save' | ||
}]; | ||
this.items = [{ | ||
fieldLabel: 'Site Label' | ||
,name: 'label' | ||
,allowBlank: false | ||
,listeners: { | ||
scope: this | ||
,blur: function(labelfield) { | ||
this.items = [{ | ||
fieldLabel: 'Site Label', | ||
name: 'label', | ||
allowBlank: false, | ||
listeners: { | ||
scope: this, | ||
blur: function (labelfield) { | ||
var handleField = this.getForm().findField('handle'); | ||
if(!handleField.getValue() && labelfield.getValue()) | ||
if (!handleField.getValue() && labelfield.getValue()) | ||
{ | ||
@@ -44,29 +44,29 @@ handleField.setValue(labelfield.getValue().toLowerCase().replace(/\s+/g,'-').replace(/[^a-z0-9\-]/g,'')); | ||
},{ | ||
fieldLabel: 'Handle' | ||
,name: 'handle' | ||
,allowBlank: false | ||
,maxLength: 16 | ||
fieldLabel: 'Handle', | ||
name: 'handle', | ||
allowBlank: false, | ||
maxLength: 16 | ||
},{ | ||
fieldLabel: 'Primary Hostname' | ||
,name: 'primary_hostname' | ||
,allowBlank: false | ||
,listeners: { | ||
scope: this | ||
,focus: function(priField) { | ||
var handleField = this.getForm().findField('handle') | ||
,defaultSuffix = eMan.app.serverConfig.defaultSuffix;; | ||
fieldLabel: 'Primary Hostname', | ||
name: 'primary_hostname', | ||
allowBlank: false, | ||
listeners: { | ||
scope: this, | ||
focus: function (priField) { | ||
var handleField = this.getForm().findField('handle'), | ||
defaultSuffix = eMan.app.serverConfig.defaultSuffix;; | ||
if(!priField.getValue() && handleField.getValue() && defaultSuffix) | ||
if (!priField.getValue() && handleField.getValue() && defaultSuffix) | ||
{ | ||
priField.setValue(handleField.getValue() + '.' + defaultSuffix); | ||
} | ||
} | ||
,blur: function(priField) { | ||
}, | ||
blur: function (priField) { | ||
var secField = this.getForm().findField('hostnames'); | ||
if(!secField.getValue() && priField.getValue()) | ||
if (!secField.getValue() && priField.getValue()) | ||
{ | ||
if(priField.getValue().substr(0,4) == 'www.') | ||
if (priField.getValue().substr(0,4) == 'www.') | ||
priField.setValue(priField.getValue().substr(4)); | ||
if(priField.getValue().split('.').length == 2) | ||
if (priField.getValue().split('.').length == 2) | ||
secField.setValue('www.'+priField.getValue()); | ||
@@ -77,11 +77,11 @@ } | ||
},{ | ||
fieldLabel: 'Alt. Hostnames' | ||
,name: 'hostnames' | ||
,listeners: { | ||
scope: this | ||
,focus: function(secField) { | ||
var handleField = this.getForm().findField('handle') | ||
,defaultSuffix = eMan.app.serverConfig.defaultSuffix | ||
,defaultHostname = defaultSuffix && (handleField.getValue() + '.' + defaultSuffix) | ||
,altHostnames = Ext.Array.clean(secField.getValue().split(/\s*,\s*/)); | ||
fieldLabel: 'Alt. Hostnames', | ||
name: 'hostnames', | ||
listeners: { | ||
scope: this, | ||
focus: function (secField) { | ||
var handleField = this.getForm().findField('handle'), | ||
defaultSuffix = eMan.app.serverConfig.defaultSuffix, | ||
defaultHostname = defaultSuffix && (handleField.getValue() + '.' + defaultSuffix), | ||
altHostnames = Ext.Array.clean(secField.getValue().split(/\s*,\s*/)); | ||
@@ -96,21 +96,21 @@ if (defaultHostname && !secField.defaultAdded && !Ext.Array.contains(altHostnames, defaultHostname)) { | ||
},{ | ||
fieldLabel: 'Parent Site' | ||
,xtype: 'combo' | ||
,name: 'parent_hostname' | ||
,autoSelect: false | ||
,emptyText: 'Select or enter hostname' | ||
,displayField: 'hostname' | ||
,valueField: 'hostname' | ||
,store: 'Skeletons' | ||
,queryMode: 'local' | ||
,listeners: { | ||
scope: this | ||
,select: function(hostField) { | ||
fieldLabel: 'Parent Site', | ||
xtype: 'combo', | ||
name: 'parent_hostname', | ||
autoSelect: false, | ||
emptyText: 'Select or enter hostname', | ||
displayField: 'hostname', | ||
valueField: 'hostname', | ||
store: 'Skeletons', | ||
queryMode: 'local', | ||
listeners: { | ||
scope: this, | ||
select: function (hostField) { | ||
var keyField = this.getForm().findField('parent_key'); | ||
if(hostField.getValue()) | ||
if (hostField.getValue()) | ||
{ | ||
var hostRecord = hostField.findRecordByValue(hostField.getValue()); | ||
if(hostRecord && hostRecord.get('key')) | ||
if (hostRecord && hostRecord.get('key')) | ||
keyField.setValue(hostRecord.get('key')); | ||
@@ -127,21 +127,21 @@ else | ||
},{ | ||
fieldLabel: 'Parent Access Key' | ||
,name: 'parent_key' | ||
fieldLabel: 'Parent Access Key', | ||
name: 'parent_key' | ||
},{ | ||
xtype: 'fieldset' | ||
,title: 'First User' | ||
,defaultType: 'textfield' | ||
,fieldDefaults: { | ||
xtype: 'fieldset', | ||
title: 'First User', | ||
defaultType: 'textfield', | ||
fieldDefaults: { | ||
anchor: '100%' | ||
} | ||
,items: [{ | ||
fieldLabel: 'Email' | ||
,name: 'user_email' | ||
,listeners: { | ||
scope: this | ||
,blur: function(emailField) { | ||
var userField = this.getForm().findField('user_username') | ||
,email = emailField.getValue(); | ||
}, | ||
items: [{ | ||
fieldLabel: 'Email', | ||
name: 'user_email', | ||
listeners: { | ||
scope: this, | ||
blur: function (emailField) { | ||
var userField = this.getForm().findField('user_username'), | ||
email = emailField.getValue(); | ||
if(!userField.getValue() && email) | ||
if (!userField.getValue() && email) | ||
{ | ||
@@ -153,19 +153,19 @@ userField.setValue(email.substr(0, email.indexOf('@'))); | ||
},{ | ||
fieldLabel: 'Username' | ||
,name: 'user_username' | ||
fieldLabel: 'Username', | ||
name: 'user_username' | ||
},{ | ||
fieldLabel: 'Password' | ||
,inputType: 'password' | ||
,name: 'user_password' | ||
fieldLabel: 'Password', | ||
inputType: 'password', | ||
name: 'user_password' | ||
},{ | ||
fieldLabel: 'First name' | ||
,name: 'user_first' | ||
fieldLabel: 'First name', | ||
name: 'user_first' | ||
},{ | ||
fieldLabel: 'Last name' | ||
,name: 'user_last' | ||
fieldLabel: 'Last name', | ||
name: 'user_last' | ||
}] | ||
}]; | ||
this.callParent(arguments); | ||
} | ||
this.callParent(arguments); | ||
} | ||
}); |
@@ -35,3 +35,3 @@ Ext.define('eMan.view.site.DeveloperForm', { | ||
listeners: { | ||
blur: function(emailField) { | ||
blur: function (emailField) { | ||
var userField = this.next('field[name=Username]'), | ||
@@ -59,2 +59,2 @@ email = emailField.getValue(); | ||
}] | ||
}); | ||
}); |
Ext.define('eMan.view.site.Grid', { | ||
extend: 'Ext.grid.Panel' | ||
,alias: 'widget.sitegrid' | ||
extend: 'Ext.grid.Panel', | ||
alias: 'widget.sitegrid', | ||
,title: 'Sites' | ||
,store: 'Sites' | ||
,viewConfig: { | ||
emptyText: 'No sites loaded' | ||
} | ||
,initComponent: function() { | ||
this.dockedItems = [{ | ||
xtype: 'toolbar' | ||
,dock: 'top' | ||
,items: [{ | ||
xtype: 'button' | ||
,action: 'create' | ||
,text: 'Create Site' | ||
,scope: this | ||
,handler: this.onCreateSitePress | ||
}] | ||
}]; | ||
this.columns = [{ | ||
text: 'Label' | ||
,dataIndex: 'label' | ||
,width: 200 | ||
,renderer: function(v, metaData) { | ||
if(v) | ||
return v; | ||
metaData.tdCls = 'x-cell-empty'; | ||
return 'Unlabeled Site'; | ||
} | ||
},{ | ||
text: 'Handle' | ||
,dataIndex: 'handle' | ||
,width: 150 | ||
},{ | ||
text: 'Primary Hostname' | ||
,dataIndex: 'primary_hostname' | ||
,width: 150 | ||
,renderer: function(v, metaData) { | ||
if(v) | ||
return '<a href="http://'+v+'" target="_blank">'+v+'</a>'; | ||
} | ||
},{ | ||
text: 'Hostnames' | ||
,dataIndex: 'hostnames' | ||
,flex: 1 | ||
,renderer: function(v) { | ||
return typeof v == 'string' ? v : v.join(', '); | ||
} | ||
},{ | ||
text: 'Parent Hostname' | ||
,dataIndex: 'parent_hostname' | ||
,width: 150 | ||
,renderer: function(v, metaData) { | ||
if(v) | ||
return v; | ||
metaData.tdCls = 'x-cell-empty'; | ||
return 'None'; | ||
} | ||
},{ | ||
text: 'Inheritance Key' | ||
,dataIndex: 'inheritance_key' | ||
,width: 150 | ||
}]; | ||
title: 'Sites', | ||
store: 'Sites', | ||
viewConfig: { | ||
emptyText: 'No sites loaded' | ||
}, | ||
this.callParent(arguments); | ||
} | ||
initComponent: function () { | ||
this.dockedItems = [{ | ||
xtype: 'toolbar', | ||
dock: 'top', | ||
items: [{ | ||
xtype: 'button', | ||
action: 'create', | ||
text: 'Create Site', | ||
scope: this, | ||
handler: this.onCreateSitePress | ||
}] | ||
}]; | ||
}); | ||
this.columns = [{ | ||
text: 'Label', | ||
dataIndex: 'label', | ||
width: 200, | ||
renderer: function (v, metaData) { | ||
if (v) | ||
return v; | ||
metaData.tdCls = 'x-cell-empty'; | ||
return 'Unlabeled Site'; | ||
} | ||
},{ | ||
text: 'Handle', | ||
dataIndex: 'handle', | ||
width: 150 | ||
},{ | ||
text: 'Primary Hostname', | ||
dataIndex: 'primary_hostname', | ||
width: 150, | ||
renderer: function (v) { | ||
if (v) | ||
return '<a href="http://'+v+'" target="_blank">'+v+'</a>'; | ||
} | ||
},{ | ||
text: 'Hostnames', | ||
dataIndex: 'hostnames', | ||
flex: 1, | ||
renderer: function (v) { | ||
return typeof v == 'string' ? v : v.join(', '); | ||
} | ||
},{ | ||
text: 'Parent Hostname', | ||
dataIndex: 'parent_hostname', | ||
width: 150, | ||
renderer: function (v, metaData) { | ||
if (v) | ||
return v; | ||
metaData.tdCls = 'x-cell-empty'; | ||
return 'None'; | ||
} | ||
},{ | ||
text: 'Inheritance Key', | ||
dataIndex: 'inheritance_key', | ||
width: 150 | ||
}]; | ||
this.callParent(arguments); | ||
} | ||
}); |
Ext.define('eMan.view.site.Menu', { | ||
extend: 'Ext.menu.Menu' | ||
,alias: 'widget.sitemenu' | ||
extend: 'Ext.menu.Menu', | ||
alias: 'widget.sitemenu', | ||
,items: [{ | ||
text: 'Create inheriting site' | ||
,action: 'create-inheriting' | ||
items: [{ | ||
text: 'Create inheriting site', | ||
action: 'create-inheriting' | ||
//,icon: '/img/icons/fugue/blue-document.png' | ||
},{ | ||
text: 'Create developer user' | ||
,action: 'create-developer' | ||
text: 'Create developer user', | ||
action: 'create-developer' | ||
}] | ||
}); |
Ext.define('eMan.view.Viewport', { | ||
extend: 'Ext.container.Viewport' | ||
extend: 'Ext.container.Viewport', | ||
,layout: 'border' | ||
,initComponent: function() { | ||
this.tbar = ['Create a new site']; | ||
this.items = [{ | ||
region: 'north' | ||
,layout: { | ||
type: 'hbox' | ||
,align: 'stretch' | ||
} | ||
,height: 200 | ||
,items: [{ | ||
xtype: 'servicesgrid' | ||
,width: 300 | ||
},{ | ||
xtype: 'loggrid' | ||
,flex: 1 | ||
}] | ||
},{ | ||
region: 'center' | ||
,xtype: 'sitegrid' | ||
}]; | ||
this.callParent(arguments); | ||
} | ||
layout: 'border', | ||
initComponent: function () { | ||
this.tbar = ['Create a new site']; | ||
this.items = [{ | ||
region: 'north', | ||
layout: { | ||
type: 'hbox', | ||
align: 'stretch' | ||
}, | ||
height: 200, | ||
items: [{ | ||
xtype: 'servicesgrid', | ||
width: 300 | ||
},{ | ||
xtype: 'loggrid', | ||
flex: 1 | ||
}] | ||
},{ | ||
region: 'center', | ||
xtype: 'sitegrid' | ||
}]; | ||
this.callParent(arguments); | ||
} | ||
}); |
{ | ||
"name": "emergence", | ||
"preferGlobal": true, | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -1,3 +0,2 @@ | ||
Emergence | ||
========= | ||
# Emergence | ||
@@ -8,38 +7,31 @@ [![Join the chat at https://gitter.im/JarvusInnovations/Emergence](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/JarvusInnovations/Emergence?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
## Features | ||
Features | ||
--------- | ||
* Rich web interface provides for all setup and management | ||
* Plugin-based support for system services to be configured and run | ||
* Plugins included for nginx and mysql | ||
* Versioned storage containers | ||
* Inherit remote containers over http | ||
* Copy-on-write | ||
* Accessible remotely via WebDAV and locally via API | ||
* PHP development framework | ||
* Classes automatically loaded from storage container | ||
* Lightweight MVC classes optimized for serial inheritance across sites | ||
* Extendable templating system powered by Dwoo | ||
- Rich web interface provides for all setup and management | ||
- Plugin-based support for system services to be configured and run | ||
- Plugins included for nginx and mysql | ||
- Versioned storage containers | ||
- Inherit remote containers over http | ||
- Copy-on-write | ||
- Accessible remotely via WebDAV and locally via API | ||
- PHP development framework | ||
- Classes automatically loaded from storage container | ||
- Lightweight MVC classes optimized for serial inheritance across sites | ||
- Extendable templating system powered by Dwoo | ||
## Requirements | ||
Requirements | ||
------------- | ||
* NodeJS | ||
* npm | ||
* underscore | ||
* node-static | ||
* mysql | ||
* nginx | ||
* php-fpm | ||
* php 5.3+ | ||
* apc | ||
* mysqli | ||
- NodeJS | ||
- npm | ||
- mysql | ||
- nginx | ||
- php-fpm | ||
- php 5.6+ | ||
- apcu | ||
- mysqli | ||
## Installation | ||
Installation | ||
-------------- | ||
See http://emr.ge/docs | ||
See [http://emr.ge/docs](http://emr.ge/docs) | ||
Visit http://serverhost:9083 in your browser | ||
Visit [http://serverhost:9083](http://serverhost:9083) in your browser |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
241690
63
2143
8
37