Skip to content

Commit bfc64ec

Browse files
committed
Added buttons for putting in various tags
1 parent 6055a40 commit bfc64ec

File tree

17 files changed

+465
-66
lines changed

17 files changed

+465
-66
lines changed

api/api/resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ class Meta:
345345
allowed_methods = ['get', 'post', 'put']
346346
authorization = Authorization()
347347
authentication = ApiKeyAuthentication()
348-
throttle = CacheThrottle(throttle_at=60, timeframe=60)
348+
throttle = CacheThrottle(throttle_at=500, timeframe=60)
349349

350350
def _db(self):
351351
try:

components/css/sidebar-collapse.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99

1010

1111
/* The left-collapsing sidebar */
12-
12+
.sidebar-color{
13+
/* TRUMP */
14+
#background-color: #5992c2;
15+
background-color: black;
16+
}
1317
.sidebar-left-collapse {
1418
margin-top:40px;
1519
border-right: solid #777777 1px;
@@ -19,7 +23,8 @@
1923
left: 0;
2024
display: none;
2125
z-index: 1002;
22-
background-color: #5992C2;
26+
/*TRUMP background-color: #5992C2;*/
27+
background-color:black;
2328
/*#292c2f;*/
2429
width: 280px;
2530
height: 100%;

components/emo/css/emo_base.css

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,12 @@ background-color: #ebebeb;
99
.emo-hoverlink:hover{
1010
color: #333;
1111
}
12-
.emo-navbar-brand{
13-
padding:10px;
14-
font-size:18px;
15-
line-height:20px;
16-
padding-left:45px;
17-
color: #333;
18-
height:40px;
19-
width: 280px;
20-
/*border-right: 1px solid #666;*/
21-
}
2212
.emo-btn-outline{
2313
border-width:2px;
2414
border-color:white;
25-
background-color: #5992c2;
15+
/* TRUMP */
16+
#background-color: #5992c2;
17+
background-color: black;
2618
color: white;
2719
height: 50px;
2820
padding-left: 15px;
@@ -34,10 +26,18 @@ background-color: #ebebeb;
3426
color: #5992c2;
3527
}
3628
.emo-navbar-brand.emo-highlighted{
37-
background-color: #5992c2;
29+
/* TRUMP */
30+
#background-color: #5992c2;
31+
background-color: black;
3832
/*border-right: 1px solid #aaa;*/
3933
color: white;
4034
}
35+
.bs_button_nav{
36+
cursor:pointer;
37+
#background-color:#5992c2;
38+
/* TRUMP */
39+
background-color: black;
40+
}
4141
.bs_button{
4242
position: absolute;
4343
width: 40px;
@@ -47,7 +47,10 @@ top: 0;
4747
margin: 0;
4848
padding-top: 10px;
4949
padding-left: 10px;
50-
background-color: #5992c2;
50+
#background-color: #5992c2;
51+
/* TRUMP */
52+
background-color: black;
53+
5154
border-style: solid;
5255
border-right: 1px;
5356
border-bottom: 1px;
@@ -233,7 +236,9 @@ color:#353535;
233236
left: 0;
234237
border-top: 2px solid white;
235238
border-bottom: 2px solid white;
236-
background-color: #5992c2;
239+
/* TRUMP */
240+
#background-color: #5992c2;
241+
background-color: black;
237242
top: 0px;
238243
}
239244
.glyphicon-nav:after {

components/emo/css/emo_navbar.css

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,30 @@
2121
border: 1px solid #AAAAAA;
2222
}
2323
.emo-navbar {
24-
background-color: white;
24+
/* TRUMP */
25+
background-color: black;
26+
color: #eee;
27+
28+
/* NORMAL */
29+
#background-color: white;
2530
min-height:40px;
2631
height:40px;
2732
margin-bottom:0px; /*#3498DB;*/}
2833

34+
.emo-navbar-brand{
35+
padding:10px;
36+
font-size:18px;
37+
line-height:20px;
38+
padding-left:45px;
39+
#color: #333;
40+
/* TRUMP */
41+
color: #eee;
42+
height:40px;
43+
width: 280px;
44+
/*border-right: 1px solid #666;*/
45+
}
46+
47+
2948
.emo-navbar .navbar-nav>.active>a:hover,.emo-navbar .navbar-nav>li>a:hover, .emo-navbar .navbar-nav>li>a:focus {
3049
background-color: #DDDDDD /*#CACACA*/
3150
}
@@ -47,9 +66,15 @@
4766
.emo-navbar .navbar-brand:hover
4867
{ color: #AAAAAA}
4968
.emo-navbar .navbar-nav>li>a
50-
{ color: #777777; min-height:24px; height:24px; margin-left:0px;margin-right:-1px;margin-top:8px;margin-bottom:8px;padding-top:2px;padding-bottom:2px;padding-left:10px;padding-right:10px; border-left-width:1px; border-right-width:1px; border-color:#777777;border-style:solid;border-top-width:0px; border-bottom-width: 0px;}
51-
emo-navbar .navbar-nav>li>a:hover, .emo-navbar .navbar-nav>li>a:focus
52-
{ background-color: #EEEEEE; color:#555555; border-color:#555555;}
69+
{
70+
/* TRUMP */
71+
#color: #777777;
72+
color: #eee;
73+
min-height:24px; height:24px; margin-left:0px;margin-right:-1px;margin-top:8px;margin-bottom:8px;padding-top:2px;padding-bottom:2px;padding-left:10px;padding-right:10px; border-left-width:1px; border-right-width:1px; border-color:#777777;border-style:solid;border-top-width:0px; border-bottom-width: 0px;}
74+
.emo-navbar .navbar-nav>li>a:hover, .emo-navbar .navbar-nav>li>a:focus
75+
{
76+
background-color: #EEEEEE;
77+
color:#111; border-color:#555555;}
5378
/*.emo-navbar .navbar-nav>.active>a,.emo-navbar .navbar-nav>.open>a, .emo-navbar .navbar-nav>.open>a:hover, .emo-navbar .navbar-nav>.open>a:focus { color: #ECF0F1}
5479
.emo-navbar .navbar-nav>.active>a:hover, .emo-navbar .navbar-nav>.active>a:focus { color: #ECF0F1; background-color:#EEEEEE}
5580
.dropdown-menu>li>a { color: #3498DB}*/

components/emo/js/emo_runs_streamer.js

Lines changed: 132 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ function ShowTag(tagname){
139139
}
140140

141141
function SlideOutDetail(){
142-
$("#detail_window > div").height($(window).height()-50);
142+
$("#loading_run").hide();
143+
//$("#detail_window > div").height($(window).height()-50);
143144
// $(".runsHider").show("fade", 50);
144-
$("#detail_window").show("slide", { direction: "right" }, 200);
145+
//$("#detail_window").show("slide", { direction: "right" }, 200);
146+
145147
}
146148
function HideDetail(){
147149
$("#detail_window").hide("fade", 50);
@@ -150,6 +152,11 @@ function HideDetail(){
150152

151153
function ShowDetail(name, detector){
152154

155+
$("#detail_window > #emobox").height($(window).height()-50);
156+
$("#loading_run").show();
157+
$("#detail_window").show("slide", { direction: "right" }, 200,
158+
function(){
159+
153160
runs_url = "/runs/get_run";
154161
params = {
155162
"detector": detector,
@@ -159,7 +166,8 @@ function ShowDetail(name, detector){
159166
"template_run_header", "run_detail_top",
160167
"template_tags", "template_tagbutton", "run_detail_tags",
161168
"template_storage", "template_site", "detail_locations",
162-
function(){SlideOutDetail()});
169+
"template_comment", "template_comments", "detail_comments",
170+
function(){SlideOutDetail()});});
163171
}
164172

165173
function DateToString(dateval){
@@ -180,7 +188,8 @@ function DateToString(dateval){
180188
function DrawDetailWindow(url, params, header_template, header_div,
181189
tag_template, tagbutton_template, tag_div,
182190
storage_template, storageloc_template,
183-
storage_div, callback)
191+
storage_div, comment_template, comments_template,
192+
comments_div, callback)
184193
//,
185194
/*//add piece by piece comment_template, comment_div,
186195
json_div, data_template, data_div,
@@ -227,6 +236,10 @@ function DrawDetailWindow(url, params, header_template, header_div,
227236
tagbutton_template));
228237
$("#"+storage_div).html(DrawStorageWindow(data, storage_template,
229238
storageloc_template));
239+
$("#"+comments_div).html(DrawCommentsWindow(data, comment_template,
240+
comments_template));
241+
document.getElementById("json").innerHTML="";
242+
$("#json").jsonView(data, { collapsed: true });
230243
callback();
231244

232245
});
@@ -241,6 +254,31 @@ function GetColor(string){
241254
return "#ec2c35";
242255
}
243256

257+
function DrawCommentsWindow(data, comment_template, comments_template){
258+
259+
var commenttemplate= $.trim($("#"+comment_template).html());
260+
Mustache.parse(commenttemplate);
261+
262+
var comments = "";
263+
for(i=0; i<data['comments'].length; i+=1){
264+
pars = {
265+
"user": data['comments'][i]['user'],
266+
"date": DateToString(data['comments'][i]['date']),
267+
"text": data['comments'][i]['text']
268+
}
269+
comments+=(Mustache.render(commenttemplate, pars));
270+
}
271+
272+
pars2 = {
273+
"comments": comments,
274+
"oid": data['_id']['$oid'],
275+
"name": data['name'],
276+
"detector": data['detector']
277+
};
278+
var commentstemplate = $.trim($("#"+comments_template).html());
279+
Mustache.parse(commentstemplate);
280+
return Mustache.render(commentstemplate, pars2);
281+
}
244282

245283
function DrawStorageWindow(data, storage_template, storageloc_template){
246284
var storageloctemplate= $.trim($("#"+storageloc_template).html());
@@ -269,7 +307,7 @@ function DrawStorageWindow(data, storage_template, storageloc_template){
269307
raw.push(Mustache.render(storageloctemplate, pars));
270308
else if(data['data'][i]['type'] == 'processed'){
271309
pars['pax_version'] = data['data'][i]['pax_version'];
272-
parx['display_paxcersion'] = "";
310+
pars['display_paxversion'] = "";
273311
processed.push(Mustache.render(storageloctemplate, pars));
274312
}
275313
else
@@ -318,20 +356,24 @@ function DrawTagWindow(data, tag_template, tagbutton_template){
318356
buttonhtml="<br style='margin:1px'><div style='width:100%'>";
319357
for(var i=0; i<data['tags'].length; i+=1){
320358
bargs = {
321-
"name": data['tags'][i]['name'],
359+
"tagname": data['tags'][i]['name'],
322360
'oid': data['_id']['$oid'],
361+
'detector': data['detector'],
362+
'name': data['name'],
323363
'hideifnotme': 'style="display:none"'
324364
};
325365
if(document.whoami == data['tags'][i]['user'])
326-
bargs['hideifnotme'] = "";
366+
bargs['hideifnotme'] = "style='display:inline;'";
327367
buttonhtml += Mustache.render(tagbuttontemplate, bargs);
328368
}
329369
buttonhtml += "</div><br style='margin:1px'>";
330370
}
331371

332372
targs = {
333373
'oid': data['_id']['$oid'],
334-
'tag_html': buttonhtml
374+
'tag_html': buttonhtml,
375+
'name': data['name'],
376+
'detector': data['detector']
335377
};
336378
console.log(targs);
337379
return Mustache.render(tagtemplate, targs);
@@ -402,3 +444,85 @@ function GetDataState(data){
402444
}
403445
return html;
404446
}
447+
448+
function NewComment(form){
449+
450+
// e.preventDefault();
451+
// validate
452+
form_array = $(form).serializeArray();
453+
name = "";
454+
detector = "";
455+
for(i=0;i<form_array.length;i+=1){
456+
if(form_array[i]['name'] == 'name')
457+
name = form_array[i]['value'];
458+
if(form_array[i]['name'] == 'detector')
459+
detector = form_array[i]['value'];
460+
if(form_array[i]['name'] == "content"
461+
&& form_array[i]['value'] == "")
462+
return false;
463+
}
464+
$.ajax({
465+
type: "POST",
466+
url: "/runs/newcomment",
467+
data: $(form).serialize(),
468+
success: function(data) {
469+
ShowDetail(name, detector);
470+
return false;
471+
}
472+
});
473+
return false;
474+
};
475+
476+
477+
function RemoveTag(id, name, runname, detector){
478+
if(id!="" && name !=""){
479+
URL="newtag?remove=true;id="+id+";tagname="+name;
480+
$.ajax({
481+
type: "GET",
482+
url: "/runs/newtag",
483+
data: {
484+
"remove": true,
485+
"id": id,
486+
"tagname": name
487+
},
488+
success: function(data) {
489+
console.log("SUCCESS");
490+
console.log(runname);
491+
console.log(detector);
492+
ShowDetail(runname, detector);
493+
return false;
494+
},
495+
error: function(data){
496+
console.log(data);
497+
},
498+
});
499+
}
500+
return false;
501+
}
502+
503+
function NewTag(form, name, detector){
504+
arr = $(form).serializeArray();
505+
var id="";
506+
var content="";
507+
console.log(arr);
508+
for(var x=0;x<arr.length;x+=1){
509+
if(arr[x]["name"]=="content")
510+
content=arr[x]["value"];
511+
else if(arr[x]["name"]=="id")
512+
id=arr[x]["value"];
513+
}
514+
if( content.indexOf(' ') >= 0 ){
515+
alert("Tags should be one word. Please use the comments tab for more extensive comments.");
516+
return false;
517+
}
518+
519+
if(id!="" && content !=""){
520+
URL="newtag?id="+id+";tagname="+content;
521+
522+
$.get(URL,function(){
523+
ShowDetail(name, detector);
524+
return false;
525+
});
526+
}
527+
return false;
528+
};

0 commit comments

Comments
 (0)