1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 23:42:33 +01:00

Added event type icon to history grid.

This commit is contained in:
Keivan Beigi 2013-06-10 18:55:05 -07:00
parent 9d8fd840c4
commit 76fb548ccd
9 changed files with 87 additions and 8 deletions

View File

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using NzbDrone.Api.REST;
using NzbDrone.Core.History;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.History
@ -15,7 +17,11 @@ namespace NzbDrone.Api.History
public string NzbInfoUrl { get; set; }
public string ReleaseGroup { get; set; }
public HistoryEventType EventType { get; set; }
public Dictionary<string, string> Data { get; set; }
public Episode Episode { get; set; }
public Core.Tv.Series Series { get; set; }
public Core.Tv.Series Series { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Tags("")]
[Migration(5)]
public class added_eventtype_to_history : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("History")
.AddColumn("EventType")
.AsInt32()
.Nullable();
}
}
}

View File

@ -21,7 +21,18 @@ namespace NzbDrone.Core.History
public Episode Episode { get; set; }
public Series Series { get; set; }
public HistoryEventType EventType { get; set; }
public Dictionary<string, string> Data { get; set; }
}
public enum HistoryEventType
{
Unknown = 0,
Grabbed = 1,
SeriesFolderImported = 2,
DownloadFolderImported = 3
}
}

View File

@ -61,6 +61,7 @@ namespace NzbDrone.Core.History
{
var history = new History
{
EventType = HistoryEventType.Grabbed,
Date = DateTime.UtcNow,
Quality = message.Episode.ParsedEpisodeInfo.Quality,
SourceTitle = message.Episode.Report.Title,
@ -83,6 +84,7 @@ namespace NzbDrone.Core.History
{
var history = new History
{
EventType = HistoryEventType.DownloadFolderImported,
Date = DateTime.UtcNow,
Quality = message.EpisodeFile.Quality,
SourceTitle = message.EpisodeFile.Path,

View File

@ -211,6 +211,7 @@
<Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" />
<Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" />
<Compile Include="Datastore\Migration\004_updated_history.cs" />
<Compile Include="Datastore\Migration\005_added_eventtype_to_history.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationOptions.cs" />

View File

@ -22,18 +22,18 @@ define(['app'], function () {
var name = this.column.get('name');
if(name === 'this'){
if (name === 'this') {
return this.model;
}
var value = this.model.get(name);
if(!value){
if (!value) {
return undefined;
}
//if not a model
if (!value.get) {
if (!value.get && typeof value === 'object') {
value = new Backbone.Model(value);
}

View File

@ -17,3 +17,7 @@
.quality-cell{
width: 130px;
}
.history-event-type-cell{
width : 10px;
}

View File

@ -0,0 +1,37 @@
"use strict";
define(['app', 'Cells/NzbDroneCell' ], function () {
NzbDrone.History.EventTypeCell = NzbDrone.Cells.NzbDroneCell.extend({
className: 'history-event-type-cell',
render: function () {
this.$el.empty();
if (this.cellValue) {
var icon = 'icon-question';
var toolTip = 'unknow event';
switch (this.cellValue) {
case 'grabbed':
icon = 'icon-cloud-download';
toolTip = 'Episode grabbed from indexer and sent to download client';
break;
case 'seriesFolderImported':
icon = 'icon-hdd';
toolTip = 'Existing episode file added to library';
break;
case 'DownloadFolderImported':
icon = 'icon-download-alt';
toolTip = 'Episode downloaded succesfully and picked up from download client';
break;
}
this.$el.html('<i class="{0}" title="{1}"/>'.format(icon, toolTip));
}
return this;
}
});
});

View File

@ -2,8 +2,8 @@
define([
'app',
'History/Collection',
'History/EventTypeCell',
'Cells/RelativeDateCell',
'Cells/IndexerCell',
'Cells/TemplatedCell',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
@ -24,9 +24,9 @@ define([
columns: [
{
name : 'indexer',
label: '',
cell : NzbDrone.Cells.IndexerCell
name: 'eventType',
label:'',
cell : NzbDrone.History.EventTypeCell
},
{
name : 'series',