Skip to content
Snippets Groups Projects
Commit d8afe664 authored by Mário Murín's avatar Mário Murín
Browse files

Update to angular 18

parent 2b91b0fc
No related branches found
No related tags found
No related merge requests found
Showing
with 18358 additions and 34489 deletions
{
"root": true,
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.*?.json"
],
"createDefaultProgram": true
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended"
],
"rules": {
"max-len": [
"error",
{
"code": 140,
"ignorePattern": "import .*"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"quotes": [
"error",
"single",
{
"allowTemplateLiterals": true
}
]
}
},
{
"files": [
"*.component.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"max-len": [
"error",
{
"code": 140
}
]
}
},
{
"files": [
"*.component.ts"
],
"extends": [
"plugin:@angular-eslint/template/process-inline-templates"
]
}
]
}
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run prettier-check
......@@ -131,21 +131,21 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "kypo-command-visualizations-example:build"
"buildTarget": "kypo-command-visualizations-example:build"
},
"configurations": {
"production": {
"browserTarget": "kypo-command-visualizations-example:build:production"
"buildTarget": "kypo-command-visualizations-example:build:production"
},
"local": {
"browserTarget": "kypo-command-visualizations-example:build:local"
"buildTarget": "kypo-command-visualizations-example:build:local"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "kypo-command-visualizations-example:build"
"buildTarget": "kypo-command-visualizations-example:build"
}
},
"test": {
......
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
).map(config => ({
...config,
files: ["**/*.ts"],
})), {
files: ["**/*.ts"],
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.*?.json"],
createDefaultProgram: true,
},
},
rules: {
"max-len": ["error", {
code: 140,
ignorePattern: "import .*",
}],
"@angular-eslint/directive-selector": ["error", {
type: "attribute",
prefix: "app",
style: "camelCase",
}],
"@angular-eslint/component-selector": ["error", {
type: "element",
prefix: "app",
style: "kebab-case",
}],
quotes: ["error", "single", {
allowTemplateLiterals: true,
}],
},
}, ...compat.extends("plugin:@angular-eslint/template/recommended").map(config => ({
...config,
files: ["**/*.component.html"],
})), {
files: ["**/*.component.html"],
rules: {
"max-len": ["error", {
code: 140,
}],
},
}, ...compat.extends("plugin:@angular-eslint/template/process-inline-templates").map(config => ({
...config,
files: ["**/*.component.ts"],
}))];
\ No newline at end of file
This diff is collapsed.
{
"name": "@muni-kypo-crp/command-visualizations",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --configuration local --ssl",
"build": "ng build",
"test": "ng test",
"lint": "ng lint && npm run prettier-check",
"e2e": "ng e2e",
"prettier-check": "prettier --check \"projects/**/*.ts\"",
"prettier-fix": "prettier --write \"./projects/**/*.ts\"",
"build-example-app": "ng build kypo-command-visualizations-example --configuration production",
"build-library": "ng build --configuration production kypo-command-visualizations",
"create-package": "cd dist/kypo-command-visualizations && npm pack",
"build-and-pack": "npm install && npm run build-library && npm run create-package",
"ci-update-version": "cd ./projects/kypo-command-visualizations/ && npm version $TAG_VERSION",
"ci-build-and-pack": "npm ci --cache .npm --prefer-offline && npm run build-library && npm run create-package",
"ci-publish-package": "cd dist/kypo-command-visualizations && npm publish",
"prepare": "husky install",
"api": "json-server -w ./utils/json-server/db.js --routes ./utils/json-server/routes.json --middlewares ./utils/json-server/server.js"
},
"private": true,
"dependencies": {
"@angular-eslint/builder": "~16.2.0",
"@angular-eslint/eslint-plugin": "^16.2.0",
"@angular-eslint/eslint-plugin-template": "^16.2.0",
"@angular-eslint/schematics": "^16.2.0",
"@angular-eslint/template-parser": "^16.2.0",
"@angular/animations": "^16.2.3",
"@angular/cdk": "^16.2.3",
"@angular/common": "^16.2.3",
"@angular/compiler": "^16.2.3",
"@angular/core": "^16.2.3",
"@angular/forms": "^16.2.3",
"@angular/material": "^16.2.3",
"@angular/platform-browser": "^16.2.3",
"@angular/platform-browser-dynamic": "^16.2.3",
"@angular/router": "^16.2.3",
"@hpcc-js/wasm": "^2.16.2",
"@sentinel/auth": "~16.1.1",
"@sentinel/common": "~16.2.4",
"@sentinel/components": "~16.3.2",
"@sentinel/layout": "~16.1.1",
"@types/chart.js": "^2.9.37",
"@types/jquery": "^3.5.14",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"angular-mgl-timeline": "^1.1.0",
"angular-oauth2-oidc": "^16.0.0",
"angular-oauth2-oidc-jwks": "^16.0.0",
"animate.css": "^4.1.1",
"chart.js": "^3.8.0",
"d3-graphviz": "^4.1.1",
"eslint": "^8.39.0",
"husky": "^8.0.1",
"jquery": "^3.6.0",
"ngx-indexed-db": "^16.0.0",
"rxjs": "~7.5.5",
"tslib": "^2.4.0",
"zone.js": "~0.13.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.2.14",
"@angular/cli": "^16.2.14",
"@angular/compiler-cli": "^16.2.12",
"@types/d3-graphviz": "^2.6.7",
"@types/jasmine": "~4.0.3",
"@types/node": "^18.0.0",
"jasmine-core": "~4.2.0",
"jasmine-spec-reporter": "~7.0.0",
"json-server": "^0.17.4",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.1",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"ng-packagr": "^16.2.3",
"prettier": "^2.7.1",
"protractor": "~7.0.0",
"ts-node": "~10.8.1",
"typescript": "~4.9.5"
}
"name": "@muni-kypo-crp/command-visualizations",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --configuration local --ssl",
"build": "ng build",
"test": "ng test",
"lint": "ng lint && npm run prettier-check",
"e2e": "ng e2e",
"prettier-check": "prettier --check \"projects/**/*.ts\"",
"prettier-fix": "prettier --write \"./projects/**/*.ts\"",
"build-example-app": "ng build kypo-command-visualizations-example --configuration production",
"build-library": "ng build --configuration production kypo-command-visualizations",
"create-package": "cd dist/kypo-command-visualizations && npm pack",
"build-and-pack": "npm install && npm run build-library && npm run create-package",
"ci-update-version": "cd ./projects/kypo-command-visualizations/ && npm version $TAG_VERSION",
"ci-build-and-pack": "npm ci --cache .npm --prefer-offline && npm run build-library && npm run create-package",
"ci-publish-package": "cd dist/kypo-command-visualizations && npm publish",
"prepare": "husky",
"api": "json-server -w ./utils/json-server/db.js --routes ./utils/json-server/routes.json --middlewares ./utils/json-server/server.js"
},
"private": true,
"dependencies": {
"@angular-eslint/builder": "^18.3.1",
"@angular-eslint/eslint-plugin": "^18.3.1",
"@angular-eslint/eslint-plugin-template": "^18.3.1",
"@angular-eslint/schematics": "^18.3.1",
"@angular-eslint/template-parser": "^18.3.1",
"@angular/animations": "^18.2.6",
"@angular/cdk": "^18.2.6",
"@angular/common": "^18.2.6",
"@angular/compiler": "^18.2.6",
"@angular/core": "^18.2.6",
"@angular/forms": "^18.2.6",
"@angular/material": "^18.2.6",
"@angular/platform-browser": "^18.2.6",
"@angular/platform-browser-dynamic": "^18.2.6",
"@angular/router": "^18.2.6",
"@hpcc-js/wasm": "^2.22.1",
"@sentinel/auth": "~18.0.2",
"@sentinel/common": "~18.0.2",
"@sentinel/components": "~18.1.4",
"@sentinel/layout": "~18.1.1",
"@types/chart.js": "^2.9.41",
"@types/jquery": "^3.5.30",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"angular-mgl-timeline": "^1.1.0",
"angular-oauth2-oidc": "^17.0.2",
"angular-oauth2-oidc-jwks": "^17.0.2",
"animate.css": "^4.1.1",
"chart.js": "^4.4.4",
"d3-graphviz": "^5.6.0",
"eslint": "^9.11.1",
"husky": "^9.1.6",
"jquery": "^3.7.1",
"ngx-indexed-db": "^18.0.0",
"rxjs": "^7.8.1",
"tslib": "^2.7.0",
"zone.js": "^0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.6",
"@angular/cli": "^18.2.6",
"@angular/compiler-cli": "^18.2.6",
"@types/jasmine": "^5.1.4",
"@types/node": "^22.6.1",
"jasmine-core": "^5.3.0",
"jasmine-spec-reporter": "^7.0.0",
"json-server": "^0.17.4",
"karma": "^6.4.4",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.1.0",
"ng-packagr": "^18.2.1",
"prettier": "^3.3.3",
"protractor": "~7.0.0",
"ts-node": "^10.9.2",
"typescript": "5.5.4"
}
}
......@@ -13,7 +13,7 @@ const routes: Routes = [
path: 'reference-graph',
loadChildren: () =>
import('./visualizations/reference-graph-page/reference-graph-page.module').then(
(m) => m.ReferenceGraphPageModule
(m) => m.ReferenceGraphPageModule,
),
canActivate: [SentinelAuthGuardWithLogin],
},
......
......@@ -2,22 +2,23 @@
// `ng build --configuration local` replaces `environment.ts` with `environment.local.ts`.
// The list of file replacements can be found in `angular.json`.
const BASE_URL = 'https://172.19.0.22';
const AUTH_URL = 'https://172.19.0.22';
const API_URL = 'http://localhost:3000';
const HOME_URL = 'https://localhost:4200';
export const environment = {
production: false,
sessionChecksEnabled: false,
commandVisualizationConfig: {
trainingBasePath: BASE_URL + '/kypo-rest-training/api/v1/',
adaptiveBasePath: BASE_URL + '/kypo-adaptive-training/api/v1/',
trainingBasePath: API_URL + '/kypo-rest-training/api/v1/',
adaptiveBasePath: API_URL + '/kypo-adaptive-training/api/v1/',
},
authConfig: {
guardMainPageRedirect: 'visualizations',
guardLoginPageRedirect: 'login',
interceptorAllowedUrls: [BASE_URL, 'https://localhost'],
interceptorAllowedUrls: [AUTH_URL, 'https://localhost'],
authorizationStrategyConfig: {
authorizationUrl: BASE_URL + '/kypo-rest-user-and-group/api/v1/users/info',
authorizationUrl: AUTH_URL + '/kypo-rest-user-and-group/api/v1/users/info',
},
providers: [
{
......@@ -26,12 +27,12 @@ export const environment = {
backgroundColor: '#002776',
oidcConfig: {
requireHttps: true,
issuer: BASE_URL + '/keycloak/realms/KYPO',
issuer: AUTH_URL + '/keycloak/realms/KYPO',
clientId: 'KYPO-client',
redirectUri: HOME_URL,
scope: 'openid email profile offline_access',
logoutUrl: BASE_URL + '/keycloak/realms/KYPO/protocol/openid-connect/logout',
silentRefreshRedirectUri: BASE_URL + '/silent-refresh.html',
logoutUrl: AUTH_URL + '/keycloak/realms/KYPO/protocol/openid-connect/logout',
silentRefreshRedirectUri: AUTH_URL + '/silent-refresh.html',
postLogoutRedirectUri: HOME_URL + '/logout-confirmed',
clearHashAfterLogin: true,
},
......
......@@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round|Material+Icons+Outlined" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script src="https://unpkg.com/@hpcc-js/wasm/dist/index.min.js" type="javascript/worker"></script>
<script src="https://unpkg.com/@hpcc-js/wasm/dist/graphviz.umd.js" type="javascript/worker"></script>
</head>
<body class="mat-typography">
<app-root></app-root>
......
......@@ -14,7 +14,10 @@ import { TrainingRunMapper } from './mappers/training-run-mapper';
export class MistakeCommandApiService {
private readonly visualizationsEndpoint = `${this.configService.config.trainingBasePath}visualizations`;
constructor(private http: HttpClient, private configService: VisualizationConfigService) {}
constructor(
private http: HttpClient,
private configService: VisualizationConfigService,
) {}
/**
* Get correct/incorrect commands executed during the given training runs.
......@@ -28,14 +31,13 @@ export class MistakeCommandApiService {
instanceId: number,
runIds: number[],
correct: boolean,
mistakeType: string[]
mistakeType: string[],
): Observable<AggregatedCommands[]> {
const params = { runIds: runIds, correct: correct, mistakeTypes: mistakeType };
return this.http
.get<AggregatedCommandsDTO[]>(
`${this.visualizationsEndpoint}/commands/training-instances/${instanceId}/aggregated`,
{ params }
)
.get<
AggregatedCommandsDTO[]
>(`${this.visualizationsEndpoint}/commands/training-instances/${instanceId}/aggregated`, { params })
.pipe(map((response) => AggregatedCommandMapper.fromDTOs(response)));
}
......@@ -49,7 +51,7 @@ export class MistakeCommandApiService {
getAggregatedCommandsForTrainee(
runId: number,
correct: boolean,
mistakeType: string[]
mistakeType: string[],
): Observable<AggregatedCommands[]> {
const params = { correct: correct, mistakeTypes: mistakeType };
return this.http
......
......@@ -87,7 +87,7 @@ export class MistakeComponent implements OnInit {
.getAggregatedCommandsForTrainee(
this.trainingRunId,
this.correct,
this.commandService.getSelectedMistakeTypes().map((mistake) => mistake.title)
this.commandService.getSelectedMistakeTypes().map((mistake) => mistake.title),
)
.pipe(take(1))
.subscribe();
......@@ -99,7 +99,7 @@ export class MistakeComponent implements OnInit {
this.trainingInstanceId,
this.commandService.getSelectedTrainees().map((trainee) => trainee.id),
this.correct,
this.commandService.getSelectedMistakeTypes().map((mistake) => mistake.title)
this.commandService.getSelectedMistakeTypes().map((mistake) => mistake.title),
)
.pipe(take(1))
.subscribe();
......@@ -109,7 +109,7 @@ export class MistakeComponent implements OnInit {
this.hasError$ = this.commandService.hasError$;
this.isLoading$ = this.commandService.isLoading$;
this.aggregatedWrongCommands$ = this.commandService.aggregatedCommands$.pipe(
map((resource) => new CommandTable(resource))
map((resource) => new CommandTable(resource)),
);
}
......@@ -133,7 +133,7 @@ export class MistakeComponent implements OnInit {
};
});
}),
take(1)
take(1),
)
.subscribe();
}
......
......@@ -35,7 +35,7 @@ export class MistakeCommandService {
getAggregatedCommandsForTrainee(
runId: number,
correct: boolean,
mistakeType: string[]
mistakeType: string[],
): Observable<AggregatedCommands[]> {
this.isLoadingSubject$.next(true);
this.hasErrorSubject$.next(false);
......@@ -49,8 +49,8 @@ export class MistakeCommandService {
() => {
this.hasErrorSubject$.next(true);
this.isLoadingSubject$.next(false);
}
)
},
),
);
}
......@@ -66,7 +66,7 @@ export class MistakeCommandService {
instanceId: number,
runIds: number[],
correct: boolean,
mistakeType: string[]
mistakeType: string[],
): Observable<AggregatedCommands[]> {
this.isLoadingSubject$.next(true);
this.hasErrorSubject$.next(false);
......@@ -82,8 +82,8 @@ export class MistakeCommandService {
() => {
this.hasErrorSubject$.next(true);
this.isLoadingSubject$.next(false);
}
)
},
),
);
}
......
{
"name": "@muni-kypo-crp/command-visualizations",
"version": "16.0.2",
"peerDependencies": {
"@angular/common": "~16.2.12",
"@angular/core": "~16.2.12",
"@angular/material": "^16.2.14"
},
"dependencies": {
"tslib": "^2.0.0"
},
"optionalDependencies": {}
}
"name": "@muni-kypo-crp/command-visualizations",
"version": "16.0.2",
"peerDependencies": {
"@angular/common": "^18.2.6",
"@angular/core": "^18.2.6",
"@angular/material": "^18.2.6"
},
"dependencies": {
"tslib": "^2.7.0"
},
"optionalDependencies": {}
}
\ No newline at end of file
......@@ -11,7 +11,10 @@ import { ReferenceGraphApiService } from './reference-graph-api.service';
export class ReferenceGraphDefaultApiService extends ReferenceGraphApiService {
private readonly graphEndpoint = `${this.configService.config.trainingBasePath}visualizations/graphs`;
constructor(private http: HttpClient, private configService: VisualizationConfigService) {
constructor(
private http: HttpClient,
private configService: VisualizationConfigService,
) {
super();
}
......
......@@ -34,8 +34,8 @@ export class ReferenceGraphComponent implements OnInit {
(graph) => {
this.graphviz = graphviz('div.reference-graph').zoom(true).fit(true).renderDot(graph.graph);
},
() => (this.hasError = true)
)
() => (this.hasError = true),
),
)
.subscribe();
}
......
......@@ -10,7 +10,10 @@ import { VisualizationConfigService } from '@muni-kypo-crp/command-visualization
export class SummaryGraphApiService {
private readonly graphEndpoint = `${this.configService.config.trainingBasePath}visualizations/graphs`;
constructor(private http: HttpClient, private configService: VisualizationConfigService) {}
constructor(
private http: HttpClient,
private configService: VisualizationConfigService,
) {}
/**
* Sends http request to retrieve summary graph for training
......
......@@ -25,8 +25,8 @@ export class SummaryGraphComponent implements OnInit {
(this.error =
err.error.api_sub_error && err.error.status === 'NOT_FOUND'
? `The summary graph for training instance hasn't been created yet.`
: 'Error occurred please refresh the page.')
)
: 'Error occurred please refresh the page.'),
),
)
.subscribe();
}
......
......@@ -5,7 +5,10 @@ import { TimelineCommandApiService } from './timeline-command-api.service';
@Injectable()
export class CommandApiConcreteService extends TimelineCommandApiService {
constructor(private http: HttpClient, private configService: VisualizationConfigService) {
constructor(
private http: HttpClient,
private configService: VisualizationConfigService,
) {
super(http, configService, configService.COMMANDS_EXTENSION);
}
}
......@@ -20,7 +20,7 @@ export class DetectedForbiddenCommandMapper {
}
private static typeFromDTO(
type: DetectedForbiddenCommandDTO.DetectedForbiddenCommandTypeEnum
type: DetectedForbiddenCommandDTO.DetectedForbiddenCommandTypeEnum,
): DetectedForbiddenCommandTypeEnum {
switch (type) {
case DetectedForbiddenCommandDTO.DetectedForbiddenCommandTypeEnum.BASH:
......
......@@ -5,7 +5,10 @@ import { TimelineCommandApiService } from './timeline-command-api.service';
@Injectable()
export class TimelineCommandApiConcreteService extends TimelineCommandApiService {
constructor(private http: HttpClient, private configService: VisualizationConfigService) {
constructor(
private http: HttpClient,
private configService: VisualizationConfigService,
) {
super(http, configService, configService.TIMELINE_EXTENSION);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment