forked from malexandrum/JiraWorkLogReportFork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
259 lines (254 loc) · 12.9 KB
/
index.html
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JIRA Work Log Report</title>
<link rel="stylesheet" href="libs/material.min.css" />
<link rel="stylesheet" href="libs/sumoselect.css" />
<script src="libs/material.min.js"></script>
<script src="libs/jquery-1.10.2.min.js"></script>
<script src="libs/jquery.sumoselect.min.js"></script>
<script src="libs/underscore-min.js"></script>
<link rel="stylesheet" href="resources/styles.css" />
<script src="resources/util.js"></script>
<script src="resources/jira-api.js"></script>
<script src="resources/config.js"></script>
<script src="resources/report.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
<div class="report-config-panel">
<div class="report-config-item">
<label>Team:</label>
<select class="option-team"></select>
</div>
<div class="report-config-item team-users">
<label>Users:</label>
<select class="option-users" multiple="multiple"></select>
</div>
<div class="report-config-item">
<label>Time Frame:</label>
<select class="option-time-frame">
<option value="TD">Today</option>
<option value="YD">Yesterday</option>
<option value="LWK">Last Week</option>
<option value="1WK">1 Week</option>
<option value="1MO">1 Month</option>
<option value="Q">Quarter</option>
<option value="PQ">Previous Quarter</option>
</select>
</div>
<div class="report-config-item">
<label>Group By:</label>
<select class="option-group-by">
<option value="USR">User</option>
<option value="DT">Date</option>
</select>
</div>
<div class="report-config-item">
<label>Date Sort:</label>
<select class="option-date-sort">
<option value="DSC">Descending</option>
<option value="ASC">Ascending</option>
</select>
</div>
</div>
<div class="mdl-layout-spacer"></div>
<button class="mdl-button mdl-button--icon settings-button">
<i class="material-icons">settings</i>
</button>
</div>
</header>
<main class="mdl-layout__content">
<div class="page-content report-page">
<div class="mdl-progress mdl-js-progress mdl-progress__indeterminate jira-api-call-progress" style="display:none"></div>
<div class="report-content">
</div>
</div>
</main>
</div>
<dialog class="settings-dialog mdl-dialog">
<div class="mdl-dialog__content">
<h5>JIRA Connection Settings</h5>
<p>Authentication is done via session cookie.<br />
Make sure you have an active session with Jira for the extension to work.</p>
<div class="config-page">
<div class="config-sections"></div>
</div>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button close">Close</button>
</div>
</dialog>
<script id="tmpl-config-section" type="text/x-underscore-template">
<div class="list-group">
<% for(var i=0; i < configs.length; i++){ %>
<div class="mdl-card mdl-shadow--4dp list-group-item" data-id="<%= configs[i].id %>">
<div class="mdl-card__supporting-text">
<div class="mdl-textfield mdl-js-textfield">
<label>Name:</label>
<input type="text" class="config-name mdl-textfield__input" placeholder="e.g. MyTeam" value="<%= configs[i].name %>" />
</div>
<div class="mdl-textfield config-host-container mdl-js-textfield">
<label>Host:</label>
<input type="text" class="config-host mdl-textfield__input" placeholder="https://company.atlassian.net" value="<%= configs[i].host %>" />
</div>
<!--
<div class="mdl-textfield mdl-js-textfield">
<label>Email:</label>
<input type="text" class="config-username mdl-textfield__input" value="<%= configs[i].username %>" />
</div>
<div class="mdl-textfield mdl-js-textfield">
<label>API Token:</label>
<input type="password" class="config-password mdl-textfield__input" value="<%= configs[i].password %>" />
</div>
-->
<div class="config-save-alert" style="display:none">
</div>
</div>
<div class="mdl-card__actions">
<button class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect config-save"><%= configs[i].id != 0 ? "Update" : "Create" %></button>
<% if(configs[i].id != 0){ %>
<button class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect config-delete">Delete</button>
<% } %>
</div>
</div>
<% } %>
</div>
</script>
<script id="tmpl-logs-by-user" type="text/x-underscore-template">
<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
<thead>
<colgroup>
<col width="11%">
<col width="7%">
<col width="32%">
<col width="32%">
<col width="10%">
<col width="8%">
<!-- <col width="8%"> -->
</colgroup>
<tr>
<th class="mdl-data-table__cell--non-numeric" rowspan="2">Date</th>
<th rowspan="2">Logged Time</th>
<!-- <th colspan="4">Log Entries</th> -->
</tr>
<tr>
<th class="mdl-data-table__cell--non-numeric">Parent</th>
<th class="mdl-data-table__cell--non-numeric">Issue</th>
<th class="mdl-data-table__cell--non-numeric">Comment</th>
<th>Time Spent</th>
<!-- <th>Time Entered</th> -->
</tr>
</thead>
<tbody>
<% for(var i=0; i < data.length; i++) {
var logGroup = data[i];
%>
<tr class="log-header-row">
<td colspan="7" class="mdl-data-table__cell--non-numeric">
<img class="user-img" src="<%= users[logGroup.username].thumbUrl %>" />
<span class="group-title"><%= users[logGroup.username].displayName %></span>
<span>Total: <%= Utility.getTimeFormatted(logGroup.totalTime) %></span>
</td>
</tr>
<% for(var j=0; j < logGroup.logs.length; j++) {
var dailyLog = logGroup.logs[j];
var numLogs = dailyLog.logs.length;
%>
<tr>
<td class="mdl-data-table__cell--non-numeric" rowspan="<%= numLogs %>"><%= Utility.getDateFormatted(dailyLog.date) %></td>
<td rowspan="<%= numLogs %>"><%= Utility.getTimeFormatted(dailyLog.totalTime) %></td>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getParent(dailyLog.logs[0]) %></td>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getIssue(dailyLog.logs[0]) %></td>
<td class="mdl-data-table__cell--non-numeric comment-col"><%= dailyLog.logs[0].comment %></td>
<td><%= Utility.getTimeFormatted(dailyLog.logs[0].time) %></td>
<!-- <td><%= Utility.getDateFormatted(dailyLog.logs[0].created) %></td> -->
</tr>
<% for(var k=1; k < dailyLog.logs.length; k++) {
var log = dailyLog.logs[k];
%>
<tr>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getParent(log) %></td>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getIssue(log) %></td>
<td class="mdl-data-table__cell--non-numeric comment-col"><%= log.comment %></td>
<td><%= Utility.getTimeFormatted(log.time) %></td>
<!-- <td><%= Utility.getDateFormatted(log.created) %></td> -->
</tr>
<% } %>
<% } %>
<% }%>
</tbody>
</table>
</script>
<script id="tmpl-logs-by-date" type="text/x-underscore-template">
<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
<thead>
<colgroup>
<col width="11%">
<col width="7%">
<col width="32%">
<col width="32%">
<col width="10%">
<col width="8%">
</colgroup>
<tr>
<th rowspan="2" class="mdl-data-table__cell--non-numeric">User</th>
<th rowspan="2">Logged Time</th>
<!-- <th colspan="4">Log Entries</th> -->
</tr>
<tr>
<th class="mdl-data-table__cell--non-numeric">Parent</th>
<th class="mdl-data-table__cell--non-numeric">Issue</th>
<th class="mdl-data-table__cell--non-numeric">Comment</th>
<th>Time Spent</th>
<!-- <th>Time Entered</th> -->
</tr>
</thead>
<tbody>
<% for(var i=0; i < data.length; i++) {
var logGroup = data[i];
%>
<tr class="log-header-row">
<td class="mdl-data-table__cell--non-numeric" colspan="6">
<span class="group-title"><%= Utility.getDateFormatted(logGroup.date, true) %></span>
<span>Total: <%= Utility.getTimeFormatted(logGroup.totalTime) %></span>
</td>
</tr>
<% for(var j=0; j < logGroup.logs.length; j++) {
var userLog = logGroup.logs[j];
var numLogs = userLog.logs.length;
%>
<tr>
<td class="mdl-data-table__cell--non-numeric" rowspan="<%= numLogs %>">
<img class="user-img" src="<%= users[userLog.username].thumbUrl %>" />
<div><%= users[userLog.username].displayName %></div>
</td>
<td rowspan="<%= numLogs %>"><%= Utility.getTimeFormatted(userLog.totalTime) %></td>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getParent(userLog.logs[0]) %></td>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getIssue(userLog.logs[0]) %></td>
<td class="mdl-data-table__cell--non-numeric comment-col"><%= userLog.logs[0].comment %></td>
<td><%= Utility.getTimeFormatted(userLog.logs[0].time) %></td>
<!-- <td><%= Utility.getDateFormatted(userLog.logs[0].created) %></td> -->
</tr>
<% for(var k=1; k < userLog.logs.length; k++) {
var log = userLog.logs[k];
%>
<tr>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getParent(log) %></td>
<td class="mdl-data-table__cell--non-numeric"><%= Utility.getIssue(log) %></td>
<td class="mdl-data-table__cell--non-numeric comment-col"><%= log.comment %></td>
<td><%= Utility.getTimeFormatted(log.time) %></td>
<!-- <td><%= Utility.getDateFormatted(log.created) %></td> -->
</tr>
<% } %>
<% } %>
<% }%>
</tbody>
</table>
</script>
</body>
</html>