diff --git a/app/lib/plugin/configuration/DropdownField.java b/app/lib/plugin/configuration/DropdownField.java new file mode 100644 index 000000000..d182c60aa --- /dev/null +++ b/app/lib/plugin/configuration/DropdownField.java @@ -0,0 +1,44 @@ +/** + * Copyright 2013 Lennart Koopmann + * + * This file is part of Graylog2. + * + * Graylog2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Graylog2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Graylog2. If not, see . + * + */ +package lib.plugin.configuration; + +import java.util.Map; + +/** + * @author Lennart Koopmann + */ +public class DropdownField extends RequestedConfigurationField { + + private final static String TYPE = "dropdown"; + + public DropdownField(Map.Entry> c) { + super(TYPE, c); + } + + @Override + public String getType() { + return TYPE; + } + + @Override + public String attributeToJSValidation(String attribute) { + throw new RuntimeException("This type does not have any validatable attributes."); + } +} diff --git a/app/models/api/responses/system/InputTypeSummaryResponse.java b/app/models/api/responses/system/InputTypeSummaryResponse.java index aac312dca..0a61c2102 100644 --- a/app/models/api/responses/system/InputTypeSummaryResponse.java +++ b/app/models/api/responses/system/InputTypeSummaryResponse.java @@ -21,10 +21,7 @@ import com.google.common.collect.Lists; import com.google.gson.annotations.SerializedName; -import lib.plugin.configuration.BooleanField; -import lib.plugin.configuration.NumberField; -import lib.plugin.configuration.RequestedConfigurationField; -import lib.plugin.configuration.TextField; +import lib.plugin.configuration.*; import play.Logger; import java.util.List; @@ -67,6 +64,8 @@ public List getRequestedConfiguration() { case "boolean": tmpBools.add(new BooleanField(c)); continue; + case "dropdown": + fields.add(new DropdownField(c)); default: Logger.info("Unknown field type [" + fieldType + "]."); } diff --git a/app/views/system/inputs/fields/dropdown_field.scala.html b/app/views/system/inputs/fields/dropdown_field.scala.html new file mode 100644 index 000000000..826d16968 --- /dev/null +++ b/app/views/system/inputs/fields/dropdown_field.scala.html @@ -0,0 +1,21 @@ +@(field: lib.plugin.configuration.RequestedConfigurationField) + + +@field.getDescription + + + + + \ No newline at end of file diff --git a/app/views/system/inputs/fields/number_field.scala.html b/app/views/system/inputs/fields/number_field.scala.html index 343ce5e4d..295c6a46d 100644 --- a/app/views/system/inputs/fields/number_field.scala.html +++ b/app/views/system/inputs/fields/number_field.scala.html @@ -1,5 +1,4 @@ @(field: lib.plugin.configuration.RequestedConfigurationField) -@import lib.plugin.configuration.NumberField @field.getDescription diff --git a/app/views/system/inputs/manage.scala.html b/app/views/system/inputs/manage.scala.html index d54b35bee..87cd7eaab 100644 --- a/app/views/system/inputs/manage.scala.html +++ b/app/views/system/inputs/manage.scala.html @@ -119,6 +119,10 @@

@if(field.getType().equals("boolean")) { @views.html.system.inputs.fields.boolean_field(field) } + + @if(field.getType().equals("dropdown")) { + @views.html.system.inputs.fields.dropdown_field(field) + } }