Merge pull request #980 from geogolem/manualImportPagingFilterFix

[Fix] filtering on Manual Import
geogolem 8 years ago committed by GitHub
commit f3b3c9ff6a

@ -13,6 +13,7 @@ namespace NzbDrone.Api
public SortDirection SortDirection { get; set; }
public string FilterKey { get; set; }
public string FilterValue { get; set; }
public string FilterType { get; set; }
public int TotalRecords { get; set; }
public List<TResource> Records { get; set; }
}

@ -252,8 +252,15 @@ namespace NzbDrone.Api.REST
{
pagingResource.FilterValue = Request.Query.FilterValue.ToString();
}
if (Request.Query.FilterType != null)
{
pagingResource.FilterType = Request.Query.FilterType.ToString();
}
}
return pagingResource;
}
}

@ -140,6 +140,25 @@ namespace NzbDrone.Api.Movie
pagingSpec.FilterExpression = v => v.MovieFileId == 0;
}
if (pagingResource.FilterKey == "title")
{
if (pagingResource.FilterValue == string.Empty || pagingResource.FilterValue == null)
{
pagingSpec.FilterExpression = v => true;
}
else
{
if (pagingResource.FilterType == "contains")
{
pagingSpec.FilterExpression = v => v.CleanTitle.Contains(pagingResource.FilterValue);
}
else
{
pagingSpec.FilterExpression = v => v.CleanTitle == pagingResource.FilterValue;
}
}
}
return ApplyToPage(_moviesService.Paged, pagingSpec, MovieResourceMapper.ToResource);
}

@ -4,6 +4,7 @@ var Marionette = require('marionette');
var Backgrid = require('backgrid');
var MoviesCollection = require('../../Movies/MoviesCollection');
var SelectRow = require('./SelectMovieRow');
var FullMovieCollection = require('../../Movies/FullMovieCollection');
module.exports = Marionette.Layout.extend({
template : 'ManualImport/Movie/SelectMovieLayoutTemplate',
@ -32,7 +33,7 @@ module.exports = Marionette.Layout.extend({
],
initialize : function() {
this.movieCollection = MoviesCollection.clone();
this.movieCollection = FullMovieCollection;
this._setModelCollection();
this.listenTo(this.movieCollection, 'row:selected', this._onSelected);

@ -67,12 +67,14 @@ module.exports = function() {
_.extend(this.prototype.state, {
filterKey : null,
filterValue : null
filterValue : null,
filterType : null
});
_.extend(this.prototype.queryParams, {
filterKey : 'filterKey',
filterValue : 'filterValue'
filterValue : 'filterValue',
filterType : 'filterType'
});
return this;

Loading…
Cancel
Save