diff --git a/src/NzbDrone.Api/System/Tasks/TaskModule.cs b/src/NzbDrone.Api/System/Tasks/TaskModule.cs index c73f8cb45..e13fadf9b 100644 --- a/src/NzbDrone.Api/System/Tasks/TaskModule.cs +++ b/src/NzbDrone.Api/System/Tasks/TaskModule.cs @@ -2,18 +2,21 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; +using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Jobs; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.SignalR; namespace NzbDrone.Api.System.Tasks { - public class TaskModule : NzbDroneRestModule + public class TaskModule : NzbDroneRestModuleWithSignalR, IHandle { private readonly ITaskManager _taskManager; private static readonly Regex NameRegex = new Regex("(?{1}'; + + if (UiSettings.get('showRelativeDates')) { + var tooltip = nextExecution.format(UiSettings.longDateTime()); + var text = nextExecution.fromNow(); + + this.$el.html(result.format(tooltip, text)); + } + + else { + this.$el.html(nextExecution.format(UiSettings.longDateTime())); + } + } + + return this; + } + }); + }); diff --git a/src/UI/System/Task/TaskIntervalCell.js b/src/UI/System/Task/TaskIntervalCell.js index 694fc042e..dd3b10276 100644 --- a/src/UI/System/Task/TaskIntervalCell.js +++ b/src/UI/System/Task/TaskIntervalCell.js @@ -13,11 +13,15 @@ define( this.$el.empty(); var interval = this.model.get('interval'); - var duration = moment.duration(interval, 'minutes').humanize(); + var duration = moment.duration(interval, 'minutes').humanize().replace(/an?(?=\s)/, '1'); - this.$el.html( - duration.replace(/an?(?=\s)/, '1') - ); + if (interval === 0 ) { + this.$el.html('disabled'); + } + + else { + this.$el.html(duration); + } return this; } diff --git a/src/UI/System/Task/TaskLayout.js b/src/UI/System/Task/TaskLayout.js index c55337c92..ee9d34701 100644 --- a/src/UI/System/Task/TaskLayout.js +++ b/src/UI/System/Task/TaskLayout.js @@ -7,8 +7,17 @@ define( 'Cells/RelativeTimeCell', 'System/Task/TaskIntervalCell', 'System/Task/ExecuteTaskCell', - 'Shared/LoadingView' - ], function (Marionette, Backgrid, BackupCollection, RelativeTimeCell, TaskIntervalCell, ExecuteTaskCell, LoadingView) { + 'System/Task/NextExecutionCell', + 'Shared/LoadingView', + 'Mixins/backbone.signalr.mixin' + ], function (Marionette, + Backgrid, + BackupCollection, + RelativeTimeCell, + TaskIntervalCell, + ExecuteTaskCell, + NextExecutionCell, + LoadingView) { return Marionette.Layout.extend({ template: 'System/Task/TaskLayoutTemplate', @@ -39,7 +48,7 @@ define( name : 'nextExecution', label : 'Next Execution', sortable : true, - cell : RelativeTimeCell + cell : NextExecutionCell }, { name : 'this', @@ -53,6 +62,7 @@ define( this.taskCollection = new BackupCollection(); this.listenTo(this.taskCollection, 'sync', this._showTasks); + this.taskCollection.bindSignalR(); }, onRender: function () { diff --git a/src/UI/System/Task/TaskLayoutTemplate.hbs b/src/UI/System/Task/TaskLayoutTemplate.hbs index 87b503704..02b971abf 100644 --- a/src/UI/System/Task/TaskLayoutTemplate.hbs +++ b/src/UI/System/Task/TaskLayoutTemplate.hbs @@ -1,5 +1,5 @@ 
-
+