Fixes #457 - Scheduler Time offset
This commit is contained in:
parent
6be39c9625
commit
4a9f448de7
10 changed files with 41 additions and 16 deletions
|
@ -304,7 +304,12 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
# only do dom updates on changes
|
||||
return if time is currentVal
|
||||
item.attr('title', App.i18n.translateTimestamp(timestamp))
|
||||
|
||||
newTitle = App.i18n.translateTimestamp(timestamp)
|
||||
if item.attr('timezone')
|
||||
newTitle += ' ' + item.attr('timezone')
|
||||
|
||||
item.attr('title', newTitle)
|
||||
item.html(time)
|
||||
|
||||
recentView: (object, o_id) =>
|
||||
|
|
|
@ -112,8 +112,9 @@ class App.UiElement.timer
|
|||
|
||||
days = @joinItems days
|
||||
hours = @joinItems hours
|
||||
timezone = App.Config.get('timezone_default') || 'UTC'
|
||||
|
||||
formGroup.find('.js-timerResult').text(App.i18n.translateInline('Run every %s at %s', days, hours))
|
||||
formGroup.find('.js-timerResult').text(App.i18n.translateInline('Run every %s at %s in %s time', days, hours, timezone))
|
||||
|
||||
@injectMinutes: (hours, minutes) ->
|
||||
newHours = [] # hours.length x minutes.length long
|
||||
|
|
|
@ -134,14 +134,23 @@ class App extends Spine.Controller
|
|||
else if attributeConfig.tag is 'datetime'
|
||||
isHtmlEscape = true
|
||||
timestamp = App.i18n.translateTimestamp(resultLocal)
|
||||
|
||||
escalation = false
|
||||
cssClass = attributeConfig.class || ''
|
||||
if cssClass.match 'escalation'
|
||||
escalation = true
|
||||
|
||||
humanTime = ''
|
||||
if !table
|
||||
humanTime = App.PrettyDate.humanTime(resultLocal, escalation)
|
||||
resultLocal = "<time class=\"humanTimeFromNow #{cssClass}\" datetime=\"#{resultLocal}\" title=\"#{timestamp}\">#{humanTime}</time>"
|
||||
|
||||
title = timestamp
|
||||
timezone = ''
|
||||
if attributeConfig.include_timezone
|
||||
timezone = " timezone=\"#{App.Config.get('timezone_default')}\""
|
||||
title += ' ' + App.Config.get('timezone_default')
|
||||
|
||||
resultLocal = "<time class=\"humanTimeFromNow #{cssClass}\" datetime=\"#{resultLocal}\" title=\"#{title}\"#{timezone}>#{humanTime}</time>"
|
||||
|
||||
if !isHtmlEscape && typeof resultLocal is 'string'
|
||||
resultLocal = App.Utils.htmlEscape(resultLocal)
|
||||
|
|
|
@ -12,8 +12,8 @@ class App.Job extends App.Model
|
|||
{ name: 'active', display: 'Active', tag: 'active', default: true },
|
||||
{ name: 'matching', display: 'Will process', readonly: 1 },
|
||||
{ name: 'processed', display: 'Has processed', readonly: 1 },
|
||||
{ name: 'last_run_at', display: 'Last run', tag: 'datetime', readonly: 1 },
|
||||
{ name: 'next_run_at', display: 'Scheduled for', tag: 'datetime', readonly: 1 },
|
||||
{ name: 'last_run_at', display: 'Last run', tag: 'datetime', readonly: 1, include_timezone: true },
|
||||
{ name: 'next_run_at', display: 'Scheduled for', tag: 'datetime', readonly: 1, include_timezone: true },
|
||||
{ name: 'running', display: 'Running', tag: 'boolean', readonly: 1 },
|
||||
{ name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 },
|
||||
{ name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 },
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<p>
|
||||
<output class="timer-output js-timerResult"></output>
|
||||
</p>
|
||||
<output class="timer-output">
|
||||
<p class="js-timerResult"></p>
|
||||
</output>
|
||||
|
||||
<div class="select-boxes">
|
||||
<div class="select-box select-box--vertical js-day">
|
||||
<div class="select-box-header"><%- @T('Day') %></div>
|
||||
|
|
|
@ -9930,7 +9930,7 @@ label + .wizard-buttonList {
|
|||
|
||||
output {
|
||||
border-bottom: 1px solid hsl(200,71%,59%);
|
||||
margin: 14px 0 0;
|
||||
margin: 14px 0 19px;
|
||||
display: inline-block;
|
||||
padding: 10px 12px 8px;
|
||||
background: hsl(201,62%,93%);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
<link rel="stylesheet" href="/assets/tests/qunit-1.21.0.css">
|
||||
<%= javascript_include_tag "/assets/tests/qunit-1.21.0.js", "/assets/tests/model_ui.js", nonce: true %>
|
||||
<%= javascript_include_tag "/assets/tests/qunit-1.21.0.js", "/assets/tests/sinon-9.2.4", "/assets/tests/model_ui.js", nonce: true %>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
|
|
|
@ -16,7 +16,7 @@ test("form elements check", function() {
|
|||
autofocus: true
|
||||
});
|
||||
|
||||
equal('Run every Monday at 00:00', el.find('.js-timerResult').val())
|
||||
equal('Run every Monday at 00:00 in UTC time', el.find('.js-timerResult').text())
|
||||
|
||||
var params = App.ControllerForm.params(el)
|
||||
var test_params = {
|
||||
|
@ -101,7 +101,7 @@ test("form elements check", function() {
|
|||
autofocus: true
|
||||
});
|
||||
|
||||
equal('Run every Monday and Friday at 00:00, 00:10, 00:50, 10:00, 10:10, 10:50, 16:00, 16:10 and 16:50', el.find('.js-timerResult').val())
|
||||
equal('Run every Monday and Friday at 00:00, 00:10, 00:50, 10:00, 10:10, 10:50, 16:00, 16:10 and 16:50 in UTC time', el.find('.js-timerResult').text())
|
||||
|
||||
var params = App.ControllerForm.params(el)
|
||||
var test_params = {
|
||||
|
@ -158,7 +158,7 @@ test("form elements check", function() {
|
|||
$('#form2 .js-hour [data-value="16"]').click()
|
||||
$('#form2 .js-minute [data-value="10"]').click()
|
||||
|
||||
equal('Run every Monday, Friday and Saturday at 00:00, 00:50, 10:00 and 10:50', el.find('.js-timerResult').val())
|
||||
equal('Run every Monday, Friday and Saturday at 00:00, 00:50, 10:00 and 10:50 in UTC time', el.find('.js-timerResult').text())
|
||||
|
||||
var params = App.ControllerForm.params(el)
|
||||
var test_params = {
|
||||
|
|
|
@ -60,6 +60,15 @@ test( "model ui basic tests", function() {
|
|||
equal( App.viewPrint( ticket, 'link1' ), '<a href="http://zammad.com" target="blank">closed</a>')
|
||||
equal( App.viewPrint( ticket, 'link2' ), '<a href="http://zammad.com" target="blank">closed</a>')
|
||||
|
||||
let stub = sinon.stub(App.Config, 'get')
|
||||
stub.withArgs('timezone_default').returns('Example/Timezone')
|
||||
let attr = App.Ticket.configure_attributes.find(e => { return e.name == 'updated_at' })
|
||||
attr.include_timezone = true
|
||||
|
||||
equal( App.viewPrint( ticket, 'updated_at' ), '<time class="humanTimeFromNow " datetime="2014-11-07T23:43:08.000Z" title="11/07/2014 23:43 Example/Timezone" timezone="Example/Timezone">11/07/2014</time>')
|
||||
|
||||
attr.include_timezone = false
|
||||
stub.restore()
|
||||
|
||||
App.i18n.set('de-de')
|
||||
equal( App.viewPrint( ticket, 'id' ), 1000)
|
||||
|
|
Loading…
Reference in a new issue