13 Commits

Author SHA1 Message Date
9bad75e7c2 Temporarily removed server stats
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 5m7s
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 3m16s
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 3m11s
2023-11-07 00:28:22 +01:00
7358b67072 Fixed server loading in web
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 5m6s
2023-11-07 00:06:17 +01:00
1b0ba01258 Fixed gql types
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 3m52s
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 3m3s
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m3s
2023-11-06 23:29:11 +01:00
6fc5ee3ed3 Merge pull request 'Fixed DeleteUserJoinedServer' (#431) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m18s
Reviewed-on: #431
2023-11-06 21:43:36 +01:00
099707446d Merge branch 'master' into staging
Some checks reported warnings
Deploy staging on push / on-push-deploy_sh-edraft (push) Has been cancelled
2023-11-06 21:43:25 +01:00
d6b7fd73df Fixed DeleteUserJoinedServer
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 4m2s
2023-11-06 21:42:52 +01:00
6bfb0ddbf9 Merge pull request 'Fixed remove user process' (#429) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m10s
Reviewed-on: #429
Reviewed-by: edraft-dev <dev.sven.heidemann@sh-edraft.de>
2023-11-06 21:34:29 +01:00
e1b76fa628 Possibly fixed rate limit in actions
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 3m0s
2023-11-06 21:26:25 +01:00
e6f98def6a Possibly fixed rate limit in actions 2023-11-06 21:26:25 +01:00
590479eee2 Set migration only on prod 2023-11-06 21:26:25 +01:00
d25305be4a Merge pull request 'Fixed migration scripts' (#427) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m24s
Reviewed-on: #427
Reviewed-by: edraft-dev <dev.sven.heidemann@sh-edraft.de>
2023-11-06 20:26:57 +01:00
2889a97f17 Merge branch 'master' into staging
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 4m21s
2023-11-06 20:25:59 +01:00
b540821a32 Fixed migration scripts
Some checks reported warnings
Deploy staging on push / on-push-deploy_sh-edraft (push) Has been cancelled
2023-11-06 20:25:10 +01:00
15 changed files with 80 additions and 57 deletions

View File

@@ -8,15 +8,8 @@ on:
jobs: jobs:
on-push-deploy_sh-edraft: on-push-deploy_sh-edraft:
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ] runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
container: catthehacker/ubuntu:act-latest container: sh-edraft.de/act-runner:latest
steps: steps:
- name: Setup Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10.12"
token: ${{ secrets.CI_GITHUB_ACCESS_TOKEN }}
- run: python -v
- name: Setup docker - name: Setup docker
uses: https://github.com/papodaca/install-docker-action@main uses: https://github.com/papodaca/install-docker-action@main
- run: docker -v - run: docker -v
@@ -30,7 +23,7 @@ jobs:
- name: Prepare bot build - name: Prepare bot build
run: | run: |
cd bot cd bot
pip install --extra-index-url https://pip.sh-edraft.de cpl-cli python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
cpl i cpl i
- name: Setup node - name: Setup node

View File

@@ -8,15 +8,8 @@ on:
jobs: jobs:
on-push-deploy_sh-edraft: on-push-deploy_sh-edraft:
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ] runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
container: catthehacker/ubuntu:act-latest container: sh-edraft.de/act-runner:latest
steps: steps:
- name: Setup Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10.12"
token: ${{ secrets.CI_GITHUB_ACCESS_TOKEN }}
- run: python -v
- name: Setup docker - name: Setup docker
uses: https://github.com/papodaca/install-docker-action@main uses: https://github.com/papodaca/install-docker-action@main
- run: docker -v - run: docker -v
@@ -30,7 +23,7 @@ jobs:
- name: Prepare bot build - name: Prepare bot build
run: | run: |
cd bot cd bot
pip install --extra-index-url https://pip.sh-edraft.de cpl-cli python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
cpl i cpl i
- name: Setup node - name: Setup node

View File

@@ -8,15 +8,8 @@ on:
jobs: jobs:
on-push-deploy_sh-edraft: on-push-deploy_sh-edraft:
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ] runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
container: catthehacker/ubuntu:act-latest container: sh-edraft.de/act-runner:latest
steps: steps:
- name: Setup Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10.12"
token: ${{ secrets.CI_GITHUB_ACCESS_TOKEN }}
- run: python -v
- name: Setup docker - name: Setup docker
uses: https://github.com/papodaca/install-docker-action@main uses: https://github.com/papodaca/install-docker-action@main
- run: docker -v - run: docker -v
@@ -30,7 +23,7 @@ jobs:
- name: Prepare bot build - name: Prepare bot build
run: | run: |
cd bot cd bot
pip install --extra-index-url https://pip.sh-edraft.de cpl-cli python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
cpl i cpl i
- name: Setup node - name: Setup node

View File

@@ -398,6 +398,9 @@ class DataIntegrityService:
if user is None: if user is None:
continue continue
for join in self._user_joins.get_user_joined_servers_by_user_id(user.id):
self._user_joins.delete_user_joined_server(join)
self._user_joins_vc.delete_user_joined_voice_channel_by_user_id(user.id) self._user_joins_vc.delete_user_joined_voice_channel_by_user_id(user.id)
self._users.delete_user(user) self._users.delete_user(user)
self._db_context.save_changes() self._db_context.save_changes()

View File

@@ -17,14 +17,10 @@ class FixUserHistoryMigration(MigrationABC):
# fix 1.1.0_AchievementsMigration # fix 1.1.0_AchievementsMigration
self._cursor.execute( self._cursor.execute(
str( str(f"""ALTER TABLE UsersHistory ADD COLUMN ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""")
f"""ALTER TABLE UsersHistory ADD COLUMN IF NOT EXISTS ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;"""
)
) )
self._cursor.execute( self._cursor.execute(
str( str(f"""ALTER TABLE UsersHistory ADD COLUMN MessageCount BIGINT NOT NULL DEFAULT 0 AFTER ReactionCount;""")
f"""ALTER TABLE UsersHistory ADD COLUMN IF NOT EXISTS MessageCount BIGINT NOT NULL DEFAULT 0 AFTER ReactionCount;"""
)
) )
self._exec(__file__, "users.sql") self._exec(__file__, "users.sql")

View File

@@ -36,7 +36,7 @@ class SteamSpecialOfferMigration(MigrationABC):
str( str(
f""" f"""
ALTER TABLE CFG_Server ALTER TABLE CFG_Server
ADD COLUMN IF NOT EXISTS GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest; ADD COLUMN GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
""" """
) )
) )
@@ -45,7 +45,7 @@ class SteamSpecialOfferMigration(MigrationABC):
str( str(
f""" f"""
ALTER TABLE CFG_ServerHistory ALTER TABLE CFG_ServerHistory
ADD COLUMN IF NOT EXISTS GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest; ADD COLUMN GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
""" """
) )
) )

View File

@@ -124,6 +124,6 @@ class UserJoinedServer(TableABC):
return str( return str(
f""" f"""
DELETE FROM `UserJoinedServers` DELETE FROM `UserJoinedServers`
WHERE `Id` = {self._join_id}; WHERE `JoinId` = {self._join_id};
""" """
) )

View File

@@ -38,7 +38,7 @@ type Server implements TableWithHistoryQuery {
config: ServerConfig config: ServerConfig
hasFeatureFlag(flag: String): FeatureFlag hasFeatureFlag(flag: String): FeatureFlag
statistic(date: String): ServerStatistic # statistic(date: String): ServerStatistic
createdAt: String createdAt: String
modifiedAt: String modifiedAt: String

View File

@@ -6,10 +6,10 @@ type ServerStatistic {
activeUserCount: Int activeUserCount: Int
userJoinedVoiceChannelCount: Int userJoinedVoiceChannelCount: Int
userJoinedVoiceChannelOntime: Int userJoinedVoiceChannelOntime: Float
userJoinedGameServerCount: Int userJoinedGameServerCount: Int
userJoinedGameServerOntime: Int userJoinedGameServerOntime: Float
userWarningCount: Int userWarningCount: Int

View File

@@ -108,7 +108,7 @@ class ServerQuery(DataQueryWithHistoryABC):
"hasFeatureFlag", "hasFeatureFlag",
lambda server, *_, **kwargs: self._resolve_has_feature_flag(server, *_, **kwargs), lambda server, *_, **kwargs: self._resolve_has_feature_flag(server, *_, **kwargs),
) )
self.set_field("statistic", lambda server, *_, **kwargs: ServerStatistics(server, kwargs)) # self.set_field("statistic", lambda server, *_, **kwargs: ServerStatistics(server, kwargs))
@staticmethod @staticmethod
def resolve_id(server: Server, *_): def resolve_id(server: Server, *_):

View File

@@ -62,6 +62,19 @@ export class Queries {
static serversQuery = ` static serversQuery = `
query ServerInfo($filter: ServerFilter, $page: Page, $sort: Sort) { query ServerInfo($filter: ServerFilter, $page: Page, $sort: Sort) {
serverCount serverCount
servers(filter: $filter, page: $page, sort: $sort) {
id
discordId
name
iconURL
userCount
activeUserCount
}
}
`;
static serversDashboardQuery = `
query DetailedServerInfo($filter: ServerFilter, $page: Page, $sort: Sort) {
servers(filter: $filter, page: $page, sort: $sort) { servers(filter: $filter, page: $page, sort: $sort) {
id id
discordId discordId
@@ -79,22 +92,23 @@ export class Queries {
receivedCommandCount receivedCommandCount
movedUsersCount movedUsersCount
} }
statistic {
achievementsAchieved
messageCount
userCount
activeUserCount
userJoinedVoiceChannelCount
userJoinedVoiceChannelOntime
userJoinedGameServerCount
userJoinedGameServerOntime
userWarningCount
activityScore
}
} }
} }
`; `;
// statistic {
// achievementsAchieved
// messageCount
// userCount
// activeUserCount
// userJoinedVoiceChannelCount
// userJoinedVoiceChannelOntime
// userJoinedGameServerCount
// userJoinedGameServerOntime
// userWarningCount
// activityScore
// }
static hasServerFeatureFlag = ` static hasServerFeatureFlag = `
query HasServerFeatureFlag($filter: ServerFilter, $flag: String) { query HasServerFeatureFlag($filter: ServerFilter, $flag: String) {
servers(filter: $filter) { servers(filter: $filter) {

View File

@@ -12,7 +12,7 @@
<div class="content"> <div class="content">
<div class="server-list-wrapper"> <div class="server-list-wrapper">
<div class="server-list"> <div class="server-list">
<div class="server"> <div class="server" *ngIf="server">
<div class="logo"> <div class="logo">
<img *ngIf="server ? server.iconURL : ''" [src]="server ? server.iconURL : ''"> <img *ngIf="server ? server.iconURL : ''" [src]="server ? server.iconURL : ''">
</div> </div>

View File

@@ -5,6 +5,10 @@ import { DataService } from "src/app/services/data/data.service";
import { SpinnerService } from "src/app/services/spinner/spinner.service"; import { SpinnerService } from "src/app/services/spinner/spinner.service";
import { SidebarService } from "../../../../services/sidebar/sidebar.service"; import { SidebarService } from "../../../../services/sidebar/sidebar.service";
import { ServerService } from "../../../../services/server.service"; import { ServerService } from "../../../../services/server.service";
import { Query } from "../../../../models/graphql/query.model";
import { Queries } from "../../../../models/graphql/queries.model";
import { catchError } from "rxjs/operators";
import { throwError } from "rxjs";
@Component({ @Component({
selector: "app-server-dashboard", selector: "app-server-dashboard",
@@ -27,14 +31,30 @@ export class ServerDashboardComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.data.getServerFromRoute(this.route).then(server => { this.data.getServerFromRoute(this.route).then(server => {
this.server = server; // this.server = server;
this.loadServer(server.id);
}); });
this.serverService.server$.subscribe(server => { this.serverService.server$.subscribe(server => {
if (!server) { if (!server) {
return; return;
} }
this.server = server; this.loadServer(server.id);
});
}
loadServer(id?: number): void {
this.data.query<Query>(Queries.serversDashboardQuery, {
filter: {
id: id
}
}).pipe(catchError(err => {
this.spinner.hideSpinner();
return throwError(() => err);
})).subscribe(data => {
this.server = data.servers[0];
this.spinner.hideSpinner();
}); });
} }

View File

@@ -29,6 +29,18 @@ export class DataService {
) { ) {
} }
public getServerIdFromRoute(route: ActivatedRoute): Promise<number> {
return new Promise((resolve, reject) => {
this.spinner.showSpinner();
if (!route.snapshot.params["serverId"] || route.snapshot.params["serverId"] == "undefined") {
this.spinner.hideSpinner();
this.router.navigate(["/dashboard"]);
reject();
}
resolve(route.snapshot.params["serverId"]);
});
}
public getServerFromRoute(route: ActivatedRoute): Promise<Server> { public getServerFromRoute(route: ActivatedRoute): Promise<Server> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.spinner.showSpinner(); this.spinner.showSpinner();
@@ -50,7 +62,6 @@ export class DataService {
resolve(server); resolve(server);
}); });
}); });
} }
public query<T>(query: string, variables?: Variables, f?: Function): Observable<T> { public query<T>(query: string, variables?: Variables, f?: Function): Observable<T> {