Fixes type errors

parent 867b55df
Pipeline #23645 failed with stages
in 5 minutes and 35 seconds
<a *ngFor="let quiz of data; let i = index"
<a *ngFor="let quiz of quizzes; let i = index"
[routerLink]="['/admin', 'quiz', quiz.id]"
class="card mx-sm-auto mx-5 my-3 cursor-pointer text-dark nav-link p-0">
<div class="card-body">
......
import { Component, OnInit } from '@angular/core';
import { QuizEntity } from '../../../lib/entities/QuizEntity';
import { QuizState } from '../../../lib/enums/QuizState';
import { AdminService } from '../../service/api/admin/admin.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
......@@ -9,10 +10,10 @@ import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
styleUrls: ['./quiz-admin.component.scss'],
})
export class QuizAdminComponent implements OnInit {
private _data: Array<object>;
private _quizzes: Array<QuizEntity>;
get data(): Array<object> {
return this._data;
get quizzes(): Array<QuizEntity> {
return this._quizzes;
}
private _deletingElements: Array<number> = [];
......@@ -23,7 +24,7 @@ export class QuizAdminComponent implements OnInit {
public ngOnInit(): void {
this.adminService.getAvailableQuizzes().subscribe(data => {
this._data = data;
this._quizzes = data;
});
}
......@@ -40,9 +41,9 @@ export class QuizAdminComponent implements OnInit {
$event.stopImmediatePropagation();
$event.preventDefault();
this._deletingElements.push(index);
this.adminService.deleteQuiz((this._data[index] as any).name || (this._data[index] as any).originalObject.name).subscribe(() => {
this.adminService.deleteQuiz((this._quizzes[index] as any).name || (this._quizzes[index] as any).originalObject.name).subscribe(() => {
this._deletingElements.splice(this._deletingElements.indexOf(index), 1);
this._data.splice(index, 1);
this._quizzes.splice(index, 1);
}, () => {
this._deletingElements.splice(this._deletingElements.indexOf(index), 1);
});
......
<div class="text-light">
<p class="card-text">Questions:</p>
<ul>
<li *ngFor="let question of data.questionList">
<li *ngFor="let question of quiz?.questionList">
<span>Type: {{question.TYPE}}</span>
<p class="card-text">Answers:</p>
<ul>
......@@ -21,41 +21,41 @@
<p class="card-text">Music Config</p>
<p class="card-text">Lobby</p>
<ul>
<li>Enabled: {{data.sessionConfig?.music.enabled.lobby}}</li>
<li>Title: {{data.sessionConfig?.music.titleConfig.lobby}}</li>
<li>Volume: {{data.sessionConfig?.music.volumeConfig.lobby}}</li>
<li>Enabled: {{quiz?.sessionConfig.music.enabled.lobby}}</li>
<li>Title: {{quiz?.sessionConfig.music.titleConfig.lobby}}</li>
<li>Volume: {{quiz?.sessionConfig.music.volumeConfig.lobby}}</li>
</ul>
<p class="card-text">Countdown Running</p>
<ul>
<li>Enabled: {{data.sessionConfig?.music.enabled.countdownRunning}}</li>
<li>Title: {{data.sessionConfig?.music.titleConfig.countdownRunning}}</li>
<li>Volume: {{data.sessionConfig?.music.volumeConfig.countdownRunning}}</li>
<li>Enabled: {{quiz?.sessionConfig.music.enabled.countdownRunning}}</li>
<li>Title: {{quiz?.sessionConfig.music.titleConfig.countdownRunning}}</li>
<li>Volume: {{quiz?.sessionConfig.music.volumeConfig.countdownRunning}}</li>
</ul>
<p class="card-text">Countdown End</p>
<ul>
<li>Enabled: {{data.sessionConfig?.music.enabled.countdownEnd}}</li>
<li>Title: {{data.sessionConfig?.music.titleConfig.countdownEnd}}</li>
<li>Volume: {{data.sessionConfig?.music.volumeConfig.countdownEnd}}</li>
<li>Enabled: {{quiz?.sessionConfig.music.enabled.countdownEnd}}</li>
<li>Title: {{quiz?.sessionConfig.music.titleConfig.countdownEnd}}</li>
<li>Volume: {{quiz?.sessionConfig.music.volumeConfig.countdownEnd}}</li>
</ul>
<p class="card-text">Nick Config</p>
<p>Member Groups:</p>
<ul>
<li *ngFor="let group of data.sessionConfig?.nicks.memberGroups">
<li *ngFor="let group of quiz?.sessionConfig.nicks.memberGroups">
<span>Name: {{group.name}}</span>
</li>
</ul>
<ul>
<li>Max Members Per Group: {{data.sessionConfig?.nicks.maxMembersPerGroup}}</li>
<li>Automatically join to Group: {{data.sessionConfig?.nicks.autoJoinToGroup}}</li>
<li>Selected Nicks: {{data.sessionConfig?.nicks.selectedNicks}}</li>
<li>Block Illegal Nicks: {{data.sessionConfig?.nicks.blockIllegalNicks}}</li>
<li>Restrict to CAS Login: {{data.sessionConfig?.nicks.restrictToCasLogin}}</li>
<li>Max Members Per Group: {{quiz?.sessionConfig.nicks.maxMembersPerGroup}}</li>
<li>Automatically join to Group: {{quiz?.sessionConfig.nicks.autoJoinToGroup}}</li>
<li>Selected Nicks: {{quiz?.sessionConfig.nicks.selectedNicks}}</li>
<li>Block Illegal Nicks: {{quiz?.sessionConfig.nicks.blockIllegalNicks}}</li>
<li>Restrict to CAS Login: {{quiz?.sessionConfig.nicks.restrictToCasLogin}}</li>
</ul>
<p class="card-text">Session Config</p>
<ul>
<li>Reading-Confirmation enabled: {{data.sessionConfig?.readingConfirmationEnabled}}</li>
<li>Confidence-Slider enabled: {{data.sessionConfig?.confidenceSliderEnabled}}</li>
<li>Show response progress: {{data.sessionConfig?.showResponseProgress}}</li>
<li>Theme: {{data.sessionConfig?.theme}}</li>
<li>Reading-Confirmation enabled: {{quiz?.sessionConfig.readingConfirmationEnabled}}</li>
<li>Confidence-Slider enabled: {{quiz?.sessionConfig.confidenceSliderEnabled}}</li>
<li>Show response progress: {{quiz?.sessionConfig.showResponseProgress}}</li>
<li>Theme: {{quiz?.sessionConfig.theme}}</li>
</ul>
</div>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { QuizEntity } from '../../../lib/entities/QuizEntity';
import { AdminService } from '../../service/api/admin/admin.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
......@@ -9,10 +10,10 @@ import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
styleUrls: ['./quiz-details-admin.component.scss'],
})
export class QuizDetailsAdminComponent implements OnInit {
private _data: object = {};
private _quiz: QuizEntity;
get data(): object {
return this._data;
get quiz(): object {
return this._quiz;
}
constructor(private footerBarService: FooterBarService, private adminService: AdminService, private activatedRoute: ActivatedRoute) {
......@@ -22,7 +23,7 @@ export class QuizDetailsAdminComponent implements OnInit {
public ngOnInit(): void {
this.activatedRoute.params.subscribe(params => {
this.adminService.getQuiz(params.id).subscribe(data => {
this._data = data;
this._quiz = data;
});
});
}
......
......@@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { DefaultSettings } from '../../../../lib/default.settings';
import { QuizEntity } from '../../../../lib/entities/QuizEntity';
import { UserService } from '../../user/user.service';
@Injectable({
......@@ -23,8 +24,8 @@ export class AdminService {
return this.http.get<Array<object>>(this._getAvailableUsersUrl, { headers: { authorization: this.userService.staticLoginToken } });
}
public getAvailableQuizzes(): Observable<Array<object>> {
return this.http.get<Array<object>>(this._getAvailableQuizzesUrl, { headers: { authorization: this.userService.staticLoginToken } });
public getAvailableQuizzes(): Observable<Array<QuizEntity>> {
return this.http.get<Array<QuizEntity>>(this._getAvailableQuizzesUrl, { headers: { authorization: this.userService.staticLoginToken } });
}
public deleteQuiz(quizName: string): Observable<void> {
......@@ -39,8 +40,8 @@ export class AdminService {
return this.http.put<void>(this._putUserUrl, value, { headers: { authorization: this.userService.staticLoginToken } });
}
public getQuiz(quizname: string): Observable<object> {
return this.http.get(`${this._getQuizUrl}/${quizname}`, { headers: { authorization: this.userService.staticLoginToken } });
public getQuiz(quizname: string): Observable<QuizEntity> {
return this.http.get<QuizEntity>(`${this._getQuizUrl}/${quizname}`, { headers: { authorization: this.userService.staticLoginToken } });
}
private initUrls(): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment