Added maintenance option to technician settings #424
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 4m20s

This commit is contained in:
2023-11-06 18:56:04 +01:00
parent e1258151de
commit 6e79811bc9
20 changed files with 99 additions and 18 deletions

View File

@@ -8,6 +8,7 @@ export interface TechnicianConfig extends DataWithHistory {
waitForShutdown?: number;
cacheMaxMessages?: number;
maxSteamOfferCount?: number;
maintenance?: boolean;
featureFlags: FeatureFlag[];
pingURLs: string[];
technicianIds: string[];

View File

@@ -216,7 +216,7 @@ export class Mutations {
`;
static updateTechnicianConfig = `
mutation updateTechnicianConfig($id: ID, $helpCommandReferenceUrl: String, $waitForRestart: Int, $waitForShutdown: Int, $cacheMaxMessages: Int, $maxSteamOfferCount: Int, $featureFlags: [FeatureFlagInput], $pingURLs: [String], $technicianIds: [String]) {
mutation updateTechnicianConfig($id: ID, $helpCommandReferenceUrl: String, $waitForRestart: Int, $waitForShutdown: Int, $cacheMaxMessages: Int, $maxSteamOfferCount: Int, $maintenance: Boolean, $featureFlags: [FeatureFlagInput], $pingURLs: [String], $technicianIds: [String]) {
technicianConfig {
updateTechnicianConfig(input: {
id: $id,
@@ -225,6 +225,7 @@ export class Mutations {
waitForShutdown: $waitForShutdown,
cacheMaxMessages: $cacheMaxMessages,
maxSteamOfferCount: $maxSteamOfferCount,
maintenance: $maintenance,
featureFlags: $featureFlags,
pingURLs: $pingURLs,
technicianIds: $technicianIds
@@ -235,6 +236,7 @@ export class Mutations {
waitForShutdown
cacheMaxMessages
maxSteamOfferCount
maintenance
featureFlags {
key
value

View File

@@ -511,6 +511,7 @@ export class Queries {
waitForShutdown
cacheMaxMessages
maxSteamOfferCount
maintenance
featureFlags {
key
value

View File

@@ -109,7 +109,8 @@
<form [formGroup]="testMailForm" class="content-column">
<div class="content-data-name">
<div class="input-field content-input-field">
<input type="email" pInputText formControlName="mail" placeholder="{{'common.email' | translate}}" autocomplete="email">
<input type="email" pInputText formControlName="mail" placeholder="{{'common.email' | translate}}"
autocomplete="email">
</div>
</div>
@@ -136,7 +137,8 @@
<div class="content-column">
<div class="content-data-name">{{'admin.settings.bot.help_url' | translate}}:</div>
<div class="content-data-value">
<input type="text" pInputText [(ngModel)]="config.helpCommandReferenceUrl" placeholder="{{'admin.settings.bot.help_url' | translate}}">
<input type="text" pInputText [(ngModel)]="config.helpCommandReferenceUrl"
placeholder="{{'admin.settings.bot.help_url' | translate}}">
</div>
</div>
</div>
@@ -145,7 +147,8 @@
<div class="content-column">
<div class="content-data-name">{{'admin.settings.bot.wait_for_restart' | translate}}:</div>
<div class="content-data-value">
<input type="number" pInputText [(ngModel)]="config.waitForRestart" placeholder="{{'admin.settings.bot.wait_for_restart' | translate}}">
<input type="number" pInputText [(ngModel)]="config.waitForRestart"
placeholder="{{'admin.settings.bot.wait_for_restart' | translate}}">
</div>
</div>
</div>
@@ -154,7 +157,8 @@
<div class="content-column">
<div class="content-data-name">{{'admin.settings.bot.wait_for_shutdown' | translate}}:</div>
<div class="content-data-value">
<input type="number" pInputText [(ngModel)]="config.waitForShutdown" placeholder="{{'admin.settings.bot.wait_for_shutdown' | translate}}">
<input type="number" pInputText [(ngModel)]="config.waitForShutdown"
placeholder="{{'admin.settings.bot.wait_for_shutdown' | translate}}">
</div>
</div>
</div>
@@ -163,7 +167,8 @@
<div class="content-column">
<div class="content-data-name">{{'admin.settings.bot.cache_max_messages' | translate}}:</div>
<div class="content-data-value">
<input type="number" pInputText [(ngModel)]="config.cacheMaxMessages" placeholder="{{'admin.settings.bot.cache_max_messages' | translate}}">
<input type="number" pInputText [(ngModel)]="config.cacheMaxMessages"
placeholder="{{'admin.settings.bot.cache_max_messages' | translate}}">
</div>
</div>
</div>
@@ -172,14 +177,23 @@
<div class="content-column">
<div class="content-data-name">{{'admin.settings.bot.max_steam_offer_count' | translate}}:</div>
<div class="content-data-value">
<input type="number" pInputText [(ngModel)]="config.maxSteamOfferCount" placeholder="{{'admin.settings.bot.max_steam_offer_count' | translate}}">
<input type="number" pInputText [(ngModel)]="config.maxSteamOfferCount"
placeholder="{{'admin.settings.bot.max_steam_offer_count' | translate}}">
</div>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.maintenance' | translate}}:</div>
<p-selectButton class="table-edit-input" [options]="stateOptions" [(ngModel)]="config.maintenance"></p-selectButton>
</div>
</div>
<div class="content-divider"></div>
<app-config-list translationKey="admin.settings.bot.ping_urls" [(data)]="config.pingURLs"></app-config-list>
<app-config-list translationKey="admin.settings.bot.technician_ids" [options]="possibleTechnicians" optionLabel="name" optionValue="id"
<app-config-list translationKey="admin.settings.bot.technician_ids" [options]="possibleTechnicians"
optionLabel="name" optionValue="id"
[(data)]="config.technicianIds"></app-config-list>
<app-feature-flag-list [(data)]="config.featureFlags"></app-feature-flag-list>

View File

@@ -56,6 +56,10 @@ export class SettingsComponent implements OnInit {
};
possibleTechnicians?: DiscordUser[];
stateOptions: any[] = [
{ label: this.translate.instant("common.state.off"), value: false },
{ label: this.translate.instant("common.state.on"), value: true }
];
constructor(
private dataService: DataService,
@@ -157,6 +161,7 @@ export class SettingsComponent implements OnInit {
waitForShutdown: this.config.waitForShutdown,
cacheMaxMessages: this.config.cacheMaxMessages,
maxSteamOfferCount: this.config.maxSteamOfferCount,
maintenance: this.config.maintenance,
featureFlags: this.config.featureFlags,
pingURLs: this.config.pingURLs,
technicianIds: this.config.technicianIds

View File

@@ -35,6 +35,7 @@ import { InputSwitchModule } from "primeng/inputswitch";
import { CalendarModule } from "primeng/calendar";
import { DataImportAndExportComponent } from './components/data-import-and-export/data-import-and-export.component';
import { FileUploadModule } from "primeng/fileupload";
import { SelectButtonModule } from "primeng/selectbutton";
const PrimeNGModules = [
@@ -64,6 +65,7 @@ const PrimeNGModules = [
InputSwitchModule,
CalendarModule,
FileUploadModule,
SelectButtonModule,
]
@NgModule({

View File

@@ -200,6 +200,10 @@
"role": "Rolle",
"rule_count": "Regeln",
"save": "Speichern",
"state": {
"off": "Aus",
"on": "Ein"
},
"user_warnings": "Verwarnungen",
"users": "Benutzer",
"value": "Wert",
@@ -433,6 +437,7 @@
"header": "Bot Konfiguration",
"help_voice_channel_id": "Sprachkanal für Hilfsbenachrichtung",
"login_message_channel_id": "Kanal für die Nachricht vom Bot nach Start",
"maintenance": "Wartungsmodus",
"max_message_xp_per_hour": "Maximale XP pro Stunde durch Nachrichten",
"max_voice_state_hours": "Maximale Stunden für eine ontime nach Bot neustart",
"message_delete_timer": "Zeit bis zum löschen einer Botnachricht in sekunden",

View File

@@ -200,6 +200,10 @@
"role": "Role",
"rule_count": "Rules",
"save": "Save",
"state": {
"off": "Off",
"on": "On"
},
"user_warnings": "User warnings",
"users": "User",
"value": "Value",
@@ -433,6 +437,7 @@
"header": "Bot configuration",
"help_voice_channel_id": "Voicechannel für help notifications",
"login_message_channel_id": "Channel for bot message after start",
"maintenance": "Maintenance mode",
"max_message_xp_per_hour": "Max xp per hour with message",
"max_voice_state_hours": "Max ontime hours after bot restart",
"message_delete_timer": "Time to wait before delete bot messages",

View File

@@ -626,6 +626,27 @@
}
}
.p-selectbutton {
.p-highlight {
background-color: $primaryHeaderColor !important;
}
.p-button {
border: 1px solid $primaryHeaderColor !important;
&:hover {
background-color: $secondaryHeaderColor !important;
border: 1px solid $secondaryHeaderColor !important;
}
&:focus {
border-color: $primaryHeaderColor !important;
box-shadow: none !important;
}
}
}
.p-multiselect {
background-color: $primaryBackgroundColor !important;
color: $primaryTextColor !important;