Fixed issue with Artist page not rendering the artists in DB

pull/4/head
Joseph Milazzo 7 years ago
parent 50d5693399
commit 0ec8830def

@ -98,7 +98,7 @@ namespace NzbDrone.Api.Music
{
//var seriesStats = _seriesStatisticsService.SeriesStatistics();
var artistResources = _artistService.GetAllArtists().ToResource();
Console.WriteLine("[DEBUG] Returning {0} Artists", artistResources.Count);
MapCoversToLocal(artistResources.ToArray());
//LinkSeriesStatistics(seriesResources, seriesStats);
//PopulateAlternateTitles(seriesResources);

@ -6,7 +6,7 @@ var ExistingSeriesCollectionView = require('./Existing/AddExistingSeriesCollecti
var AddSeriesView = require('./AddSeriesView');
var ProfileCollection = require('../Profile/ProfileCollection');
var RootFolderCollection = require('./RootFolders/RootFolderCollection');
require('../Series/SeriesCollection');
require('../Artist/ArtistCollection');
module.exports = Marionette.Layout.extend({
template : 'AddSeries/AddSeriesLayoutTemplate',

@ -1,34 +1,33 @@
var NzbDroneController = require('../Shared/NzbDroneController');
var AppLayout = require('../AppLayout');
var ArtistCollection = require('./ArtistCollection');
var SeriesIndexLayout = require('./Index/SeriesIndexLayout');
var SeriesIndexLayout = require('../Series/Index/SeriesIndexLayout');
var SeriesDetailsLayout = require('../Series/Details/SeriesDetailsLayout');
module.exports = NzbDroneController.extend({
_originalInit : NzbDroneController.prototype.initialize,
initialize : function() {
this.route('', this.series);
this.route('artist', this.series);
this.route('artist/:query', this.seriesDetails);
this.route('', this.artist);
this.route('artist', this.artist);
this.route('artist/:query', this.artistDetails);
this._originalInit.apply(this, arguments);
},
artist : function() {
this.setTitle('Lidarr');
this.setArtistName('Lidarr');
this.showMainRegion(new SeriesIndexLayout());
},
seriesDetails : function(query) {
artistDetails : function(query) {
var artists = ArtistCollection.where({ artistNameSlug : query });
console.log('seriesDetails, artists: ', artists);
console.log('artistDetails, artists: ', artists);
if (artists.length !== 0) {
var targetSeries = artists[0];
console.log("[ArtistController] targetSeries: ", targetSeries);
this.setTitle(targetSeries.get('title'));
this.setArtistName(targetSeries.get('artistName'));
this.setTitle(targetSeries.get('artistName')); // TODO: Update NzbDroneController
//this.setArtistName(targetSeries.get('artistName'));
this.showMainRegion(new SeriesDetailsLayout({ model : targetSeries }));
} else {
this.showNotFound();

@ -71,6 +71,16 @@ Handlebars.registerHelper('seasonCountHelper', function() {
return new Handlebars.SafeString('<span class="label label-info">{0} Seasons</span>'.format(seasonCount));
});
Handlebars.registerHelper('albumCountHelper', function() {
var albumCount = this.albumCount;
if (albumCount === 1) {
return new Handlebars.SafeString('<span class="label label-info">{0} Albums</span>'.format(albumCount));
}
return new Handlebars.SafeString('<span class="label label-info">{0} Albums</span>'.format(albumCount));
});
/*Handlebars.registerHelper('titleWithYear', function() {
if (this.title.endsWith(' ({0})'.format(this.year))) {
return this.title;

@ -8,14 +8,14 @@
<div class="col-md-10 col-xs-9">
<div class="row">
<div class="col-md-10 col-xs-10">
<a href="{{route}}" target="_blank">
<h2>{{title}}</h2>
<a href="artist/{{artistName}}" target="_blank">
<h2>{{artistName}}</h2>
</a>
</div>
<div class="col-md-2 col-xs-2">
<div class="pull-right series-overview-list-actions">
<i class="icon-lidarr-refresh x-refresh" title="Update series info and scan disk"/>
<i class="icon-lidarr-edit x-edit" title="Edit Series"/>
<i class="icon-lidarr-refresh x-refresh" title="Update artist info and scan disk"/>
<i class="icon-lidarr-edit x-edit" title="Edit Artist"/>
</div>
</div>
</div>
@ -35,15 +35,17 @@
</div>
<div class="row">
<div class="col-md-10 col-xs-8">
{{#if_eq status compare="ended"}}
<!--{{#if_eq status compare="ended"}}
<span class="label label-danger">Ended</span>
{{/if_eq}}
{{/if_eq}}-->
<!--
NOTE: We can show next drop date of album in future
{{#if nextAiring}}
<span class="label label-default">{{RelativeDate nextAiring}}</span>
{{/if}}
{{/if}}-->
{{seasonCountHelper}}
{{albumCountHelper}}
{{profile profileId}}
</div>

@ -4,7 +4,7 @@ var Backgrid = require('backgrid');
var PosterCollectionView = require('./Posters/SeriesPostersCollectionView');
var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
var EmptyView = require('./EmptyView');
var SeriesCollection = require('../SeriesCollection');
var ArtistCollection = require('../../Artist/ArtistCollection');
var RelativeDateCell = require('../../Cells/RelativeDateCell');
var SeriesTitleCell = require('../../Cells/SeriesTitleCell');
var TemplatedCell = require('../../Cells/TemplatedCell');
@ -111,28 +111,28 @@ module.exports = Marionette.Layout.extend({
},
initialize : function() {
this.seriesCollection = SeriesCollection.clone();
this.seriesCollection.shadowCollection.bindSignalR();
this.artistCollection = ArtistCollection.clone();
this.artistCollection.shadowCollection.bindSignalR();
this.listenTo(this.seriesCollection.shadowCollection, 'sync', function(model, collection, options) {
this.seriesCollection.fullCollection.resetFiltered();
this.listenTo(this.artistCollection, 'sync', function(model, collection, options) {
this.artistCollection.fullCollection.resetFiltered();
this._renderView();
});
this.listenTo(this.seriesCollection.shadowCollection, 'add', function(model, collection, options) {
this.seriesCollection.fullCollection.resetFiltered();
this.listenTo(this.artistCollection, 'add', function(model, collection, options) {
this.artistCollection.fullCollection.resetFiltered();
this._renderView();
});
this.listenTo(this.seriesCollection.shadowCollection, 'remove', function(model, collection, options) {
this.seriesCollection.fullCollection.resetFiltered();
this.listenTo(this.artistCollection, 'remove', function(model, collection, options) {
this.artistCollection.fullCollection.resetFiltered();
this._renderView();
});
this.sortingOptions = {
type : 'sorting',
storeState : false,
viewCollection : this.seriesCollection,
viewCollection : this.artistCollection,
items : [
{
title : 'Title',
@ -243,7 +243,7 @@ module.exports = Marionette.Layout.extend({
_showTable : function() {
this.currentView = new Backgrid.Grid({
collection : this.seriesCollection,
collection : this.artistCollection,
columns : this.columns,
className : 'table table-hover'
});
@ -253,7 +253,7 @@ module.exports = Marionette.Layout.extend({
_showList : function() {
this.currentView = new ListCollectionView({
collection : this.seriesCollection
collection : this.artistCollection
});
this._renderView();
@ -261,14 +261,15 @@ module.exports = Marionette.Layout.extend({
_showPosters : function() {
this.currentView = new PosterCollectionView({
collection : this.seriesCollection
collection : this.artistCollection
});
this._renderView();
},
_renderView : function() {
if (SeriesCollection.length === 0) {
// Problem is this is calling before artistCollection has updated. Where are the promises with backbone?
if (this.artistCollection.length === 0) {
this.seriesRegion.show(new EmptyView());
this.toolbar.close();
@ -282,13 +283,14 @@ module.exports = Marionette.Layout.extend({
},
_fetchCollection : function() {
this.seriesCollection.fetch();
this.artistCollection.fetch();
console.log('index page, collection: ', this.artistCollection);
},
_setFilter : function(buttonContext) {
var mode = buttonContext.model.get('key');
this.seriesCollection.setFilterMode(mode);
this.artistCollection.setFilterMode(mode);
},
_showToolbar : function() {
@ -317,22 +319,22 @@ module.exports = Marionette.Layout.extend({
_showFooter : function() {
var footerModel = new FooterModel();
var series = SeriesCollection.models.length;
var series = this.artistCollection.models.length;
var episodes = 0;
var episodeFiles = 0;
var ended = 0;
var continuing = 0;
var monitored = 0;
_.each(SeriesCollection.models, function(model) {
episodes += model.get('episodeCount');
_.each(this.artistCollection.models, function(model) {
episodes += model.get('episodeCount'); // TODO: Refactor to Seasons and Tracks
episodeFiles += model.get('episodeFileCount');
if (model.get('status').toLowerCase() === 'ended') {
/*if (model.get('status').toLowerCase() === 'ended') {
ended++;
} else {
continuing++;
}
}*/
if (model.get('monitored')) {
monitored++;

@ -5,7 +5,7 @@ var RouteBinder = require('./jQuery/RouteBinder');
var SignalRBroadcaster = require('./Shared/SignalRBroadcaster');
var NavbarLayout = require('./Navbar/NavbarLayout');
var AppLayout = require('./AppLayout');
var SeriesController = require('./Series/SeriesController');
var ArtistController = require('./Artist/ArtistController');
var Router = require('./Router');
var ModalController = require('./Shared/Modal/ModalController');
var ControlPanelController = require('./Shared/ControlPanel/ControlPanelController');
@ -20,7 +20,7 @@ require('./Hotkeys/Hotkeys');
require('./Shared/piwikCheck');
require('./Shared/VersionChangeMonitor');
new SeriesController();
new ArtistController();
new ModalController();
new ControlPanelController();
new Router();

@ -5,6 +5,8 @@ var vent = new Wreqr.EventAggregator();
vent.Events = {
SeriesAdded : 'series:added',
SeriesDeleted : 'series:deleted',
ArtistAdded : 'artist:added',
ArtistDeleted : 'artist:deleted',
CommandComplete : 'command:complete',
ServerUpdated : 'server:updated',
EpisodeFileDeleted : 'episodefile:deleted'

Loading…
Cancel
Save