Merge pull request #29 in TEA/dafa-web-monorepo from refactor/stricter-eslint to develop
Squashed commit of the following: commit 4e7a87134edb95c9d522514140dcf8ff8b5c9bfa Merge: c586d676f97f51Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Mon Jun 28 09:12:35 2021 +0200 Merge branch 'develop' into refactor/stricter-eslint # Conflicts: # apps/dafa-web/src/app/pages/administration/pages/employee-form/employee-form.component.ts commit c586d675ced7a0dd4bd88599f62dd7a72fe39723 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Jun 23 16:24:37 2021 +0200 Fix linting of avrop commit 70aa93e06c7677ce6b2e5068c74709ef5f9feecc Merge: ace99504afe9b5Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Jun 23 16:12:30 2021 +0200 Merge branch 'develop' into refactor/stricter-eslint # Conflicts: # apps/dafa-web/src/app/pages/avrop/avrop.component.spec.ts # apps/dafa-web/src/app/pages/ciam-landing/ciam-landing.component.spec.ts # apps/dafa-web/src/app/pages/logout/logout.component.spec.ts commit ace9950d3dc9517d8fe4e4b53af6813b6b175720 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Jun 23 10:53:00 2021 +0200 Fix remaining linting warnings/errors commit c15b0a4b8a62604928871d45095d9ad257add0a8 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Wed Jun 23 10:44:32 2021 +0200 fix more linting errors and warnings commit 924c925347dbf0a1029237859c748bf107cfd03c Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Jun 22 17:07:26 2021 +0200 Fixed a lot of linting errors commit f730f04ebb2d28e150ba20c2507493fac64f0a2d Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Jun 22 16:32:58 2021 +0200 fix some linting problems commit 64fe06c034586688fd7252198de0baf0caaccca2 Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Jun 22 16:15:32 2021 +0200 add recommended eslint rules with type-checking
This commit is contained in:
@@ -8,7 +8,7 @@ describe('AdministrationComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [AdministrationComponent],
|
||||
imports: [RouterTestingModule],
|
||||
}).compileComponents();
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ describe('EmployeeCardComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [EmployeeCardComponent],
|
||||
imports: [RouterTestingModule, HttpClientTestingModule],
|
||||
|
||||
+4
-2
@@ -14,8 +14,10 @@ import { map, switchMap } from 'rxjs/operators';
|
||||
})
|
||||
export class EmployeeCardComponent {
|
||||
private _pendingSelectedParticipants$ = new BehaviorSubject<string[]>([]);
|
||||
private _employeeId$: Observable<string> = this.activatedRoute.params.pipe(map(({ employeeId }) => employeeId));
|
||||
authorizationsAsString$: Observable<string>;
|
||||
private _employeeId$: Observable<string> = this.activatedRoute.params.pipe(
|
||||
map(({ employeeId }) => employeeId as string)
|
||||
);
|
||||
|
||||
detailedEmployeeData$: Observable<Employee> = this._employeeId$.pipe(
|
||||
switchMap(employeeId => this.employeeService.fetchDetailedEmployeeData$(employeeId))
|
||||
);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ describe('EmployeeFormComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [EmployeeFormComponent],
|
||||
imports: [
|
||||
|
||||
+9
-6
@@ -25,7 +25,7 @@ export class EmployeeFormComponent {
|
||||
map(services => services.map(({ name, id }) => ({ name, value: id })))
|
||||
);
|
||||
toggleDialog = false;
|
||||
modalAuthInfo: any = {'name': 'Test Behörighetsnamn'};
|
||||
modalAuthInfo: { name: string } = { name: 'Test Behörighetsnamn' };
|
||||
|
||||
formGroup: FormGroup = this.formBuilder.group({
|
||||
firstName: this.formBuilder.control('', [RequiredValidator('Förnamn')]),
|
||||
@@ -68,6 +68,7 @@ export class EmployeeFormComponent {
|
||||
|
||||
return controlsWithErrors.map(key => ({
|
||||
id: key,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
message: this.formGroup.controls[key].errors.message,
|
||||
}));
|
||||
}
|
||||
@@ -80,7 +81,7 @@ export class EmployeeFormComponent {
|
||||
}
|
||||
|
||||
toggleAuthorization(authorization: Authorization, checked: boolean): void {
|
||||
const currentAuthorizations = this.authorizationsControl.value;
|
||||
const currentAuthorizations = this.authorizationsControl.value as { id: unknown }[];
|
||||
|
||||
if (checked) {
|
||||
this.authorizationsControl.patchValue([...currentAuthorizations, authorization]);
|
||||
@@ -92,7 +93,7 @@ export class EmployeeFormComponent {
|
||||
}
|
||||
|
||||
toggleService(service: Service, checked: boolean): void {
|
||||
const currentServices = this.servicesControl.value;
|
||||
const currentServices = this.servicesControl.value as { id: unknown }[];
|
||||
|
||||
if (checked) {
|
||||
this.servicesControl.patchValue([...currentServices, service]);
|
||||
@@ -101,8 +102,9 @@ export class EmployeeFormComponent {
|
||||
}
|
||||
}
|
||||
|
||||
openDialog(val: boolean, authName?:any) {
|
||||
if(authName) {
|
||||
openDialog(val: boolean, authName?: string): void {
|
||||
if (authName) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
this.modalAuthInfo.name = authName;
|
||||
}
|
||||
this.toggleDialog = val;
|
||||
@@ -127,12 +129,13 @@ export class EmployeeFormComponent {
|
||||
submitForm(): void {
|
||||
this.submitted = true;
|
||||
if (this.formGroup.valid) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const submittableValues = {
|
||||
...this.formGroup.value,
|
||||
};
|
||||
const post = this.employeeService.postNewEmployee(submittableValues).subscribe({
|
||||
next: id => {
|
||||
this.router.navigate(['/administration', 'personal', id]);
|
||||
void this.router.navigate(['/administration', 'personal', id]);
|
||||
},
|
||||
complete: () => {
|
||||
post.unsubscribe();
|
||||
|
||||
+5
-6
@@ -1,4 +1,4 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { EmployeesListComponent } from './employees-list.component';
|
||||
@@ -12,7 +12,6 @@ describe('EmployeesListComponent', () => {
|
||||
let fixture: ComponentFixture<EmployeesListComponent>;
|
||||
const getEmployeeRows = () => fixture.debugElement.queryAll(By.css('.employees-list__row'));
|
||||
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
@@ -31,17 +30,17 @@ describe('EmployeesListComponent', () => {
|
||||
describe('20 employees sorted by Full name Ascending', () => {
|
||||
beforeEach(() => {
|
||||
component.employees = employeesMock;
|
||||
component.paginationMeta = {count: employeesMock.length, limit: 50, page: 1, totalPages: 3};
|
||||
component.sort = {key: <keyof Employee>'fullName', order: SortOrder.ASC };
|
||||
component.paginationMeta = { count: employeesMock.length, limit: 50, page: 1, totalPages: 3 };
|
||||
component.sort = { key: <keyof Employee>'fullName', order: SortOrder.ASC };
|
||||
|
||||
fixture.detectChanges();
|
||||
})
|
||||
});
|
||||
|
||||
it('should display the rows from employees object 20 rows regardless of pagination', () => {
|
||||
expect(getEmployeeRows().length).toBe(20);
|
||||
});
|
||||
|
||||
it('should display the up caret next to Full name to indicate that it\'s sorted by full name Ascending', () => {
|
||||
it('should display the up caret next to Full name to indicate that it´s sorted by full name Ascending', () => {
|
||||
const fullNameUpCaret = fixture.debugElement.query(By.css('#sort-button-fullName > digi-icon-caret-up'));
|
||||
expect(fullNameUpCaret).toBeTruthy();
|
||||
});
|
||||
|
||||
+15
-2
@@ -4,7 +4,6 @@ import { Employee } from '@dafa-models/employee.model';
|
||||
import { PaginationMeta } from '@dafa-models/pagination-meta.model';
|
||||
import { Sort } from '@dafa-models/sort.model';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'dafa-employees-list',
|
||||
templateUrl: './employees-list.component.html',
|
||||
@@ -18,22 +17,36 @@ export class EmployeesListComponent {
|
||||
@Output() sorted = new EventEmitter<keyof Employee>();
|
||||
@Output() paginated = new EventEmitter<number>();
|
||||
|
||||
columnHeaders: {label: string, key: keyof Employee}[] = [{label: 'Namn', key: 'fullName'}, {label: 'Tjänst', key: 'services'}, {label: 'Utförandeverksamheter', key: 'organizations'}];
|
||||
columnHeaders: { label: string; key: keyof Employee }[] = [
|
||||
{ label: 'Namn', key: 'fullName' },
|
||||
{
|
||||
label: 'Tjänst',
|
||||
key: 'services',
|
||||
},
|
||||
{
|
||||
label: 'Utförandeverksamheter',
|
||||
key: 'organizations',
|
||||
},
|
||||
];
|
||||
|
||||
orderType = SortOrder;
|
||||
|
||||
get currentPage(): number {
|
||||
return this.paginationMeta.page;
|
||||
}
|
||||
|
||||
get totalPages(): number {
|
||||
return this.paginationMeta?.totalPages;
|
||||
}
|
||||
|
||||
get count(): number {
|
||||
return this.paginationMeta.count;
|
||||
}
|
||||
|
||||
get currentResultStart(): number {
|
||||
return (this.currentPage - 1) * this.paginationMeta.limit + 1;
|
||||
}
|
||||
|
||||
get currentResultEnd(): number {
|
||||
const end = this.currentResultStart + this.paginationMeta.limit - 1;
|
||||
return end < this.count ? end : this.count;
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ describe('EmployeesComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [EmployeesComponent],
|
||||
imports: [RouterTestingModule, HttpClientTestingModule],
|
||||
@@ -25,6 +25,6 @@ describe('EmployeesComponent', () => {
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
void expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ export class EmployeesComponent {
|
||||
this.employeeService.setSearchFilter(this.searchValue);
|
||||
}
|
||||
|
||||
setSearchValue($event: CustomEvent): void {
|
||||
setSearchValue($event: CustomEvent<{ target: { value: string } }>): void {
|
||||
this._searchValue$.next($event.detail.target.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { AvropService } from '../avrop.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Deltagare } from '../models/Deltagare';
|
||||
import { MultiselectFilterOption } from '../models/AvropFilterOptions';
|
||||
|
||||
@Component({
|
||||
@@ -10,7 +9,7 @@ import { MultiselectFilterOption } from '../models/AvropFilterOptions';
|
||||
styleUrls: ['./avrop-filters.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AvropFiltersComponent implements OnInit {
|
||||
export class AvropFiltersComponent {
|
||||
selectableTjanster$: Observable<MultiselectFilterOption[]> = this.avropService.selectableTjanster$;
|
||||
selectableUtforandeVerksamheter$: Observable<MultiselectFilterOption[]> = this.avropService
|
||||
.selectableUtforandeVerksamheter$;
|
||||
@@ -18,17 +17,15 @@ export class AvropFiltersComponent implements OnInit {
|
||||
|
||||
constructor(private avropService: AvropService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
updateSelectedTjanster(filterOptions: MultiselectFilterOption[]) {
|
||||
updateSelectedTjanster(filterOptions: MultiselectFilterOption[]): void {
|
||||
this.avropService.setSelectedTjanster(filterOptions);
|
||||
}
|
||||
|
||||
updateSelectedUtforandeVerksamheter(filterOptions: MultiselectFilterOption[]) {
|
||||
updateSelectedUtforandeVerksamheter(filterOptions: MultiselectFilterOption[]): void {
|
||||
this.avropService.setSelectedUtforandeVerksamheter(filterOptions);
|
||||
}
|
||||
|
||||
updateSelectedKommuner(filterOptions: MultiselectFilterOption[]) {
|
||||
updateSelectedKommuner(filterOptions: MultiselectFilterOption[]): void {
|
||||
this.avropService.setSelectedKommuner(filterOptions);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -1,7 +1,6 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy, Input, Output } from '@angular/core';
|
||||
import { MultiselectFilterOption } from '../../models/AvropFilterOptions';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { Deltagare } from '../../models/Deltagare';
|
||||
import { EventEmitter } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
@@ -20,7 +19,6 @@ export class TemporaryFilterComponent implements OnInit {
|
||||
@Output() selectedOptionsChange = new EventEmitter<MultiselectFilterOption[]>();
|
||||
|
||||
// THIS SHOULD BE REPLACED BY DIGI COMPONENT
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this._selectedAvropFilterOption$ = new BehaviorSubject<MultiselectFilterOption[]>(this.selectedOptions);
|
||||
@@ -31,7 +29,7 @@ export class TemporaryFilterComponent implements OnInit {
|
||||
return this.selectedOptions?.includes(filterOption) ?? false;
|
||||
}
|
||||
|
||||
setOptionState(filterOption: MultiselectFilterOption, isSelected: boolean) {
|
||||
setOptionState(filterOption: MultiselectFilterOption, isSelected: boolean): void {
|
||||
if (isSelected) {
|
||||
return this._selectedAvropFilterOption$.next([...(this._selectedAvropFilterOption$.value ?? []), filterOption]);
|
||||
}
|
||||
@@ -40,7 +38,7 @@ export class TemporaryFilterComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
emitSelectedOptions() {
|
||||
emitSelectedOptions(): void {
|
||||
this.selectedOptionsChange.emit(this._selectedAvropFilterOption$.value);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-6
@@ -1,5 +1,5 @@
|
||||
import { EventEmitter } from '@angular/core';
|
||||
import { Component, OnInit, ChangeDetectionStrategy, Input, Output } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy, Input, Output } from '@angular/core';
|
||||
import { Deltagare } from '../../models/Deltagare';
|
||||
import { Handledare } from '../../models/Handledare';
|
||||
|
||||
@@ -9,18 +9,15 @@ import { Handledare } from '../../models/Handledare';
|
||||
styleUrls: ['./avrop-table-row.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AvropTableRowComponent implements OnInit {
|
||||
export class AvropTableRowComponent {
|
||||
@Input() deltagare: Deltagare;
|
||||
@Input() isSelected: boolean;
|
||||
@Input() isLocked: boolean;
|
||||
@Output() isSelectedChange = new EventEmitter<boolean>();
|
||||
@Input() handledare: Handledare;
|
||||
@Input() handledareConfirmed: boolean;
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
emitSelectionChange(isSelected: boolean) {
|
||||
emitSelectionChange(isSelected: boolean): void {
|
||||
this.isSelectedChange.emit(isSelected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ export class AvropTableComponent implements OnInit {
|
||||
return this.isLocked ? this.selectedDeltagareListInput : this.selectableDeltagareList;
|
||||
}
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this._selectedDeltagare$
|
||||
.pipe(filter(x => !!x))
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('CallOffComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [AvropComponent],
|
||||
imports: [RouterTestingModule],
|
||||
}).compileComponents();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { AvropService } from './avrop.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { MultiselectFilterOption } from './models/AvropFilterOptions';
|
||||
@@ -11,7 +11,7 @@ import { Handledare } from './models/Handledare';
|
||||
styleUrls: ['./avrop.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AvropComponent implements OnInit {
|
||||
export class AvropComponent {
|
||||
steps = 3;
|
||||
|
||||
currentStep$ = this.avropService.currentStep$;
|
||||
@@ -27,41 +27,37 @@ export class AvropComponent implements OnInit {
|
||||
|
||||
constructor(private avropService: AvropService) {}
|
||||
|
||||
updateSelectedDeltagareList(deltagareList: Deltagare[]) {
|
||||
updateSelectedDeltagareList(deltagareList: Deltagare[]): void {
|
||||
this.avropService.setSelectedDeltagare(deltagareList);
|
||||
}
|
||||
|
||||
lockSelectedDeltagare() {
|
||||
lockSelectedDeltagare(): void {
|
||||
this.avropService.lockSelectedDeltagare();
|
||||
}
|
||||
|
||||
unlockSelectedDeltagare() {
|
||||
unlockSelectedDeltagare(): void {
|
||||
this.avropService.unlockSelectedDeltagare();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// this.avropService.loadFromAPI();
|
||||
}
|
||||
|
||||
confirmHandledare() {
|
||||
confirmHandledare(): void {
|
||||
this.avropService.confirmHandledare();
|
||||
}
|
||||
|
||||
unconfirmHandledare() {
|
||||
unconfirmHandledare(): void {
|
||||
this.avropService.unconfirmHandledare();
|
||||
}
|
||||
|
||||
save() {
|
||||
this.avropService.save();
|
||||
async save(): Promise<void> {
|
||||
return this.avropService.save();
|
||||
}
|
||||
|
||||
changeHandledare(newHandledare: Event) {
|
||||
const handledareId = newHandledare.target['value'];
|
||||
changeHandledare(newHandledare: { target: HTMLInputElement }): void {
|
||||
const handledareId = newHandledare.target.value;
|
||||
|
||||
this.avropService.setHandledareState(handledareId);
|
||||
}
|
||||
|
||||
goToStep1() {
|
||||
goToStep1(): void {
|
||||
this.avropService.goToStep1();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,35 +109,35 @@ export class AvropService {
|
||||
return 1;
|
||||
}
|
||||
|
||||
setSelectedDeltagare(deltagare: Deltagare[]) {
|
||||
setSelectedDeltagare(deltagare: Deltagare[]): void {
|
||||
this._selectedDeltagareList$.next(deltagare);
|
||||
}
|
||||
|
||||
constructor(private avropApiService: AvropApiService) {}
|
||||
|
||||
lockSelectedDeltagare() {
|
||||
lockSelectedDeltagare(): void {
|
||||
if ((this._selectedDeltagareList$?.value?.length ?? -1) <= 0) {
|
||||
throw new Error('För att låsa deltagare behöver några ha markerats först.');
|
||||
}
|
||||
this._deltagareListIsLocked$.next(true);
|
||||
}
|
||||
|
||||
unlockSelectedDeltagare() {
|
||||
unlockSelectedDeltagare(): void {
|
||||
this._deltagareListIsLocked$.next(false);
|
||||
}
|
||||
|
||||
confirmHandledare() {
|
||||
confirmHandledare(): void {
|
||||
if (!this._selectedHandledare$?.value) {
|
||||
throw new Error('För att kunna tilldela behövs en handledare väljas först.');
|
||||
}
|
||||
this._handledareIsConfirmed$.next(true);
|
||||
}
|
||||
|
||||
unconfirmHandledare() {
|
||||
unconfirmHandledare(): void {
|
||||
this._handledareIsConfirmed$.next(false);
|
||||
}
|
||||
|
||||
async save() {
|
||||
async save(): Promise<void> {
|
||||
if (!this._handledareIsConfirmed$) {
|
||||
throw new Error('Handledaren måste bekräftas innan avropet kan sparas');
|
||||
}
|
||||
@@ -148,27 +148,28 @@ export class AvropService {
|
||||
|
||||
await this.avropApiService.tilldelaHandledare(this._selectedDeltagareList$.value, this._selectedHandledare$.value);
|
||||
this._avropIsSaved$.next(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setHandledareState(handledareId: string) {
|
||||
setHandledareState(handledareId: string): void {
|
||||
this.selectableHandledareList$.pipe(first()).subscribe(handledareList => {
|
||||
this._selectedHandledare$.next(handledareList.find(handledare => handledare.id === handledareId));
|
||||
});
|
||||
}
|
||||
|
||||
setSelectedTjanster(selectedFilterOptions: MultiselectFilterOption[]) {
|
||||
setSelectedTjanster(selectedFilterOptions: MultiselectFilterOption[]): void {
|
||||
this._selectedTjanster$.next(selectedFilterOptions);
|
||||
}
|
||||
|
||||
setSelectedUtforandeVerksamheter(selectedFilterOptions: MultiselectFilterOption[]) {
|
||||
setSelectedUtforandeVerksamheter(selectedFilterOptions: MultiselectFilterOption[]): void {
|
||||
this._selectedUtforandeVerksamheter$.next(selectedFilterOptions);
|
||||
}
|
||||
|
||||
setSelectedKommuner(selectedFilterOptions: MultiselectFilterOption[]) {
|
||||
setSelectedKommuner(selectedFilterOptions: MultiselectFilterOption[]): void {
|
||||
this._selectedKommuner$.next(selectedFilterOptions);
|
||||
}
|
||||
|
||||
goToStep1() {
|
||||
goToStep1(): void {
|
||||
this._selectedHandledare$.next(null);
|
||||
this._selectedDeltagareList$.next(null);
|
||||
this._deltagareListIsLocked$.next(false);
|
||||
|
||||
@@ -7,32 +7,31 @@ import { AuthenticationService } from '@dafa-services/api/authentication.service
|
||||
selector: 'dafa-ciam-landing',
|
||||
templateUrl: './ciam-landing.component.html',
|
||||
styleUrls: ['./ciam-landing.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CiamLandingComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private authenticationService: AuthenticationService
|
||||
) {}
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private authenticationService: AuthenticationService
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.queryParams.pipe(
|
||||
first(),
|
||||
map(({code}) => {
|
||||
if (!code) {
|
||||
throw new Error('Expected CIAM to return \'code\' in queryparams.');
|
||||
}
|
||||
return code as string;
|
||||
}),
|
||||
switchMap(code => {
|
||||
return this.authenticationService.login$(code)
|
||||
}))
|
||||
ngOnInit(): void {
|
||||
this.route.queryParams
|
||||
.pipe(
|
||||
first(),
|
||||
map(({ code }) => {
|
||||
if (!code) {
|
||||
throw new Error('Expected CIAM to return "code" in queryparams.');
|
||||
}
|
||||
return code as string;
|
||||
}),
|
||||
switchMap(code => {
|
||||
return this.authenticationService.login$(code);
|
||||
})
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.router.navigateByUrl('/')
|
||||
})
|
||||
;
|
||||
void this.router.navigateByUrl('/');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { environment } from '@dafa-environment';
|
||||
import { AuthenticationService } from '@dafa-services/api/authentication.service';
|
||||
|
||||
@@ -12,11 +11,7 @@ import { AuthenticationService } from '@dafa-services/api/authentication.service
|
||||
export class LogoutComponent implements OnInit {
|
||||
loginUrl = environment.loginUrl;
|
||||
|
||||
constructor(
|
||||
private authenticationService: AuthenticationService
|
||||
) {
|
||||
|
||||
}
|
||||
constructor(private authenticationService: AuthenticationService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.authenticationService.logout();
|
||||
|
||||
@@ -3,15 +3,10 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LogoutComponent } from './logout.component';
|
||||
import { DigiNgButtonModule } from '@af/digi-ng/_button/button';
|
||||
import { LoggedInShellModule } from '../../components/logged-in-shell/logged-in-shell.module';
|
||||
|
||||
@NgModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [LogoutComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild([{ path: '', component: LogoutComponent }]),
|
||||
DigiNgButtonModule
|
||||
]
|
||||
imports: [CommonModule, RouterModule.forChild([{ path: '', component: LogoutComponent }]), DigiNgButtonModule],
|
||||
})
|
||||
export class LogoutModule {}
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('MessagesComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [MessagesComponent],
|
||||
imports: [RouterTestingModule],
|
||||
}).compileComponents();
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('ReleasesComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
||||
declarations: [MockLoginComponent],
|
||||
}).compileComponents();
|
||||
|
||||
@@ -3,15 +3,10 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MockLoginComponent } from './mock-login.component';
|
||||
import { DigiNgButtonModule } from '@af/digi-ng/_button/button';
|
||||
import { LoggedInShellModule } from '../../components/logged-in-shell/logged-in-shell.module';
|
||||
|
||||
@NgModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [MockLoginComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild([{ path: '', component: MockLoginComponent }]),
|
||||
DigiNgButtonModule
|
||||
]
|
||||
imports: [CommonModule, RouterModule.forChild([{ path: '', component: MockLoginComponent }]), DigiNgButtonModule],
|
||||
})
|
||||
export class MockLoginModule {}
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('PageNotFoundComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [PageNotFoundComponent],
|
||||
imports: [RouterTestingModule],
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import { map, switchMap } from 'rxjs/operators';
|
||||
})
|
||||
export class ParticipantCardComponent {
|
||||
private _participantId$: Observable<string> = this.activatedRoute.params.pipe(
|
||||
map(({ participantId }) => participantId)
|
||||
map(({ participantId }) => participantId as string)
|
||||
);
|
||||
detailedParticipantData$: Observable<Participant> = this._participantId$.pipe(
|
||||
switchMap(participantId => this.participantsService.fetchDetailedParticipantData$(participantId))
|
||||
|
||||
+1
-1
@@ -4,8 +4,8 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { BackLinkModule } from '@dafa-shared/components/back-link/back-link.module';
|
||||
import { IconModule } from '@dafa-shared/components/icon/icon.module';
|
||||
import { LoggedInShellModule } from 'apps/dafa-web/src/app/components/logged-in-shell/logged-in-shell.module';
|
||||
import { ParticipantCardComponent } from './participant-card.component';
|
||||
import { LoggedInShellModule } from '../../../../components/logged-in-shell/logged-in-shell.module';
|
||||
|
||||
@NgModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('ParticipantsComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [ParticipantsComponent],
|
||||
imports: [RouterTestingModule, HttpClientTestingModule, DigiNgSkeletonBaseModule, ParticipantsListModule],
|
||||
|
||||
@@ -30,6 +30,7 @@ export class ParticipantsComponent {
|
||||
}
|
||||
|
||||
handleSearchInput($event: CustomEvent): void {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
this._searchValue$.next($event.detail.target.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('ReleasesComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
||||
declarations: [ReleasesComponent],
|
||||
}).compileComponents();
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('SettingsComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [SettingsComponent],
|
||||
imports: [RouterTestingModule],
|
||||
}).compileComponents();
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('StartComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [StartComponent],
|
||||
imports: [RouterTestingModule],
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
import { CardHeadingLevel, CardVariation } from '@af/digi-ng/_card/card';
|
||||
import {
|
||||
NotificationAlertHeadingLevel,
|
||||
NotificationAlertSize,
|
||||
NotificationAlertVariation,
|
||||
} from '@af/digi-ng/_notification/notification-alert';
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { InfoCardHeadingLevel } from '@digi/core/dist/types/components/_info-card/info-card/info-card-heading-level.enum';
|
||||
import { InfoCardType } from '@digi/core/dist/types/components/_info-card/info-card/info-card-type.enum';
|
||||
|
||||
@Component({
|
||||
selector: 'dafa-start',
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('StatisticsComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [StatisticsComponent],
|
||||
imports: [RouterTestingModule],
|
||||
}).compileComponents();
|
||||
|
||||
Reference in New Issue
Block a user