Added frontend implementation #460

This commit is contained in:
Sven Heidemann 2023-12-15 15:38:38 +01:00
parent e516def7ef
commit 72715aac62
9 changed files with 65 additions and 22 deletions

View File

@ -321,6 +321,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`DefaultRoleId`,
`ShortRoleNameSetOnlyHighest`,
`GameOfferNotificationChatId`,
`ResetMemberAfterRejoin`,
`FeatureFlags`,
`ServerId`
) VALUES (
@ -341,6 +342,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
{"NULL" if self._default_role_id is None else self._default_role_id},
{self._short_role_name_only_set_highest_role},
{self._game_offer_notification_chat_id},
{self._reset_member_after_rejoin},
'{json.dumps(self._feature_flags)}',
{self._server.id}
);
@ -369,6 +371,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
`ShortRoleNameSetOnlyHighest` = {self._short_role_name_only_set_highest_role},
`GameOfferNotificationChatId` = {self._game_offer_notification_chat_id},
`ResetMemberAfterRejoin` = {self._reset_member_after_rejoin},
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
`ServerId` = {self._server.id}
WHERE `Id` = {self._id};

View File

@ -51,7 +51,7 @@ type ServerConfigHistory implements HistoryTableQuery {
loginMessageChannelId: String
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
gameOfferNotificationChatId: String
resetMemberAfterRejoin: Boolean
featureFlagCount: Int
featureFlags: [FeatureFlag]
@ -104,6 +104,7 @@ input ServerConfigInput {
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
gameOfferNotificationChatId: String
resetMemberAfterRejoin: Boolean
featureFlags: [FeatureFlagInput]
afkChannelIds: [String]

View File

@ -20,6 +20,7 @@ export interface ServerConfig extends DataWithHistory {
defaultRoleId?: string;
shortRoleNameOnlySetHighestRole?: boolean;
gameOfferNotificationChatId?: string;
resetMemberAfterRejoin?: boolean;
featureFlags: FeatureFlag[];
afkChannelIds: string[];
moderatorRoleIds: string[];

View File

@ -340,6 +340,7 @@ export class Mutations {
$defaultRoleId: String,
$shortRoleNameOnlySetHighestRole: Boolean,
$gameOfferNotificationChatId: String,
$resetMemberAfterRejoin: Boolean,
$featureFlags: [FeatureFlagInput],
$afkChannelIds: [String],
$moderatorRoleIds: [String],
@ -365,6 +366,7 @@ export class Mutations {
defaultRoleId: $defaultRoleId,
shortRoleNameOnlySetHighestRole: $shortRoleNameOnlySetHighestRole,
gameOfferNotificationChatId: $gameOfferNotificationChatId,
resetMemberAfterRejoin: $resetMemberAfterRejoin,
featureFlags: $featureFlags,
afkChannelIds: $afkChannelIds,
moderatorRoleIds: $moderatorRoleIds,
@ -388,6 +390,7 @@ export class Mutations {
defaultRoleId
shortRoleNameOnlySetHighestRole
gameOfferNotificationChatId
resetMemberAfterRejoin
featureFlags {
key
value

View File

@ -637,6 +637,7 @@ export class Queries {
defaultRoleId
shortRoleNameOnlySetHighestRole
gameOfferNotificationChatId
resetMemberAfterRejoin
featureFlags {
key
value

View File

@ -14,14 +14,16 @@
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.message_delete_timer' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.messageDeleteTimer"
placeholder="{{'view.server.config.bot.message_delete_timer' | translate}}"></div>
placeholder="{{'view.server.config.bot.message_delete_timer' | translate}}">
</div>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.notification_chat_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id" [(ngModel)]="config.notificationChatId"
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id"
[(ngModel)]="config.notificationChatId"
placeholder="{{'view.server.config.bot.notification_chat_id' | translate}}"></p-dropdown>
</div>
</div>
@ -30,14 +32,16 @@
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.max_voice_state_hours' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.maxVoiceStateHours"
placeholder="{{'view.server.config.bot.max_voice_state_hours' | translate}}"></div>
placeholder="{{'view.server.config.bot.max_voice_state_hours' | translate}}">
</div>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.xp_per_message' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpPerMessage" placeholder="{{'view.server.config.bot.xp_per_message' | translate}}">
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpPerMessage"
placeholder="{{'view.server.config.bot.xp_per_message' | translate}}">
</div>
</div>
</div>
@ -45,7 +49,8 @@
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.xp_per_reaction' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpPerReaction" placeholder="{{'view.server.config.bot.xp_per_reaction' | translate}}">
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpPerReaction"
placeholder="{{'view.server.config.bot.xp_per_reaction' | translate}}">
</div>
</div>
</div>
@ -54,7 +59,8 @@
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.max_message_xp_per_hour' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.maxMessageXpPerHour"
placeholder="{{'view.server.config.bot.max_message_xp_per_hour' | translate}}"></div>
placeholder="{{'view.server.config.bot.max_message_xp_per_hour' | translate}}">
</div>
</div>
</div>
@ -62,7 +68,8 @@
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.xp_per_ontime_hour' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpPerOntimeHour"
placeholder="{{'view.server.config.bot.xp_per_ontime_hour' | translate}}"></div>
placeholder="{{'view.server.config.bot.xp_per_ontime_hour' | translate}}">
</div>
</div>
</div>
@ -70,7 +77,8 @@
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.xp_per_event_participation' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpPerEventParticipation"
placeholder="{{'view.server.config.bot.xp_per_event_participation' | translate}}"></div>
placeholder="{{'view.server.config.bot.xp_per_event_participation' | translate}}">
</div>
</div>
</div>
@ -78,7 +86,8 @@
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.xp_per_achievement' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpPerAchievement"
placeholder="{{'view.server.config.bot.xp_per_achievement' | translate}}"></div>
placeholder="{{'view.server.config.bot.xp_per_achievement' | translate}}">
</div>
</div>
</div>
@ -86,14 +95,16 @@
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.xp_for_birthday' | translate}}:</div>
<div class="content-data-value"><input type="number" pInputText [(ngModel)]="config.xpForBirthday"
placeholder="{{'view.server.config.bot.xp_for_birthday' | translate}}"></div>
placeholder="{{'view.server.config.bot.xp_for_birthday' | translate}}">
</div>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.afk_command_channel_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="voiceChannels" optionLabel="name" optionValue="id" [(ngModel)]="config.afkCommandChannelId"
<p-dropdown class="content-data-value" [options]="voiceChannels" optionLabel="name" optionValue="id"
[(ngModel)]="config.afkCommandChannelId"
placeholder="{{'view.server.config.bot.afk_command_channel_id' | translate}}"></p-dropdown>
</div>
</div>
@ -101,7 +112,8 @@
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.help_voice_channel_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="voiceChannels" optionLabel="name" optionValue="id" [(ngModel)]="config.helpVoiceChannelId"
<p-dropdown class="content-data-value" [options]="voiceChannels" optionLabel="name" optionValue="id"
[(ngModel)]="config.helpVoiceChannelId"
placeholder="{{'view.server.config.bot.help_voice_channel_id' | translate}}"></p-dropdown>
</div>
</div>
@ -109,7 +121,8 @@
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.team_channel_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id" [(ngModel)]="config.teamChannelId"
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id"
[(ngModel)]="config.teamChannelId"
placeholder="{{'view.server.config.bot.team_channel_id' | translate}}"></p-dropdown>
</div>
</div>
@ -117,7 +130,8 @@
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.login_message_channel_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id" [(ngModel)]="config.loginMessageChannelId"
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id"
[(ngModel)]="config.loginMessageChannelId"
placeholder="{{'view.server.config.bot.login_message_channel_id' | translate}}"></p-dropdown>
</div>
</div>
@ -125,15 +139,18 @@
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.default_role_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="roles ?? []" optionLabel="name" optionValue="id" [(ngModel)]="config.defaultRoleId"
<p-dropdown class="content-data-value" [options]="roles ?? []" optionLabel="name" optionValue="id"
[(ngModel)]="config.defaultRoleId"
placeholder="{{'view.server.config.bot.default_role_id' | translate}}"></p-dropdown>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="boolAsStrings" [(ngModel)]="config.shortRoleNameOnlySetHighestRole"
<div class="content-data-name">{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}:
</div>
<p-dropdown class="content-data-value" [options]="boolAsStrings"
[(ngModel)]="config.shortRoleNameOnlySetHighestRole"
placeholder="{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}"></p-dropdown>
</div>
</div>
@ -141,17 +158,31 @@
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.game_offer_notification_chat_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id" [(ngModel)]="config.gameOfferNotificationChatId"
<p-dropdown class="content-data-value" [options]="textChannels" optionLabel="name" optionValue="id"
[(ngModel)]="config.gameOfferNotificationChatId"
placeholder="{{'view.server.config.bot.game_offer_notification_chat_id' | translate}}"></p-dropdown>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.reset_member_after_rejoin' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="boolAsStrings"
[(ngModel)]="config.resetMemberAfterRejoin"
placeholder="{{'view.server.config.bot.reset_member_after_rejoin' | translate}}"></p-dropdown>
</div>
</div>
<div class="content-divider"></div>
<app-config-list [options]="voiceChannels" optionLabel="name" optionValue="id" translationKey="view.server.config.bot.afk_channels"
<app-config-list [options]="voiceChannels" optionLabel="name" optionValue="id"
translationKey="view.server.config.bot.afk_channels"
[(data)]="config.afkChannelIds"></app-config-list>
<app-config-list [options]="roles" optionLabel="name" optionValue="id" translationKey="view.server.config.bot.moderator_roles"
<app-config-list [options]="roles" optionLabel="name" optionValue="id"
translationKey="view.server.config.bot.moderator_roles"
[(data)]="config.moderatorRoleIds"></app-config-list>
<app-config-list [options]="roles" optionLabel="name" optionValue="id" translationKey="view.server.config.bot.admin_roles" [(data)]="config.adminRoleIds"></app-config-list>
<app-config-list [options]="roles" optionLabel="name" optionValue="id"
translationKey="view.server.config.bot.admin_roles"
[(data)]="config.adminRoleIds"></app-config-list>
<app-feature-flag-list *ngIf="isTechnician" [(data)]="config.featureFlags"></app-feature-flag-list>
<div class="content-row">

View File

@ -126,6 +126,7 @@ export class ConfigComponent implements OnInit {
defaultRoleId: this.config.defaultRoleId,
shortRoleNameOnlySetHighestRole: this.config.shortRoleNameOnlySetHighestRole,
gameOfferNotificationChatId: this.config.gameOfferNotificationChatId,
resetMemberAfterRejoin: this.config.resetMemberAfterRejoin,
featureFlags: this.config.featureFlags,
afkChannelIds: this.config.afkChannelIds,
moderatorRoleIds: this.config.moderatorRoleIds,

View File

@ -455,6 +455,7 @@
"message_delete_timer": "Zeit bis zum löschen einer Botnachricht in sekunden",
"moderator_roles": "Moderator Rollen",
"notification_chat_id": "Benachrichtungskanal",
"reset_member_after_rejoin": "Mitglied nach erneutem Beitritt zurücksetzen",
"short_role_name_only_set_highest_role": "Bei Rollen Kürzeln nur die höchste Rolle verwenden",
"team_channel_id": "Team chat",
"xp_for_birthday": "XP für Geburtstag",

View File

@ -455,6 +455,7 @@
"message_delete_timer": "Time to wait before delete bot messages",
"moderator_roles": "Moderator roles",
"notification_chat_id": "Notification channel",
"reset_member_after_rejoin": "Reset member after rejoin",
"short_role_name_only_set_highest_role": "For role abbreviations use only the highest role",
"team_channel_id": "Team chat",
"xp_for_birthday": "XP for birthday",