Added feature flags to server config #334
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { DataWithHistory } from "../data/data.model";
|
||||
import { FeatureFlag } from "./feature-flags.model";
|
||||
|
||||
export interface ServerConfig extends DataWithHistory {
|
||||
id?: number;
|
||||
@@ -15,6 +16,7 @@ export interface ServerConfig extends DataWithHistory {
|
||||
helpVoiceChannelId?: string;
|
||||
teamChannelId?: string;
|
||||
loginMessageChannelId?: string;
|
||||
featureFlags: FeatureFlag[];
|
||||
afkChannelIds: string[];
|
||||
moderatorRoleIds: string[];
|
||||
adminRoleIds: string[];
|
||||
|
@@ -211,6 +211,7 @@ export class Mutations {
|
||||
$helpVoiceChannelId: String,
|
||||
$teamChannelId: String,
|
||||
$loginMessageChannelId: String,
|
||||
$featureFlags: [FeatureFlagInput],
|
||||
$afkChannelIds: [String],
|
||||
$moderatorRoleIds: [String],
|
||||
$adminRoleIds: [String]
|
||||
@@ -218,21 +219,22 @@ export class Mutations {
|
||||
serverConfig {
|
||||
updateServerConfig(input: {
|
||||
id: $id,
|
||||
messageDeleteTimer: $messageDeleteTimer
|
||||
notificationChatId: $notificationChatId
|
||||
maxVoiceStateHours: $maxVoiceStateHours
|
||||
xpPerMessage: $xpPerMessage
|
||||
xpPerReaction: $xpPerReaction
|
||||
maxMessageXpPerHour: $maxMessageXpPerHour
|
||||
xpPerOntimeHour: $xpPerOntimeHour
|
||||
xpPerEventParticipation: $xpPerEventParticipation
|
||||
xpPerAchievement: $xpPerAchievement
|
||||
afkCommandChannelId: $afkCommandChannelId
|
||||
helpVoiceChannelId: $helpVoiceChannelId
|
||||
teamChannelId: $teamChannelId
|
||||
loginMessageChannelId: $loginMessageChannelId
|
||||
afkChannelIds: $afkChannelIds
|
||||
moderatorRoleIds: $moderatorRoleIds
|
||||
messageDeleteTimer: $messageDeleteTimer,
|
||||
notificationChatId: $notificationChatId,
|
||||
maxVoiceStateHours: $maxVoiceStateHours,
|
||||
xpPerMessage: $xpPerMessage,
|
||||
xpPerReaction: $xpPerReaction,
|
||||
maxMessageXpPerHour: $maxMessageXpPerHour,
|
||||
xpPerOntimeHour: $xpPerOntimeHour,
|
||||
xpPerEventParticipation: $xpPerEventParticipation,
|
||||
xpPerAchievement: $xpPerAchievement,
|
||||
afkCommandChannelId: $afkCommandChannelId,
|
||||
helpVoiceChannelId: $helpVoiceChannelId,
|
||||
teamChannelId: $teamChannelId,
|
||||
loginMessageChannelId: $loginMessageChannelId,
|
||||
featureFlags: $featureFlags,
|
||||
afkChannelIds: $afkChannelIds,
|
||||
moderatorRoleIds: $moderatorRoleIds,
|
||||
adminRoleIds: $adminRoleIds
|
||||
}) {
|
||||
id
|
||||
@@ -249,6 +251,10 @@ export class Mutations {
|
||||
helpVoiceChannelId
|
||||
teamChannelId
|
||||
loginMessageChannelId
|
||||
featureFlags {
|
||||
key
|
||||
value
|
||||
}
|
||||
afkChannelIds
|
||||
moderatorRoleIds
|
||||
adminRoleIds
|
||||
|
@@ -385,6 +385,10 @@ export class Queries {
|
||||
helpVoiceChannelId
|
||||
teamChannelId
|
||||
loginMessageChannelId
|
||||
featureFlags {
|
||||
key
|
||||
value
|
||||
}
|
||||
afkChannelIds
|
||||
moderatorRoleIds
|
||||
adminRoleIds
|
||||
|
@@ -59,3 +59,8 @@ export interface AutoRoleRuleQuery {
|
||||
autoRoleRules: AutoRoleRule[];
|
||||
}
|
||||
|
||||
|
||||
export interface PossibleFeatureFlagsQuery {
|
||||
possibleFeatureFlags: string[];
|
||||
}
|
||||
|
||||
|
@@ -163,9 +163,7 @@
|
||||
<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" [(data)]="config.technicianIds"></app-config-list>
|
||||
|
||||
<app-feature-flag-list [(data)]="config.featureFlags"></app-feature-flag-list>
|
||||
<div class="content-divider"></div>
|
||||
|
||||
<div class="content-row">
|
||||
<button pButton icon="pi pi-save" label="{{'common.save' | translate}}" class="btn login-form-submit-btn"
|
||||
|
@@ -19,7 +19,7 @@
|
||||
<td style="flex: 3;">
|
||||
<p-cellEditor>
|
||||
<ng-template pTemplate="input">
|
||||
<input class="table-edit-input" pInputText type="text" [(ngModel)]="value.value.key">
|
||||
<p-dropdown class="table-edit-input" [options]="featureFlags" [(ngModel)]="value.value.key"></p-dropdown>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="output">
|
||||
{{value.value.key}}
|
||||
@@ -52,3 +52,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-divider"></div>
|
||||
|
@@ -1,24 +1,36 @@
|
||||
import { Component } from "@angular/core";
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { ConfigListComponent } from "../config-list/config-list.component";
|
||||
import { Table } from "primeng/table";
|
||||
import { PossibleFeatureFlagsQuery } from "../../../../models/graphql/query.model";
|
||||
import { DataService } from "../../../../services/data/data.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-feature-flag-list",
|
||||
templateUrl: "./feature-flag-list.component.html",
|
||||
styleUrls: ["./feature-flag-list.component.scss"]
|
||||
})
|
||||
export class FeatureFlagListComponent extends ConfigListComponent {
|
||||
options: boolean[] = [true, false];
|
||||
export class FeatureFlagListComponent extends ConfigListComponent implements OnInit {
|
||||
featureFlags: string[] = [];
|
||||
|
||||
constructor() {
|
||||
|
||||
constructor(
|
||||
private dataService: DataService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.dataService.query<PossibleFeatureFlagsQuery>("{possibleFeatureFlags}"
|
||||
).subscribe(data => {
|
||||
this.featureFlags = data.possibleFeatureFlags;
|
||||
});
|
||||
}
|
||||
|
||||
override addNew(table: Table) {
|
||||
const id = Math.max.apply(Math, this.internal_data.map(value => {
|
||||
return value.id ?? 0;
|
||||
})) + 1;
|
||||
const newItem = { id: id, value: {key: "", value: false} };
|
||||
const newItem = { id: id, value: { key: "", value: false } };
|
||||
this.internal_data.push(newItem);
|
||||
|
||||
table.initRowEdit(newItem);
|
||||
|
@@ -113,6 +113,7 @@
|
||||
<app-config-list translationKey="view.server.config.bot.afk_channels" [(data)]="config.afkChannelIds"></app-config-list>
|
||||
<app-config-list translationKey="view.server.config.bot.moderator_roles" [(data)]="config.moderatorRoleIds"></app-config-list>
|
||||
<app-config-list translationKey="view.server.config.bot.admin_roles" [(data)]="config.adminRoleIds"></app-config-list>
|
||||
<app-feature-flag-list [(data)]="config.featureFlags"></app-feature-flag-list>
|
||||
|
||||
<div class="content-row">
|
||||
<button pButton icon="pi pi-save" label="{{'common.save' | translate}}" class="btn login-form-submit-btn"
|
||||
|
@@ -16,7 +16,6 @@ import { AuthService } from "../../../../../../services/auth/auth.service";
|
||||
import { ServerConfig } from "../../../../../../models/config/server-config.model";
|
||||
import { Server } from "../../../../../../models/data/server.model";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { Table } from "primeng/table";
|
||||
|
||||
type AFKChannelId = {
|
||||
id: number;
|
||||
@@ -31,6 +30,7 @@ type AFKChannelId = {
|
||||
export class ConfigComponent implements OnInit {
|
||||
config: ServerConfig = {
|
||||
messageDeleteTimer: 0,
|
||||
featureFlags: [],
|
||||
afkChannelIds: [],
|
||||
moderatorRoleIds: [],
|
||||
adminRoleIds: []
|
||||
@@ -101,6 +101,7 @@ export class ConfigComponent implements OnInit {
|
||||
helpVoiceChannelId: this.config.helpVoiceChannelId,
|
||||
teamChannelId: this.config.teamChannelId,
|
||||
loginMessageChannelId: this.config.loginMessageChannelId,
|
||||
featureFlags: this.config.featureFlags,
|
||||
afkChannelIds: this.config.afkChannelIds,
|
||||
moderatorRoleIds: this.config.moderatorRoleIds,
|
||||
adminRoleIds: this.config.adminRoleIds
|
||||
@@ -110,7 +111,7 @@ export class ConfigComponent implements OnInit {
|
||||
return throwError(err);
|
||||
})).subscribe(result => {
|
||||
this.spinner.hideSpinner();
|
||||
this.toastService.success(this.translate.instant("view.server.config.message.server#_config_create"), this.translate.instant("view.server.config.message.server_config_create_d"));
|
||||
this.toastService.success(this.translate.instant("view.server.config.message.server_config_create"), this.translate.instant("view.server.config.message.server_config_create_d"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user