From 5660cf37d0a058aa820494bce55bcafc272ea99e Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 23 Aug 2025 01:01:23 +0700 Subject: [PATCH 1/3] feat(app): migrate login dialog --- .../login-with-access-token-dialog.component.ts | 11 +++++++++-- .../login-with-access-token-dialog.html | 7 +++---- .../login-with-access-token-dialog.module.ts | 3 +-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts index 9ee0adcdc..e143194e1 100644 --- a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts +++ b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts @@ -6,6 +6,7 @@ import { import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service'; import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; +import { FormControl, Validators } from '@angular/forms'; import { MatCheckboxChange } from '@angular/material/checkbox'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Router } from '@angular/router'; @@ -20,6 +21,10 @@ import { eyeOffOutline, eyeOutline } from 'ionicons/icons'; standalone: false }) export class LoginWithAccessTokenDialog { + public accessTokenControl = new FormControl( + this.data.accessToken, + Validators.required + ); public isAccessTokenHidden = true; public constructor( @@ -45,8 +50,10 @@ export class LoginWithAccessTokenDialog { } public onLoginWithAccessToken() { - if (this.data.accessToken) { - this.dialogRef.close(this.data); + if (this.accessTokenControl.valid) { + this.dialogRef.close({ + accessToken: this.accessTokenControl.value + }); } } diff --git a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html index 77191db8e..bcce4bfa8 100644 --- a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html +++ b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html @@ -11,9 +11,8 @@ Security Token diff --git a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.module.ts b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.module.ts index d6035ae52..fcced81aa 100644 --- a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.module.ts +++ b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.module.ts @@ -1,7 +1,7 @@ import { TextFieldModule } from '@angular/cdk/text-field'; import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatDialogModule } from '@angular/material/dialog'; @@ -16,7 +16,6 @@ import { LoginWithAccessTokenDialog } from './login-with-access-token-dialog.com declarations: [LoginWithAccessTokenDialog], imports: [ CommonModule, - FormsModule, GfDialogHeaderModule, IonIcon, MatButtonModule, From 2a970e9506a8836f969b60a403f159053fa032f9 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 23 Aug 2025 01:04:28 +0700 Subject: [PATCH 2/3] feat(docs): update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b496df2c..eb97d2eba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Migrated the login with access token dialog from `ngModel` to form control + ## 2.192.0 - 2025-08-21 ### Added From 9c630167b41f630d55d391be5d529f5b209a38a7 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 23 Aug 2025 10:45:52 +0700 Subject: [PATCH 3/3] resolve comments --- .../login-with-access-token-dialog.component.ts | 6 +++--- .../login-with-access-token-dialog.html | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts index e143194e1..4f11f1025 100644 --- a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts +++ b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts @@ -21,7 +21,7 @@ import { eyeOffOutline, eyeOutline } from 'ionicons/icons'; standalone: false }) export class LoginWithAccessTokenDialog { - public accessTokenControl = new FormControl( + public accessTokenFormControl = new FormControl( this.data.accessToken, Validators.required ); @@ -50,9 +50,9 @@ export class LoginWithAccessTokenDialog { } public onLoginWithAccessToken() { - if (this.accessTokenControl.valid) { + if (this.accessTokenFormControl.valid) { this.dialogRef.close({ - accessToken: this.accessTokenControl.value + accessToken: this.accessTokenFormControl.value }); } } diff --git a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html index bcce4bfa8..dca06f970 100644 --- a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html +++ b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html @@ -11,7 +11,7 @@ Security Token