-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_page
executable file
·97 lines (86 loc) · 1.97 KB
/
make_page
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
#!/bin/bash
declare -a g_m="";
declare -a g_li="";
function add_li() {
g_li+="<li><a href=\"javascript:loadJSON('$1', function(response) {var data = JSON.parse(response); document.getElementById('chartControls').innerHTML=data.chartControls; document.getElementById('tableContainer').innerHTML=data.table; chartM(data, 'Total');});\">$2</a></li>"
}
function add_sub() {
g_m+="<li class=\"$1\">"
g_m+="<a class=\"$2\" href=\"$3\">$4</a>"
g_m+="<div class=\"mp-level\">"
g_m+="<h2>$5</h2>"
g_m+="<a class=\"mp-back\" href=\"#\">back</a>"
g_m+="<ul>${g_li}</ul><div></li>"
}
tmpINDEX=tmpindex.html
cp index.skel $tmpINDEX
for id in "machine" "user"
do
DATAFOLDER=./data/${id}/
for timeId in "Hour" "Day" "Week"
do
for f in "${DATAFOLDER}${timeId}_"*".data"
do
if [ -f $f ]
then
add_li $f $timeId
fi
done
done
g_m+="$g_li"
unset g_li
#Month
for f in "${DATAFOLDER}Month_"*".data"
do
if [ -f $f ]
then
FILENAME=$(basename $f)
index=`expr index "$FILENAME" -`
add_li $f ${FILENAME:6:$index-7}
fi
done
for i in {1..12}
do
MONTHNAME=`date -d "$i/01" +%b`
for f in $DATAFOLDER"Month${MONTHNAME}"*".data"
do
if [ -f $f ]
then
FILENAME=$(basename $f)
index=`expr index "$FILENAME" -`
add_li $f ${FILENAME:5:$index-6}
fi
done
done
if [ -n "$g_li" ]
then
add_sub "icon icon-arrow-left" "icon icon-calendar" "#" "Month" "Month"
unset g_li
fi
#Year
for f in $DATAFOLDER"Year_"*".data"
do
if [ -f $f ]
then
FILENAME=$(basename $f)
index=`expr index "$FILENAME" -`
add_li $f ${FILENAME:5:$index-6}
fi
done
if [ -n "$g_li" ]
then
add_sub "icon icon-arrow-left" "icon icon-calendar" "#" "Year" "Year"
unset g_li
fi
if [ -z "$g_m" ]
then
g_m+="<li><a href=\"\">No data</a></li>"
fi
s=${g_m//[\/]/\\/}
sed -i -e "s/${id}_stats/$s/" $tmpINDEX
unset g_m
done
ORGNAME=${ORGNAME//[\/]/\\/}
sed -i -e "s/ORGNAME/$ORGNAME/g" $tmpINDEX
sed -i "s/CONDORADMIN/$CONDORADMIN/g" $tmpINDEX
mv -f $tmpINDEX index.html