auto migrate standalone components

This commit is contained in:
2025-01-05 10:26:35 +01:00
parent 8b8395fc3c
commit 54ee9a5b11
121 changed files with 947 additions and 685 deletions

View File

@@ -9,8 +9,8 @@ describe('InfoComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [InfoComponent],
}).compileComponents();
imports: [InfoComponent],
}).compileComponents();
}),
);

View File

@@ -6,12 +6,39 @@ import {ChordMode} from '../../../widget-modules/components/song-text/song-text.
import {faSignOutAlt} from '@fortawesome/free-solid-svg-icons';
import {RolePipe} from './role.pipe';
import {roles} from '../../../services/user/roles';
import { NgIf, AsyncPipe } from '@angular/common';
import { CardComponent } from '../../../widget-modules/components/card/card.component';
import { MatFormField, MatLabel, MatHint } from '@angular/material/form-field';
import { MatSelect } from '@angular/material/select';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { MatOption } from '@angular/material/core';
import { ButtonRowComponent } from '../../../widget-modules/components/button-row/button-row.component';
import { ButtonComponent } from '../../../widget-modules/components/button/button.component';
import { RouterLink } from '@angular/router';
import { RoleDirective } from '../../../services/user/role.directive';
import { UsersComponent } from './users/users.component';
@Component({
selector: 'app-info',
templateUrl: './info.component.html',
styleUrls: ['./info.component.less'],
standalone: false,
selector: 'app-info',
templateUrl: './info.component.html',
styleUrls: ['./info.component.less'],
imports: [
NgIf,
CardComponent,
MatFormField,
MatLabel,
MatSelect,
ReactiveFormsModule,
FormsModule,
MatOption,
MatHint,
ButtonRowComponent,
ButtonComponent,
RouterLink,
RoleDirective,
UsersComponent,
AsyncPipe,
],
})
export class InfoComponent implements OnInit {
public user$: Observable<User | null> | null = null;

View File

@@ -1,10 +1,7 @@
import {Pipe, PipeTransform} from '@angular/core';
import {roles} from '../../../services/user/roles';
@Pipe({
name: 'role',
standalone: false,
})
@Pipe({ name: 'role', })
export class RolePipe implements PipeTransform {
public transform(role: roles): string {
switch (role) {

View File

@@ -9,8 +9,8 @@ describe('UserComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [UserComponent],
}).compileComponents();
imports: [UserComponent],
}).compileComponents();
}),
);

View File

@@ -3,12 +3,34 @@ import {User} from '../../../../../services/user/user';
import {UserService} from '../../../../../services/user/user.service';
import {ROLE_TYPES} from '../../../../../services/user/roles';
import {faTimes} from '@fortawesome/free-solid-svg-icons';
import { NgIf, NgFor } from '@angular/common';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { MatSelect } from '@angular/material/select';
import { MatOption } from '@angular/material/core';
import { MatIconButton } from '@angular/material/button';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { RolePipe } from '../../role.pipe';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.less'],
standalone: false,
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.less'],
imports: [
NgIf,
MatFormField,
MatLabel,
MatInput,
ReactiveFormsModule,
FormsModule,
MatSelect,
NgFor,
MatOption,
MatIconButton,
FaIconComponent,
RolePipe,
],
})
export class UserComponent {
public id = '';

View File

@@ -9,8 +9,8 @@ describe('UsersComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [UsersComponent],
}).compileComponents();
imports: [UsersComponent],
}).compileComponents();
}),
);

View File

@@ -2,12 +2,22 @@ import {Component} from '@angular/core';
import {UserService} from '../../../../services/user/user.service';
import {Observable} from 'rxjs';
import {User} from '../../../../services/user/user';
import { CardComponent } from '../../../../widget-modules/components/card/card.component';
import { NgFor, AsyncPipe } from '@angular/common';
import { UserComponent } from './user/user.component';
import { SortByPipe } from '../../../../widget-modules/pipes/sort-by/sort-by.pipe';
@Component({
selector: 'app-users',
templateUrl: './users.component.html',
styleUrls: ['./users.component.less'],
standalone: false,
selector: 'app-users',
templateUrl: './users.component.html',
styleUrls: ['./users.component.less'],
imports: [
CardComponent,
NgFor,
UserComponent,
AsyncPipe,
SortByPipe,
],
})
export class UsersComponent {
public users$: Observable<User[]>;

View File

@@ -1,9 +1,6 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'authMessage',
standalone: false,
})
@Pipe({ name: 'authMessage', })
export class AuthMessagePipe implements PipeTransform {
public transform(code: string): string {
switch (code) {

View File

@@ -9,8 +9,8 @@ describe('LoginComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [LoginComponent],
}).compileComponents();
imports: [LoginComponent],
}).compileComponents();
}),
);

View File

@@ -1,14 +1,30 @@
import {Component, OnInit} from '@angular/core';
import {UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import {Router} from '@angular/router';
import { UntypedFormControl, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
import { Router, RouterLink } from '@angular/router';
import {UserService} from '../../../services/user/user.service';
import {faSignInAlt, faUserPlus} from '@fortawesome/free-solid-svg-icons';
import { LogoComponent } from '../../../widget-modules/components/logo/logo.component';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import { NgIf } from '@angular/common';
import { MatButton } from '@angular/material/button';
import { AuthMessagePipe } from './auth-message.pipe';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.less'],
standalone: false,
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.less'],
imports: [
LogoComponent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
NgIf,
MatButton,
RouterLink,
AuthMessagePipe,
],
})
export class LoginComponent implements OnInit {
public form: UntypedFormGroup = new UntypedFormGroup({

View File

@@ -9,8 +9,8 @@ describe('LogoutComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [LogoutComponent],
}).compileComponents();
imports: [LogoutComponent],
}).compileComponents();
}),
);

View File

@@ -3,10 +3,9 @@ import {Router} from '@angular/router';
import {UserService} from '../../../services/user/user.service';
@Component({
selector: 'app-logout',
templateUrl: './logout.component.html',
styleUrls: ['./logout.component.less'],
standalone: false,
selector: 'app-logout',
templateUrl: './logout.component.html',
styleUrls: ['./logout.component.less'],
})
export class LogoutComponent implements AfterViewInit {
public constructor(private userService: UserService, private router: Router) {

View File

@@ -9,8 +9,8 @@ describe('NewComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [NewComponent],
}).compileComponents();
imports: [NewComponent],
}).compileComponents();
}),
);

View File

@@ -1,13 +1,26 @@
import {Component, OnInit} from '@angular/core';
import {UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
import {UserService} from '../../../services/user/user.service';
import {faUserPlus} from '@fortawesome/free-solid-svg-icons';
import { CardComponent } from '../../../widget-modules/components/card/card.component';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import { ButtonRowComponent } from '../../../widget-modules/components/button-row/button-row.component';
import { ButtonComponent } from '../../../widget-modules/components/button/button.component';
@Component({
selector: 'app-new',
templateUrl: './new.component.html',
styleUrls: ['./new.component.less'],
standalone: false,
selector: 'app-new',
templateUrl: './new.component.html',
styleUrls: ['./new.component.less'],
imports: [
CardComponent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
ButtonRowComponent,
ButtonComponent,
],
})
export class NewComponent implements OnInit {
public form: UntypedFormGroup = this.fb.group({

View File

@@ -9,8 +9,8 @@ describe('PasswordSendComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [PasswordSendComponent],
}).compileComponents();
imports: [PasswordSendComponent],
}).compileComponents();
}),
);

View File

@@ -1,10 +1,11 @@
import {Component} from '@angular/core';
import { CardComponent } from '../../../widget-modules/components/card/card.component';
@Component({
selector: 'app-password-send',
templateUrl: './password-send.component.html',
styleUrls: ['./password-send.component.less'],
standalone: false,
selector: 'app-password-send',
templateUrl: './password-send.component.html',
styleUrls: ['./password-send.component.less'],
imports: [CardComponent],
})
export class PasswordSendComponent {
}

View File

@@ -9,8 +9,8 @@ describe('PasswordComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [PasswordComponent],
}).compileComponents();
imports: [PasswordComponent],
}).compileComponents();
}),
);

View File

@@ -1,14 +1,31 @@
import {Component, OnInit} from '@angular/core';
import {UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import { UntypedFormControl, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
import {Router} from '@angular/router';
import {UserService} from '../../../services/user/user.service';
import {faWindowRestore} from '@fortawesome/free-solid-svg-icons';
import { CardComponent } from '../../../widget-modules/components/card/card.component';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import { ButtonRowComponent } from '../../../widget-modules/components/button-row/button-row.component';
import { ButtonComponent } from '../../../widget-modules/components/button/button.component';
import { NgIf } from '@angular/common';
import { AuthMessagePipe } from '../login/auth-message.pipe';
@Component({
selector: 'app-password',
templateUrl: './password.component.html',
styleUrls: ['./password.component.less'],
standalone: false,
selector: 'app-password',
templateUrl: './password.component.html',
styleUrls: ['./password.component.less'],
imports: [
CardComponent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
ButtonRowComponent,
ButtonComponent,
NgIf,
AuthMessagePipe,
],
})
export class PasswordComponent implements OnInit {
public form: UntypedFormGroup = new UntypedFormGroup({

View File

@@ -2,11 +2,11 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {LoginComponent} from './login/login.component';
import {UserRoutingModule} from './user-routing.module';
import {CardModule} from '../../widget-modules/components/card/card.module';
import {MatFormFieldModule} from '@angular/material/form-field';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatInputModule} from '@angular/material/input';
import {ButtonRowModule} from '../../widget-modules/components/button-row/button-row.module';
import {MatButtonModule} from '@angular/material/button';
import {AuthMessagePipe} from './login/auth-message.pipe';
import {InfoComponent} from './info/info.component';
@@ -16,32 +16,27 @@ import {MatSelectModule} from '@angular/material/select';
import {PasswordComponent} from './password/password.component';
import {PasswordSendComponent} from './password-send/password-send.component';
import {UsersComponent} from './info/users/users.component';
import {RoleModule} from '../../services/user/role.module';
import {UserComponent} from './info/users/user/user.component';
import {NewComponent} from './new/new.component';
import {ButtonModule} from '../../widget-modules/components/button/button.module';
import {LogoModule} from '../../widget-modules/components/logo/logo.module';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {SortByPipe} from '../../widget-modules/pipes/sort-by/sort-by.pipe';
@NgModule({
declarations: [LoginComponent, AuthMessagePipe, InfoComponent, LogoutComponent, RolePipe, PasswordComponent, PasswordSendComponent, UsersComponent, UserComponent, NewComponent],
imports: [
imports: [
CommonModule,
UserRoutingModule,
CardModule,
MatFormFieldModule,
ReactiveFormsModule,
MatInputModule,
ButtonRowModule,
MatButtonModule,
MatSelectModule,
FormsModule,
RoleModule,
ButtonModule,
LogoModule,
FontAwesomeModule,
SortByPipe,
],
LoginComponent, AuthMessagePipe, InfoComponent, LogoutComponent, RolePipe, PasswordComponent, PasswordSendComponent, UsersComponent, UserComponent, NewComponent,
],
})
export class UserModule {}