Big stuff update

parent f1d9305f
Pipeline #21854 failed with stages
in 4 minutes and 8 seconds
......@@ -49,7 +49,7 @@ export class FrontendPage {
}
private getQuiznameInputElement(): ElementFinder {
return element(by.css('#hashtag-input-field'));
return element(by.css('#name-input-field'));
}
private getPasswordInputElement(): ElementFinder {
......
......@@ -8,6 +8,7 @@
},
"description": "Version 2 of arsnova.click (Frontend WebApp)",
"scripts": {
"dependency-check": "npx --ignore-existing madge --circular --extensions ts src",
"ng": "ng",
"start:SSR": "cd dist && node server",
"start:DEV": "ng serve --host 0.0.0.0 --port 4210 --disable-host-check --aot",
......
......@@ -3,7 +3,6 @@ import { enableProdMode } from '@angular/core';
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import * as bodyParser from 'body-parser';
import * as child_process from 'child_process';
import * as compress from 'compression';
......@@ -17,6 +16,7 @@ import 'reflect-metadata';
// These are important and needed before anything else
import 'zone.js/dist/zone-node';
import { DefaultSettings } from './src/lib/default.settings';
import { MessageProtocol, StatusProtocol } from './src/lib/enums/Message';
Error.stackTraceLimit = Infinity;
console.error = (msg) => {
......@@ -66,8 +66,8 @@ app.use(compress());
app.param('project', (req, res, next, project) => {
if (!project || !i18nFileBaseLocation[project]) {
res.status(500).send({
status: COMMUNICATION_PROTOCOL.STATUS.FAILED,
data: COMMUNICATION_PROTOCOL.I18N.INVALID_PROJECT_SPECIFIED,
status: StatusProtocol.Failed,
data: MessageProtocol.InvalidProjectSpecified,
payload: { project },
});
} else {
......@@ -197,21 +197,19 @@ const getUnusedKeys = (req) => {
const i18nFileContent = JSON.parse(fs.readFileSync(path.join(req.i18nFileBaseLocation, `${langRefs[i]}.json`)).toString('UTF-8'));
const objectPaths = objectPath(i18nFileContent);
objectPaths.forEach((
i18nPath => {
let matched = false;
fileNames.forEach(filename => {
if (matched) {
return;
}
const fileContent = fs.readFileSync(filename).toString('UTF-8');
matched = fileContent.indexOf(i18nPath) > -1;
});
if (!matched) {
result[langRefs[i]].push(i18nPath);
objectPaths.forEach((i18nPath => {
let matched = false;
fileNames.forEach(filename => {
if (matched) {
return;
}
const fileContent = fs.readFileSync(filename).toString('UTF-8');
matched = fileContent.indexOf(i18nPath) > -1;
});
if (!matched) {
result[langRefs[i]].push(i18nPath);
}
));
}));
}
return result;
......@@ -266,7 +264,7 @@ app.get('/api/v1/plugin/i18nator/:project/langFile', async (req, res) => {
payload.branch = cache[req.projectCache].branch;
res.send({
status: COMMUNICATION_PROTOCOL.STATUS.SUCCESSFUL,
status: StatusProtocol.Success,
payload,
});
});
......@@ -276,16 +274,16 @@ app.post('/api/v1/plugin/i18nator/:project/updateLang', async (req, res) => {
if (!username || !token) {
res.send({
status: COMMUNICATION_PROTOCOL.STATUS.FAILED,
step: COMMUNICATION_PROTOCOL.AUTHORIZATION.AUTHENTICATE_STATIC,
status: StatusProtocol.Failed,
step: MessageProtocol.AuthenticateStatic,
payload: { reason: 'UNKOWN_LOGIN' },
});
return;
}
if (!req.body.data) {
res.status(500).send({
status: COMMUNICATION_PROTOCOL.STATUS.FAILED,
data: COMMUNICATION_PROTOCOL.I18N.INVALID_DATA,
status: StatusProtocol.Failed,
data: MessageProtocol.InvalidData,
payload: { body: req.body },
});
return;
......@@ -301,7 +299,7 @@ app.post('/api/v1/plugin/i18nator/:project/updateLang', async (req, res) => {
response.on('end', () => {
data = JSON.parse(data);
if (!data && data.status !== COMMUNICATION_PROTOCOL.STATUS.SUCCESSFUL) {
if (!data && data.status !== StatusProtocol.Success) {
return;
}
......@@ -326,15 +324,15 @@ app.post('/api/v1/plugin/i18nator/:project/updateLang', async (req, res) => {
const exists = fs.existsSync(fileLocation);
if (!exists) {
res.status(404).send({
status: COMMUNICATION_PROTOCOL.STATUS.FAILED,
data: COMMUNICATION_PROTOCOL.I18N.FILE_NOT_FOUND,
status: StatusProtocol.Failed,
data: MessageProtocol.FileNotFound,
payload: { fileLocation },
});
return;
}
fs.writeFileSync(fileLocation, JSON.stringify(fileContent));
if (index === langKeys.length - 1) {
res.send({ status: COMMUNICATION_PROTOCOL.STATUS.SUCCESSFUL });
res.send({ status: StatusProtocol.Success });
}
});
});
......@@ -344,8 +342,8 @@ app.post('/api/v1/plugin/i18nator/:project/updateLang', async (req, res) => {
console.log('error at validating login token', error);
request.abort();
res.send({
status: COMMUNICATION_PROTOCOL.STATUS.FAILED,
step: COMMUNICATION_PROTOCOL.I18N.UPDATE_LANG,
status: StatusProtocol.Failed,
step: MessageProtocol.UpdateLang,
payload: { error },
});
return;
......
......@@ -8,10 +8,10 @@ import { createTranslateLoader } from '../../../lib/translation.factory';
import { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { CurrentQuizMockService } from '../../service/current-quiz/current-quiz.mock.service';
import { CurrentQuizService } from '../../service/current-quiz/current-quiz.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
import { I18nService } from '../../service/i18n/i18n.service';
import { QuizService } from '../../service/quiz/quiz.service';
import { SettingsService } from '../../service/settings/settings.service';
import { SharedService } from '../../service/shared/shared.service';
import { IndexedDbService } from '../../service/storage/indexed.db.service';
......@@ -50,7 +50,7 @@ describe('AdminOverviewComponent', () => {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, ThemesService, {
provide: CurrentQuizService,
provide: QuizService,
useClass: CurrentQuizMockService,
}, {
provide: TrackingService,
......
......@@ -12,73 +12,84 @@
</div>
<p class="card-text">
<span>Name: </span>
<span *ngIf="quiz.name">{{quiz.name}}</span>
<span *ngIf="quiz.originalObject?.hashtag">{{quiz.originalObject.hashtag}}</span>
<span>{{quiz.name}}</span>
</p>
<p class="card-text"
*ngIf="quiz.expiry">
<span>Expiry: </span>
<span>{{quiz.expiry}}</span>
</p>
<p class="card-text"
*ngIf="quiz.visibility">
<span>Visibility: </span>
<span>{{quiz.visibility}}</span>
</p>
<p class="card-text">Is Active: {{isActiveQuiz(quiz)}}</p>
<ng-container *ngIf="isActiveQuiz(quiz)">
<p class="card-text">MemberEntity Groups:</p>
<ng-container>
<p class="card-text">Member Groups:</p>
<ul>
<li *ngFor="let group of quiz.memberGroups">
<span>Name: {{group.name}}</span>
<ul>
<li *ngFor="let member of group.members">
<span>MemberEntity Name: {{member}}</span>
<span>Member Name: {{member}}</span>
</li>
</ul>
</li>
</ul>
<p class="card-text">Questions:</p>
<ul>
<li *ngFor="let question of quiz.questionList">
<span>Type: {{question.TYPE}}</span>
<p class="card-text">Answers:</p>
<ul>
<li *ngFor="let answers of group.answerOptionList">
<li *ngFor="let answers of question.answerOptionList">
<span>Answer Text: {{answers.answerText}}</span><br/>
<span>Is Correct: {{answers.isCorrect}}</span><br/>
<span>Type: {{answers.TYPE}}</span><br/>
</li>
</ul>
<span>Display Answer Text: {{question.displayAnswerText}}</span>
<span>Multiple Selection Enabled: {{question.multipleSelectionEnabled}}</span>
<span>Show One Answer Per Row: {{question.showOneAnswerPerRow}}</span>
<span>Timer: {{question.timer}}</span>
<span>Display Answer Text: {{question.displayAnswerText}}</span><br/>
<span>Multiple Selection Enabled: {{question.multipleSelectionEnabled}}</span><br/>
<span>Show One Answer Per Row: {{question.showOneAnswerPerRow}}</span><br/>
<span>Timer: {{question.timer}}</span><br/>
<span>Question Text: {{question.questionText}}</span>
</li>
</ul>
<p class="card-text">Music Config</p>
<p class="card-text">Lobby</p>
<ul>
<li>Enabled: {{quiz.originalObject.sessionConfig.music.enabled.lobby}}</li>
<li>Title: {{quiz.originalObject.sessionConfig.music.titleConfig.lobby}}</li>
<li>Title: {{quiz.originalObject.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: {{quiz.originalObject.sessionConfig.music.enabled.countdownRunning}}</li>
<li>Title: {{quiz.originalObject.sessionConfig.music.titleConfig.countdownRunning}}</li>
<li>Title: {{quiz.originalObject.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: {{quiz.originalObject.sessionConfig.music.enabled.countdownEnd}}</li>
<li>Title: {{quiz.originalObject.sessionConfig.music.titleConfig.countdownEnd}}</li>
<li>Title: {{quiz.originalObject.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>
<ul>
<li>MemberEntity Groups: {{quiz.originalObject.sessionConfig.nicks.memberGroups}}</li>
<li>Max Members Per Group: {{quiz.originalObject.sessionConfig.nicks.maxMembersPerGroup}}</li>
<li>Automatically join to Group: {{quiz.originalObject.sessionConfig.nicks.autoJoinToGroup}}</li>
<li>Selected Nicks: {{quiz.originalObject.sessionConfig.nicks.selectedNicks}}</li>
<li>blockIllegalNicks: {{quiz.originalObject.sessionConfig.nicks.blockIllegalNicks}}</li>
<li>restrictToCasLogin: {{quiz.originalObject.sessionConfig.nicks.restrictToCasLogin}}</li>
<li>Member Groups: {{quiz.sessionConfig.nicks.memberGroups}}</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>readingConfirmationEnabled: {{quiz.originalObject.sessionConfig.readingConfirmationEnabled}}</li>
<li>confidenceSliderEnabled: {{quiz.originalObject.sessionConfig.confidenceSliderEnabled}}</li>
<li>showResponseProgress: {{quiz.originalObject.sessionConfig.showResponseProgress}}</li>
<li>theme: {{quiz.originalObject.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>
</ng-container>
</div>
......
.card-text {
margin-bottom: 0;
}
\ No newline at end of file
......@@ -11,10 +11,10 @@ import { createTranslateLoader } from '../../../lib/translation.factory';
import { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { CurrentQuizMockService } from '../../service/current-quiz/current-quiz.mock.service';
import { CurrentQuizService } from '../../service/current-quiz/current-quiz.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
import { I18nService } from '../../service/i18n/i18n.service';
import { QuizService } from '../../service/quiz/quiz.service';
import { SettingsService } from '../../service/settings/settings.service';
import { SharedService } from '../../service/shared/shared.service';
import { IndexedDbService } from '../../service/storage/indexed.db.service';
......@@ -60,7 +60,7 @@ describe('QuizAdminComponent', () => {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, ThemesService, {
provide: CurrentQuizService,
provide: QuizService,
useClass: CurrentQuizMockService,
}, {
provide: TrackingService,
......
......@@ -36,7 +36,7 @@ export class QuizAdminComponent implements OnInit {
public deleteElem(index: number): void {
this._deletingElements.push(index);
this.adminService.deleteQuiz((this._data[index] as any).name || (this._data[index] as any).originalObject.hashtag).subscribe(() => {
this.adminService.deleteQuiz((this._data[index] as any).name || (this._data[index] as any).originalObject.name).subscribe(() => {
this._deletingElements.splice(this._deletingElements.indexOf(index), 1);
this._data.splice(index, 1);
}, () => {
......
<button class="btn btn-primary"
<button class="btn btn-info"
(click)="showAddUserModal()">
Add User
</button>
......@@ -19,13 +19,17 @@
class="cursor-pointer"
(click)="deleteElem(i)"></fa-icon>
</div>
<p class="card-text">Username: {{user.username}}</p>
<p class="card-text">Gitlab Token: {{user.gitlabToken}}</p>
<p class="card-text">
<p class="card-text mb-0">Username: {{user.name}}</p>
<p class="card-text mb-0">
<span>Gitlab Token:&nbsp;</span>
<span *ngIf="!user.gitlabToken">No Gitlab access token set</span>
<span>{{user.gitlabToken}}</span>
</p>
<p class="card-text mb-0">
<span>Password-Hash:</span><br/>
<span>{{user.passwordHash}}</span>
</p>
<p class="card-text">User Authorizations:</p>
<p class="card-text mb-0">User Authorizations:</p>
<ul>
<li *ngFor="let auth of user.userAuthorizations">{{auth}}</li>
</ul>
......
......@@ -11,10 +11,10 @@ import { createTranslateLoader } from '../../../lib/translation.factory';
import { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { CurrentQuizMockService } from '../../service/current-quiz/current-quiz.mock.service';
import { CurrentQuizService } from '../../service/current-quiz/current-quiz.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
import { I18nService } from '../../service/i18n/i18n.service';
import { QuizService } from '../../service/quiz/quiz.service';
import { SettingsService } from '../../service/settings/settings.service';
import { SharedService } from '../../service/shared/shared.service';
import { IndexedDbService } from '../../service/storage/indexed.db.service';
......@@ -60,7 +60,7 @@ describe('UserAdminComponent', () => {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, ThemesService, {
provide: CurrentQuizService,
provide: QuizService,
useClass: CurrentQuizMockService,
}, {
provide: TrackingService,
......
......@@ -49,7 +49,7 @@ export class UserAdminComponent implements OnInit {
public showAddUserModal(): void {
this.ngbModal.open(AddUserComponent).result.then(value => {
value.passwordHash = this.userService.hashPassword(value.username, value.password);
value.passwordHash = this.userService.hashPassword(value.name, value.password);
delete value.password;
this.adminService.updateUser(value).subscribe(() => {
this._data.push(value);
......@@ -59,15 +59,17 @@ export class UserAdminComponent implements OnInit {
public editElem(index: number): void {
const ref = this.ngbModal.open(AddUserComponent);
ref.componentInstance.username = (this._data[index] as any).username;
ref.componentInstance.name = (this._data[index] as any).name;
ref.componentInstance.gitlabToken = (this._data[index] as any).gitlabToken;
ref.componentInstance.userAuthorizations = (this._data[index] as any).userAuthorizations;
ref.result.then(value => {
value.originalUser = (this._data[index] as any).username;
value.originalUser = (this._data[index] as any).name;
value.passwordHash = this.userService.hashPassword(value.name, value.password);
delete value.password;
this.adminService.updateUser(value).subscribe(() => {
value.passwordHash = this.userService.hashPassword(value.username, value.password);
delete value.password;
(this._data[index] as any).username = value.username;
(this._data[index] as any).name = value.name;
(this._data[index] as any).passwordHash = value.passwordHash;
(this._data[index] as any).gitlabToken = value.gitlabToken;
(this._data[index] as any).userAuthorizations = value.userAuthorizations;
......
......@@ -10,7 +10,7 @@
<h5 class="text-center">{{'component.quiz_summary.quiz_name' | translate}}</h5>
<p class="mb-0 d-flex align-self-center align-items-end h-100 text-bold text-center"
role="listitem">
<span>{{this.activeQuestionGroupService.activeQuestionGroup?.hashtag}}</span>
<span>{{this.quizService.quiz?.name}}</span>
</p>
</div>
</div>
......@@ -22,11 +22,11 @@
<h5 class="text-center">{{'component.quiz_summary.validation_question_group' | translate}}</h5>
<p class="mb-0 d-flex align-self-center align-items-end h-100 text-bold text-center"
role="listitem">
<span *ngIf="this.activeQuestionGroupService.activeQuestionGroup?.isValid()"
<span *ngIf="this.quizService.quiz?.isValid()"
class="text-success">
{{'component.quiz_summary.question_group_successful' | translate}}
</span>
<span *ngIf="!this.activeQuestionGroupService.activeQuestionGroup?.isValid()"
<span *ngIf="!this.quizService.quiz?.isValid()"
class="text-danger">
{{'component.quiz_summary.question_group_failed' | translate}}
</span>
......@@ -42,21 +42,21 @@
<h5 class="text-center">{{'component.quiz_summary.quiz_url' | translate}}</h5>
<p class="mb-0 text-wrap"
role="listitem">
<span>{{getQuizUrl(this.activeQuestionGroupService.activeQuestionGroup?.hashtag)}}</span>
<span>{{getQuizUrl(this.quizService.quiz?.name)}}</span>
</p>
</div>
</div>
<div *ngIf="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.length === 0 && isShowingMore"
<div *ngIf="this.quizService.quiz?.sessionConfig.nicks.selectedNicks.length === 0 && isShowingMore"
class="col-6 col-md-12 mt-sm-2 mb-2 mb-sm-0">
<div class="element-wrapper bg-white px-2 py-2 mb-2 h-100">
<h5 class="text-center text-hyphen">{{'component.quiz_summary.isRestrictingRudeNicks' | translate}}</h5>
<p class="mb-0 text-center"
role="listitem">
<span *ngIf="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.blockIllegalNicks">
<span *ngIf="this.quizService.quiz?.sessionConfig.nicks.blockIllegalNicks">
{{'global.yes' | translate}}
</span>
<span *ngIf="!this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.blockIllegalNicks">
<span *ngIf="!this.quizService.quiz?.sessionConfig.nicks.blockIllegalNicks">
{{'global.no' | translate}}
</span>
</p>
......@@ -71,10 +71,10 @@
<h5 class="text-center">{{'component.quiz_summary.isRestrictingToCAS' | translate}}</h5>
<p class="mb-0 text-center text-hyphen"
role="listitem">
<span *ngIf="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.restrictToCasLogin">
<span *ngIf="this.quizService.quiz?.sessionConfig.nicks.restrictToCasLogin">
{{'global.yes' | translate}}
</span>
<span *ngIf="!this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.restrictToCasLogin">
<span *ngIf="!this.quizService.quiz?.sessionConfig.nicks.restrictToCasLogin">
{{'global.no' | translate}}
</span>
</p>
......@@ -82,26 +82,26 @@
</div>
<div *ngIf="isShowingMore"
[class.col-6]="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.length === 0"
[class.col-md-12]="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.length === 0"
[class.col-12]="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.length > 0"
[class.col-6]="this.quizService.quiz?.sessionConfig.nicks.selectedNicks.length === 0"
[class.col-md-12]="this.quizService.quiz?.sessionConfig.nicks.selectedNicks.length === 0"
[class.col-12]="this.quizService.quiz?.sessionConfig.nicks.selectedNicks.length > 0"
class="mt-sm-2 mb-2 mb-sm-0 px-0">
<div class="element-wrapper bg-white px-2 py-2 mb-2 h-100">
<h5 class="text-center">{{'component.quiz_summary.selected_nicks' | translate}}</h5>
<p class="mb-0">
<span *ngIf="!this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.length">
<span *ngIf="!this.quizService.quiz?.sessionConfig.nicks.selectedNicks.length">
{{'component.quiz_summary.no_selected_nicks' | translate}}
</span>
<span *ngIf="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.length">
<span *ngIf="this.quizService.quiz?.sessionConfig.nicks.selectedNicks.length">
{{'component.quiz_summary.selected_nicks' | translate}}&#58;&nbsp;
{{this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.length}}
{{this.quizService.quiz?.sessionConfig.nicks.selectedNicks.length}}
</span>
</p>
<p class="mb-0"
[innerHTML]="this.activeQuestionGroupService.activeQuestionGroup?.sessionConfig.nicks.selectedNicks.join(', ')">
[innerHTML]="this.quizService.quiz?.sessionConfig.nicks.selectedNicks.join(', ')">
</p>
</div>
</div>
......
......@@ -5,8 +5,8 @@ import { RouterTestingModule } from '@angular/router/testing';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { ActiveQuestionGroupMockService } from '../../service/active-question-group/active-question-group.mock.service';
import { ActiveQuestionGroupService } from '../../service/active-question-group/active-question-group.service';
import { QuizMockService } from '../../service/quiz/quiz-mock.service';
import { QuizService } from '../../service/quiz/quiz.service';
import { TrackingMockService } from '../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../service/tracking/tracking.service';
......@@ -19,10 +19,7 @@ describe('AdditionalDataComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
HttpClientModule,
HttpClientTestingModule,
TranslateModule.forRoot({
RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
......@@ -35,8 +32,13 @@ describe('AdditionalDataComponent', () => {
}),
],
providers: [
{ provide: ActiveQuestionGroupService, useClass: ActiveQuestionGroupMockService },
{ provide: TrackingService, useClass: TrackingMockService },
{
provide: QuizService,
useClass: QuizMockService,
}, {
provide: TrackingService,
useClass: TrackingMockService,
},
],
declarations: [AdditionalDataComponent],
}).compileComponents();
......
import { DOCUMENT } from '@angular/common';
import { Component, HostListener, Inject } from '@angular/core';
import { ActiveQuestionGroupService } from '../../service/active-question-group/active-question-group.service';
import { QuizService } from '../../service/quiz/quiz.service';
import { TrackingService } from '../../service/tracking/tracking.service';
@Component({
......@@ -27,10 +27,7 @@ export class AdditionalDataComponent {
private readonly _quizUrl: string;
constructor(@Inject(DOCUMENT) readonly document,
public activeQuestionGroupService: ActiveQuestionGroupService,
private trackingService: TrackingService,
) {
constructor(@Inject(DOCUMENT) readonly document, public quizService: QuizService, private trackingService: TrackingService) {
}
public getQuizUrl(quizName: string): string {
......
<nav *ngIf="footerElements.length"
<nav *ngIf="footerBarService.footerElements.length"
id="navbar-footer-container"
class="nav navbar-footer flex-nowrap flex-sm-column justify-content-sm-start p-1"
role="navigation">
......@@ -8,7 +8,7 @@
(change)="fileChange($event)"
accept="application/json"
multiple="multiple"/>
<div *ngFor="let elem of footerElements"
<div *ngFor="let elem of footerBarService.footerElements"
class="footerElement px-2 py-2 px-sm-1 py-sm-2 pointer d-flex align-items-center justify-content-center justify-content-sm-start"
[class.success]="elem.selectable && elem.isActive"
[class.error]="elem.selectable && !elem.isActive"
......
......@@ -7,14 +7,13 @@ import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-transl
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { FooterbarElement } from '../../../lib/footerbar-element/footerbar-element';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { ActiveQuestionGroupMockService } from '../../service/active-question-group/active-question-group.mock.service';
import { ActiveQuestionGroupService } from '../../service/active-question-group/active-question-group.service';
import { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { CurrentQuizMockService } from '../../service/current-quiz/current-quiz.mock.service';
import { CurrentQuizService } from '../../service/current-quiz/current-quiz.service';