Browse Source

fix issue

pull/3437/head
zhoupzh 2 years ago
parent
commit
09cc4e3f84
2 changed files with 17 additions and 20 deletions
  1. +2
    -4
      modules/templates/helper.go
  2. +15
    -16
      templates/custom/task_wait_count.tmpl

+ 2
- 4
modules/templates/helper.go View File

@@ -471,10 +471,8 @@ func Str2html(raw string) template.HTML {
func subOne(length int) int {
return length - 1
}
func addOne(i interface{}) int64 {
if i>=0 {
return i + 1
}
func addOne(length int64) int64 {
return length + 1
}
// Escape escapes a HTML string
func Escape(raw string) string {


+ 15
- 16
templates/custom/task_wait_count.tmpl View File

@@ -1,26 +1,25 @@
<div style="display:inline-block;">
<div style="display:flex;align-items:center;color:#f2711c;">
<i class="ri-error-warning-line" style="margin-right: 0.5rem; font-size: 14px"></i>
<span style="font-size: 12px">{{.i18n.Tr "repo.wait_count_start"}} <span class="__task_wait_count__">{{addOne .WaitCount}}</span> {{.i18n.Tr "repo.wait_count_end"}}</span>
<span style="font-size: 12px">{{.i18n.Tr "repo.wait_count_start"}} <span class="__task_wait_count__">{{if .WaitCount}}1{{else}}{{addOne .WaitCount}}{{end}}</span> {{.i18n.Tr "repo.wait_count_end"}}</span>
</div>
</div>
<script>
;(function() {
var queuesDetail = {{.QueuesDetail}};
// if (queuesDetail) {
// function changeSpecs() {
// var specsSelEl = $('select#__specs__');
// var seldOption = specsSelEl.find('option:selected');
// var queueCode = seldOption.attr('queueCode');
// $('span.__task_wait_count__').text((queuesDetail[queueCode] || 0) +1);
// };
// $('body').on('change', 'select#__specs__', function(e) {
// changeSpecs();
// });
// setTimeout(function() {
// changeSpecs();
// }, 50);
// }
if (queuesDetail) {
function changeSpecs() {
var specsSelEl = $('select#__specs__');
var seldOption = specsSelEl.find('option:selected');
var queueCode = seldOption.attr('queueCode');
$('span.__task_wait_count__').text((queuesDetail[queueCode] || 0) +1);
};
$('body').on('change', 'select#__specs__', function(e) {
changeSpecs();
});
setTimeout(function() {
changeSpecs();
}, 50);
}
})();
</script>

Loading…
Cancel
Save