Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

playing around with user input...

  • Loading branch information...
commit ccdec0a70a895777325d2444d24fd640710f3950 1 parent 4449b6d
@nordenmark authored
View
15 jsfw_pid/handle.html
@@ -1,3 +1,14 @@
-<h1>Handle template for component: jsfw_pid</h1>
+<h1>Information about pid: <span id="pid"></span></h1>
+
+Send message to process: {{input}}
+
+
+<table id="argcontainer" class="console">
+ <thead>
+ <tr>
+ <th>Key</th>
+ <th>Value</th>
+ </tr>
+ </thead>
+</table>
-Argument given: <span id="argcontainer"></span>
View
3  jsfw_pid/jsfw_pid.css
@@ -0,0 +1,3 @@
+.console {
+ font-family: "Consolas";
+}
View
10 jsfw_pid/jsfw_pid.erl
@@ -1,5 +1,5 @@
-module(jsfw_pid).
--export([get/0, get/1]).
+-export([get/0, get/1, input/1]).
get() ->
PIDs = erlang:processes(),
@@ -19,4 +19,10 @@ get() ->
] || PID <- PIDs ].
get(Arg) ->
- Arg.
+ PID = jsfw_utility:arg_to_pid(Arg),
+ Info = erlang:process_info(PID),
+ io:format("Info: ~p~n", [Info]),
+ [ [Key, Value] || {Key, Value} <- Info ].
+
+input(Input) ->
+ io:format("Received input: ~p~n", [Input]).
View
2  jsfw_pid/jsfw_pid.html
@@ -1,6 +1,6 @@
<h2>jsfw_pid</h2>
-<table id="jsoncontainer">
+<table id="jsoncontainer" class="console">
<thead>
<tr>
<th>PID</th>
View
7 jsfw_pid/jsfw_pid.js
@@ -12,6 +12,11 @@ var jsfw_pid = new function() {
// This function is called when an argument is clicked on the component's page
this.handle = function(arg) {
+ $("#pid").html(arg);
fill_json("/json/jsfw_pid/" + arg, $("#argcontainer"));
}
-}
+
+ // this.input = function(input) {
+ // send_input("console.log("Input given: " + input);
+ // }
+}
View
1  system/component.config
@@ -0,0 +1 @@
+[{displayname,"System"},{enabled,"true"}].
View
3  system/handle.html
@@ -0,0 +1,3 @@
+<h1>Handle template for component: system</h1>
+
+Argument given: <span id="argcontainer"></span>
View
0  system/system.css
No changes.
View
27 system/system.erl
@@ -0,0 +1,27 @@
+-module(system).
+-export([get/0, get/1]).
+
+%% Returns information about the system and node we're currently running on
+get() ->
+ {H, M, S} = erlang:time(),
+ Formatter = fun(X) ->
+ case X < 10 of
+ true ->
+ "0" ++ integer_to_list(X);
+ false ->
+ integer_to_list(X)
+ end
+ end,
+ Clock = lists:concat([Formatter(H),":",Formatter(M),":",Formatter(S)]),
+ Data = [
+ [<<"Node">>, node()],
+ [<<"Clock">>, Clock]
+ ],
+ %% Memory information
+ Unit = fun(B) -> integer_to_list(B) ++ " bytes" end,
+ Memory = [[Key, Unit(Value)] || {Key, Value} <- erlang:memory()],
+
+ Data ++ Memory.
+
+get(Arg) ->
+ Arg.
View
4 system/system.html
@@ -0,0 +1,4 @@
+<h2>system</h2>
+{{toggle_button}}
+<p>This table consists of information about the system and the node that JSFW runs on.</p>
+<table id="jsoncontainer" class="console"></table>
View
17 system/system.js
@@ -0,0 +1,17 @@
+var system = new function() {
+
+ // This function is called when the component is clicked in the menu
+ this.init = function() {
+ fill_json("/json/system", $("#jsoncontainer"));
+ }
+
+ // This function is called when the component is automatically refreshed
+ this.refresh = function() {
+ fill_json("/json/system", $("#jsoncontainer"));
+ }
+
+ // This function is called when an argument is clicked on the component's page
+ this.handle = function(arg) {
+ fill_json("/json/system/" + arg, $("#argcontainer"));
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.