Allow to hide classification settings in the webapp

This commit is contained in:
Eike Kettner 2020-09-05 16:00:19 +02:00
parent 5ae994e903
commit 1dcccbcf7d
6 changed files with 27 additions and 4 deletions

View File

@ -30,6 +30,13 @@ docspell.server {
# In order to keep this low, a limit can be defined here. # In order to keep this low, a limit can be defined here.
max-note-length = 180 max-note-length = 180
# This defines whether the classification form in the collective
# settings is displayed or not. If all joex instances have document
# classification disabled, it makes sense to hide its settings from
# users.
show-classification-settings = true
# Authentication. # Authentication.
auth { auth {

View File

@ -14,6 +14,7 @@ case class Config(
bind: Config.Bind, bind: Config.Bind,
backend: BackendConfig, backend: BackendConfig,
auth: Login.Config, auth: Login.Config,
showClassificationSettings: Boolean,
integrationEndpoint: Config.IntegrationEndpoint, integrationEndpoint: Config.IntegrationEndpoint,
maxItemPageSize: Int, maxItemPageSize: Int,
maxNoteLength: Int, maxNoteLength: Int,

View File

@ -17,7 +17,8 @@ case class Flags(
integrationEnabled: Boolean, integrationEnabled: Boolean,
fullTextSearchEnabled: Boolean, fullTextSearchEnabled: Boolean,
maxPageSize: Int, maxPageSize: Int,
maxNoteLength: Int maxNoteLength: Int,
showClassificationSettings: Boolean
) )
object Flags { object Flags {
@ -30,7 +31,8 @@ object Flags {
cfg.integrationEndpoint.enabled, cfg.integrationEndpoint.enabled,
cfg.fullTextSearch.enabled, cfg.fullTextSearch.enabled,
cfg.maxItemPageSize, cfg.maxItemPageSize,
cfg.maxNoteLength cfg.maxNoteLength,
cfg.showClassificationSettings
) )
implicit val jsonEncoder: Encoder[Flags] = implicit val jsonEncoder: Encoder[Flags] =

View File

@ -277,7 +277,7 @@ view flags settings model =
, h3 , h3
[ classList [ classList
[ ( "ui dividing header", True ) [ ( "ui dividing header", True )
, ( "invisible hidden", False ) , ( "invisible hidden", not flags.config.showClassificationSettings )
] ]
] ]
[ text "Document Classifier" [ text "Document Classifier"
@ -285,7 +285,7 @@ view flags settings model =
, div , div
[ classList [ classList
[ ( "field", True ) [ ( "field", True )
, ( "invisible hidden", False ) , ( "invisible hidden", not flags.config.showClassificationSettings )
] ]
] ]
[ Html.map ClassifierSettingMsg [ Html.map ClassifierSettingMsg

View File

@ -18,6 +18,7 @@ type alias Config =
, fullTextSearchEnabled : Bool , fullTextSearchEnabled : Bool
, maxPageSize : Int , maxPageSize : Int
, maxNoteLength : Int , maxNoteLength : Int
, showClassificationSettings : Bool
} }

View File

@ -15,6 +15,7 @@ let
base-url = "http://localhost:7880"; base-url = "http://localhost:7880";
max-item-page-size = 200; max-item-page-size = 200;
max-note-length = 180; max-note-length = 180;
show-classification-settings = true;
bind = { bind = {
address = "localhost"; address = "localhost";
port = 7880; port = 7880;
@ -136,6 +137,17 @@ in {
''; '';
}; };
show-classification-settings = mkOption {
type = types.bool;
default = defaults.show-classification-settings;
description = ''
This defines whether the classification form in the collective
settings is displayed or not. If all joex instances have document
classification disabled, it makes sense to hide its settings from
users.
'';
};
bind = mkOption { bind = mkOption {
type = types.submodule({ type = types.submodule({
options = { options = {