New: Add tags field to MovieCollection (#8736)

* New: Add tags field to MovieCollection
* Added Tag input prepopulation for new collection movies
* Handle editting of collection tags
* Revert changes to CollectionController.cs
pull/8768/head
Ricardo Christmann 1 year ago committed by GitHub
parent bd1844030d
commit fe41aada06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,7 @@ function createMapStateToProps() {
qualityProfileId: collection.qualityProfileId,
minimumAvailability: collection.minimumAvailability,
searchForMovie: collection.searchOnAdd,
tags: []
tags: collection.tags || []
};
const {

@ -50,6 +50,7 @@ class EditCollectionModalContent extends Component {
minimumAvailability,
// Id,
rootFolderPath,
tags,
searchOnAdd
} = item;
@ -126,6 +127,17 @@ class EditCollectionModalContent extends Component {
/>
</FormGroup>
<FormGroup>
<FormLabel>{translate('Tags')}</FormLabel>
<FormInputGroup
type={inputTypes.TAG}
name="tags"
onChange={onInputChange}
{...tags}
/>
</FormGroup>
<FormGroup>
<FormLabel>{translate('SearchOnAdd')}</FormLabel>

@ -42,6 +42,7 @@ function createMapStateToProps() {
qualityProfileId: collection.qualityProfileId,
minimumAvailability: collection.minimumAvailability,
rootFolderPath: collection.rootFolderPath,
tags: collection.tags,
searchOnAdd: collection.searchOnAdd
};

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(225)]
public class add_tags_to_collections : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Collections").AddColumn("Tags").AsString().Nullable();
}
}
}

@ -25,6 +25,7 @@ namespace NzbDrone.Core.Movies.Collections
public List<MediaCover.MediaCover> Images { get; set; }
public DateTime Added { get; set; }
public List<MovieMetadata> Movies { get; set; }
public HashSet<int> Tags { get; set; }
public void ApplyChanges(MovieCollection otherCollection)
{
@ -35,6 +36,7 @@ namespace NzbDrone.Core.Movies.Collections
QualityProfileId = otherCollection.QualityProfileId;
MinimumAvailability = otherCollection.MinimumAvailability;
RootFolderPath = otherCollection.RootFolderPath;
Tags = otherCollection.Tags;
}
}
}

@ -139,7 +139,8 @@ namespace NzbDrone.Core.Movies
SearchForMovie = collection.SearchOnAdd,
AddMethod = AddMovieMethod.Collection
},
Monitored = true
Monitored = true,
Tags = collection.Tags
}).ToList(), true);
}
}

@ -141,7 +141,8 @@ namespace NzbDrone.Core.Movies
SearchOnAdd = movie.AddOptions?.SearchForMovie ?? false,
QualityProfileId = movie.ProfileId,
MinimumAvailability = movie.MinimumAvailability,
RootFolderPath = _folderService.GetBestRootFolderPath(movie.Path).TrimEnd('/', '\\', ' ')
RootFolderPath = _folderService.GetBestRootFolderPath(movie.Path).TrimEnd('/', '\\', ' '),
Tags = movie.Tags
});
if (newCollection != null)

@ -26,6 +26,7 @@ namespace Radarr.Api.V3.Collections
public MovieStatusType MinimumAvailability { get; set; }
public List<CollectionMovieResource> Movies { get; set; }
public int MissingMovies { get; set; }
public HashSet<int> Tags { get; set; }
}
public static class CollectionResourceMapper
@ -49,7 +50,8 @@ namespace Radarr.Api.V3.Collections
QualityProfileId = model.QualityProfileId,
RootFolderPath = model.RootFolderPath,
MinimumAvailability = model.MinimumAvailability,
SearchOnAdd = model.SearchOnAdd
SearchOnAdd = model.SearchOnAdd,
Tags = model.Tags
};
}
@ -76,7 +78,8 @@ namespace Radarr.Api.V3.Collections
QualityProfileId = resource.QualityProfileId,
RootFolderPath = resource.RootFolderPath,
SearchOnAdd = resource.SearchOnAdd,
MinimumAvailability = resource.MinimumAvailability
MinimumAvailability = resource.MinimumAvailability,
Tags = resource.Tags
};
}

Loading…
Cancel
Save