diff --git a/modules/restserver/src/main/resources/reference.conf b/modules/restserver/src/main/resources/reference.conf index c9ec753e..70a7062c 100644 --- a/modules/restserver/src/main/resources/reference.conf +++ b/modules/restserver/src/main/resources/reference.conf @@ -30,6 +30,13 @@ docspell.server { # In order to keep this low, a limit can be defined here. 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. auth { diff --git a/modules/restserver/src/main/scala/docspell/restserver/Config.scala b/modules/restserver/src/main/scala/docspell/restserver/Config.scala index b665e8e7..bda7ebc7 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/Config.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/Config.scala @@ -14,6 +14,7 @@ case class Config( bind: Config.Bind, backend: BackendConfig, auth: Login.Config, + showClassificationSettings: Boolean, integrationEndpoint: Config.IntegrationEndpoint, maxItemPageSize: Int, maxNoteLength: Int, diff --git a/modules/restserver/src/main/scala/docspell/restserver/webapp/Flags.scala b/modules/restserver/src/main/scala/docspell/restserver/webapp/Flags.scala index b430e91a..98134f2a 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/webapp/Flags.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/webapp/Flags.scala @@ -17,7 +17,8 @@ case class Flags( integrationEnabled: Boolean, fullTextSearchEnabled: Boolean, maxPageSize: Int, - maxNoteLength: Int + maxNoteLength: Int, + showClassificationSettings: Boolean ) object Flags { @@ -30,7 +31,8 @@ object Flags { cfg.integrationEndpoint.enabled, cfg.fullTextSearch.enabled, cfg.maxItemPageSize, - cfg.maxNoteLength + cfg.maxNoteLength, + cfg.showClassificationSettings ) implicit val jsonEncoder: Encoder[Flags] = diff --git a/modules/webapp/src/main/elm/Comp/CollectiveSettingsForm.elm b/modules/webapp/src/main/elm/Comp/CollectiveSettingsForm.elm index 1efef12d..c73217e5 100644 --- a/modules/webapp/src/main/elm/Comp/CollectiveSettingsForm.elm +++ b/modules/webapp/src/main/elm/Comp/CollectiveSettingsForm.elm @@ -277,7 +277,7 @@ view flags settings model = , h3 [ classList [ ( "ui dividing header", True ) - , ( "invisible hidden", False ) + , ( "invisible hidden", not flags.config.showClassificationSettings ) ] ] [ text "Document Classifier" @@ -285,7 +285,7 @@ view flags settings model = , div [ classList [ ( "field", True ) - , ( "invisible hidden", False ) + , ( "invisible hidden", not flags.config.showClassificationSettings ) ] ] [ Html.map ClassifierSettingMsg diff --git a/modules/webapp/src/main/elm/Data/Flags.elm b/modules/webapp/src/main/elm/Data/Flags.elm index 052c8aa3..279de096 100644 --- a/modules/webapp/src/main/elm/Data/Flags.elm +++ b/modules/webapp/src/main/elm/Data/Flags.elm @@ -18,6 +18,7 @@ type alias Config = , fullTextSearchEnabled : Bool , maxPageSize : Int , maxNoteLength : Int + , showClassificationSettings : Bool } diff --git a/nix/module-server.nix b/nix/module-server.nix index b75ad86e..cf0bb195 100644 --- a/nix/module-server.nix +++ b/nix/module-server.nix @@ -15,6 +15,7 @@ let base-url = "http://localhost:7880"; max-item-page-size = 200; max-note-length = 180; + show-classification-settings = true; bind = { address = "localhost"; 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 { type = types.submodule({ options = {