Added feature flags config to technician settings #334
This commit is contained in:
4
kdb-web/src/app/models/config/feature-flags.model.ts
Normal file
4
kdb-web/src/app/models/config/feature-flags.model.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface FeatureFlag {
|
||||
key: string;
|
||||
value: boolean;
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
import { DataWithHistory } from "../data/data.model";
|
||||
import { FeatureFlag } from "./feature-flags.model";
|
||||
|
||||
export interface TechnicianConfig extends DataWithHistory {
|
||||
id?: number;
|
||||
@@ -6,6 +7,7 @@ export interface TechnicianConfig extends DataWithHistory {
|
||||
waitForRestart?: number;
|
||||
waitForShutdown?: number;
|
||||
cacheMaxMessages?: number;
|
||||
featureFlags: FeatureFlag[];
|
||||
pingURLs: string[];
|
||||
technicianIds: string[];
|
||||
}
|
||||
|
@@ -167,7 +167,7 @@ export class Mutations {
|
||||
`;
|
||||
|
||||
static updateTechnicianConfig = `
|
||||
mutation updateTechnicianConfig($id: ID, $helpCommandReferenceUrl: String, $waitForRestart: Int, $waitForShutdown: Int, $cacheMaxMessages: Int, $pingURLs: [String], $technicianIds: [String]) {
|
||||
mutation updateTechnicianConfig($id: ID, $helpCommandReferenceUrl: String, $waitForRestart: Int, $waitForShutdown: Int, $cacheMaxMessages: Int, $featureFlags: [FeatureFlagInput], $pingURLs: [String], $technicianIds: [String]) {
|
||||
technicianConfig {
|
||||
updateTechnicianConfig(input: {
|
||||
id: $id,
|
||||
@@ -175,6 +175,7 @@ export class Mutations {
|
||||
waitForRestart: $waitForRestart,
|
||||
waitForShutdown: $waitForShutdown,
|
||||
cacheMaxMessages: $cacheMaxMessages,
|
||||
featureFlags: $featureFlags,
|
||||
pingURLs: $pingURLs,
|
||||
technicianIds: $technicianIds
|
||||
}) {
|
||||
@@ -183,6 +184,10 @@ export class Mutations {
|
||||
waitForRestart
|
||||
waitForShutdown
|
||||
cacheMaxMessages
|
||||
featureFlags {
|
||||
key
|
||||
value
|
||||
}
|
||||
pingURLs
|
||||
technicianIds
|
||||
}
|
||||
|
@@ -353,6 +353,10 @@ export class Queries {
|
||||
waitForRestart
|
||||
waitForShutdown
|
||||
cacheMaxMessages
|
||||
featureFlags {
|
||||
key
|
||||
value
|
||||
}
|
||||
pingURLs
|
||||
technicianIds
|
||||
|
||||
|
@@ -164,6 +164,9 @@
|
||||
<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"
|
||||
(click)="saveTechnicianConfig()"></button>
|
||||
|
@@ -49,6 +49,7 @@ export class SettingsComponent implements OnInit {
|
||||
waitForRestart: 0,
|
||||
waitForShutdown: 0,
|
||||
cacheMaxMessages: 0,
|
||||
featureFlags: [],
|
||||
pingURLs: [],
|
||||
technicianIds: []
|
||||
};
|
||||
@@ -150,6 +151,7 @@ export class SettingsComponent implements OnInit {
|
||||
waitForRestart: this.config.waitForRestart,
|
||||
waitForShutdown: this.config.waitForShutdown,
|
||||
cacheMaxMessages: this.config.cacheMaxMessages,
|
||||
featureFlags: this.config.featureFlags,
|
||||
pingURLs: this.config.pingURLs,
|
||||
technicianIds: this.config.technicianIds
|
||||
}
|
||||
|
@@ -15,8 +15,8 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-value let-editing="editing" let-ri="rowIndex">
|
||||
<tr [pEditableRow]="value">
|
||||
<td>
|
||||
<tr [pEditableRow]="value" style="display: flex;">
|
||||
<td style="flex: 1;">
|
||||
<p-cellEditor>
|
||||
<ng-template pTemplate="input">
|
||||
<input class="table-edit-input" pInputText type="text" [(ngModel)]="value.value">
|
||||
|
@@ -0,0 +1,54 @@
|
||||
<div class="content-row">
|
||||
<div class="content-column">
|
||||
<div class="content-data-name">
|
||||
{{'common.feature_flags' | translate}}:
|
||||
</div>
|
||||
<div class="content-data-value-row">
|
||||
<p-table #dt [value]="internal_data" dataKey="id" editMode="row">
|
||||
<ng-template pTemplate="caption">
|
||||
<div class="table-caption">
|
||||
<div class="table-caption-btn-wrapper btn-wrapper">
|
||||
<button pButton class="icon-btn btn"
|
||||
icon="pi pi-plus" (click)="addNew(dt)">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-value let-editing="editing" let-ri="rowIndex">
|
||||
<tr [pEditableRow]="value" style="display: flex;">
|
||||
<td style="flex: 3;">
|
||||
<p-cellEditor>
|
||||
<ng-template pTemplate="input">
|
||||
<input class="table-edit-input" pInputText type="text" [(ngModel)]="value.value.key">
|
||||
</ng-template>
|
||||
<ng-template pTemplate="output">
|
||||
{{value.value.key}}
|
||||
</ng-template>
|
||||
</p-cellEditor>
|
||||
</td>
|
||||
<td style="flex: 1;">
|
||||
<p-cellEditor>
|
||||
<ng-template pTemplate="input">
|
||||
<p-inputSwitch class="table-edit-input" [(ngModel)]="value.value.value"></p-inputSwitch>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="output">
|
||||
<p-inputSwitch class="table-edit-input" [(ngModel)]="value.value.value" [disabled]="true"></p-inputSwitch>
|
||||
</ng-template>
|
||||
</p-cellEditor>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-wrapper">
|
||||
<button *ngIf="!editing" pButton type="button" pInitEditableRow class="btn icon-btn" icon="pi pi-pencil" (click)="editInit(value, ri)"></button>
|
||||
<button *ngIf="!editing" pButton type="button" class="btn danger-icon-btn" icon="pi pi-trash" (click)="delete(ri)"></button>
|
||||
|
||||
<button *ngIf="editing" pButton type="button" pSaveEditableRow class="btn icon-btn" icon="pi pi-check" (click)="editSave(value, ri)"></button>
|
||||
<button *ngIf="editing" pButton type="button" pCancelEditableRow class="btn danger-icon-btn" icon="pi pi-times"
|
||||
(click)="editCancel(ri)"></button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FeatureFlagListComponent } from './feature-flag-list.component';
|
||||
|
||||
describe('FeatureFlagListComponent', () => {
|
||||
let component: FeatureFlagListComponent;
|
||||
let fixture: ComponentFixture<FeatureFlagListComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ FeatureFlagListComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(FeatureFlagListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,28 @@
|
||||
import { Component } from "@angular/core";
|
||||
import { ConfigListComponent } from "../config-list/config-list.component";
|
||||
import { Table } from "primeng/table";
|
||||
|
||||
@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];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
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} };
|
||||
this.internal_data.push(newItem);
|
||||
|
||||
table.initRowEdit(newItem);
|
||||
const index = this.internal_data.findIndex(l => l.id == newItem.id);
|
||||
this.editInit(newItem, index);
|
||||
}
|
||||
}
|
@@ -30,6 +30,8 @@ import { MultiSelectModule } from "primeng/multiselect";
|
||||
import { HideableColumnComponent } from './components/hideable-column/hideable-column.component';
|
||||
import { HideableHeaderComponent } from './components/hideable-header/hideable-header.component';
|
||||
import { MultiSelectColumnsComponent } from './base/multi-select-columns/multi-select-columns.component';
|
||||
import { FeatureFlagListComponent } from './components/feature-flag-list/feature-flag-list.component';
|
||||
import { InputSwitchModule } from "primeng/inputswitch";
|
||||
|
||||
|
||||
@NgModule({
|
||||
@@ -42,6 +44,7 @@ import { MultiSelectColumnsComponent } from './base/multi-select-columns/multi-s
|
||||
HideableColumnComponent,
|
||||
HideableHeaderComponent,
|
||||
MultiSelectColumnsComponent,
|
||||
FeatureFlagListComponent,
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
@@ -68,6 +71,7 @@ import { MultiSelectColumnsComponent } from './base/multi-select-columns/multi-s
|
||||
SidebarModule,
|
||||
DataViewModule,
|
||||
MultiSelectModule,
|
||||
InputSwitchModule,
|
||||
],
|
||||
exports: [
|
||||
ButtonModule,
|
||||
@@ -102,6 +106,8 @@ import { MultiSelectColumnsComponent } from './base/multi-select-columns/multi-s
|
||||
HideableColumnComponent,
|
||||
HideableHeaderComponent,
|
||||
MultiSelectColumnsComponent,
|
||||
FeatureFlagListComponent,
|
||||
InputSwitchModule,
|
||||
]
|
||||
})
|
||||
export class SharedModule {
|
||||
|
@@ -122,6 +122,7 @@
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
"feature_flags": "Funktionen",
|
||||
"404": "404 - Der Eintrag konnte nicht gefunden werden",
|
||||
"actions": "Aktionen",
|
||||
"active": "Aktiv",
|
||||
|
@@ -587,7 +587,7 @@
|
||||
|
||||
.p-datatable .p-sortable-column.p-highlight,
|
||||
.p-datatable .p-sortable-column.p-highlight .p-sortable-column-icon,
|
||||
.p-datatable .p-sortable-column:not(.p-highlight):hover{
|
||||
.p-datatable .p-sortable-column:not(.p-highlight):hover {
|
||||
color: $primaryHeaderColor !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
@@ -672,4 +672,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.p-inputswitch.p-inputswitch-checked .p-inputswitch-slider {
|
||||
background: $primaryHeaderColor !important;
|
||||
}
|
||||
|
||||
.p-inputswitch.p-focus .p-inputswitch-slider {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user