aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElijah Moore <elimoor@siue.edu>2022-02-17 18:43:32 -0600
committerElijah Moore <elimoor@siue.edu>2022-02-17 18:43:32 -0600
commitc500f56c28abc3acc66dd5c72e26273f60b63cdc (patch)
treedac2da101a591c23dd9485f1aed85ccff2c8a902
parenta086ab28898a897086ecb8e8a7d6b810f0559513 (diff)
Incomplete commit
Co-authored-by: Toby Vincent <Tobyv13@gmail.com> Co-authored-by: Anthony Schneider <BoredOY@users.noreply.github.com> Co-authored-by: Neil Kollack <nkollack@gmail.com>
-rw-r--r--adminPage.html23
-rw-r--r--functions.js58
-rw-r--r--node_modules/.package-lock.json2
-rw-r--r--package-lock.json2
-rw-r--r--package.json4
5 files changed, 68 insertions, 21 deletions
diff --git a/adminPage.html b/adminPage.html
index 9d8cc8d..9c88cbd 100644
--- a/adminPage.html
+++ b/adminPage.html
@@ -3,11 +3,16 @@
<html lang="en">
<head>
+ <meta
+ charset="utf-8"
+ name="viewport"
+ content="width=device-width, initial-scale=1">
<title>SIUE Zone Container Manager - Admin</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="ZoneStyle.css">
- <link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
+
+ <link rel="stylesheet" href="ZoneStyle.css"/>
+ <link rel="stylesheet" href="node_modules/xterm/css/xterm.css"/>
<script src="node_modules/xterm/lib/xterm.js"></script>
+ <!-- <script type="module" src="./node_modules/xterm/lib/xterm.js"></script> -->
</head>
<body>
@@ -22,9 +27,7 @@
</div>
<!-- sidebar on the left ends -->
<!-- main container -->
- <div class="terminalContainer" id="terminal">
-
- </div>
+ <div class="terminalContainer" id="terminal"></div>
<!-- main container ends-->
<!-- topology summary -->
<div class="topolSumContainer">
@@ -37,14 +40,12 @@
<h2>Container Summary</h2>
<p>Container summary will go here</p>
</div>
- <script>
+ <!-- <script>
var term = new Terminal({rows: 48, cols: 140});
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
- </script>
- <script type="text/javascript" src="functions.js">
-
- </script>
+ </script> -->
+ <script type="module" src="./functions.js"></script>
</body>
diff --git a/functions.js b/functions.js
index 8b05e96..af88f49 100644
--- a/functions.js
+++ b/functions.js
@@ -1,12 +1,56 @@
-import Terminal from "node_modules/xterm/lib/xterm.js";
+// import { Terminal } from './node_modules/xterm/lib/xterm.js';
+import { Terminal } from "xterm";
-// we'll finish this some day
-// function createTerminal(rows, columns) {
-// var term = new Terminal({rows: rows, cols: columns});
-// term.open(document.getElementById('terminal'));
-// term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
+var terminal = new Terminal({rows: 48, cols: 140});
+var termPrompt = '$ ';
+var command = '';
+var backspaceLimit = 2;
-// }
+terminal.open(document.getElementById('terminal'));
+terminal.write('Welcome to Featherfall Containers!');
+
+terminal.writePrompt = function() {
+ terminal.write('\r\n' + termPrompt);
+};
+
+terminal.on('key',
+ function (key, eVal) {
+ var isPrintable = (
+ !eVal.metaKey && !eVal.altKey && !eVal.ctrlKey
+ );
+
+ switch (ev.key) {
+ case 'Enter':
+ if (command == 'clear') {
+ terminal.clear();
+ }
+
+ command = '';
+
+ terminal.writePrompt();
+ break;
+ case 'Backspace':
+ console.log(terminal.rows);
+
+ if (terminal.x > backspaceLimit) {
+ terminal.write('\b \b');
+ }
+ break;
+ default:
+ if (isPrintable) {
+ command += key;
+ terminal.write(key);
+ }
+ break;
+ }
+ }
+);
+
+terminal.on('paste',
+ function (copiedData, eVal) {
+ terminal.write(copiedData);
+ }
+);
function toStudentView() {
location.replace("index.html")
diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json
index 5f68269..0d27f5d 100644
--- a/node_modules/.package-lock.json
+++ b/node_modules/.package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "CS499",
+ "name": "zone.cs.siue.edu",
"lockfileVersion": 2,
"requires": true,
"packages": {
diff --git a/package-lock.json b/package-lock.json
index de4ceb1..49172eb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "CS499",
+ "name": "zone.cs.siue.edu",
"lockfileVersion": 2,
"requires": true,
"packages": {
diff --git a/package.json b/package.json
index 0c58b00..eaf51d2 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,7 @@
{
"dependencies": {
- "xterm": "^4.17.0"
+ "xterm": "^4.17.0",
+ "react-dom": "16.0.0",
+ "react": "16.0.0"
}
}