Skip to content

Commit 0ac3b69

Browse files
esoadamoxhyrom
andauthored
bump from KSI (#14) (#15)
* bump from KSI (#14) * feat(admin): allow sending emails * feat(admin): tasks wave filtering * feat(admin): discussion per tasks * feat(admin): achievements list * chore: increase angular budget * feat(admin): instance config * fix(edulint): dedupe requests * fix(edulint): new api format * fix(admin): do not redirect while caching * fix(admin): temporarily disable achievements * feat(module-programming): show edulint messages directly * chore: disable sandboxed autodeploy * fix: set text color in sortable item (fi-ksi#99) * fix(tasks): refresh waves on login * feat(docker): build * feat(docker): auto-publish --------- Co-authored-by: Jozef Steinhübl <[email protected]> * patch(docker): cotainer name --------- Co-authored-by: Jozef Steinhübl <[email protected]>
1 parent 2444dc6 commit 0ac3b69

File tree

73 files changed

+1306
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1306
-105
lines changed

.docker/rewrite.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
server.modules += ( "mod_rewrite" )
2+
3+
url.rewrite-if-not-file = ( "" => "/" )
4+
server.error-handler-404 = "/index.html"

.github/workflows/build-docker.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Docker Compose Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build_and_push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out the repository, including submodules
14+
uses: actions/checkout@v3
15+
with:
16+
submodules: recursive
17+
path: web
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Log in to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKER_USERNAME }}
26+
password: ${{ secrets.DOCKER_PASSWORD }}
27+
28+
- name: Build and push Docker images
29+
working-directory: ./web
30+
run: |
31+
npm install
32+
npm run build.docker
33+
docker compose push

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM rtsp/lighttpd
2+
ADD .docker/rewrite.conf /etc/lighttpd/conf.d/14-rewrite.conf
3+
ADD dist/web-frontend-angular/cs /var/www/html
4+
RUN chown -R lighttpd /var/www/html

angular.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,31 @@
4848
"ngswConfigPath": "ngsw-config.json"
4949
},
5050
"configurations": {
51+
"production": {
52+
"budgets": [
53+
{
54+
"type": "initial",
55+
"maximumWarning": "500kb",
56+
"maximumError": "5mb"
57+
},
58+
{
59+
"type": "anyComponentStyle",
60+
"maximumWarning": "2kb",
61+
"maximumError": "60kb"
62+
}
63+
],
64+
"fileReplacements": [
65+
{
66+
"replace": "src/environments/environment.ts",
67+
"with": "src/environments/environment.prod.ts"
68+
},
69+
{
70+
"replace": "src/routes/routes.ts",
71+
"with": "src/routes/routes.cs.ts"
72+
}
73+
],
74+
"outputHashing": "all"
75+
},
5176
"pubdev": {
5277
"buildOptimizer": false,
5378
"optimization": false,

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '3.8'
2+
3+
services:
4+
ksi-fe-dev-local:
5+
container_name: naskoc-fe-local
6+
image: fi-ksi/naskoc-fe-local
7+
build: .
8+
ports:
9+
- "4201:80"

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"start.pubdev": "ng serve --configuration pubdev",
77
"start.proxy": "ng serve --configuration proxy",
88
"start": "ng serve",
9+
"start.docker": "npm run build.docker && docker compose up",
910
"build": "npm run gen.changelog && ng build",
11+
"build.docker": "npm run build && docker compose build",
1012
"build.pubdev": "npm run gen.changelog && ng build --configuration pubdev",
1113
"build.prod": "npm run gen.changelog && ng build --configuration production && cp src/matomo/prod.js dist/web-frontend-angular/*/assets/scripts/matomo.js && cp -r src/cgi-bin/ dist/web-frontend-angular/cgi-bin/",
1214
"watch": "ng build --watch --configuration development",

src/api/backend/api/default.service.ts

Lines changed: 124 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { AchievementGrantRequest } from '../model/achievementGrantRequest';
2222
import { AchievementGrantResponse } from '../model/achievementGrantResponse';
2323
import { AchievementResponse } from '../model/achievementResponse';
2424
import { AchievementsResponse } from '../model/achievementsResponse';
25+
import { AdminInstanceConfig } from '../model/adminInstanceConfig';
26+
import { AdminInstanceConfigResponse } from '../model/adminInstanceConfigResponse';
2527
import { AdminTaskCreationRequest } from '../model/adminTaskCreationRequest';
2628
import { AdminTaskDeployResponse } from '../model/adminTaskDeployResponse';
2729
import { AdminTaskMergeResponse } from '../model/adminTaskMergeResponse';
@@ -2969,6 +2971,105 @@ export class DefaultService {
29692971
);
29702972
}
29712973

2974+
/**
2975+
*
2976+
*
2977+
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
2978+
* @param reportProgress flag to report request and response progress.
2979+
*/
2980+
public instanceConfigGetAll(observe?: 'body', reportProgress?: boolean): Observable<AdminInstanceConfigResponse>;
2981+
public instanceConfigGetAll(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<AdminInstanceConfigResponse>>;
2982+
public instanceConfigGetAll(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<AdminInstanceConfigResponse>>;
2983+
public instanceConfigGetAll(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
2984+
2985+
let headers = this.defaultHeaders;
2986+
2987+
// authentication (ksi) required
2988+
if (this.configuration.accessToken) {
2989+
const accessToken = typeof this.configuration.accessToken === 'function'
2990+
? this.configuration.accessToken()
2991+
: this.configuration.accessToken;
2992+
headers = headers.set('Authorization', 'Bearer ' + accessToken);
2993+
}
2994+
2995+
// to determine the Accept header
2996+
let httpHeaderAccepts: string[] = [
2997+
'application/json'
2998+
];
2999+
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
3000+
if (httpHeaderAcceptSelected != undefined) {
3001+
headers = headers.set('Accept', httpHeaderAcceptSelected);
3002+
}
3003+
3004+
// to determine the Content-Type header
3005+
const consumes: string[] = [
3006+
];
3007+
3008+
return this.httpClient.request<AdminInstanceConfigResponse>('get',`${this.basePath}/admin/instanceConfig`,
3009+
{
3010+
withCredentials: this.configuration.withCredentials,
3011+
headers: headers,
3012+
observe: observe,
3013+
reportProgress: reportProgress
3014+
}
3015+
);
3016+
}
3017+
3018+
/**
3019+
*
3020+
*
3021+
* @param body
3022+
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
3023+
* @param reportProgress flag to report request and response progress.
3024+
*/
3025+
public instanceConfigSetSingle(body: AdminInstanceConfig, observe?: 'body', reportProgress?: boolean): Observable<string>;
3026+
public instanceConfigSetSingle(body: AdminInstanceConfig, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>;
3027+
public instanceConfigSetSingle(body: AdminInstanceConfig, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>;
3028+
public instanceConfigSetSingle(body: AdminInstanceConfig, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
3029+
3030+
if (body === null || body === undefined) {
3031+
throw new Error('Required parameter body was null or undefined when calling instanceConfigSetSingle.');
3032+
}
3033+
3034+
let headers = this.defaultHeaders;
3035+
3036+
// authentication (ksi) required
3037+
if (this.configuration.accessToken) {
3038+
const accessToken = typeof this.configuration.accessToken === 'function'
3039+
? this.configuration.accessToken()
3040+
: this.configuration.accessToken;
3041+
headers = headers.set('Authorization', 'Bearer ' + accessToken);
3042+
}
3043+
3044+
// to determine the Accept header
3045+
let httpHeaderAccepts: string[] = [
3046+
'application/json'
3047+
];
3048+
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
3049+
if (httpHeaderAcceptSelected != undefined) {
3050+
headers = headers.set('Accept', httpHeaderAcceptSelected);
3051+
}
3052+
3053+
// to determine the Content-Type header
3054+
const consumes: string[] = [
3055+
'application/json'
3056+
];
3057+
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
3058+
if (httpContentTypeSelected != undefined) {
3059+
headers = headers.set('Content-Type', httpContentTypeSelected);
3060+
}
3061+
3062+
return this.httpClient.request<string>('post',`${this.basePath}/admin/instanceConfig`,
3063+
{
3064+
body: body,
3065+
withCredentials: this.configuration.withCredentials,
3066+
headers: headers,
3067+
observe: observe,
3068+
reportProgress: reportProgress
3069+
}
3070+
);
3071+
}
3072+
29723073
/**
29733074
*
29743075
*
@@ -4246,21 +4347,21 @@ export class DefaultService {
42464347
/**
42474348
*
42484349
*
4249-
* @param _wave
4350+
* @param wave
42504351
* @param year
42514352
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
42524353
* @param reportProgress flag to report request and response progress.
42534354
*/
4254-
public threadsGetAll(_wave?: number, year?: number, observe?: 'body', reportProgress?: boolean): Observable<ThreadsResponse>;
4255-
public threadsGetAll(_wave?: number, year?: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ThreadsResponse>>;
4256-
public threadsGetAll(_wave?: number, year?: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ThreadsResponse>>;
4257-
public threadsGetAll(_wave?: number, year?: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
4355+
public threadsGetAll(wave?: number, year?: number, observe?: 'body', reportProgress?: boolean): Observable<ThreadsResponse>;
4356+
public threadsGetAll(wave?: number, year?: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ThreadsResponse>>;
4357+
public threadsGetAll(wave?: number, year?: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ThreadsResponse>>;
4358+
public threadsGetAll(wave?: number, year?: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
42584359

42594360

42604361

42614362
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
4262-
if (_wave !== undefined && _wave !== null) {
4263-
queryParameters = queryParameters.set('_wave', <any>_wave);
4363+
if (wave !== undefined && wave !== null) {
4364+
queryParameters = queryParameters.set('wave', <any>wave);
42644365
}
42654366

42664367
let headers = this.defaultHeaders;
@@ -4739,6 +4840,14 @@ export class DefaultService {
47394840
headers = headers.set('year', String(year));
47404841
}
47414842

4843+
// authentication (ksi) required
4844+
if (this.configuration.accessToken) {
4845+
const accessToken = typeof this.configuration.accessToken === 'function'
4846+
? this.configuration.accessToken()
4847+
: this.configuration.accessToken;
4848+
headers = headers.set('Authorization', 'Bearer ' + accessToken);
4849+
}
4850+
47424851
// to determine the Accept header
47434852
let httpHeaderAccepts: string[] = [
47444853
'application/json'
@@ -4780,6 +4889,14 @@ export class DefaultService {
47804889

47814890
let headers = this.defaultHeaders;
47824891

4892+
// authentication (ksi) required
4893+
if (this.configuration.accessToken) {
4894+
const accessToken = typeof this.configuration.accessToken === 'function'
4895+
? this.configuration.accessToken()
4896+
: this.configuration.accessToken;
4897+
headers = headers.set('Authorization', 'Bearer ' + accessToken);
4898+
}
4899+
47834900
// to determine the Accept header
47844901
let httpHeaderAccepts: string[] = [
47854902
'application/json'

src/api/backend/model/achievement.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface Achievement {
1414
title: string;
1515
picture: string;
1616
description: string;
17+
persistent: boolean;
1718
id: number;
1819
year: number;
1920
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* web-backend-swagger
3+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
export interface AchievementBase {
14+
title: string;
15+
picture: string;
16+
description: string;
17+
persistent: boolean;
18+
}

src/api/backend/model/achievementCreation.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,4 @@
1111
*/
1212

1313
export interface AchievementCreation {
14-
title: string;
15-
picture: string;
16-
description: string;
17-
persistent: boolean;
1814
}

0 commit comments

Comments
 (0)