Skip to content

Commit

Permalink
Fix TS bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ToToSe committed Jun 9, 2016
1 parent 3f7873f commit 433c84b
Show file tree
Hide file tree
Showing 27 changed files with 1,605 additions and 148 deletions.
4 changes: 2 additions & 2 deletions Plugins/Vorlon/plugins/express/control.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="tree-view-wrapper panel-left">
<div id="treeView3" class="code-text">
<div class="explorer-menu" id="express-routes" style="display:block;">

</div>
<div class="explorer-menu" id="express-request" style="display:none;">

Expand All @@ -19,7 +19,7 @@

</div>
<div class="explorer-menu" id="express-locals" style="display:none;">

</div>
</div>
</div>
Expand Down
54 changes: 54 additions & 0 deletions Plugins/Vorlon/plugins/express/vorlon.express.client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var VORLON;
(function (VORLON) {
var ExpressClient = (function (_super) {
__extends(ExpressClient, _super);
function ExpressClient() {
_super.call(this, "express");
this.hooked = false;
this._ready = true;
console.log('Started');
}
ExpressClient.prototype.getID = function () {
return "NODEJS";
};
ExpressClient.prototype.refresh = function () {
};
ExpressClient.prototype.startClientSide = function () {
};
ExpressClient.prototype.setupExpressHook = function () {
console.log('Hooking express');
var expressSource;
if (!VORLON.Tools.IsWindowAvailable) {
if (!this._hookAlreadyDone) {
this._hookAlreadyDone = true;
var express = require('express');
}
}
this.hooked = true;
};
ExpressClient.prototype._hookPrototype = function (that, expressSource) {
if (!this._previousExpress) {
this._previousExpress = expressSource.application.init;
}
expressSource.application.init = function () {
console.log('IN EXPRESS !');
return that._previousExpress.apply(this);
};
};
ExpressClient.prototype.onRealtimeMessageReceivedFromDashboardSide = function (receivedObject) {
if (!VORLON.Tools.IsWindowAvailable) {
if (receivedObject == 'express') {
this.sendToDashboard({ type: 'express', data: global.express_vorlonJS });
}
}
};
return ExpressClient;
}(VORLON.ClientPlugin));
VORLON.ExpressClient = ExpressClient;
VORLON.Core.RegisterClientPlugin(new ExpressClient());
})(VORLON || (VORLON = {}));

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 16 additions & 12 deletions Plugins/Vorlon/plugins/express/vorlon.express.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module VORLON {
private _expressSource;
private _hookAlreadyDone;
public hooked: boolean = false;

constructor() {
super("express"); // Name
this._ready = true; // No need to wait
Expand All @@ -27,28 +27,30 @@ module VORLON {

// Start the clientside code
public startClientSide(): void {
this.setupExpressHook();
//this.setupExpressHook();
}

public setupExpressHook(){
console.log('Hooking express');

var expressSource;

if (!Tools.IsWindowAvailable) {
if (!this._hookAlreadyDone) {
this._hookAlreadyDone = true;
var express = require('express');
var express = require('express');
}
}
}

this.hooked = true;
}

private _hookPrototype(that, expressSource) {
if(!this._previousExpress){
this._previousExpress = expressSource.response.ServerResponse.send;
if(!this._previousExpress){
this._previousExpress = expressSource.application.init;
}
expressSource.response.ServerResponse.send = function() {

expressSource.application.init = function() {
console.log('IN EXPRESS !');
return that._previousExpress.apply(this);
}
Expand All @@ -57,8 +59,10 @@ module VORLON {
// Handle messages from the dashboard, on the client
public onRealtimeMessageReceivedFromDashboardSide(receivedObject: any): void {
if (!Tools.IsWindowAvailable) {

}
if (receivedObject == 'express') {
this.sendToDashboard({ type: 'express', data: global.express_vorlonJS});
}
}
}
}

Expand Down
20 changes: 20 additions & 0 deletions Plugins/Vorlon/plugins/express/vorlon.express.dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ var VORLON;
ExpressDashboard.prototype.startDashboardSide = function (div) {
var _this = this;
if (div === void 0) { div = null; }
this.sendToClient('express');
this._insertHtmlContentAsync(div, function (filledDiv) {
_this.toogleMenu();
});
};
ExpressDashboard.prototype.setRoutes = function () {
this._express._router.stack.filter(function (r) { return r.route; }).map(function (r) {
var route = '<p> ' + r.route.path + ' - [';
for (var key in r.route.methods) {
route += key + ' ';
}
route += '] </p>';
$('#express-routes').append(route);
});
};
ExpressDashboard.prototype.toogleMenu = function () {
$('.plugin-express .open-menu').click(function () {
$('.plugin-express .open-menu').removeClass('active-menu');
Expand All @@ -33,6 +44,15 @@ var VORLON;
});
};
ExpressDashboard.prototype.onRealtimeMessageReceivedFromClientSide = function (receivedObject) {
if (receivedObject.type == 'express') {
this._express = receivedObject.data;
if (typeof this._express === 'undefined') {
alert('EXPRESS IN NOT DEFINED (express_vorlonJS)');
}
else {
this.setRoutes();
}
}
};
return ExpressDashboard;
}(VORLON.DashboardPlugin));
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion Plugins/Vorlon/plugins/express/vorlon.express.dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,27 @@ module VORLON {
// into the dashboard
private _inputField: HTMLInputElement
private _outputDiv: HTMLElement
private _express: any

public startDashboardSide(div: HTMLDivElement = null): void {
this.sendToClient('express');
this._insertHtmlContentAsync(div, (filledDiv) => {
this.toogleMenu();
})
}

public setRoutes(): void {
console.log('6', this._express);
this._express._router.stack.filter(r => r.route).map(r => {
var route = '<p> ' + r.route.path + ' - [';
for (var key in r.route.methods) {
route += key + ' ';
}
route += '] </p>';
$('#express-routes').append(route);
});
}

public toogleMenu(): void {
$('.plugin-express .open-menu').click(function() {
$('.plugin-express .open-menu').removeClass('active-menu');
Expand All @@ -44,7 +58,17 @@ module VORLON {
}

public onRealtimeMessageReceivedFromClientSide(receivedObject: any): void {

console.log('3', receivedObject);
if (receivedObject.type == 'express') {
console.log('4');
this._express = receivedObject.data;
if (typeof this._express === 'undefined') {
alert('EXPRESS IN NOT DEFINED (express_vorlonJS)');
} else {
console.log('5');
this.setRoutes();
}
}
}
}

Expand Down
74 changes: 74 additions & 0 deletions Plugins/Vorlon/plugins/nodejs/vorlon.nodejs.client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var VORLON;
(function (VORLON) {
var NodejsClient = (function (_super) {
__extends(NodejsClient, _super);
function NodejsClient() {
_super.call(this, "nodejs");
this._ready = true;
console.log('Started');
}
NodejsClient.prototype.getID = function () {
return "NODEJS";
};
NodejsClient.prototype.refresh = function () {
};
NodejsClient.prototype.startClientSide = function () {
console.log('client');
};
NodejsClient.prototype.simpleStringify = function (object) {
var simpleObject = {};
for (var prop in object) {
if (!object.hasOwnProperty(prop)) {
continue;
}
if (typeof (object[prop]) == 'object') {
continue;
}
if (typeof (object[prop]) == 'function') {
continue;
}
simpleObject[prop] = object[prop];
}
return JSON.stringify(simpleObject);
};
;
NodejsClient.prototype.onRealtimeMessageReceivedFromDashboardSide = function (receivedObject) {
if (!VORLON.Tools.IsWindowAvailable) {
if (receivedObject == 'modules') {
this.sendToDashboard({ type: 'modules', data: Object.keys(require('module')._cache) });
}
else if (receivedObject == 'infos') {
this.sendToDashboard({ type: 'infos', data: {
title: process.title,
version: process.version,
platform: process.platform,
arch: process.arch,
debugPort: process['debugPort'],
pid: process.pid,
USERNAME: process.env.USERNAME,
USERDOMAIN_ROAMINGPROFILE: process.env.USERDOMAIN_ROAMINGPROFILE,
USERPROFILE: process.env.USERPROFILE,
WINDIR: process.env.WINDIR,
UATDATA: process.env.UATDATA,
USERDOMAIN: process.env.USERDOMAIN,
} });
}
else if (receivedObject == 'memory') {
var _that = this;
_that.sendToDashboard({ type: 'memory', data: process.memoryUsage() });
setInterval(function () {
_that.sendToDashboard({ type: 'memory', data: process.memoryUsage() });
}, 5000);
}
}
};
return NodejsClient;
}(VORLON.ClientPlugin));
VORLON.NodejsClient = NodejsClient;
VORLON.Core.RegisterClientPlugin(new NodejsClient());
})(VORLON || (VORLON = {}));
1 change: 1 addition & 0 deletions Plugins/Vorlon/plugins/nodejs/vorlon.nodejs.client.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions Plugins/Vorlon/plugins/nodejs/vorlon.nodejs.client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module VORLON {

export class NodejsClient extends ClientPlugin {

constructor() {
Expand All @@ -25,8 +26,8 @@ module VORLON {
public startClientSide(): void {
console.log('client');
}
public simpleStringify (object :any): void {

public simpleStringify (object :any): any {
var simpleObject = {};
for (var prop in object ){
if (!object.hasOwnProperty(prop)){
Expand Down Expand Up @@ -54,7 +55,7 @@ module VORLON {
version: process.version,
platform: process.platform,
arch: process.arch,
debugPort: process.debugPort,
debugPort: process['debugPort'],
pid: process.pid,
USERNAME: process.env.USERNAME,
USERDOMAIN_ROAMINGPROFILE: process.env.USERDOMAIN_ROAMINGPROFILE,
Expand All @@ -65,12 +66,12 @@ module VORLON {
}});
} else if (receivedObject == 'memory') {
var _that = this;
_that.sendToDashboard({ type: 'memory', data: process.memoryUsage()});
_that.sendToDashboard({ type: 'memory', data: process.memoryUsage()});
setInterval(function() {
_that.sendToDashboard({ type: 'memory', data: process.memoryUsage()});
_that.sendToDashboard({ type: 'memory', data: process.memoryUsage()});
}, 5000);
}
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions Plugins/Vorlon/plugins/nodejs/vorlon.nodejs.dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ var VORLON;
this._insertHtmlContentAsync(div, function (filledDiv) {
_this.toogleMenu();
_this._time = 0;
_this._ctx = document.getElementById("memory-chart").getContext("2d");
_this._ctx = document.getElementById("memory-chart");
_this._ctx = _this._ctx.getContext("2d");
_this._chart_data = {
labels: [],
datasets: [
Expand Down Expand Up @@ -157,7 +158,6 @@ var VORLON;
if (receivedObject.type == 'modules') {
var list = receivedObject.data;
var data = [];
console.log(list);
for (var i = 0; i < list.length; i++) {
list[i] = list[i].split("\\");
for (var z = 0; z < list[i].length; z++) {
Expand Down
Loading

0 comments on commit 433c84b

Please sign in to comment.