mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 21:09:05 +00:00
Remove Thumbnail Preferences. (#1200)
* Remove thumbnail preferences. #1089 * Remove thumbnail preferences test. * Remove thumbnail preferences from backend. * Fix database.go * Update generated TS files. * Reorder the migrations.
This commit is contained in:
@@ -195,6 +195,11 @@ func MigrateDatabase(db *gorm.DB) error {
|
|||||||
log.Printf("Failed to run exif GPS correction migration: %v\n", err)
|
log.Printf("Failed to run exif GPS correction migration: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// v2.5.0 - Remove Thumbnail Method for Downsampliing filters
|
||||||
|
if db.Migrator().HasColumn(&models.SiteInfo{}, "thumbnail_method") {
|
||||||
|
db.Migrator().DropColumn(&models.SiteInfo{}, "thumbnail_method")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,31 +153,30 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mutation struct {
|
Mutation struct {
|
||||||
AuthorizeUser func(childComplexity int, username string, password string) int
|
AuthorizeUser func(childComplexity int, username string, password string) int
|
||||||
ChangeUserPreferences func(childComplexity int, language *string) int
|
ChangeUserPreferences func(childComplexity int, language *string) int
|
||||||
CombineFaceGroups func(childComplexity int, destinationFaceGroupID int, sourceFaceGroupID int) int
|
CombineFaceGroups func(childComplexity int, destinationFaceGroupID int, sourceFaceGroupID int) int
|
||||||
CreateUser func(childComplexity int, username string, password *string, admin bool) int
|
CreateUser func(childComplexity int, username string, password *string, admin bool) int
|
||||||
DeleteShareToken func(childComplexity int, token string) int
|
DeleteShareToken func(childComplexity int, token string) int
|
||||||
DeleteUser func(childComplexity int, id int) int
|
DeleteUser func(childComplexity int, id int) int
|
||||||
DetachImageFaces func(childComplexity int, imageFaceIDs []int) int
|
DetachImageFaces func(childComplexity int, imageFaceIDs []int) int
|
||||||
FavoriteMedia func(childComplexity int, mediaID int, favorite bool) int
|
FavoriteMedia func(childComplexity int, mediaID int, favorite bool) int
|
||||||
InitialSetupWizard func(childComplexity int, username string, password string, rootPath string) int
|
InitialSetupWizard func(childComplexity int, username string, password string, rootPath string) int
|
||||||
MoveImageFaces func(childComplexity int, imageFaceIDs []int, destinationFaceGroupID int) int
|
MoveImageFaces func(childComplexity int, imageFaceIDs []int, destinationFaceGroupID int) int
|
||||||
ProtectShareToken func(childComplexity int, token string, password *string) int
|
ProtectShareToken func(childComplexity int, token string, password *string) int
|
||||||
RecognizeUnlabeledFaces func(childComplexity int) int
|
RecognizeUnlabeledFaces func(childComplexity int) int
|
||||||
ResetAlbumCover func(childComplexity int, albumID int) int
|
ResetAlbumCover func(childComplexity int, albumID int) int
|
||||||
ScanAll func(childComplexity int) int
|
ScanAll func(childComplexity int) int
|
||||||
ScanUser func(childComplexity int, userID int) int
|
ScanUser func(childComplexity int, userID int) int
|
||||||
SetAlbumCover func(childComplexity int, coverID int) int
|
SetAlbumCover func(childComplexity int, coverID int) int
|
||||||
SetFaceGroupLabel func(childComplexity int, faceGroupID int, label *string) int
|
SetFaceGroupLabel func(childComplexity int, faceGroupID int, label *string) int
|
||||||
SetPeriodicScanInterval func(childComplexity int, interval int) int
|
SetPeriodicScanInterval func(childComplexity int, interval int) int
|
||||||
SetScannerConcurrentWorkers func(childComplexity int, workers int) int
|
SetScannerConcurrentWorkers func(childComplexity int, workers int) int
|
||||||
SetThumbnailDownsampleMethod func(childComplexity int, method models.ThumbnailFilter) int
|
ShareAlbum func(childComplexity int, albumID int, expire *time.Time, password *string) int
|
||||||
ShareAlbum func(childComplexity int, albumID int, expire *time.Time, password *string) int
|
ShareMedia func(childComplexity int, mediaID int, expire *time.Time, password *string) int
|
||||||
ShareMedia func(childComplexity int, mediaID int, expire *time.Time, password *string) int
|
UpdateUser func(childComplexity int, id int, username *string, password *string, admin *bool) int
|
||||||
UpdateUser func(childComplexity int, id int, username *string, password *string, admin *bool) int
|
UserAddRootPath func(childComplexity int, id int, rootPath string) int
|
||||||
UserAddRootPath func(childComplexity int, id int, rootPath string) int
|
UserRemoveRootAlbum func(childComplexity int, userID int, albumID int) int
|
||||||
UserRemoveRootAlbum func(childComplexity int, userID int, albumID int) int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification struct {
|
Notification struct {
|
||||||
@@ -239,7 +238,6 @@ type ComplexityRoot struct {
|
|||||||
FaceDetectionEnabled func(childComplexity int) int
|
FaceDetectionEnabled func(childComplexity int) int
|
||||||
InitialSetup func(childComplexity int) int
|
InitialSetup func(childComplexity int) int
|
||||||
PeriodicScanInterval func(childComplexity int) int
|
PeriodicScanInterval func(childComplexity int) int
|
||||||
ThumbnailMethod func(childComplexity int) int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Subscription struct {
|
Subscription struct {
|
||||||
@@ -330,7 +328,6 @@ type MutationResolver interface {
|
|||||||
ShareMedia(ctx context.Context, mediaID int, expire *time.Time, password *string) (*models.ShareToken, error)
|
ShareMedia(ctx context.Context, mediaID int, expire *time.Time, password *string) (*models.ShareToken, error)
|
||||||
DeleteShareToken(ctx context.Context, token string) (*models.ShareToken, error)
|
DeleteShareToken(ctx context.Context, token string) (*models.ShareToken, error)
|
||||||
ProtectShareToken(ctx context.Context, token string, password *string) (*models.ShareToken, error)
|
ProtectShareToken(ctx context.Context, token string, password *string) (*models.ShareToken, error)
|
||||||
SetThumbnailDownsampleMethod(ctx context.Context, method models.ThumbnailFilter) (models.ThumbnailFilter, error)
|
|
||||||
AuthorizeUser(ctx context.Context, username string, password string) (*models.AuthorizeResult, error)
|
AuthorizeUser(ctx context.Context, username string, password string) (*models.AuthorizeResult, error)
|
||||||
InitialSetupWizard(ctx context.Context, username string, password string, rootPath string) (*models.AuthorizeResult, error)
|
InitialSetupWizard(ctx context.Context, username string, password string, rootPath string) (*models.AuthorizeResult, error)
|
||||||
UpdateUser(ctx context.Context, id int, username *string, password *string, admin *bool) (*models.User, error)
|
UpdateUser(ctx context.Context, id int, username *string, password *string, admin *bool) (*models.User, error)
|
||||||
@@ -1066,18 +1063,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.Mutation.SetScannerConcurrentWorkers(childComplexity, args["workers"].(int)), true
|
return e.complexity.Mutation.SetScannerConcurrentWorkers(childComplexity, args["workers"].(int)), true
|
||||||
|
|
||||||
case "Mutation.setThumbnailDownsampleMethod":
|
|
||||||
if e.complexity.Mutation.SetThumbnailDownsampleMethod == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
args, err := ec.field_Mutation_setThumbnailDownsampleMethod_args(ctx, rawArgs)
|
|
||||||
if err != nil {
|
|
||||||
return 0, false
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.Mutation.SetThumbnailDownsampleMethod(childComplexity, args["method"].(models.ThumbnailFilter)), true
|
|
||||||
|
|
||||||
case "Mutation.shareAlbum":
|
case "Mutation.shareAlbum":
|
||||||
if e.complexity.Mutation.ShareAlbum == nil {
|
if e.complexity.Mutation.ShareAlbum == nil {
|
||||||
break
|
break
|
||||||
@@ -1499,13 +1484,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.SiteInfo.PeriodicScanInterval(childComplexity), true
|
return e.complexity.SiteInfo.PeriodicScanInterval(childComplexity), true
|
||||||
|
|
||||||
case "SiteInfo.thumbnailMethod":
|
|
||||||
if e.complexity.SiteInfo.ThumbnailMethod == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.SiteInfo.ThumbnailMethod(childComplexity), true
|
|
||||||
|
|
||||||
case "Subscription.notification":
|
case "Subscription.notification":
|
||||||
if e.complexity.Subscription.Notification == nil {
|
if e.complexity.Subscription.Notification == nil {
|
||||||
break
|
break
|
||||||
@@ -1784,7 +1762,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er
|
|||||||
return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil
|
return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:embed "resolvers/album.graphql" "resolvers/faces.graphql" "resolvers/media.graphql" "resolvers/media_geo_json.graphql" "resolvers/notification.graphql" "resolvers/root.graphql" "resolvers/scanner.graphql" "resolvers/search.graphql" "resolvers/share_token.graphql" "resolvers/site_info.graphql" "resolvers/thumbnails.graphql" "resolvers/timeline.graphql" "resolvers/user.graphql"
|
//go:embed "resolvers/album.graphql" "resolvers/faces.graphql" "resolvers/media.graphql" "resolvers/media_geo_json.graphql" "resolvers/notification.graphql" "resolvers/root.graphql" "resolvers/scanner.graphql" "resolvers/search.graphql" "resolvers/share_token.graphql" "resolvers/site_info.graphql" "resolvers/timeline.graphql" "resolvers/user.graphql"
|
||||||
var sourcesFS embed.FS
|
var sourcesFS embed.FS
|
||||||
|
|
||||||
func sourceData(filename string) string {
|
func sourceData(filename string) string {
|
||||||
@@ -1806,7 +1784,6 @@ var sources = []*ast.Source{
|
|||||||
{Name: "resolvers/search.graphql", Input: sourceData("resolvers/search.graphql"), BuiltIn: false},
|
{Name: "resolvers/search.graphql", Input: sourceData("resolvers/search.graphql"), BuiltIn: false},
|
||||||
{Name: "resolvers/share_token.graphql", Input: sourceData("resolvers/share_token.graphql"), BuiltIn: false},
|
{Name: "resolvers/share_token.graphql", Input: sourceData("resolvers/share_token.graphql"), BuiltIn: false},
|
||||||
{Name: "resolvers/site_info.graphql", Input: sourceData("resolvers/site_info.graphql"), BuiltIn: false},
|
{Name: "resolvers/site_info.graphql", Input: sourceData("resolvers/site_info.graphql"), BuiltIn: false},
|
||||||
{Name: "resolvers/thumbnails.graphql", Input: sourceData("resolvers/thumbnails.graphql"), BuiltIn: false},
|
|
||||||
{Name: "resolvers/timeline.graphql", Input: sourceData("resolvers/timeline.graphql"), BuiltIn: false},
|
{Name: "resolvers/timeline.graphql", Input: sourceData("resolvers/timeline.graphql"), BuiltIn: false},
|
||||||
{Name: "resolvers/user.graphql", Input: sourceData("resolvers/user.graphql"), BuiltIn: false},
|
{Name: "resolvers/user.graphql", Input: sourceData("resolvers/user.graphql"), BuiltIn: false},
|
||||||
}
|
}
|
||||||
@@ -2675,34 +2652,6 @@ func (ec *executionContext) field_Mutation_setScannerConcurrentWorkers_argsWorke
|
|||||||
return zeroVal, nil
|
return zeroVal, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Mutation_setThumbnailDownsampleMethod_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
|
||||||
var err error
|
|
||||||
args := map[string]any{}
|
|
||||||
arg0, err := ec.field_Mutation_setThumbnailDownsampleMethod_argsMethod(ctx, rawArgs)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
args["method"] = arg0
|
|
||||||
return args, nil
|
|
||||||
}
|
|
||||||
func (ec *executionContext) field_Mutation_setThumbnailDownsampleMethod_argsMethod(
|
|
||||||
ctx context.Context,
|
|
||||||
rawArgs map[string]any,
|
|
||||||
) (models.ThumbnailFilter, error) {
|
|
||||||
if _, ok := rawArgs["method"]; !ok {
|
|
||||||
var zeroVal models.ThumbnailFilter
|
|
||||||
return zeroVal, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("method"))
|
|
||||||
if tmp, ok := rawArgs["method"]; ok {
|
|
||||||
return ec.unmarshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx, tmp)
|
|
||||||
}
|
|
||||||
|
|
||||||
var zeroVal models.ThumbnailFilter
|
|
||||||
return zeroVal, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) field_Mutation_shareAlbum_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
func (ec *executionContext) field_Mutation_shareAlbum_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]any{}
|
args := map[string]any{}
|
||||||
@@ -8383,83 +8332,6 @@ func (ec *executionContext) fieldContext_Mutation_protectShareToken(ctx context.
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Mutation_setThumbnailDownsampleMethod(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
|
||||||
fc, err := ec.fieldContext_Mutation_setThumbnailDownsampleMethod(ctx, field)
|
|
||||||
if err != nil {
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
ctx = graphql.WithFieldContext(ctx, fc)
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
ec.Error(ctx, ec.Recover(ctx, r))
|
|
||||||
ret = graphql.Null
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
|
||||||
directive0 := func(rctx context.Context) (any, error) {
|
|
||||||
ctx = rctx // use context from middleware stack in children
|
|
||||||
return ec.resolvers.Mutation().SetThumbnailDownsampleMethod(rctx, fc.Args["method"].(models.ThumbnailFilter))
|
|
||||||
}
|
|
||||||
|
|
||||||
directive1 := func(ctx context.Context) (any, error) {
|
|
||||||
if ec.directives.IsAdmin == nil {
|
|
||||||
var zeroVal models.ThumbnailFilter
|
|
||||||
return zeroVal, errors.New("directive isAdmin is not implemented")
|
|
||||||
}
|
|
||||||
return ec.directives.IsAdmin(ctx, nil, directive0)
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp, err := directive1(rctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, graphql.ErrorOnPath(ctx, err)
|
|
||||||
}
|
|
||||||
if tmp == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
if data, ok := tmp.(models.ThumbnailFilter); ok {
|
|
||||||
return data, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be github.com/photoview/photoview/api/graphql/models.ThumbnailFilter`, tmp)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
ec.Error(ctx, err)
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
if resTmp == nil {
|
|
||||||
if !graphql.HasFieldError(ctx, fc) {
|
|
||||||
ec.Errorf(ctx, "must not be null")
|
|
||||||
}
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
res := resTmp.(models.ThumbnailFilter)
|
|
||||||
fc.Result = res
|
|
||||||
return ec.marshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx, field.Selections, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Mutation_setThumbnailDownsampleMethod(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
|
||||||
fc = &graphql.FieldContext{
|
|
||||||
Object: "Mutation",
|
|
||||||
Field: field,
|
|
||||||
IsMethod: true,
|
|
||||||
IsResolver: true,
|
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
|
||||||
return nil, errors.New("field of type ThumbnailFilter does not have child fields")
|
|
||||||
},
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
err = ec.Recover(ctx, r)
|
|
||||||
ec.Error(ctx, err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
ctx = graphql.WithFieldContext(ctx, fc)
|
|
||||||
if fc.Args, err = ec.field_Mutation_setThumbnailDownsampleMethod_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
|
|
||||||
ec.Error(ctx, err)
|
|
||||||
return fc, err
|
|
||||||
}
|
|
||||||
return fc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) _Mutation_authorizeUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Mutation_authorizeUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Mutation_authorizeUser(ctx, field)
|
fc, err := ec.fieldContext_Mutation_authorizeUser(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -10453,8 +10325,6 @@ func (ec *executionContext) fieldContext_Query_siteInfo(_ context.Context, field
|
|||||||
return ec.fieldContext_SiteInfo_periodicScanInterval(ctx, field)
|
return ec.fieldContext_SiteInfo_periodicScanInterval(ctx, field)
|
||||||
case "concurrentWorkers":
|
case "concurrentWorkers":
|
||||||
return ec.fieldContext_SiteInfo_concurrentWorkers(ctx, field)
|
return ec.fieldContext_SiteInfo_concurrentWorkers(ctx, field)
|
||||||
case "thumbnailMethod":
|
|
||||||
return ec.fieldContext_SiteInfo_thumbnailMethod(ctx, field)
|
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("no field named %q was found under type SiteInfo", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type SiteInfo", field.Name)
|
||||||
},
|
},
|
||||||
@@ -11888,72 +11758,6 @@ func (ec *executionContext) fieldContext_SiteInfo_concurrentWorkers(_ context.Co
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _SiteInfo_thumbnailMethod(ctx context.Context, field graphql.CollectedField, obj *models.SiteInfo) (ret graphql.Marshaler) {
|
|
||||||
fc, err := ec.fieldContext_SiteInfo_thumbnailMethod(ctx, field)
|
|
||||||
if err != nil {
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
ctx = graphql.WithFieldContext(ctx, fc)
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
ec.Error(ctx, ec.Recover(ctx, r))
|
|
||||||
ret = graphql.Null
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
|
||||||
directive0 := func(rctx context.Context) (any, error) {
|
|
||||||
ctx = rctx // use context from middleware stack in children
|
|
||||||
return obj.ThumbnailMethod, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
directive1 := func(ctx context.Context) (any, error) {
|
|
||||||
if ec.directives.IsAdmin == nil {
|
|
||||||
var zeroVal models.ThumbnailFilter
|
|
||||||
return zeroVal, errors.New("directive isAdmin is not implemented")
|
|
||||||
}
|
|
||||||
return ec.directives.IsAdmin(ctx, obj, directive0)
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp, err := directive1(rctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, graphql.ErrorOnPath(ctx, err)
|
|
||||||
}
|
|
||||||
if tmp == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
if data, ok := tmp.(models.ThumbnailFilter); ok {
|
|
||||||
return data, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be github.com/photoview/photoview/api/graphql/models.ThumbnailFilter`, tmp)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
ec.Error(ctx, err)
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
if resTmp == nil {
|
|
||||||
if !graphql.HasFieldError(ctx, fc) {
|
|
||||||
ec.Errorf(ctx, "must not be null")
|
|
||||||
}
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
res := resTmp.(models.ThumbnailFilter)
|
|
||||||
fc.Result = res
|
|
||||||
return ec.marshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx, field.Selections, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_SiteInfo_thumbnailMethod(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
|
||||||
fc = &graphql.FieldContext{
|
|
||||||
Object: "SiteInfo",
|
|
||||||
Field: field,
|
|
||||||
IsMethod: false,
|
|
||||||
IsResolver: false,
|
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
|
||||||
return nil, errors.New("field of type ThumbnailFilter does not have child fields")
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return fc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) _Subscription_notification(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) {
|
func (ec *executionContext) _Subscription_notification(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Subscription_notification(ctx, field)
|
fc, err := ec.fieldContext_Subscription_notification(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -16515,13 +16319,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
out.Invalids++
|
out.Invalids++
|
||||||
}
|
}
|
||||||
case "setThumbnailDownsampleMethod":
|
|
||||||
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
|
||||||
return ec._Mutation_setThumbnailDownsampleMethod(ctx, field)
|
|
||||||
})
|
|
||||||
if out.Values[i] == graphql.Null {
|
|
||||||
out.Invalids++
|
|
||||||
}
|
|
||||||
case "authorizeUser":
|
case "authorizeUser":
|
||||||
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
||||||
return ec._Mutation_authorizeUser(ctx, field)
|
return ec._Mutation_authorizeUser(ctx, field)
|
||||||
@@ -17331,11 +17128,6 @@ func (ec *executionContext) _SiteInfo(ctx context.Context, sel ast.SelectionSet,
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
}
|
}
|
||||||
case "thumbnailMethod":
|
|
||||||
out.Values[i] = ec._SiteInfo_thumbnailMethod(ctx, field, obj)
|
|
||||||
if out.Values[i] == graphql.Null {
|
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
panic("unknown field " + strconv.Quote(field.Name))
|
panic("unknown field " + strconv.Quote(field.Name))
|
||||||
}
|
}
|
||||||
@@ -18603,16 +18395,6 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx context.Context, v any) (models.ThumbnailFilter, error) {
|
|
||||||
var res models.ThumbnailFilter
|
|
||||||
err := res.UnmarshalGQL(v)
|
|
||||||
return res, graphql.ErrorOnPath(ctx, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) marshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx context.Context, sel ast.SelectionSet, v models.ThumbnailFilter) graphql.Marshaler {
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v any) (time.Time, error) {
|
func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v any) (time.Time, error) {
|
||||||
res, err := graphql.UnmarshalTime(v)
|
res, err := graphql.UnmarshalTime(v)
|
||||||
return res, graphql.ErrorOnPath(ctx, err)
|
return res, graphql.ErrorOnPath(ctx, err)
|
||||||
|
|||||||
@@ -310,67 +310,3 @@ func (e OrderDirection) MarshalJSON() ([]byte, error) {
|
|||||||
e.MarshalGQL(&buf)
|
e.MarshalGQL(&buf)
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Supported downsampling filters for thumbnail generation
|
|
||||||
type ThumbnailFilter string
|
|
||||||
|
|
||||||
const (
|
|
||||||
ThumbnailFilterNearestNeighbor ThumbnailFilter = "NearestNeighbor"
|
|
||||||
ThumbnailFilterBox ThumbnailFilter = "Box"
|
|
||||||
ThumbnailFilterLinear ThumbnailFilter = "Linear"
|
|
||||||
ThumbnailFilterMitchellNetravali ThumbnailFilter = "MitchellNetravali"
|
|
||||||
ThumbnailFilterCatmullRom ThumbnailFilter = "CatmullRom"
|
|
||||||
ThumbnailFilterLanczos ThumbnailFilter = "Lanczos"
|
|
||||||
)
|
|
||||||
|
|
||||||
var AllThumbnailFilter = []ThumbnailFilter{
|
|
||||||
ThumbnailFilterNearestNeighbor,
|
|
||||||
ThumbnailFilterBox,
|
|
||||||
ThumbnailFilterLinear,
|
|
||||||
ThumbnailFilterMitchellNetravali,
|
|
||||||
ThumbnailFilterCatmullRom,
|
|
||||||
ThumbnailFilterLanczos,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e ThumbnailFilter) IsValid() bool {
|
|
||||||
switch e {
|
|
||||||
case ThumbnailFilterNearestNeighbor, ThumbnailFilterBox, ThumbnailFilterLinear, ThumbnailFilterMitchellNetravali, ThumbnailFilterCatmullRom, ThumbnailFilterLanczos:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e ThumbnailFilter) String() string {
|
|
||||||
return string(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *ThumbnailFilter) UnmarshalGQL(v any) error {
|
|
||||||
str, ok := v.(string)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("enums must be strings")
|
|
||||||
}
|
|
||||||
|
|
||||||
*e = ThumbnailFilter(str)
|
|
||||||
if !e.IsValid() {
|
|
||||||
return fmt.Errorf("%s is not a valid ThumbnailFilter", str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e ThumbnailFilter) MarshalGQL(w io.Writer) {
|
|
||||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *ThumbnailFilter) UnmarshalJSON(b []byte) error {
|
|
||||||
s, err := strconv.Unquote(string(b))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return e.UnmarshalGQL(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e ThumbnailFilter) MarshalJSON() ([]byte, error) {
|
|
||||||
var buf bytes.Buffer
|
|
||||||
e.MarshalGQL(&buf)
|
|
||||||
return buf.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ type SiteInfo struct {
|
|||||||
InitialSetup bool `gorm:"not null"`
|
InitialSetup bool `gorm:"not null"`
|
||||||
PeriodicScanInterval int `gorm:"not null"`
|
PeriodicScanInterval int `gorm:"not null"`
|
||||||
ConcurrentWorkers int `gorm:"not null"`
|
ConcurrentWorkers int `gorm:"not null"`
|
||||||
ThumbnailMethod ThumbnailFilter `gorm:"not null"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SiteInfo) TableName() string {
|
func (SiteInfo) TableName() string {
|
||||||
@@ -27,7 +26,6 @@ func DefaultSiteInfo(db *gorm.DB) SiteInfo {
|
|||||||
InitialSetup: true,
|
InitialSetup: true,
|
||||||
PeriodicScanInterval: 0,
|
PeriodicScanInterval: 0,
|
||||||
ConcurrentWorkers: defaultConcurrentWorkers,
|
ConcurrentWorkers: defaultConcurrentWorkers,
|
||||||
ThumbnailMethod: ThumbnailFilterNearestNeighbor,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ func TestSiteInfo(t *testing.T) {
|
|||||||
site_info.InitialSetup = false
|
site_info.InitialSetup = false
|
||||||
site_info.PeriodicScanInterval = 360
|
site_info.PeriodicScanInterval = 360
|
||||||
site_info.ConcurrentWorkers = 10
|
site_info.ConcurrentWorkers = 10
|
||||||
site_info.ThumbnailMethod = models.ThumbnailFilterLanczos
|
|
||||||
|
|
||||||
if !assert.NoError(t, db.Session(&gorm.Session{AllowGlobalUpdate: true}).Save(&site_info).Error) {
|
if !assert.NoError(t, db.Session(&gorm.Session{AllowGlobalUpdate: true}).Save(&site_info).Error) {
|
||||||
return
|
return
|
||||||
@@ -37,7 +36,6 @@ func TestSiteInfo(t *testing.T) {
|
|||||||
InitialSetup: false,
|
InitialSetup: false,
|
||||||
PeriodicScanInterval: 360,
|
PeriodicScanInterval: 360,
|
||||||
ConcurrentWorkers: 10,
|
ConcurrentWorkers: 10,
|
||||||
ThumbnailMethod: models.ThumbnailFilterLanczos,
|
|
||||||
}, *site_info)
|
}, *site_info)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ type SiteInfo {
|
|||||||
periodicScanInterval: Int! @isAdmin
|
periodicScanInterval: Int! @isAdmin
|
||||||
"How many max concurrent scanner jobs that should run at once"
|
"How many max concurrent scanner jobs that should run at once"
|
||||||
concurrentWorkers: Int! @isAdmin
|
concurrentWorkers: Int! @isAdmin
|
||||||
"The filter to use when generating thumbnails"
|
|
||||||
thumbnailMethod: ThumbnailFilter! @isAdmin
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extend type Query {
|
extend type Query {
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package resolvers
|
|
||||||
|
|
||||||
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
||||||
// will be copied through when generating and any unknown code will be moved to the end.
|
|
||||||
// Code generated by github.com/99designs/gqlgen version v0.17.73
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/photoview/photoview/api/graphql/models"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SetThumbnailDownsampleMethod is the resolver for the setThumbnailDownsampleMethod field.
|
|
||||||
func (r *mutationResolver) SetThumbnailDownsampleMethod(ctx context.Context, method models.ThumbnailFilter) (models.ThumbnailFilter, error) {
|
|
||||||
db := r.DB(ctx)
|
|
||||||
|
|
||||||
// if method > 5 {
|
|
||||||
// return 0, errors.New("The requested filter is unsupported, defaulting to nearest neighbor")
|
|
||||||
// }
|
|
||||||
|
|
||||||
if err := db.
|
|
||||||
Session(&gorm.Session{AllowGlobalUpdate: true}).
|
|
||||||
Model(&models.SiteInfo{}).
|
|
||||||
Update("thumbnail_method", method).
|
|
||||||
Error; err != nil {
|
|
||||||
|
|
||||||
return models.ThumbnailFilterNearestNeighbor, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var siteInfo models.SiteInfo
|
|
||||||
if err := db.First(&siteInfo).Error; err != nil {
|
|
||||||
return models.ThumbnailFilterNearestNeighbor, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return siteInfo.ThumbnailMethod, nil
|
|
||||||
|
|
||||||
// var langTrans *models.LanguageTranslation = nil
|
|
||||||
// if language != nil {
|
|
||||||
// lng := models.LanguageTranslation(*language)
|
|
||||||
// langTrans = &lng
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
"Supported downsampling filters for thumbnail generation"
|
|
||||||
enum ThumbnailFilter {
|
|
||||||
NearestNeighbor,
|
|
||||||
Box,
|
|
||||||
Linear,
|
|
||||||
MitchellNetravali,
|
|
||||||
CatmullRom,
|
|
||||||
Lanczos,
|
|
||||||
}
|
|
||||||
|
|
||||||
extend type Mutation {
|
|
||||||
"Set the filter to be used when generating thumbnails"
|
|
||||||
setThumbnailDownsampleMethod(method: ThumbnailFilter!): ThumbnailFilter! @isAdmin
|
|
||||||
}
|
|
||||||
@@ -21,15 +21,6 @@ import (
|
|||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
var thumbFilter = map[models.ThumbnailFilter]imaging.ResampleFilter{
|
|
||||||
models.ThumbnailFilterNearestNeighbor: imaging.NearestNeighbor,
|
|
||||||
models.ThumbnailFilterBox: imaging.Box,
|
|
||||||
models.ThumbnailFilterLinear: imaging.Linear,
|
|
||||||
models.ThumbnailFilterMitchellNetravali: imaging.MitchellNetravali,
|
|
||||||
models.ThumbnailFilterCatmullRom: imaging.CatmullRom,
|
|
||||||
models.ThumbnailFilterLanczos: imaging.Lanczos,
|
|
||||||
}
|
|
||||||
|
|
||||||
func EncodeThumbnail(db *gorm.DB, inputPath string, outputPath string) (*media_utils.PhotoDimensions, error) {
|
func EncodeThumbnail(db *gorm.DB, inputPath string, outputPath string) (*media_utils.PhotoDimensions, error) {
|
||||||
|
|
||||||
var siteInfo models.SiteInfo
|
var siteInfo models.SiteInfo
|
||||||
@@ -45,7 +36,7 @@ func EncodeThumbnail(db *gorm.DB, inputPath string, outputPath string) (*media_u
|
|||||||
dimensions := media_utils.PhotoDimensionsFromRect(inputImage.Bounds())
|
dimensions := media_utils.PhotoDimensionsFromRect(inputImage.Bounds())
|
||||||
dimensions = dimensions.ThumbnailScale()
|
dimensions = dimensions.ThumbnailScale()
|
||||||
|
|
||||||
thumbImage := imaging.Resize(inputImage, dimensions.Width, dimensions.Height, thumbFilter[siteInfo.ThumbnailMethod])
|
thumbImage := imaging.Resize(inputImage, dimensions.Width, dimensions.Height, imaging.NearestNeighbor)
|
||||||
if err = encodeImageJPEG(thumbImage, outputPath, 60); err != nil {
|
if err = encodeImageJPEG(thumbImage, outputPath, 60); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useIsAdmin } from '../../components/routes/AuthorizedRoute'
|
|||||||
import Layout from '../../components/layout/Layout'
|
import Layout from '../../components/layout/Layout'
|
||||||
import ScannerSection from './ScannerSection'
|
import ScannerSection from './ScannerSection'
|
||||||
import UserPreferences from './UserPreferences'
|
import UserPreferences from './UserPreferences'
|
||||||
import ThumbnailPreferences from './ThumbnailPreferences'
|
|
||||||
import UsersTable from './Users/UsersTable'
|
import UsersTable from './Users/UsersTable'
|
||||||
import VersionInfo from './VersionInfo'
|
import VersionInfo from './VersionInfo'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
@@ -47,7 +46,6 @@ const SettingsPage = () => {
|
|||||||
<>
|
<>
|
||||||
<ScannerSection />
|
<ScannerSection />
|
||||||
<UsersTable />
|
<UsersTable />
|
||||||
<ThumbnailPreferences />
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<VersionInfo />
|
<VersionInfo />
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import { MockedProvider } from '@apollo/client/testing'
|
|
||||||
|
|
||||||
import { render, screen } from '@testing-library/react'
|
|
||||||
|
|
||||||
import { ThumbnailFilter } from '../../__generated__/globalTypes'
|
|
||||||
|
|
||||||
import ThumbnailPreferences, {
|
|
||||||
THUMBNAIL_METHOD_QUERY,
|
|
||||||
SET_THUMBNAIL_METHOD_MUTATION,
|
|
||||||
} from './ThumbnailPreferences'
|
|
||||||
|
|
||||||
test('load ThumbnailPreferences', () => {
|
|
||||||
const graphqlMocks = [
|
|
||||||
{
|
|
||||||
request: {
|
|
||||||
query: THUMBNAIL_METHOD_QUERY,
|
|
||||||
},
|
|
||||||
result: {
|
|
||||||
data: {
|
|
||||||
siteInfo: { method: ThumbnailFilter.NearestNeighbor },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
request: {
|
|
||||||
query: SET_THUMBNAIL_METHOD_MUTATION,
|
|
||||||
variables: {
|
|
||||||
method: ThumbnailFilter.Lanczos,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
result: {
|
|
||||||
data: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
render(
|
|
||||||
<MockedProvider
|
|
||||||
mocks={graphqlMocks}
|
|
||||||
addTypename={false}
|
|
||||||
defaultOptions={{
|
|
||||||
// disable cache, required to make fragments work
|
|
||||||
watchQuery: { fetchPolicy: 'no-cache' },
|
|
||||||
query: { fetchPolicy: 'no-cache' },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ThumbnailPreferences />
|
|
||||||
</MockedProvider>
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(screen.getByText('Downsampling method')).toBeInTheDocument()
|
|
||||||
})
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
import { gql } from '@apollo/client'
|
|
||||||
import React, { useRef, useState } from 'react'
|
|
||||||
import { useMutation, useQuery } from '@apollo/client'
|
|
||||||
import {
|
|
||||||
SectionTitle,
|
|
||||||
InputLabelDescription,
|
|
||||||
InputLabelTitle,
|
|
||||||
} from './SettingsPage'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
|
||||||
import { ThumbnailFilter } from '../../__generated__/globalTypes'
|
|
||||||
import { thumbnailMethodQuery } from './__generated__/thumbnailMethodQuery'
|
|
||||||
import {
|
|
||||||
setThumbnailMethodMutation,
|
|
||||||
setThumbnailMethodMutationVariables,
|
|
||||||
} from './__generated__/setThumbnailMethodMutation'
|
|
||||||
import Dropdown, { DropdownItem } from '../../primitives/form/Dropdown'
|
|
||||||
import Loader from '../../primitives/Loader'
|
|
||||||
|
|
||||||
export const THUMBNAIL_METHOD_QUERY = gql`
|
|
||||||
query thumbnailMethodQuery {
|
|
||||||
siteInfo {
|
|
||||||
thumbnailMethod
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
export const SET_THUMBNAIL_METHOD_MUTATION = gql`
|
|
||||||
mutation setThumbnailMethodMutation($method: ThumbnailFilter!) {
|
|
||||||
setThumbnailDownsampleMethod(method: $method)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const ThumbnailPreferences = () => {
|
|
||||||
const { t } = useTranslation()
|
|
||||||
|
|
||||||
const downsampleMethodServerValue = useRef<null | number>(null)
|
|
||||||
const [downsampleMethod, setDownsampleMethod] = useState(0)
|
|
||||||
|
|
||||||
const downsampleMethodQuery = useQuery<thumbnailMethodQuery>(
|
|
||||||
THUMBNAIL_METHOD_QUERY,
|
|
||||||
{
|
|
||||||
onCompleted(data) {
|
|
||||||
setDownsampleMethod(data.siteInfo.thumbnailMethod)
|
|
||||||
downsampleMethodServerValue.current = data.siteInfo.thumbnailMethod
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const [setDownsampleMutation, downsampleMutationData] = useMutation<
|
|
||||||
setThumbnailMethodMutation,
|
|
||||||
setThumbnailMethodMutationVariables
|
|
||||||
>(SET_THUMBNAIL_METHOD_MUTATION)
|
|
||||||
|
|
||||||
const updateDownsampleMethod = (downsampleMethod: number) => {
|
|
||||||
if (downsampleMethodServerValue.current != downsampleMethod) {
|
|
||||||
downsampleMethodServerValue.current = downsampleMethod
|
|
||||||
setDownsampleMutation({
|
|
||||||
variables: {
|
|
||||||
method: downsampleMethod,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const methodItems: DropdownItem[] = [
|
|
||||||
{
|
|
||||||
label: t(
|
|
||||||
'settings.thumbnails.method.filter.nearest_neighbor',
|
|
||||||
'Nearest Neighbor (default)'
|
|
||||||
),
|
|
||||||
value: ThumbnailFilter.NearestNeighbor,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('settings.thumbnails.method.filter.box', 'Box'),
|
|
||||||
value: ThumbnailFilter.Box,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('settings.thumbnails.method.filter.linear', 'Linear'),
|
|
||||||
value: ThumbnailFilter.Linear,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t(
|
|
||||||
'settings.thumbnails.method.filter.mitchell_netravali',
|
|
||||||
'Mitchell-Netravali'
|
|
||||||
),
|
|
||||||
value: ThumbnailFilter.MitchellNetravali,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('settings.thumbnails.method.filter.catmull_rom', 'Catmull-Rom'),
|
|
||||||
value: ThumbnailFilter.CatmullRom,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t(
|
|
||||||
'settings.thumbnails.method.filter.Lanczos',
|
|
||||||
'Lanczos (highest quality)'
|
|
||||||
),
|
|
||||||
value: ThumbnailFilter.Lanczos,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<SectionTitle>
|
|
||||||
{t('settings.thumbnails.title', 'Thumbnail preferences')}
|
|
||||||
</SectionTitle>
|
|
||||||
<label htmlFor="thumbnail_method_field">
|
|
||||||
<InputLabelTitle>
|
|
||||||
{t('settings.thumbnails.method.label', 'Downsampling method')}
|
|
||||||
</InputLabelTitle>
|
|
||||||
<InputLabelDescription>
|
|
||||||
{t(
|
|
||||||
'settings.thumbnails.method.description',
|
|
||||||
'The filter to use when generating thumbnails'
|
|
||||||
)}
|
|
||||||
</InputLabelDescription>
|
|
||||||
</label>
|
|
||||||
<Dropdown
|
|
||||||
aria-label="Method"
|
|
||||||
items={methodItems}
|
|
||||||
selected={downsampleMethod}
|
|
||||||
setSelected={value => {
|
|
||||||
setDownsampleMethod(value)
|
|
||||||
updateDownsampleMethod(value)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Loader
|
|
||||||
active={downsampleMethodQuery.loading || downsampleMutationData.loading}
|
|
||||||
size="small"
|
|
||||||
style={{ marginLeft: 16 }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ThumbnailPreferences
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { ThumbnailFilter } from "./../../../__generated__/globalTypes";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL mutation operation: setThumbnailMethodMutation
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface setThumbnailMethodMutation {
|
|
||||||
/**
|
|
||||||
* Set the filter to be used when generating thumbnails
|
|
||||||
*/
|
|
||||||
setThumbnailDownsampleMethod: ThumbnailFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface setThumbnailMethodMutationVariables {
|
|
||||||
method: ThumbnailFilter;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { ThumbnailFilter } from "./../../../__generated__/globalTypes";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL query operation: thumbnailMethodQuery
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface thumbnailMethodQuery_siteInfo {
|
|
||||||
__typename: "SiteInfo";
|
|
||||||
/**
|
|
||||||
* The filter to use when generating thumbnails
|
|
||||||
*/
|
|
||||||
thumbnailMethod: ThumbnailFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface thumbnailMethodQuery {
|
|
||||||
siteInfo: thumbnailMethodQuery_siteInfo;
|
|
||||||
}
|
|
||||||
14
ui/src/__generated__/globalTypes.ts
generated
14
ui/src/__generated__/globalTypes.ts
generated
@@ -23,8 +23,8 @@ export enum LanguageTranslation {
|
|||||||
SimplifiedChinese = "SimplifiedChinese",
|
SimplifiedChinese = "SimplifiedChinese",
|
||||||
Spanish = "Spanish",
|
Spanish = "Spanish",
|
||||||
Swedish = "Swedish",
|
Swedish = "Swedish",
|
||||||
TraditionalChineseTW = "TraditionalChineseTW",
|
|
||||||
TraditionalChineseHK = "TraditionalChineseHK",
|
TraditionalChineseHK = "TraditionalChineseHK",
|
||||||
|
TraditionalChineseTW = "TraditionalChineseTW",
|
||||||
Turkish = "Turkish",
|
Turkish = "Turkish",
|
||||||
Ukrainian = "Ukrainian",
|
Ukrainian = "Ukrainian",
|
||||||
}
|
}
|
||||||
@@ -51,18 +51,6 @@ export enum OrderDirection {
|
|||||||
DESC = "DESC",
|
DESC = "DESC",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Supported downsampling filters for thumbnail generation
|
|
||||||
*/
|
|
||||||
export enum ThumbnailFilter {
|
|
||||||
Box = "Box",
|
|
||||||
CatmullRom = "CatmullRom",
|
|
||||||
Lanczos = "Lanczos",
|
|
||||||
Linear = "Linear",
|
|
||||||
MitchellNetravali = "MitchellNetravali",
|
|
||||||
NearestNeighbor = "NearestNeighbor",
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================
|
//==============================================================
|
||||||
// END Enums and Input Objects
|
// END Enums and Input Objects
|
||||||
//==============================================================
|
//==============================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user