Browse Source

fix issue

pull/3437/head
zhoupzh 2 years ago
parent
commit
21cf7fbc8d
2 changed files with 7 additions and 2 deletions
  1. +4
    -1
      modules/templates/helper.go
  2. +3
    -1
      templates/custom/task_wait_count.tmpl

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

@@ -103,6 +103,7 @@ func NewFuncMap() []template.FuncMap {
"SafeJS": SafeJS,
"Str2html": Str2html,
"subOne": subOne,
"addOne": addOne,
"TimeSince": timeutil.TimeSince,
"TimeSinceUnix": timeutil.TimeSinceUnix,
"TimeSinceUnix1": timeutil.TimeSinceUnix1,
@@ -470,7 +471,9 @@ func Str2html(raw string) template.HTML {
func subOne(length int) int {
return length - 1
}

func addOne(length int64) int {
return length + 1
}
// Escape escapes a HTML string
func Escape(raw string) string {
return html.EscapeString(raw)


+ 3
- 1
templates/custom/task_wait_count.tmpl View File

@@ -1,17 +1,19 @@
<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__">{{.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__">{{addOne .WaitCount}}</span> {{.i18n.Tr "repo.wait_count_end"}}</span>
</div>
</div>
<script>
;(function() {
var queuesDetail = {{.QueuesDetail}};
console.log("queuesDetail:",queuesDetail)
if (queuesDetail) {
function changeSpecs() {
var specsSelEl = $('select#__specs__');
var seldOption = specsSelEl.find('option:selected');
var queueCode = seldOption.attr('queueCode');
console.log(seldOption,queueCode)
$('span.__task_wait_count__').text((queuesDetail[queueCode] || 0) +1);
};
$('body').on('change', 'select#__specs__', function(e) {


Loading…
Cancel
Save