UI cleanup for tasks

pull/115/head
Mark McDowall 10 years ago
parent 2b0ddb6131
commit 6b912a56f0

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using NzbDrone.Core.Jobs; using NzbDrone.Core.Jobs;
namespace NzbDrone.Api.System.Tasks namespace NzbDrone.Api.System.Tasks
@ -9,6 +10,8 @@ namespace NzbDrone.Api.System.Tasks
{ {
private readonly ITaskManager _taskManager; private readonly ITaskManager _taskManager;
private static readonly Regex NameRegex = new Regex("(?<!^)[A-Z]", RegexOptions.Compiled);
public TaskModule(ITaskManager taskManager) public TaskModule(ITaskManager taskManager)
: base("system/task") : base("system/task")
{ {
@ -23,11 +26,13 @@ namespace NzbDrone.Api.System.Tasks
private static TaskResource ConvertToResource(ScheduledTask scheduledTask) private static TaskResource ConvertToResource(ScheduledTask scheduledTask)
{ {
var taskName = scheduledTask.TypeName.Split('.').Last().Replace("Command", "");
return new TaskResource return new TaskResource
{ {
Id = scheduledTask.Id, Id = scheduledTask.Id,
Name = scheduledTask.TypeName.Split('.').Last().Replace("Command", ""), Name = NameRegex.Replace(taskName, match => " " + match.Value),
CommandName = scheduledTask.TypeName.Split('.').Last(), TaskName = taskName,
Interval = scheduledTask.Interval, Interval = scheduledTask.Interval,
LastExecution = scheduledTask.LastExecution, LastExecution = scheduledTask.LastExecution,
NextExecution = scheduledTask.LastExecution.AddMinutes(scheduledTask.Interval) NextExecution = scheduledTask.LastExecution.AddMinutes(scheduledTask.Interval)

@ -6,7 +6,7 @@ namespace NzbDrone.Api.System.Tasks
public class TaskResource : RestResource public class TaskResource : RestResource
{ {
public String Name { get; set; } public String Name { get; set; }
public String CommandName { get; set; } public String TaskName { get; set; }
public Int32 Interval { get; set; } public Int32 Interval { get; set; }
public DateTime LastExecution { get; set; } public DateTime LastExecution { get; set; }
public DateTime NextExecution { get; set; } public DateTime NextExecution { get; set; }

@ -44,15 +44,17 @@
.text-overflow(); .text-overflow();
} }
.relative-date-cell { .relative-date-cell, .relative-time-cell {
width : 150px;
cursor: default;
.text-overflow(); .text-overflow();
cursor : default;
.tooltip-inner {
max-width : 250px;
}
} }
.relative-time-cell { .relative-date-cell {
cursor: default; width : 150px;
.text-overflow();
} }
.history-event-type-cell { .history-event-type-cell {

@ -16,10 +16,11 @@ define(
this.$el.empty(); this.$el.empty();
var task = this.model.get('name'); var name = this.model.get('name');
var task = this.model.get('taskName');
this.$el.html( this.$el.html(
'<i class="icon-cogs x-execute" title="Execute {0}"></i>'.format(task) '<i class="icon-refresh icon-can-spin x-execute" title="Execute {0}"></i>'.format(name)
); );
CommandController.bindToCommand({ CommandController.bindToCommand({
@ -33,8 +34,8 @@ define(
}, },
_executeTask: function () { _executeTask: function () {
CommandController.Execute(this.model.get('name'), { CommandController.Execute(this.model.get('taskName'), {
name : this.model.get('name') name : this.model.get('taskName')
}); });
} }
}); });

Loading…
Cancel
Save