Skip to content

Commit

Permalink
Boot 3.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ch4mpy committed Nov 13, 2023
1 parent 47526f9 commit 43dc748
Show file tree
Hide file tree
Showing 13 changed files with 205 additions and 171 deletions.
4 changes: 2 additions & 2 deletions angular-ui/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
"browserTarget": "quiz:build:development",
"host": "0.0.0.0",
"ssl": true,
"sslCert": "/Users/ch4mp/.ssh/mc-ch4mp_self_signed.crt",
"sslKey": "/Users/ch4mp/.ssh/mc-ch4mp_req_key.pem"
"sslCert": "/Users/ch4mp/.ssh/mc-ch4mp.local_self_signed.crt",
"sslKey": "/Users/ch4mp/.ssh/mc-ch4mp.local_req_key.pem"
}
},
"defaultConfiguration": "development"
Expand Down
11 changes: 8 additions & 3 deletions angular-ui/projects/quiz/src/app/quiz-details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,15 @@ export class QuizDetailsPage implements OnInit, OnDestroy {

submitAnswer() {
this.isLoading = true;
this.skillTestApi.submitSkillTest(this.skillTest).subscribe({
next: (skillTest) => {
this.skillTestApi.submitSkillTest(this.skillTest, 'response').subscribe({
next: (response) => {
this.isLoading = false;
this.dialog.open(SkillTestResultDialog, { data: skillTest });
this.dialog.open(SkillTestResultDialog, { data: {
dto: response.body,
testUri: response.headers.get('Location'),
isAuthorNotified: !!this.quiz?.isTrainerNotifiedOfNewTests,
}
});
this.isAnswerSubmitted = true;
},
error: (error) => {
Expand Down
9 changes: 7 additions & 2 deletions angular-ui/projects/quiz/src/app/skill-test-details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ import { ErrorDialog } from './error.dialog';
mode="indeterminate"
></mat-progress-bar>
</div>
<h2>{{ skillTest?.traineeUsername }}: {{ skillTest?.score }}</h2>
<h2>
<span>{{ skillTest?.traineeUsername }}</span>
<span>: {{ skillTest?.score }}</span></h2>
<h3>{{ skillTest?.traineeFirstName }} {{ skillTest?.traineeLastName }} <a [href]="email" target="_blank">{{ skillTest?.traineeEmail }}</a></h3>
<div *ngFor="let question of quiz?.questions" style="margin-bottom: 1em;">
<div>
<div>{{ question.label }}</div>
<h2>{{ question.label }}</h2>
<div *ngFor="let choice of question.choices" style="display: block;">
<mat-checkbox style="margin-left: 2em;"
[checked]="isChoiceSelected(question.questionId, choice.choiceId)"
Expand All @@ -50,6 +52,9 @@ import { ErrorDialog } from './error.dialog';
>close</mat-icon
>
</div>
<div>
<p>{{ question.comment }}</p>
</div>
</div>
</div>
</div>`,
Expand Down
12 changes: 9 additions & 3 deletions angular-ui/projects/quiz/src/app/skill-test-result.dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { SkillTestResultPreviewDto } from '@c4-soft/quiz-api';

export interface SkillTestResultDialogData {
dto: SkillTestResultPreviewDto;
testUri: string;
isAuthorNotified: boolean;
}
@Component({
selector: 'app-skill-test-result',
template: `<mat-toolbar color="primary">
<span>Answer saved</span>
</mat-toolbar>
<div style="margin: 3em;">
<div>Score: {{ data.score }}</div>
<div>Your trainer was notified</div>
<div>Score: {{ data.dto.score }}</div>
<div *ngIf="data.isAuthorNotified">Your trainer was notified</div>
<div>Details: <a [href]="data.testUri">{{ data.testUri }}</a></div>
</div>`,
styles: [
]
})
export class SkillTestResultDialog {

constructor(@Inject(MAT_DIALOG_DATA) public data: SkillTestResultPreviewDto) {}
constructor(@Inject(MAT_DIALOG_DATA) public data: SkillTestResultDialogData) {}
}
2 changes: 1 addition & 1 deletion angular-ui/projects/quiz/src/app/toolbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Router } from '@angular/router';
<button mat-menu-item [routerLink]="['/', 'quizzes']">Quizzes</button>
<button mat-menu-item *ngIf="currentUser.isTrainer" [routerLink]="['/', 'tests']">Trainees tests</button>
<button mat-menu-item [routerLink]="['/', 'privacy']">Privacy Policy</button>
<a mat-menu-item href="https://oidc.c4-soft.com/auth/realms/quiz/account/">account</a>
<a mat-menu-item *ngIf="currentUser.isAuthenticated" href="https://oidc.c4-soft.com/auth/realms/quiz/account/">Account</a>
</mat-menu>`,
styles: [
]
Expand Down
2 changes: 1 addition & 1 deletion angular-ui/projects/quiz/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
.page-body {
width: 100%;
max-width: 1280px;
margin: auto;
margin: 1em;
}

.warn-color {
Expand Down
8 changes: 3 additions & 5 deletions api/bff/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ scheme: http
keycloak-host: https://oidc.c4-soft.com
keycloak-realm: quiz
oauth2-issuer: ${keycloak-host}/auth/realms/${keycloak-realm}
oauth2-secret: change-me

gateway-uri: ${scheme}://localhost:${server.port}
quiz-api-uri: ${scheme}://localhost:7084
Expand Down Expand Up @@ -31,7 +32,7 @@ spring:
quiz-bff:
provider: keycloak
client-id: quiz-bff
client-secret: change-me
client-secret: ${oauth2-secret}
authorization-grant-type: authorization_code
scope:
- openid
Expand Down Expand Up @@ -64,6 +65,7 @@ spring:
- TokenRelay=
- SaveSession
- StripPrefix=2
# Access the quiz API with OAuth2 clients like Postman
- id: quiz-resource-server
uri: ${quiz-api-uri}
predicates:
Expand Down Expand Up @@ -92,15 +94,11 @@ com:
security-matchers:
- /login/**
- /oauth2/**
- /
- /me
- /logout
- /bff/**
permit-all:
- /login/**
- /oauth2/**
- /
- /me
- /bff/**
csrf: cookie-accessible-from-js
post-login-redirect-path: /ui/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"relation": ["delegate_permission/common.get_login_creds"],
"target": {
"namespace": "web",
"site": "https://oidc.c4-soft.com"
"site": "https://quiz.c4-soft.com"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.4</version>
<version>3.1.5</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

Expand All @@ -18,7 +18,7 @@
<properties>
<java.version>17</java.version>
<spring-cloud-dependencies.version>2022.0.4</spring-cloud-dependencies.version>
<com.c4-soft.springaddons.version>7.1.10</com.c4-soft.springaddons.version>
<com.c4-soft.springaddons.version>7.1.13</com.c4-soft.springaddons.version>
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
<swagger-annotations.version>2.2.15</swagger-annotations.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
@Configuration
@EnableFeignClients
public class FeignConfig {

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "keycloak-admin-api")
@FeignClient(name = "quiz-admin")
public interface KeycloakAdminApiClient {
@GetMapping(value = "/users")
List<UserRepresentation> getUser(@RequestParam(value="username") String username, @RequestParam(value="exact") boolean exact);
Expand Down
Loading

0 comments on commit 43dc748

Please sign in to comment.