Skip to content

Commit

Permalink
🔧 add config option to show/hide event room legend closes #165
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Fihlon <[email protected]>
  • Loading branch information
McPringle committed Jul 16, 2024
1 parent e97a92e commit 46ee190
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 55 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For questions and support requests, please use
* Add support for session tracks with default icons and custom SVG images
* Theming: all colors are now configurable
* Create hashed passwords for admin access on the command line
* New config option to show/hide event room legend

### Bugfixes

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ To modify the default configuration values, just specify environment variables w
| DEMO_ROOM_COUNT | 0 | Number of rooms for the event demo plugin (0 = disabled). |
| DOAG_EVENT_API | [1] | The URL of the DOAG event API to read the conference agenda. |
| DOAG_EVENT_ID | 0 | The ID of the DOAG event to read the conference agenda (0 = disabled). |
| EVENT_SHOW_LEGEND | true | Show (true) or hide (false) the event room legend. |
| EVENT_UPDATE_FREQUENCY | 5 | How often (in minutes) to update event data (0 = disabled). |
| FILTER_LENGTH | 500 | Hide social media posts which exceed this length (0 = disabled). |
| FILTER_REPLIES | true | Hide social media posts which are replies. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
*/
package swiss.fihlon.apus.plugin.event;

public record EventConfig(int updateFrequency) {
public record EventConfig(int updateFrequency, boolean showLegend) {
}
15 changes: 12 additions & 3 deletions src/main/java/swiss/fihlon/apus/ui/view/EventView.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.vaadin.flow.component.notification.Notification;
import org.jetbrains.annotations.NotNull;
import org.springframework.scheduling.TaskScheduler;
import swiss.fihlon.apus.configuration.Configuration;
import swiss.fihlon.apus.event.Room;
import swiss.fihlon.apus.event.RoomStyle;
import swiss.fihlon.apus.event.Session;
Expand Down Expand Up @@ -53,12 +54,18 @@ public final class EventView extends Div {
private final Div roomContainer = new Div();
private final Span legend = new Span();

private final boolean showLegend;

public EventView(@NotNull final EventService eventService,
@NotNull final TaskScheduler taskScheduler) {
@NotNull final TaskScheduler taskScheduler,
@NotNull final Configuration configuration) {
this.eventService = eventService;
this.showLegend = configuration.getEvent().showLegend();
setId("event-view");
add(createTitle());
add(createLegend());
if (showLegend) {
add(createLegend());
}
add(roomContainer);
roomContainer.addClassName("room-container");
final ScheduledFuture<?> updateScheduler = taskScheduler.scheduleAtFixedRate(
Expand Down Expand Up @@ -88,7 +95,9 @@ private void updateConferenceSessions() {
roomStylesInUse.add(roomView.getRoomStyle());
roomContainer.add(roomView);
}
updateLegend(roomStylesInUse);
if (showLegend) {
updateLegend(roomStylesInUse);
}
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public SocialWallView(@NotNull final EventService eventService,
});
}
setId("social-wall-view");
add(new EventView(eventService, taskScheduler));
add(new EventView(eventService, taskScheduler, configuration));
add(new SocialView(socialService, taskScheduler, configuration));
}
}
Original file line number Diff line number Diff line change
@@ -1,89 +1,94 @@
{
"properties": [
"properties" : [
{
"name": "apus.admin.password",
"type": "java.lang.String",
"description": "The password to get admin access (empty = disabled)."
"name" : "apus.admin.password",
"type" : "java.lang.String",
"description" : "The password to get admin access (empty = disabled)."
},
{
"name": "apus.custom.styles",
"type": "java.lang.String",
"description": "Inject custom styles into the user interface."
"name" : "apus.custom.styles",
"type" : "java.lang.String",
"description" : "Inject custom styles into the user interface."
},
{
"name" : "apus.demo.roomCount",
"type" : "java.lang.Integer",
"description" : "Number of rooms for the event demo plugin."
},
{
"name": "apus.doag.eventApi",
"type": "java.lang.String",
"description": "The URL of the DOAG event API to read the conference agenda."
"name" : "apus.doag.eventApi",
"type" : "java.lang.String",
"description" : "The URL of the DOAG event API to read the conference agenda."
},
{
"name": "apus.doag.eventId",
"type": "java.lang.Integer",
"description": "The ID of the DOAG event to read the conference agenda."
"name" : "apus.doag.eventId",
"type" : "java.lang.Integer",
"description" : "The ID of the DOAG event to read the conference agenda."
},
{
"name" : "apus.event.showLegend",
"type" : "java.lang.Boolean",
"description" : "Show (true) or hide (false) the event room legend."
},
{
"name": "apus.event.updateFrequency",
"type": "java.lang.Integer",
"description": "How often (in minutes) to update event data."
"name" : "apus.event.updateFrequency",
"type" : "java.lang.Integer",
"description" : "How often (in minutes) to update event data."
},
{
"name": "apus.filter.length",
"type": "java.lang.Integer",
"description": "Hide social media messages which exceed this length."
"name" : "apus.filter.length",
"type" : "java.lang.Integer",
"description" : "Hide social media messages which exceed this length."
},
{
"name": "apus.filter.replies",
"type": "java.lang.Boolean",
"description": "Hide social media messages which are replies."
"name" : "apus.filter.replies",
"type" : "java.lang.Boolean",
"description" : "Hide social media messages which are replies."
},
{
"name": "apus.filter.sensitive",
"type": "java.lang.Boolean",
"description": "Hide social media messages which contain sensitive information."
"name" : "apus.filter.sensitive",
"type" : "java.lang.Boolean",
"description" : "Hide social media messages which contain sensitive information."
},
{
"name": "apus.filter.words",
"type": "java.lang.String",
"description": "Hide social media messages which contain these words."
"name" : "apus.filter.words",
"type" : "java.lang.String",
"description" : "Hide social media messages which contain these words."
},
{
"name": "apus.jfs.dbUrl",
"type": "java.lang.String",
"description": "The URL of the database file for Java Forum Stuttgart."
"name" : "apus.jfs.dbUrl",
"type" : "java.lang.String",
"description" : "The URL of the database file for Java Forum Stuttgart."
},
{
"name": "apus.mastodon.hashtag",
"type": "java.lang.String",
"description": "The hashtag for the Mastodon wall."
"name" : "apus.mastodon.hashtag",
"type" : "java.lang.String",
"description" : "The hashtag for the Mastodon wall."
},
{
"name": "apus.mastodon.imageLimit",
"type": "java.lang.Integer",
"description": "Limit number of images per post."
"name" : "apus.mastodon.imageLimit",
"type" : "java.lang.Integer",
"description" : "Limit number of images per post."
},
{
"name": "apus.mastodon.imagesEnabled",
"type": "java.lang.Boolean",
"description": "Enable or disable images in mastodon posts."
"name" : "apus.mastodon.imagesEnabled",
"type" : "java.lang.Boolean",
"description" : "Enable or disable images in mastodon posts."
},
{
"name": "apus.mastodon.instance",
"type": "java.lang.String",
"description": "The Mastodon instance used to read the posts from."
"name" : "apus.mastodon.instance",
"type" : "java.lang.String",
"description" : "The Mastodon instance used to read the posts from."
},
{
"name": "apus.sessionize.eventId",
"type": "java.lang.String",
"description": "The ID of the Sessionize event to read the conference agenda."
"name" : "apus.sessionize.eventId",
"type" : "java.lang.String",
"description" : "The ID of the Sessionize event to read the conference agenda."
},
{
"name": "apus.sessionize.eventApi",
"type": "java.lang.String",
"description": "The URL of the Sessionize event API to read the conference agenda."
"name" : "apus.sessionize.eventApi",
"type" : "java.lang.String",
"description" : "The URL of the Sessionize event API to read the conference agenda."
}
]
}
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ apus.custom.styles=${CUSTOM_STYLES:}
apus.demo.roomCount=${DEMO_ROOM_COUNT:0}
apus.doag.eventApi=${DOAG_EVENT_API:https://meine.doag.org/api/event/action.getCPEventAgenda/eventId.%d/}
apus.doag.eventId=${DOAG_EVENT_ID:0}
apus.event.showLegend=${EVENT_SHOW_LEGEND:true}
apus.event.updateFrequency=${EVENT_UPDATE_FREQUENCY:5}
apus.filter.length=${FILTER_LENGTH:500}
apus.filter.replies=${FILTER_REPLIES:true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EventServiceTest {
@BeforeAll
static void mockConfiguration() {
configurationMock = mock(Configuration.class);
when(configurationMock.getEvent()).thenReturn(new EventConfig(0));
when(configurationMock.getEvent()).thenReturn(new EventConfig(0, true));
}

@Test
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apus.custom.styles=
apus.demo.roomCount=-1
apus.doag.eventApi=file:src/test/resources/DOAG.json?eventId=%d
apus.doag.eventId=-1
apus.event.showLegend=true
apus.event.updateFrequency=5
apus.filter.length=500
apus.filter.replies=false
Expand Down

0 comments on commit 46ee190

Please sign in to comment.