Member Names external by application.properties

This commit is contained in:
Mirco 2024-06-13 10:08:32 +02:00
parent abaff760ab
commit d1e633c4d3
6 changed files with 66 additions and 23 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
build/
.gradle/
.idea/

View file

@ -4,7 +4,14 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="cd657914-f421-422e-8fe7-ce4378fd5404" name="Changes" comment="" />
<list default="true" id="cd657914-f421-422e-8fe7-ce4378fd5404" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gradlew" beforeDir="false" afterPath="$PROJECT_DIR$/gradlew" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MEApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MEApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MainView.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/ModeratorElection/MainView.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -40,6 +47,9 @@
<component name="PackageJsonUpdateNotifier">
<dismissed value="$PROJECT_DIR$/package.json" />
</component>
<component name="ProblemsViewState">
<option name="selectedTabId" value="QODANA_PROBLEMS_VIEW_TAB" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 1
}</component>
@ -48,17 +58,32 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_ADD_EXTERNAL_FILES": "true",
"Gradle.ModeratorElection [:MEApplication.main()].executor": "Run",
"Gradle.base-starter-spring-gradle [:DemoApplication.main()].executor": "Run",
"Gradle.base-starter-spring-gradle [:MEApplication.main()].executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "/home/zam/repo/JavaLearning/base-starter-spring-gradle"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;Application.App_build.executor&quot;: &quot;Run&quot;,
&quot;Gradle.Build ModeratorElection.executor&quot;: &quot;Run&quot;,
&quot;Gradle.Load Gradle Dependencies.executor&quot;: &quot;Run&quot;,
&quot;Gradle.ModeratorElection [:MEApplication.main()].executor&quot;: &quot;Run&quot;,
&quot;Gradle.base-starter-spring-gradle [:DemoApplication.main()].executor&quot;: &quot;Run&quot;,
&quot;Gradle.base-starter-spring-gradle [:MEApplication.main()].executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/zam/repo/JavaLearning/base-starter-spring-gradle&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;build.tools&quot;
}
}]]></component>
}</component>
<component name="RunManager">
<configuration name="App_build" type="Application" factoryName="Application">
<option name="ALTERNATIVE_JRE_PATH" value="21" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.ModeratorElection.MEApplication" />
<module name="ModeratorElection" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
@ -70,4 +95,15 @@
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
</project>

14
gradlew vendored
View file

@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

View file

@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MEApplication {
public static void main(String[] args) {
SpringApplication.run(MEApplication.class, args);
}

View file

@ -14,19 +14,25 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.PageTitle;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Route("")
@PageTitle("Moderatorenwahl")
@Configuration
public class MainView extends VerticalLayout {
public MainView() {
public MainView(@Value("${membernames}") String membernames) {
String[] memberNamesArray = membernames.split(",");
List<String> selectMemberItemsNameslist = Arrays.asList(memberNamesArray);
CheckboxGroup<String> checkboxGroup = new CheckboxGroup<>();
checkboxGroup.setLabel("Team members to elect");
checkboxGroup.setItems("Micha", "Ansgar", "Clemens", "Mattis", "Erik", "Mirco");
checkboxGroup.select("Micha", "Ansgar", "Clemens", "Mattis", "Erik", "Mirco");
checkboxGroup.setItems(selectMemberItemsNameslist);
checkboxGroup.select(selectMemberItemsNameslist);
checkboxGroup.addThemeVariants(CheckboxGroupVariant.LUMO_VERTICAL);
add(checkboxGroup);

View file

@ -8,3 +8,4 @@ vaadin.launch-browser=true
# For more information https://vaadin.com/docs/latest/integrations/spring/configuration#special-configuration-parameters
vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.example.application
spring.jpa.defer-datasource-initialization = true
membernames=Micha,Ansgar,Clemens,Mattis,Erik,Mirco