1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

needed to pass the filterType, received the filterType and handle

the filterType
This commit is contained in:
geogolem 2017-03-02 15:14:43 -05:00
parent b492fece6c
commit ff11388009
5 changed files with 32 additions and 3 deletions

View File

@ -13,6 +13,7 @@ public class PagingResource<TResource>
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; }
}

View File

@ -252,7 +252,14 @@ private PagingResource<TResource> ReadPagingResourceFromRequest()
{
pagingResource.FilterValue = Request.Query.FilterValue.ToString();
}
if (Request.Query.FilterType != null)
{
pagingResource.FilterType = Request.Query.FilterType.ToString();
}
}
return pagingResource;
}

View File

@ -140,6 +140,24 @@ private PagingResource<MovieResource> GetMoviePaged(PagingResource<MovieResource
pagingSpec.FilterExpression = v => v.MovieFileId == 0;
}
if (pagingResource.FilterKey == "title")
{
if (pagingResource.FilterType == "contains")
{
if (pagingResource.FilterValue == string.Empty || pagingResource.FilterValue == null)
{
pagingSpec.FilterExpression = v => true;
}
else
{
pagingSpec.FilterExpression = v => v.CleanTitle.Contains(pagingResource.FilterValue);
}
} else
{
pagingSpec.FilterExpression = v => v.CleanTitle == pagingResource.FilterValue;
}
}
return ApplyToPage(_moviesService.Paged, pagingSpec, MovieResourceMapper.ToResource);
}

View File

@ -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);

View File

@ -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;