UI cleanup for tasks

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

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

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

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

@ -16,10 +16,11 @@ define(
this.$el.empty();
var task = this.model.get('name');
var name = this.model.get('name');
var task = this.model.get('taskName');
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({
@ -33,8 +34,8 @@ define(
},
_executeTask: function () {
CommandController.Execute(this.model.get('name'), {
name : this.model.get('name')
CommandController.Execute(this.model.get('taskName'), {
name : this.model.get('taskName')
});
}
});

Loading…
Cancel
Save