Completed feature #391

This commit is contained in:
Sven Heidemann 2023-10-02 08:24:20 +02:00
parent 2182c021b9
commit f5d88ec94c
11 changed files with 113 additions and 82 deletions

View File

@ -6,7 +6,6 @@ volumes:
services: services:
kdb_bot_staging_1: kdb_bot_staging_1:
image: sh-edraft.de/kdb-bot:1.1.8 image: sh-edraft.de/kdb-bot:1.1.8
container_name: kdb_bot_staging_1
depends_on: depends_on:
- kdb_db_staging_1 - kdb_db_staging_1
networks: networks:
@ -25,15 +24,19 @@ services:
mode: replicated mode: replicated
replicas: 1 replicas: 1
placement: placement:
constraints: [ node.role == manager ] constraints: [node.role == manager]
resources: resources:
reservations: reservations:
cpus: "0.5" cpus: "0.5"
memory: 1024M memory: 1024M
restart_policy:
condition: on-failure
delay: 3s
max_attempts: 3
window: 60s
kdb_web_staging_1: kdb_web_staging_1:
image: sh-edraft.de/kdb-web:1.1.8 image: sh-edraft.de/kdb-web:1.1.8
container_name: kdb_web_staging_1
depends_on: depends_on:
- kdb_bot_staging_1 - kdb_bot_staging_1
networks: networks:
@ -42,12 +45,12 @@ services:
volumes: volumes:
- /opt/kdb/staging/web/config.json:/usr/share/nginx/html/assets/config.json - /opt/kdb/staging/web/config.json:/usr/share/nginx/html/assets/config.json
environment: environment:
BOT_CONTAINER_NAME: "kdb_bot_staging_1" BOT_CONTAINER_NAME: "kdb_bot_staging_1"
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
placement: placement:
constraints: [ node.role == manager ] constraints: [node.role == manager]
resources: resources:
limits: limits:
cpus: "0.4" cpus: "0.4"
@ -58,7 +61,6 @@ services:
kdb_db_staging_1: kdb_db_staging_1:
image: mysql:latest image: mysql:latest
container_name: kdb_db_staging_1
command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1 command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1
networks: networks:
- kdb_test - kdb_test
@ -75,7 +77,7 @@ services:
mode: replicated mode: replicated
replicas: 1 replicas: 1
placement: placement:
constraints: [ node.role == manager ] constraints: [node.role == manager]
resources: resources:
reservations: reservations:
cpus: "0.1" cpus: "0.1"

View File

@ -1,82 +1,87 @@
version: "3.9" version: "3.9"
volumes: volumes:
kdb_db_prod_1: kdb_db_prod_1:
services: services:
kdb_bot_prod_1: kdb_bot_prod_1:
image: sh-edraft.de/kdb-bot:1.1.8 image: sh-edraft.de/kdb-bot:1.1.8
depends_on: depends_on:
- kdb_db_prod_1 - kdb_db_prod_1
networks: networks:
- kdb_prod - kdb_prod
- reverse_proxy - reverse_proxy
volumes: volumes:
- /opt/kdb/production/bot/config:/app/bot/config - /opt/kdb/production/bot/config:/app/bot/config
- /opt/kdb/production/bot/api_config:/app/bot_api/config - /opt/kdb/production/bot/api_config:/app/bot_api/config
- /opt/kdb/production/bot/logs:/app/bot/logs - /opt/kdb/production/bot/logs:/app/bot/logs
environment: environment:
KDB_ENVIRONMENT: "production" KDB_ENVIRONMENT: "production"
KDB_TOKEN: "OTk4MTU5NTEyNDYyNzA4Nzg2.Gx0hSB.Ouq2dfRKxLBJvHfEq8OrFBHVUF24AQrVf55coM" KDB_TOKEN: "OTk4MTU5NTEyNDYyNzA4Nzg2.Gx0hSB.Ouq2dfRKxLBJvHfEq8OrFBHVUF24AQrVf55coM"
KDB_PREFIX: "!k " KDB_PREFIX: "!k "
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
placement: placement:
constraints: [ node.role == manager ] constraints: [node.role == manager]
resources: resources:
reservations: reservations:
cpus: "0.5" cpus: "0.5"
memory: 1024M memory: 1024M
restart_policy:
condition: on-failure
delay: 3s
max_attempts: 3
window: 60s
kdb_web_prod_1: kdb_web_prod_1:
image: sh-edraft.de/kdb-web:1.1.8 image: sh-edraft.de/kdb-web:1.1.8
depends_on: depends_on:
- kdb_bot_prod_1 - kdb_bot_prod_1
networks: networks:
- kdb_prod - kdb_prod
- reverse_proxy - reverse_proxy
volumes: volumes:
- /opt/kdb/production/web/config.json:/usr/share/nginx/html/assets/config.json - /opt/kdb/production/web/config.json:/usr/share/nginx/html/assets/config.json
environment: environment:
BOT_CONTAINER_NAME: "kdb_bot_prod_1" BOT_CONTAINER_NAME: "kdb_bot_prod_1"
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
placement: placement:
constraints: [ node.role == manager ] constraints: [node.role == manager]
resources: resources:
limits: limits:
cpus: "0.4" cpus: "0.4"
memory: 400M memory: 400M
reservations: reservations:
cpus: "0.1" cpus: "0.1"
memory: 20M memory: 20M
kdb_db_prod_1: kdb_db_prod_1:
image: mysql:latest image: mysql:latest
command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1 command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1
networks: networks:
- kdb_prod - kdb_prod
restart: unless-stopped restart: unless-stopped
environment: environment:
MYSQL_ROOT_PASSWORD: "kd_kdb" MYSQL_ROOT_PASSWORD: "kd_kdb"
MYSQL_USER: "kd_kdb" MYSQL_USER: "kd_kdb"
MYSQL_PASSWORD: ",2#MzfN4J=7r(q,Tz3npDkCR§>VE&}7T" MYSQL_PASSWORD: ",2#MzfN4J=7r(q,Tz3npDkCR§>VE&}7T"
MYSQL_DATABASE: "kd_kdb" MYSQL_DATABASE: "kd_kdb"
ports: ports:
- "3307:3306" - "3307:3306"
volumes: volumes:
- kdb_db_prod_1:/var/lib/mysql - kdb_db_prod_1:/var/lib/mysql
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
placement: placement:
constraints: [ node.role == manager ] constraints: [node.role == manager]
resources: resources:
reservations: reservations:
cpus: "0.1" cpus: "0.1"
memory: 150M memory: 150M
networks: networks:
reverse_proxy: reverse_proxy:

View File

@ -285,6 +285,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`TeamChannelId`, `TeamChannelId`,
`LoginMessageChannelId`, `LoginMessageChannelId`,
`DefaultRoleId`, `DefaultRoleId`,
`ShortRoleNameSetOnlyHighest`,
`FeatureFlags`, `FeatureFlags`,
`ServerId` `ServerId`
) VALUES ( ) VALUES (
@ -302,6 +303,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
{self._team_channel_id}, {self._team_channel_id},
{self._login_message_channel_id}, {self._login_message_channel_id},
{"NULL" if self._default_role_id is None else self._default_role_id}, {"NULL" if self._default_role_id is None else self._default_role_id},
{self._short_role_name_only_set_highest_role},
'{json.dumps(self._feature_flags)}', '{json.dumps(self._feature_flags)}',
{self._server.id} {self._server.id}
); );
@ -327,6 +329,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`TeamChannelId` = {self._team_channel_id}, `TeamChannelId` = {self._team_channel_id},
`LoginMessageChannelId` = {self._login_message_channel_id}, `LoginMessageChannelId` = {self._login_message_channel_id},
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id}, `DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
`ShortRoleNameSetOnlyHighest` = {self._short_role_name_only_set_highest_role},
`FeatureFlags` = '{json.dumps(self._feature_flags)}', `FeatureFlags` = '{json.dumps(self._feature_flags)}',
`ServerId` = {self._server.id} `ServerId` = {self._server.id}
WHERE `Id` = {self._id}; WHERE `Id` = {self._id};

View File

@ -92,7 +92,7 @@ class ServerConfigMutation(QueryABC):
server_config.default_role_id = ( server_config.default_role_id = (
input["defaultRoleId"] if "defaultRoleId" in input else server_config.default_role_id input["defaultRoleId"] if "defaultRoleId" in input else server_config.default_role_id
) )
server_config.default_role_id = ( server_config.short_role_name_only_set_highest_role = (
input["shortRoleNameOnlySetHighestRole"] input["shortRoleNameOnlySetHighestRole"]
if "shortRoleNameOnlySetHighestRole" in input if "shortRoleNameOnlySetHighestRole" in input
else server_config.short_role_name_only_set_highest_role else server_config.short_role_name_only_set_highest_role

View File

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

View File

@ -254,6 +254,7 @@ export class Mutations {
$teamChannelId: String, $teamChannelId: String,
$loginMessageChannelId: String, $loginMessageChannelId: String,
$defaultRoleId: String, $defaultRoleId: String,
$shortRoleNameOnlySetHighestRole: Boolean
$featureFlags: [FeatureFlagInput], $featureFlags: [FeatureFlagInput],
$afkChannelIds: [String], $afkChannelIds: [String],
$moderatorRoleIds: [String], $moderatorRoleIds: [String],
@ -276,6 +277,7 @@ export class Mutations {
teamChannelId: $teamChannelId, teamChannelId: $teamChannelId,
loginMessageChannelId: $loginMessageChannelId, loginMessageChannelId: $loginMessageChannelId,
defaultRoleId: $defaultRoleId, defaultRoleId: $defaultRoleId,
shortRoleNameOnlySetHighestRole: $shortRoleNameOnlySetHighestRole,
featureFlags: $featureFlags, featureFlags: $featureFlags,
afkChannelIds: $afkChannelIds, afkChannelIds: $afkChannelIds,
moderatorRoleIds: $moderatorRoleIds, moderatorRoleIds: $moderatorRoleIds,
@ -295,6 +297,8 @@ export class Mutations {
helpVoiceChannelId helpVoiceChannelId
teamChannelId teamChannelId
loginMessageChannelId loginMessageChannelId
defaultRoleId
shortRoleNameOnlySetHighestRole
featureFlags { featureFlags {
key key
value value

View File

@ -487,6 +487,7 @@ export class Queries {
teamChannelId teamChannelId
loginMessageChannelId loginMessageChannelId
defaultRoleId defaultRoleId
shortRoleNameOnlySetHighestRole
featureFlags { featureFlags {
key key
value value

View File

@ -122,6 +122,14 @@
</div> </div>
</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"
placeholder="{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}"></p-dropdown>
</div>
</div>
<div class="content-divider"></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> [(data)]="config.afkChannelIds"></app-config-list>

View File

@ -46,6 +46,10 @@ export class ConfigComponent implements OnInit {
roles?: Role[]; roles?: Role[];
voiceChannels: Channel[] = []; voiceChannels: Channel[] = [];
textChannels: Channel[] = []; textChannels: Channel[] = [];
boolAsStrings = [
{ label: this.translate.instant("common.bool_as_string.true"), value: true },
{ label: this.translate.instant("common.bool_as_string.false"), value: false }
];
constructor( constructor(
private data: DataService, private data: DataService,
@ -119,6 +123,7 @@ export class ConfigComponent implements OnInit {
teamChannelId: this.config.teamChannelId, teamChannelId: this.config.teamChannelId,
loginMessageChannelId: this.config.loginMessageChannelId, loginMessageChannelId: this.config.loginMessageChannelId,
defaultRoleId: this.config.defaultRoleId, defaultRoleId: this.config.defaultRoleId,
shortRoleNameOnlySetHighestRole: this.config.shortRoleNameOnlySetHighestRole,
featureFlags: this.config.featureFlags, featureFlags: this.config.featureFlags,
afkChannelIds: this.config.afkChannelIds, afkChannelIds: this.config.afkChannelIds,
moderatorRoleIds: this.config.moderatorRoleIds, moderatorRoleIds: this.config.moderatorRoleIds,

View File

@ -419,6 +419,7 @@
"afk_channels": "AFK Sprachkanäle", "afk_channels": "AFK Sprachkanäle",
"afk_command_channel_id": "AFK Kanal für den Befehl /afk", "afk_command_channel_id": "AFK Kanal für den Befehl /afk",
"default_role_id": "Standardrolle des Servers", "default_role_id": "Standardrolle des Servers",
"short_role_name_only_set_highest_role": "Bei Rollen Kürzeln nur die höchste Rolle verwenden",
"header": "Bot Konfiguration", "header": "Bot Konfiguration",
"help_voice_channel_id": "Sprachkanal für Hilfsbenachrichtung", "help_voice_channel_id": "Sprachkanal für Hilfsbenachrichtung",
"login_message_channel_id": "Kanal für die Nachricht vom Bot nach Start", "login_message_channel_id": "Kanal für die Nachricht vom Bot nach Start",

View File

@ -419,6 +419,7 @@
"afk_channels": "AFK Voicechannel", "afk_channels": "AFK Voicechannel",
"afk_command_channel_id": "AFK Channel for the command /afk", "afk_command_channel_id": "AFK Channel for the command /afk",
"default_role_id": "Default role", "default_role_id": "Default role",
"short_role_name_only_set_highest_role": "For role abbreviations use only the highest role",
"header": "Bot configuration", "header": "Bot configuration",
"help_voice_channel_id": "Voicechannel für help notifications", "help_voice_channel_id": "Voicechannel für help notifications",
"login_message_channel_id": "Channel for bot message after start", "login_message_channel_id": "Channel for bot message after start",