-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
116 lines (99 loc) · 4.19 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const express = require('express');
const app = express();
var fs = require('fs');
var os = require('os');
app.use(express.json());
app.use(express.urlencoded());
function endInput() {
if (confirm("Save form input and Close Window?")) {
close();
}
}
app.get('/', function(request, response, next){
response.send(`
<head>
<script src="http://code.jquery.com/jquery-git2.js"></script>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>Tickets updating tool</title>
<style>
table {
border-collapse:collapse;
}
table,th, td {
border: 1px solid black;
}
.txt {
font-weight:bold;
text-align:right;
}
.phone {
font-weight:bold;
text-align:right;
width:150px;
}
.footer {
text-align:center;
padding:5px;
background-color:lightblue;
}
.city {
width:180px;
}
.state {
width:50px;
}
</style>
</head>
<body>
<form method="POST" action="/">
<table>
<tbody>
<tr>
<th class="txt" style="width:200px"><label for="cmssw_release">CMSSW release</label></th>
<td colspan="3"><input type="text" id="cmssw_release" name="cmssw_release" placeholder="12_5_0_pre1" tabindex="1" style="width:400px;"></td>
</tr>
<tr>
<th class="txt"><label for="batch_name">Batch name</label></th>
<td colspan="3"><input type="text" id="batch_name" name="batch_name" placeholder="fullsim_PU_2022_14TeV" tabindex="2" style="width:400px;"></td>
</tr>
<tr>
<th class="txt">Add these workflow IDs</th>
<td colspan="3"><textarea id="workflow_ids_add" name="workflow_ids_add" placeholder="39408 39409 39434 39436" rows="5" cols="30" tabindex="3" style="width:400px;"></textarea></td>
</tr>
<tr>
<th class="txt">Remove these workflow IDs</th>
<td colspan="3"><textarea id="workflow_ids_remove" name="workflow_ids_remove" placeholder="11834 11846 11892 11852" rows="5" cols="30" tabindex="4" style="width:400px;"></textarea></td>
</tr>
<tr>
<th class="txt"><label for="n_factor">Events factor</label> </th>
<td colspan="3"><input type="number" id="n_factor" name="n_factor" placeholder="1" tabindex="5" style="width:80px;"></td>
</tr>
<tr>
<th class="city txt"><label for="recycle_gs">Recycle GS</label></th>
<td><input type="checkbox" id="recycle_gs" name="recycle_gs" tabindex="6"></td>
</tr>
<tr>
<th class="txt"><label for="rewrite_gt_string">Rewrite GT string</label></th>
<td colspan="3"><input type="rewrite_gt_string" id="rewrite_gt_string" name="rewrite_gt_string" placeholder="CMSSW_12_5_0_pre2-124X_mcRun3_2022_realistic_v3-v1" style="width:400px;" tabindex="7"></td>
</tr>
<tr>
<th colspan="4" class="footer">
<input id="next_ticket" type="submit" value="Next ticket" tabindex="8" onclick="e.preventDefault()" style="background-color:yellow">
<input id="clear_input" type="reset" value="Clear the form" tabindex="9" style="background-color:red">
</th>
</tr>
</tbody>
</table>
</form>
</body>
`);
});
app.post('/', function(request, response, next){
console.log('POST');
console.log(request.body);
fs.appendFile('data.txt', JSON.stringify(request.body) + os.EOL, function(err){
if (err) throw err;
console.log("Saved data to file");
})
});
app.listen(2000);