Added statistics #420

This commit is contained in:
Sven Heidemann 2023-11-05 15:51:25 +01:00
parent d1ecfe9603
commit 90de90684c
10 changed files with 133 additions and 2 deletions

View File

@ -20,6 +20,7 @@ export interface Server extends Data {
autoRoles?: AutoRole[];
clientCount?: number;
clients?: Client[];
statistic?: ServerStatistic;
levelCount?: number;
levels?: Level[];
userCount?: number;
@ -35,3 +36,16 @@ export interface ServerFilter {
discordId?: String;
name?: String;
}
export interface ServerStatistic {
achievementsAchieved?: Number
messageCount?: Number
userCount?: Number
activeUserCount?: Number
userJoinedVoiceChannelCount?: Number
userJoinedVoiceChannelOntime?: Number
userJoinedGameServerCount?: Number
userJoinedGameServerOntime?: Number
userWarningCount?: Number
activityScore?: Number
}

View File

@ -79,6 +79,18 @@ export class Queries {
receivedCommandCount
movedUsersCount
}
statistic {
achievementsAchieved
messageCount
userCount
activeUserCount
userJoinedVoiceChannelCount
userJoinedVoiceChannelOntime
userJoinedGameServerCount
userJoinedGameServerOntime
userWarningCount
activityScore
}
}
}
`;

View File

@ -0,0 +1,35 @@
<div class="client">
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.activity_score' | translate}}</label>
<label class="client-info-value">{{stats?.activityScore}}</label>
</div>
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.achievements_achieved' | translate}}</label>
<label class="client-info-value">{{stats?.achievementsAchieved}}</label>
</div>
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.message_count' | translate}}</label>
<label class="client-info-value">{{stats?.messageCount}}</label>
</div>
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.user_joined_voice_channel_count' | translate}}</label>
<label class="client-info-value">{{stats?.userJoinedVoiceChannelCount}}</label>
</div>
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.user_joined_voice_channel_ontime' | translate}}</label>
<label class="client-info-value">{{stats?.userJoinedVoiceChannelOntime}}</label>
</div>
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.user_joined_game_server_count' | translate}}</label>
<label class="client-info-value">{{stats?.userJoinedGameServerCount}}</label>
</div>
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.user_joined_game_server_ontime' | translate}}</label>
<label class="client-info-value">{{stats?.userJoinedGameServerOntime}}</label>
</div>
<div class="client-info client-info-small">
<label class="client-info-header">{{'view.server.dashboard.user_warning_count' | translate}}</label>
<label class="client-info-value">{{stats?.userWarningCount}}</label>
</div>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ServerStatisticComponent } from './server-statistic.component';
describe('ServerStatisticComponent', () => {
let component: ServerStatisticComponent;
let fixture: ComponentFixture<ServerStatisticComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ServerStatisticComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ServerStatisticComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,22 @@
import { Component, Input } from "@angular/core";
import { ServerStatistic } from "../../../../../../models/data/server.model";
@Component({
selector: 'app-server-statistic',
templateUrl: './server-statistic.component.html',
styleUrls: ['./server-statistic.component.scss']
})
export class ServerStatisticComponent {
@Input() stats?: ServerStatistic = {
achievementsAchieved: 0,
messageCount: 0,
userCount: 0,
activeUserCount: 0,
userJoinedVoiceChannelCount: 0,
userJoinedVoiceChannelOntime: 0,
userJoinedGameServerCount: 0,
userJoinedGameServerOntime: 0,
userWarningCount: 0,
activityScore: 0,
};
}

View File

@ -28,6 +28,13 @@
{{'view.dashboard.server.active_members' | translate}} {{server ? server.activeUserCount : ''}}
</div>
<div class="content-divider"></div>
<div class="client-data">
<app-server-statistic class="client-component" [stats]="server.statistic"></app-server-statistic>
</div>
<div class="content-divider"></div>
<div class="client-data"
*ngFor="let client of server?.clients">
<app-client class="client-component" [client]="client"></app-client>

View File

@ -6,6 +6,7 @@ import { SharedModule } from "../../shared/shared.module";
import { ProfileComponent } from "./profile/profile.component";
import { MembersComponent } from "./members/members.component";
import { ClientComponent } from "./server-dashboard/components/client/client.component";
import { ServerStatisticComponent } from './server-dashboard/components/server-statistic/server-statistic.component';
@NgModule({
@ -14,6 +15,7 @@ import { ClientComponent } from "./server-dashboard/components/client/client.com
ProfileComponent,
MembersComponent,
ClientComponent,
ServerStatisticComponent,
],
imports: [
CommonModule,

View File

@ -454,13 +454,21 @@
}
},
"dashboard": {
"achievements_achieved": "Errungenschaften vergeben",
"activity_score": "Aktivitätsbewertung",
"deleted_message_count": "Gelöschte Nachrichten",
"header": "Server dashboard",
"message_count": "Anzahl Nachrichten",
"moved_users_count": "Verschobene Benutzer",
"name": "Name",
"received_command_count": "Empfangene Befehle",
"received_message_count": "Empfangene Nachrichten",
"sent_message_count": "Gesendete Nachrichten"
"sent_message_count": "Gesendete Nachrichten",
"user_joined_game_server_count": "Anzahl Gameserver beitritte",
"user_joined_game_server_ontime": "Gameserver Ontime",
"user_joined_voice_channel_count": "Anzahl Sprachkanal beitritte",
"user_joined_voice_channel_ontime": "Sprachkanal Ontime",
"user_warning_count": "Anzahl Verwarnungen"
},
"header": "Server",
"levels": {

View File

@ -454,13 +454,21 @@
}
},
"dashboard": {
"achievements_achieved": "Achievements achieved",
"activity_score": "Activity score",
"deleted_message_count": "Deleted messages",
"header": "Server dashboard",
"message_count": "Message count",
"moved_users_count": "Moved users",
"name": "Name",
"received_command_count": "Received commands",
"received_message_count": "Received messages",
"sent_message_count": "Sent messages"
"sent_message_count": "Sent messages",
"user_joined_game_server_count": "Joined Gameserver count",
"user_joined_game_server_ontime": "Gameserver ontime",
"user_joined_voice_channel_count": "Joined voice channel count",
"user_joined_voice_channel_ontime": "Joined voice channel ontime",
"user_warning_count": "User warning count"
},
"header": "Server",
"levels": {