• R/O
  • HTTP
  • SSH
  • HTTPS

zephyr: Commit

This repository is for zephyr, which is implemented for a GUI of Eos.


Commit MetaInfo

Revision4affb69f890ca0e09cbe4789f6f466e26366e473 (tree)
Time2016-02-19 19:02:47
Authorhimetani_cafe <fumifumi@yasu...>
Commiterhimetani_cafe

Log Message

[Develop and Manual Test] show help with websocket

Change Summary

Incremental Difference

--- a/front-end/app/index.html
+++ b/front-end/app/index.html
@@ -2,7 +2,8 @@
22 <html>
33 <head lang="en">
44 <meta charset="UTF-8">
5- <title>Zephyrだよ</title>
5+ <title>Zephyr</title>
6+ <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
67 <link rel="stylesheet" href="./css/style.css">
78 </head>
89 <body ng-app="zephyr">
--- a/front-end/app/scripts/directives/Command.ts
+++ b/front-end/app/scripts/directives/Command.ts
@@ -162,5 +162,13 @@ namespace app.directives {
162162 });
163163 }
164164
165+ public help() {
166+ this.APIEndPoint
167+ .help(this.name)
168+ .then((result) => {
169+ console.log(result);
170+ });
171+ }
172+
165173 }
166174 }
--- a/front-end/app/scripts/services/APIEndPoint.ts
+++ b/front-end/app/scripts/services/APIEndPoint.ts
@@ -73,5 +73,10 @@ namespace app.services {
7373 var endPoint = '/api/v1/debug';
7474 return this.$http.get(endPoint);
7575 }
76+ public help(command:string): ng.IHttpPromise<string> {
77+ var endPoint = '/api/v1/help/' + command;
78+ return this.$http.get(endPoint);
79+ }
80+
7681 }
7782 }
--- a/front-end/app/style.scss
+++ b/front-end/app/style.scss
@@ -17,6 +17,9 @@ $panel-bg: #eee;
1717 height: 100%;
1818 }
1919
20+.console-body p {
21+ font-family: 'Open Sans';
22+}
2023 // Import libs
2124 // --------------------
2225 @import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
--- a/front-end/app/templates/command.html
+++ b/front-end/app/templates/command.html
@@ -42,9 +42,10 @@
4242 </div>
4343 <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
4444 <h4>Message from console</h4>
45+ <button type="button" class="btn btn-default" ng-click="ctrl.help()">show help</button>
4546 <div class="panel-info">
4647 <div class="panel-body console-body">
47- <p ng-repeat="msg in ctrl.messages track by $index" class="lead">{{msg}}</p>
48+ <p ng-repeat="msg in ctrl.messages track by $index">{{msg}}</p>
4849 </div>
4950 </div>
5051 </div>
--- a/front-end/dist/bundle.js
+++ b/front-end/dist/bundle.js
@@ -41070,6 +41070,10 @@
4107041070 var endPoint = '/api/v1/debug';
4107141071 return this.$http.get(endPoint);
4107241072 };
41073+ APIEndPoint.prototype.help = function (command) {
41074+ var endPoint = '/api/v1/help/' + command;
41075+ return this.$http.get(endPoint);
41076+ };
4107341077 return APIEndPoint;
4107441078 })();
4107541079 services.APIEndPoint = APIEndPoint;
@@ -41266,6 +41270,13 @@
4126641270 console.log(result);
4126741271 });
4126841272 };
41273+ CommandController.prototype.help = function () {
41274+ this.APIEndPoint
41275+ .help(this.name)
41276+ .then(function (result) {
41277+ console.log(result);
41278+ });
41279+ };
4126941280 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4127041281 return CommandController;
4127141282 })();
@@ -41678,6 +41689,10 @@
4167841689 var endPoint = '/api/v1/debug';
4167941690 return this.$http.get(endPoint);
4168041691 };
41692+ APIEndPoint.prototype.help = function (command) {
41693+ var endPoint = '/api/v1/help/' + command;
41694+ return this.$http.get(endPoint);
41695+ };
4168141696 return APIEndPoint;
4168241697 })();
4168341698 services.APIEndPoint = APIEndPoint;
@@ -41874,6 +41889,13 @@
4187441889 console.log(result);
4187541890 });
4187641891 };
41892+ CommandController.prototype.help = function () {
41893+ this.APIEndPoint
41894+ .help(this.name)
41895+ .then(function (result) {
41896+ console.log(result);
41897+ });
41898+ };
4187741899 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4187841900 return CommandController;
4187941901 })();
@@ -42286,6 +42308,10 @@
4228642308 var endPoint = '/api/v1/debug';
4228742309 return this.$http.get(endPoint);
4228842310 };
42311+ APIEndPoint.prototype.help = function (command) {
42312+ var endPoint = '/api/v1/help/' + command;
42313+ return this.$http.get(endPoint);
42314+ };
4228942315 return APIEndPoint;
4229042316 })();
4229142317 services.APIEndPoint = APIEndPoint;
@@ -42482,6 +42508,13 @@
4248242508 console.log(result);
4248342509 });
4248442510 };
42511+ CommandController.prototype.help = function () {
42512+ this.APIEndPoint
42513+ .help(this.name)
42514+ .then(function (result) {
42515+ console.log(result);
42516+ });
42517+ };
4248542518 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4248642519 return CommandController;
4248742520 })();
@@ -42894,6 +42927,10 @@
4289442927 var endPoint = '/api/v1/debug';
4289542928 return this.$http.get(endPoint);
4289642929 };
42930+ APIEndPoint.prototype.help = function (command) {
42931+ var endPoint = '/api/v1/help/' + command;
42932+ return this.$http.get(endPoint);
42933+ };
4289742934 return APIEndPoint;
4289842935 })();
4289942936 services.APIEndPoint = APIEndPoint;
@@ -43090,6 +43127,13 @@
4309043127 console.log(result);
4309143128 });
4309243129 };
43130+ CommandController.prototype.help = function () {
43131+ this.APIEndPoint
43132+ .help(this.name)
43133+ .then(function (result) {
43134+ console.log(result);
43135+ });
43136+ };
4309343137 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4309443138 return CommandController;
4309543139 })();
@@ -43502,6 +43546,10 @@
4350243546 var endPoint = '/api/v1/debug';
4350343547 return this.$http.get(endPoint);
4350443548 };
43549+ APIEndPoint.prototype.help = function (command) {
43550+ var endPoint = '/api/v1/help/' + command;
43551+ return this.$http.get(endPoint);
43552+ };
4350543553 return APIEndPoint;
4350643554 })();
4350743555 services.APIEndPoint = APIEndPoint;
@@ -43698,6 +43746,13 @@
4369843746 console.log(result);
4369943747 });
4370043748 };
43749+ CommandController.prototype.help = function () {
43750+ this.APIEndPoint
43751+ .help(this.name)
43752+ .then(function (result) {
43753+ console.log(result);
43754+ });
43755+ };
4370143756 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4370243757 return CommandController;
4370343758 })();
@@ -44110,6 +44165,10 @@
4411044165 var endPoint = '/api/v1/debug';
4411144166 return this.$http.get(endPoint);
4411244167 };
44168+ APIEndPoint.prototype.help = function (command) {
44169+ var endPoint = '/api/v1/help/' + command;
44170+ return this.$http.get(endPoint);
44171+ };
4411344172 return APIEndPoint;
4411444173 })();
4411544174 services.APIEndPoint = APIEndPoint;
@@ -44306,6 +44365,13 @@
4430644365 console.log(result);
4430744366 });
4430844367 };
44368+ CommandController.prototype.help = function () {
44369+ this.APIEndPoint
44370+ .help(this.name)
44371+ .then(function (result) {
44372+ console.log(result);
44373+ });
44374+ };
4430944375 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4431044376 return CommandController;
4431144377 })();
@@ -44718,6 +44784,10 @@
4471844784 var endPoint = '/api/v1/debug';
4471944785 return this.$http.get(endPoint);
4472044786 };
44787+ APIEndPoint.prototype.help = function (command) {
44788+ var endPoint = '/api/v1/help/' + command;
44789+ return this.$http.get(endPoint);
44790+ };
4472144791 return APIEndPoint;
4472244792 })();
4472344793 services.APIEndPoint = APIEndPoint;
@@ -44914,6 +44984,13 @@
4491444984 console.log(result);
4491544985 });
4491644986 };
44987+ CommandController.prototype.help = function () {
44988+ this.APIEndPoint
44989+ .help(this.name)
44990+ .then(function (result) {
44991+ console.log(result);
44992+ });
44993+ };
4491744994 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4491844995 return CommandController;
4491944996 })();
@@ -45326,6 +45403,10 @@
4532645403 var endPoint = '/api/v1/debug';
4532745404 return this.$http.get(endPoint);
4532845405 };
45406+ APIEndPoint.prototype.help = function (command) {
45407+ var endPoint = '/api/v1/help/' + command;
45408+ return this.$http.get(endPoint);
45409+ };
4532945410 return APIEndPoint;
4533045411 })();
4533145412 services.APIEndPoint = APIEndPoint;
@@ -45522,6 +45603,13 @@
4552245603 console.log(result);
4552345604 });
4552445605 };
45606+ CommandController.prototype.help = function () {
45607+ this.APIEndPoint
45608+ .help(this.name)
45609+ .then(function (result) {
45610+ console.log(result);
45611+ });
45612+ };
4552545613 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4552645614 return CommandController;
4552745615 })();
@@ -45934,6 +46022,10 @@
4593446022 var endPoint = '/api/v1/debug';
4593546023 return this.$http.get(endPoint);
4593646024 };
46025+ APIEndPoint.prototype.help = function (command) {
46026+ var endPoint = '/api/v1/help/' + command;
46027+ return this.$http.get(endPoint);
46028+ };
4593746029 return APIEndPoint;
4593846030 })();
4593946031 services.APIEndPoint = APIEndPoint;
@@ -46130,6 +46222,13 @@
4613046222 console.log(result);
4613146223 });
4613246224 };
46225+ CommandController.prototype.help = function () {
46226+ this.APIEndPoint
46227+ .help(this.name)
46228+ .then(function (result) {
46229+ console.log(result);
46230+ });
46231+ };
4613346232 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4613446233 return CommandController;
4613546234 })();
@@ -46542,6 +46641,10 @@
4654246641 var endPoint = '/api/v1/debug';
4654346642 return this.$http.get(endPoint);
4654446643 };
46644+ APIEndPoint.prototype.help = function (command) {
46645+ var endPoint = '/api/v1/help/' + command;
46646+ return this.$http.get(endPoint);
46647+ };
4654546648 return APIEndPoint;
4654646649 })();
4654746650 services.APIEndPoint = APIEndPoint;
@@ -46738,6 +46841,13 @@
4673846841 console.log(result);
4673946842 });
4674046843 };
46844+ CommandController.prototype.help = function () {
46845+ this.APIEndPoint
46846+ .help(this.name)
46847+ .then(function (result) {
46848+ console.log(result);
46849+ });
46850+ };
4674146851 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4674246852 return CommandController;
4674346853 })();
@@ -47150,6 +47260,10 @@
4715047260 var endPoint = '/api/v1/debug';
4715147261 return this.$http.get(endPoint);
4715247262 };
47263+ APIEndPoint.prototype.help = function (command) {
47264+ var endPoint = '/api/v1/help/' + command;
47265+ return this.$http.get(endPoint);
47266+ };
4715347267 return APIEndPoint;
4715447268 })();
4715547269 services.APIEndPoint = APIEndPoint;
@@ -47346,6 +47460,13 @@
4734647460 console.log(result);
4734747461 });
4734847462 };
47463+ CommandController.prototype.help = function () {
47464+ this.APIEndPoint
47465+ .help(this.name)
47466+ .then(function (result) {
47467+ console.log(result);
47468+ });
47469+ };
4734947470 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4735047471 return CommandController;
4735147472 })();
@@ -47758,6 +47879,10 @@
4775847879 var endPoint = '/api/v1/debug';
4775947880 return this.$http.get(endPoint);
4776047881 };
47882+ APIEndPoint.prototype.help = function (command) {
47883+ var endPoint = '/api/v1/help/' + command;
47884+ return this.$http.get(endPoint);
47885+ };
4776147886 return APIEndPoint;
4776247887 })();
4776347888 services.APIEndPoint = APIEndPoint;
@@ -47954,6 +48079,13 @@
4795448079 console.log(result);
4795548080 });
4795648081 };
48082+ CommandController.prototype.help = function () {
48083+ this.APIEndPoint
48084+ .help(this.name)
48085+ .then(function (result) {
48086+ console.log(result);
48087+ });
48088+ };
4795748089 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4795848090 return CommandController;
4795948091 })();
@@ -48366,6 +48498,10 @@
4836648498 var endPoint = '/api/v1/debug';
4836748499 return this.$http.get(endPoint);
4836848500 };
48501+ APIEndPoint.prototype.help = function (command) {
48502+ var endPoint = '/api/v1/help/' + command;
48503+ return this.$http.get(endPoint);
48504+ };
4836948505 return APIEndPoint;
4837048506 })();
4837148507 services.APIEndPoint = APIEndPoint;
@@ -48562,6 +48698,13 @@
4856248698 console.log(result);
4856348699 });
4856448700 };
48701+ CommandController.prototype.help = function () {
48702+ this.APIEndPoint
48703+ .help(this.name)
48704+ .then(function (result) {
48705+ console.log(result);
48706+ });
48707+ };
4856548708 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4856648709 return CommandController;
4856748710 })();
@@ -48974,6 +49117,10 @@
4897449117 var endPoint = '/api/v1/debug';
4897549118 return this.$http.get(endPoint);
4897649119 };
49120+ APIEndPoint.prototype.help = function (command) {
49121+ var endPoint = '/api/v1/help/' + command;
49122+ return this.$http.get(endPoint);
49123+ };
4897749124 return APIEndPoint;
4897849125 })();
4897949126 services.APIEndPoint = APIEndPoint;
@@ -49170,6 +49317,13 @@
4917049317 console.log(result);
4917149318 });
4917249319 };
49320+ CommandController.prototype.help = function () {
49321+ this.APIEndPoint
49322+ .help(this.name)
49323+ .then(function (result) {
49324+ console.log(result);
49325+ });
49326+ };
4917349327 CommandController.$inject = ['APIEndPoint', '$scope', 'MyModal', 'WebSocket'];
4917449328 return CommandController;
4917549329 })();
--- a/front-end/dist/css/style.css
+++ b/front-end/dist/css/style.css
@@ -12,6 +12,9 @@
1212 background-color: white;
1313 height: 100%; }
1414
15+.console-body p {
16+ font-family: 'Open Sans'; }
17+
1518 /*!
1619 * Bootstrap v3.3.6 (http://getbootstrap.com)
1720 * Copyright 2011-2015 Twitter, Inc.
--- a/front-end/dist/index.html
+++ b/front-end/dist/index.html
@@ -2,7 +2,8 @@
22 <html>
33 <head lang="en">
44 <meta charset="UTF-8">
5- <title>Zephyrだよ</title>
5+ <title>Zephyr</title>
6+ <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
67 <link rel="stylesheet" href="./css/style.css">
78 </head>
89 <body ng-app="zephyr">
--- a/front-end/dist/templates/command.html
+++ b/front-end/dist/templates/command.html
@@ -42,9 +42,10 @@
4242 </div>
4343 <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
4444 <h4>Message from console</h4>
45+ <button type="button" class="btn btn-default" ng-click="ctrl.help()">show help</button>
4546 <div class="panel-info">
4647 <div class="panel-body console-body">
47- <p ng-repeat="msg in ctrl.messages track by $index" class="lead">{{msg}}</p>
48+ <p ng-repeat="msg in ctrl.messages track by $index">{{msg}}</p>
4849 </div>
4950 </div>
5051 </div>
--- /dev/null
+++ b/server/api/v1/help/index.js
@@ -0,0 +1,27 @@
1+'use strict';
2+
3+var express = require('express');
4+var router = express.Router()
5+var path = require('path')
6+var ws = require(__dirname + '/../../../../server/class/WebSocket').instance;
7+var spawn = require('child_process').spawn;
8+
9+var config = {
10+ cwd: ''
11+};
12+
13+router.get('/:command', function(req, res) {
14+ var command = req.params.command;
15+ var runner = spawn(command,['-h'],config);
16+
17+ runner.stderr.on('data', (data) => {
18+ ws.emit('console', data.toString());
19+ });
20+
21+ runner.on('close', function() {
22+ res.send('/api/v1/help/'+command+' success');
23+ });
24+
25+});
26+
27+module.exports = router;
--- a/server/routes.js
+++ b/server/routes.js
@@ -25,6 +25,7 @@ module.exports = function(app) {
2525 app.use('/api/v1/tagList', require(__dirname + '/api/v1/tagList'));
2626 app.use('/api/v1/commandList', require(__dirname + '/api/v1/commandList'));
2727 app.use('/api/v1/debug', require(__dirname + '/api/v1/debug'));
28+ app.use('/api/v1/help', require(__dirname + '/api/v1/help'));
2829
2930 app.route('/*')
3031 .get(function(req, res) {
Show on old repository browser