Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Configuration with Admin Page + Artemis Teams #124

Merged
merged 60 commits into from
Nov 24, 2024

Conversation

GODrums
Copy link
Contributor

@GODrums GODrums commented Oct 20, 2024

Motivation

To accomodate for long-running production deployments, we want to be able to change the application configuation during runtime while keeping it persistent.
Instead of separating the leaderboard via repositories, we want to group users teams to acknowledge cross-repository development.

Description

  • Dynamic Configuration
    • Add persistent entity for application (server) config
    • Endpoints to access config in client
    • Rework meta endpoint with dynamic config
  • Admin Page /admin
    • Display and edit current config values
    • Rework UI elements with Spartan
    • Create nav-bar / side-menu for admin sub-pages
  • Artemis Teams
    • Create Team entities with dynamic members
    • Allow re-assigning members in admin page /admin/users
    • UI for adding / deleting teams
    • Add teams-filter to leaderboard
    • Automatic team assignments via PR activity

Follow-Ups

Refer to #160

Testing Instructions

  1. Start the application-server and webapp
  2. Login with your Github account (make sure it has the 'Admin'-role in Keycloak)
  3. Click on "Admin" in the top nav-bar
  4. Try changing some of the values in the admin area, such as the list of monitoried repositories
  5. Restart the application-server and control if your changes were persisted

Screenshots (if applicable)

image

Checklist

General

  • PR title is clear and descriptive
  • PR description explains the purpose and changes
  • Code follows project coding standards
  • Self-review of the code has been done
  • Changes have been tested locally
  • Screenshots have been attached (if applicable)
  • Documentation has been updated (if applicable)

Client (if applicable)

  • UI changes look good on all screen sizes and browsers
  • No console errors or warnings
  • User experience and accessibility have been tested
  • Added Storybook stories for new components
  • Components follow design system guidelines (if applicable)

Server (if applicable)

  • Code is performant and follows best practices
  • No security vulnerabilities introduced
  • Proper error handling has been implemented
  • Added tests for new functionality
  • Changes have been tested in different environments (if applicable)

@GODrums GODrums self-assigned this Oct 20, 2024
@github-actions github-actions bot added feature size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 20, 2024
@github-actions github-actions bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 20, 2024
@GODrums GODrums marked this pull request as draft October 21, 2024 00:43
@github-actions github-actions bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Oct 21, 2024
@GODrums GODrums changed the title WIP: Dynamic Configuration with Admin Page + Artemis Teams Dynamic Configuration with Admin Page + Artemis Teams Oct 25, 2024
@@ -175,7 +178,7 @@ private String[] getSubjects() {
.map(String::toLowerCase)
.toArray(String[]::new);

return Arrays.stream(repositoriesToMonitor)
return adminService.getAdminConfig().getRepositoriesToMonitor().stream()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in NatsConsumerService are not sufficient to for NATS to send messages for dynamically changed repos during runtime. It runs once on startup and any further changes adding or removing a repo to monitor will not work as expected.

I think that we have to use consumerContext.getConsumerInfo().getConsumerConfiguration() and update the filterSubjects once the monitored repos change with streamContext.createOrUpdateConsumer.

Alternatively, we can also move this dynamic configuration part of repos to monitor to a follow-up PR and remove it from this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Implemented this in d8cd507.

I added the AdminConfigChangedEvent, which gets emitted when the repositories are updated. The NatsConsumerService now listens for this event and updates the consumer accordingly. Unfortunately, I am getting NATS timeouts when updating the consumer - not sure if it's a Problem with my code or the server?

Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try to take over this part and investigate 👍

Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also the review for the client code. I think we still have to implement a lot of things in this PR before we should merge it.

Please get more familiar with tanstack query, especially in regards to mutations:
https://tanstack.com/query/latest/docs/framework/angular/guides/mutations

There is also a page on optimistic updates that might be of interest:
https://tanstack.com/query/latest/docs/framework/angular/guides/optimistic-updates

webapp/src/app/admin/admin.component.html Outdated Show resolved Hide resolved
webapp/src/app/admin/admin.component.ts Outdated Show resolved Hide resolved
webapp/src/app/admin/admin.component.ts Outdated Show resolved Hide resolved
webapp/src/app/admin/admin.component.ts Outdated Show resolved Hide resolved
webapp/src/app/admin/users/table/users-table.component.ts Outdated Show resolved Hide resolved
webapp/src/app/admin/users/table/users-table.component.ts Outdated Show resolved Hide resolved
webapp/src/app/admin/users/table/users-table.component.ts Outdated Show resolved Hide resolved
webapp/src/app/home/home.component.ts Outdated Show resolved Hide resolved
milesha added a commit that referenced this pull request Nov 19, 2024
Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will merge it for now, we can do the remaining things in a follow-up

@FelixTJDietrich FelixTJDietrich merged commit 570524d into develop Nov 24, 2024
6 of 7 checks passed
@FelixTJDietrich FelixTJDietrich deleted the feature/admin-config-page branch November 24, 2024 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application-server client enhancement New feature or request feature intelligence-service size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants