Show More
@@ -1,164 +1,165 b'' | |||||
1 | <div class="panel panel-default"> |
|
1 | <div class="panel panel-default"> | |
2 | <div class="panel-heading"> |
|
2 | <div class="panel-heading"> | |
3 | <h3 class="panel-title">${_('Strip commits from repository')}</h3> |
|
3 | <h3 class="panel-title">${_('Strip commits from repository')}</h3> | |
4 | </div> |
|
4 | </div> | |
5 | <div class="panel-body"> |
|
5 | <div class="panel-body"> | |
6 | %if c.repo_info.repo_type != 'svn': |
|
6 | %if c.repo_info.repo_type != 'svn': | |
7 | <h4>${_('Please provide up to %d commits commits to strip') % c.strip_limit}</h4> |
|
7 | <h4>${_('Please provide up to %d commits commits to strip') % c.strip_limit}</h4> | |
8 | <p> |
|
8 | <p> | |
9 | ${_('In the first step commits will be verified for existance in the repository')}. </br> |
|
9 | ${_('In the first step commits will be verified for existance in the repository')}. </br> | |
10 | ${_('In the second step, correct commits will be available for stripping')}. |
|
10 | ${_('In the second step, correct commits will be available for stripping')}. | |
11 | </p> |
|
11 | </p> | |
12 | ${h.secure_form(h.route_path('strip_check', repo_name=c.repo_info.repo_name), method='post')} |
|
12 | ${h.secure_form(h.route_path('strip_check', repo_name=c.repo_info.repo_name), method='post')} | |
13 | <div id="change_body" class="field"> |
|
13 | <div id="change_body" class="field"> | |
14 | <div id="box-1" class="inputx locked_input"> |
|
14 | <div id="box-1" class="inputx locked_input"> | |
15 | <input class="text" id="changeset_id-1" name="changeset_id-1" size="59" |
|
15 | <input class="text" id="changeset_id-1" name="changeset_id-1" size="59" | |
16 | placeholder="${_('Enter full 40 character commit sha')}" type="text" value=""> |
|
16 | placeholder="${_('Enter full 40 character commit sha')}" type="text" value=""> | |
17 | <div id="plus_icon-1" class="btn btn-default plus_input_button" onclick="addNew(1);return false"> |
|
17 | <div id="plus_icon-1" class="btn btn-default plus_input_button" onclick="addNew(1);return false"> | |
18 | <i class="icon-plus">${_('Add another commit')}</i> |
|
18 | <i class="icon-plus">${_('Add another commit')}</i> | |
19 | </div> |
|
19 | </div> | |
20 | </div> |
|
20 | </div> | |
21 | </div> |
|
21 | </div> | |
22 |
|
22 | |||
23 | <div id="results" style="display:none; padding: 10px 0px;"></div> |
|
23 | <div id="results" style="display:none; padding: 10px 0px;"></div> | |
24 |
|
24 | |||
25 | <div class="buttons"> |
|
25 | <div class="buttons"> | |
26 | <button class="btn btn-small btn-primary" onclick="checkCommits();return false"> |
|
26 | <button class="btn btn-small btn-primary" onclick="checkCommits();return false"> | |
27 | ${_('Check commits')} |
|
27 | ${_('Check commits')} | |
28 | </button> |
|
28 | </button> | |
29 | </div> |
|
29 | </div> | |
30 |
|
30 | |||
31 | ${h.end_form()} |
|
31 | ${h.end_form()} | |
32 | %else: |
|
32 | %else: | |
33 | <h4>${_('Sorry this functionality is not available for SVN repository')}</h4> |
|
33 | <h4>${_('Sorry this functionality is not available for SVN repository')}</h4> | |
34 | %endif |
|
34 | %endif | |
35 | </div> |
|
35 | </div> | |
36 | </div> |
|
36 | </div> | |
37 |
|
37 | |||
38 |
|
38 | |||
39 | <script> |
|
39 | <script> | |
40 | var plus_leaf = 1; |
|
40 | var plus_leaf = 1; | |
41 |
|
41 | |||
42 | addNew = function(number){ |
|
42 | addNew = function(number){ | |
43 | if (number >= ${c.strip_limit}){ |
|
43 | if (number >= ${c.strip_limit}){ | |
44 | return; |
|
44 | return; | |
45 | } |
|
45 | } | |
46 | var minus = '<i id="i_minus_icon-'+(number+1)+'" class="icon-minus">${_('Remove')}</i>'; |
|
46 | var minus = '<i id="i_minus_icon-'+(number+1)+'" class="icon-minus">${_('Remove')}</i>'; | |
47 | $('#plus_icon-'+number).detach(); |
|
47 | $('#plus_icon-'+number).detach(); | |
48 | number++; |
|
48 | number++; | |
49 |
|
49 | |||
50 | var input = '<div id="box-'+number+'" class="inputx locked_input">'+ |
|
50 | var input = '<div id="box-'+number+'" class="inputx locked_input">'+ | |
51 | '<input class="text" id="changeset_id-'+number+'" name="changeset_id-'+number+'" size="59" type="text" value="">'+ |
|
51 | '<input class="text" id="changeset_id-'+number+'" name="changeset_id-'+number+'" size="59" type="text" value="">'+ | |
52 | '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number+');return false">'+ |
|
52 | '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number+');return false">'+ | |
53 | '<i id="i_plus_icon-'+(number)+'" class="icon-plus">${_('Add another commit')}</i>'+ |
|
53 | '<i id="i_plus_icon-'+(number)+'" class="icon-plus">${_('Add another commit')}</i>'+ | |
54 | '</div>'+ |
|
54 | '</div>'+ | |
55 | '<div id="minus_icon-'+number+'" class="btn btn-default minus_input_button" onclick="delOld('+(number)+');return false">'+ |
|
55 | '<div id="minus_icon-'+number+'" class="btn btn-default minus_input_button" onclick="delOld('+(number)+');return false">'+ | |
56 | minus + |
|
56 | minus + | |
57 | '</div>' + |
|
57 | '</div>' + | |
58 | '</div>'; |
|
58 | '</div>'; | |
59 | $('#change_body').append(input); |
|
59 | $('#change_body').append(input); | |
60 | plus_leaf++; |
|
60 | plus_leaf++; | |
61 | }; |
|
61 | }; | |
62 |
|
62 | |||
63 | reIndex = function(number){ |
|
63 | reIndex = function(number){ | |
64 | for(var i=number;i<=plus_leaf;i++){ |
|
64 | for(var i=number;i<=plus_leaf;i++){ | |
65 | var check = $('#box-'+i); |
|
65 | var check = $('#box-'+i); | |
66 | if (check.length == 0){ |
|
66 | if (check.length == 0){ | |
67 | var change = $('#box-'+(i+1)); |
|
67 | var change = $('#box-'+(i+1)); | |
68 |
|
68 | |||
69 | change.attr('id','box-'+i); |
|
69 | change.attr('id','box-'+i); | |
70 | var plus = $('#plus_icon-'+(i+1)); |
|
70 | var plus = $('#plus_icon-'+(i+1)); | |
71 | var i_plus = $('#i_plus_icon-'+(i+1)); |
|
71 | var i_plus = $('#i_plus_icon-'+(i+1)); | |
72 | if (plus.length != 0){ |
|
72 | if (plus.length != 0){ | |
73 | plus.attr('id','plus_icon-'+i); |
|
73 | plus.attr('id','plus_icon-'+i); | |
74 | i_plus.attr('id','i_plus_icon-'+i); |
|
74 | i_plus.attr('id','i_plus_icon-'+i); | |
75 | i_plus.attr('onclick','addNew('+i+');return false'); |
|
75 | i_plus.attr('onclick','addNew('+i+');return false'); | |
76 | plus_leaf--; |
|
76 | plus_leaf--; | |
77 | } |
|
77 | } | |
78 | var minus = $('#minus_icon-'+(i+1)); |
|
78 | var minus = $('#minus_icon-'+(i+1)); | |
79 | var i_minus = $('#i_minus_icon-'+(i+1)); |
|
79 | var i_minus = $('#i_minus_icon-'+(i+1)); | |
80 | minus.attr('id','minus_icon-'+i); |
|
80 | minus.attr('id','minus_icon-'+i); | |
81 | i_minus.attr('id','i_minus_icon-'+i); |
|
81 | i_minus.attr('id','i_minus_icon-'+i); | |
82 | i_minus.attr('onclick','delOld('+i+');return false'); |
|
82 | i_minus.attr('onclick','delOld('+i+');return false'); | |
83 | } |
|
83 | } | |
84 | } |
|
84 | } | |
85 | }; |
|
85 | }; | |
86 |
|
86 | |||
87 | delOld = function(number){ |
|
87 | delOld = function(number){ | |
88 | $('#box-'+number).remove(); |
|
88 | $('#box-'+number).remove(); | |
89 | number = number - 1; |
|
89 | number = number - 1; | |
90 | var box = $('#box-'+number); |
|
90 | var box = $('#box-'+number); | |
91 | var plus = '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number +');return false">'+ |
|
91 | var plus = '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number +');return false">'+ | |
92 | '<i id="i_plus_icon-'+number+'" class="icon-plus">${_('Add another commit')}</i></div>'; |
|
92 | '<i id="i_plus_icon-'+number+'" class="icon-plus">${_('Add another commit')}</i></div>'; | |
93 | var minus = $('#minus_icon-'+number); |
|
93 | var minus = $('#minus_icon-'+number); | |
94 | if(number +1 == plus_leaf){ |
|
94 | if(number +1 == plus_leaf){ | |
95 | minus.detach(); |
|
95 | minus.detach(); | |
96 | box.append(plus); |
|
96 | box.append(plus); | |
97 | box.append(minus); |
|
97 | box.append(minus); | |
|
98 | plus_leaf --; | |||
98 | } |
|
99 | } | |
99 | reIndex(number+1); |
|
100 | reIndex(number+1); | |
100 |
|
101 | |||
101 | }; |
|
102 | }; | |
102 |
|
103 | |||
103 | var result_data; |
|
104 | var result_data; | |
104 |
|
105 | |||
105 | checkCommits = function() { |
|
106 | checkCommits = function() { | |
106 | var postData = $('form').serialize(); |
|
107 | var postData = $('form').serialize(); | |
107 | $('#results').show(); |
|
108 | $('#results').show(); | |
108 | $('#results').html('<h4>${_('Checking commits')}...</h4>'); |
|
109 | $('#results').html('<h4>${_('Checking commits')}...</h4>'); | |
109 | var url = "${h.route_path('strip_check', repo_name=c.repo_info.repo_name)}"; |
|
110 | var url = "${h.route_path('strip_check', repo_name=c.repo_info.repo_name)}"; | |
110 | var btn = $('button'); |
|
111 | var btn = $('button'); | |
111 | btn.attr('disabled', 'disabled'); |
|
112 | btn.attr('disabled', 'disabled'); | |
112 | btn.addClass('disabled'); |
|
113 | btn.addClass('disabled'); | |
113 |
|
114 | |||
114 | var success = function (data) { |
|
115 | var success = function (data) { | |
115 | result_data = {}; |
|
116 | result_data = {}; | |
116 | var i = 0; |
|
117 | var i = 0; | |
117 | result =''; |
|
118 | result =''; | |
118 | $.each(data, function(index, value){ |
|
119 | $.each(data, function(index, value){ | |
119 | i= index; |
|
120 | i= index; | |
120 | var box = $('#box-'+index); |
|
121 | var box = $('#box-'+index); | |
121 | if (value.rev){ |
|
122 | if (value.rev){ | |
122 | result_data[index] = JSON.stringify(value); |
|
123 | result_data[index] = JSON.stringify(value); | |
123 | msg = '${_("author")}: ' + value.author + ' ${_("comment")}: ' + value.comment; |
|
124 | msg = '${_("author")}: ' + value.author + ' ${_("comment")}: ' + value.comment; | |
124 | result += '<h4><code>' +value.rev+ '</code>${_(' commit verified positive')}</br> '+ msg + '</h4>'; |
|
125 | result += '<h4><code>' +value.rev+ '</code>${_(' commit verified positive')}</br> '+ msg + '</h4>'; | |
125 | } |
|
126 | } | |
126 | else{ |
|
127 | else{ | |
127 | result += '<h4><code>' +value.commit+ '</code>${_(' commit verified negative')}' + '</h4>'; |
|
128 | result += '<h4><code>' +value.commit+ '</code>${_(' commit verified negative')}' + '</h4>'; | |
128 | } |
|
129 | } | |
129 | box.remove(); |
|
130 | box.remove(); | |
130 | }); |
|
131 | }); | |
131 | var box = $('#box-'+(parseInt(i)+1)); |
|
132 | var box = $('#box-'+(parseInt(i)+1)); | |
132 | box.remove(); |
|
133 | box.remove(); | |
133 | $('#results').html(result); |
|
134 | $('#results').html(result); | |
134 | }; |
|
135 | }; | |
135 |
|
136 | |||
136 | btn.html('Strip'); |
|
137 | btn.html('Strip'); | |
137 | btn.removeAttr('disabled'); |
|
138 | btn.removeAttr('disabled'); | |
138 | btn.removeClass('disabled'); |
|
139 | btn.removeClass('disabled'); | |
139 | btn.attr('onclick','strip();return false;'); |
|
140 | btn.attr('onclick','strip();return false;'); | |
140 | ajaxPOST(url, postData, success, null); |
|
141 | ajaxPOST(url, postData, success, null); | |
141 | }; |
|
142 | }; | |
142 |
|
143 | |||
143 | strip = function(){ |
|
144 | strip = function(){ | |
144 | var url = "${h.route_path('strip_execute', repo_name=c.repo_info.repo_name)}"; |
|
145 | var url = "${h.route_path('strip_execute', repo_name=c.repo_info.repo_name)}"; | |
145 | var success = function(data){ |
|
146 | var success = function(data){ | |
146 | result = ''; |
|
147 | result = ''; | |
147 | $.each(data, function(index, value){ |
|
148 | $.each(data, function(index, value){ | |
148 | if(data[index]){ |
|
149 | if(data[index]){ | |
149 | result += '<h4>' +index+ '${_(' commit striped successful')}' + '</h4>'; |
|
150 | result += '<h4>' +index+ '${_(' commit striped successful')}' + '</h4>'; | |
150 | } |
|
151 | } | |
151 | else{ |
|
152 | else{ | |
152 | result += '<h4>' +index+ '${_(' commit striped failed')}' + '</h4>'; |
|
153 | result += '<h4>' +index+ '${_(' commit striped failed')}' + '</h4>'; | |
153 | } |
|
154 | } | |
154 | }); |
|
155 | }); | |
155 | $('#results').html(result); |
|
156 | $('#results').html(result); | |
156 |
|
157 | |||
157 | }; |
|
158 | }; | |
158 | ajaxPOST(url, result_data, success, null); |
|
159 | ajaxPOST(url, result_data, success, null); | |
159 | var btn = $('button'); |
|
160 | var btn = $('button'); | |
160 | btn.attr('disabled', 'disabled'); |
|
161 | btn.attr('disabled', 'disabled'); | |
161 | btn.addClass('disabled'); |
|
162 | btn.addClass('disabled'); | |
162 |
|
163 | |||
163 | }; |
|
164 | }; | |
164 | </script> |
|
165 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now