-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.html
157 lines (132 loc) · 5.87 KB
/
main.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
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="static/css/main.css" rel="stylesheet" type="text/css">
<script src="static/js/jquery.js"></script>
<script src="static/js/jquery-tmpl.js"></script>
</head>
<body style="padding: 100px 10px 0 40px">
<input id="release_number" type="text" name="release_name"/>
<input id="release_submit" class="g-button m-button_orange" type="submit" value="Get release info"/>
<div class="suggestions_container" style="display:none;"> </div>
<div class="loader"> </div>
<div class="load_error">Error</div>
<div class="table_container" style="display:none;">
<table>
<thead>
<tr>
<th class="head-field">Задача</th>
<th class="head-field">Пакеты</th>
<th class="head-repo">hh.ru</th>
<th class="head-repo">xhh</th>
<th class="head-repo">common</th>
</tr>
</thead>
<tbody id="issues_container">
</tbody>
</table>
<div class="sqls_container">
</div>
</div>
<script id="release-suggestion" type="text/x-jquery-tmpl">
<span class="g-switcher m-switcher_009CD5" style="margin-right:20px;">
${data.key} (${data.fields.summary})
</span>
</script>
<script id="sql_template_header" type="text/x-jquery-tmpl">
</br><b>${repo}:</b></br>
</script>
<script id="sql_template" type="text/x-jquery-tmpl">
<b>${sql}</b></br>
</script>
<script id="issue_template" type="text/x-jquery-tmpl">
<tr>
<td style="width:100px;">
<a href="http://jira.hh.ru/browse/${name}">${name}</a>
</td>
<td>
{{if data.packages }}
${data.packages}
{{/if}}
</td>
<td class="table-checkbox">
<input type="checkbox" {{if data['git_branches']['hh.ru'] }} checked="checked" {{/if}}></input>
</td>
<td class="table-checkbox">
<input type="checkbox" {{if data['git_branches']['xhh'] }} checked="checked" {{/if}}></input>
</td>
<td class="table-checkbox">
<input type="checkbox" {{if data['git_branches']['hh-common'] }} checked="checked" {{/if}}></input>
</td>
</tr>
</script>
<script>
$(document).ready(function(){
var release_number = $('#release_number'),
issues_container = $('#issues_container'),
sqls_container = $('.sqls_container'),
suggestions_container = $('.suggestions_container'),
loader = $('.loader'),
error = $('.load_error'),
table = $('.table_container');
var onSuccessAjax = function(transport) {
issues_container.empty();
sqls_container.empty();
loader.hide();
if (transport.release_variants) {
suggestions_container.empty();
suggestions_container.show();
$.each(transport.release_variants, function(index, release){
var suggest_item = $("#release-suggestion").tmpl({data: release});
suggest_item.appendTo(suggestions_container);
suggest_item.click(function(){
get_release(release.key);
});
});
};
var release = transport.release;
if (release) {
var issues = release.issues;
var sqls = release.sqls;
if (sqls) {
$.each(sqls, function(repo, values){
if (values) {
$("#sql_template_header").tmpl({repo: repo}).appendTo(sqls_container);
$.each(values, function(index, sql){
$("#sql_template").tmpl({sql: sql}).appendTo(sqls_container);
});
}
});
};
if (issues) {
table.show();
$.each(issues, function(issue, data){
$("#issue_template").tmpl({name: issue, data: data}).appendTo(issues_container);
});
};
};
};
var errorAjax = function(transport){
loader.hide();
error.show();
};
var get_release = function(release){
error.hide();
table.hide();
loader.show();
console.log('get_release: ' + release);
$.ajax({
url: '/ajax/get_release_info',
data: {'release': release},
success: onSuccessAjax,
error: errorAjax
});
};
$('#release_submit').click(function(){
get_release(release_number.val());
});
});
</script>
</body>
</html>