Skip to content

Commit af8a1c0

Browse files
committed
frontend tsc
1 parent c9f0d4d commit af8a1c0

13 files changed

Lines changed: 44 additions & 50 deletions

File tree

frontend/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class AppComponent {
8686
public connections: Connection[] = [];
8787

8888
constructor (
89-
private changeDetector: ChangeDetectorRef,
89+
public changeDetector: ChangeDetectorRef,
9090
// private ngZone: NgZone,
9191
public route: ActivatedRoute,
9292
public router: Router,

frontend/src/app/components/dashboard/db-table-view/db-table-filters-dialog/db-table-filters-dialog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class DbTableFiltersDialogComponent implements OnInit {
5858

5959
public tableRowFields: Object;
6060
public tableRowStructure: Object;
61-
public tableRowFieldsShown: Object = {};
61+
public tableRowFieldsShown: Record<string, string> = {};
6262
public tableRowFieldsComparator: Object = {};
6363
public tableForeignKeys: {[key: string]: TableForeignKey};
6464
public tableFiltersCount: number;

frontend/src/app/components/dashboard/db-tables-list/db-folder-edit-dialog/db-folder-edit-dialog.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class DbFolderEditDialogComponent {
4242
public folder: Folder;
4343
public tables: TableProperties[];
4444
public folderIconColors: { name: string; value: string }[];
45+
originalFolderName: string;
4546

4647
constructor(
4748
public dialogRef: MatDialogRef<DbFolderEditDialogComponent>,
@@ -112,4 +113,4 @@ export class DbFolderEditDialogComponent {
112113
onCancel() {
113114
this.dialogRef.close();
114115
}
115-
}
116+
}

frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class DbTableRowEditComponent implements OnInit {
7474
public connectionName: string | null = null;
7575
public tableName: string | null = null;
7676
public dispalyTableName: string | null = null;
77-
public tableRowValues: object;
77+
public tableRowValues: Record<string, any>;
7878
public tableRowStructure: object;
7979
public tableRowRequiredValues: object;
8080
public identityColumn: string;
@@ -119,6 +119,7 @@ export class DbTableRowEditComponent implements OnInit {
119119
private confirmationDialogRef: any;
120120

121121
originalOrder = () => { return 0; }
122+
routeSub: any;
122123

123124
constructor(
124125
private _connections: ConnectionsService,

frontend/src/app/components/login/login.component.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ describe('LoginComponent', () => {
2929
providers: [provideHttpClient(), provideRouter([])]
3030
}).compileComponents();
3131

32-
// @ts-expect-error
3332
global.window.google = jasmine.createSpyObj(['accounts']);
3433
// @ts-expect-error
3534
global.window.google.accounts = jasmine.createSpyObj(['id']);
36-
// @ts-expect-error
3735
global.window.google.accounts.id = jasmine.createSpyObj(['initialize', 'renderButton', 'prompt']);
3836
});
3937

frontend/src/app/components/registration/registration.component.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ describe('RegistrationComponent', () => {
3535
// @ts-expect-error
3636
global.window.gtag = jasmine.createSpy();
3737

38-
// @ts-expect-error
3938
global.window.google = jasmine.createSpyObj(['accounts']);
4039
// @ts-expect-error
4140
global.window.google.accounts = jasmine.createSpyObj(['id']);
42-
// @ts-expect-error
4341
global.window.google.accounts.id = jasmine.createSpyObj(['initialize', 'renderButton', 'prompt']);
4442
});
4543

frontend/src/app/components/secrets/secrets.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export class SecretsComponent implements OnInit, OnDestroy {
5959
public loading = true;
6060
public searchQuery = '';
6161
public displayedColumns = ['slug', 'masterEncryption', 'expiresAt', 'updatedAt', 'actions'];
62+
public subscriptions: Subscription[] = [];
6263

6364
private searchSubject = new Subject<string>();
64-
private subscriptions: Subscription[] = [];
6565

6666
constructor(
6767
private _secrets: SecretsService,

frontend/src/app/components/ui-components/record-edit-fields/boolean/boolean.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
55
import { ConnectionsService } from 'src/app/services/connections.service';
66
import { FormsModule } from '@angular/forms';
77
import { MatButtonToggleModule } from '@angular/material/button-toggle';
8+
import { DBtype } from 'src/app/models/connection';
89

910
@Component({
1011
selector: 'app-edit-boolean',
@@ -16,6 +17,7 @@ export class BooleanEditComponent extends BaseEditFieldComponent {
1617
@Input() value: boolean | number | string | null;
1718

1819
public isRadiogroup: boolean;
20+
connectionType: DBtype;
1921

2022
constructor(
2123
private _connections: ConnectionsService,
@@ -40,8 +42,8 @@ export class BooleanEditComponent extends BaseEditFieldComponent {
4042
// Parse widget parameters if available
4143
let parsedParams = null;
4244
if (this.widgetStructure?.widget_params) {
43-
parsedParams = typeof this.widgetStructure.widget_params === 'string'
44-
? JSON.parse(this.widgetStructure.widget_params)
45+
parsedParams = typeof this.widgetStructure.widget_params === 'string'
46+
? JSON.parse(this.widgetStructure.widget_params)
4547
: this.widgetStructure.widget_params;
4648
}
4749

@@ -57,4 +59,4 @@ export class BooleanEditComponent extends BaseEditFieldComponent {
5759
}
5860
this.onFieldChange.emit(this.value);
5961
}
60-
}
62+
}

frontend/src/app/components/ui-components/record-edit-fields/money/money.component.spec.ts

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ describe('MoneyEditComponent', () => {
2727

2828
fixture = TestBed.createComponent(MoneyEditComponent);
2929
component = fixture.componentInstance;
30-
30+
3131
// Set required properties from base component
3232
component.label = 'Test Money';
3333
component.required = false;
3434
component.disabled = false;
3535
component.readonly = false;
36-
36+
3737
fixture.detectChanges();
3838
});
3939

@@ -87,9 +87,9 @@ describe('MoneyEditComponent', () => {
8787
component.selectedCurrency = 'EUR';
8888
component.amount = 100;
8989
spyOn(component.onFieldChange, 'emit');
90-
90+
9191
component.onCurrencyChange();
92-
92+
9393
expect(component.onFieldChange.emit).toHaveBeenCalledWith({
9494
amount: 100,
9595
currency: 'EUR'
@@ -100,9 +100,9 @@ describe('MoneyEditComponent', () => {
100100
component.displayAmount = '123.45';
101101
component.selectedCurrency = 'USD';
102102
spyOn(component.onFieldChange, 'emit');
103-
103+
104104
component.onAmountChange();
105-
105+
106106
expect(component.amount).toBe(123.45);
107107
expect(component.onFieldChange.emit).toHaveBeenCalledWith(123.45);
108108
});
@@ -112,9 +112,9 @@ describe('MoneyEditComponent', () => {
112112
component.displayAmount = '123.45';
113113
component.selectedCurrency = 'USD';
114114
spyOn(component.onFieldChange, 'emit');
115-
115+
116116
component.onAmountChange();
117-
117+
118118
expect(component.amount).toBe(123.45);
119119
expect(component.onFieldChange.emit).toHaveBeenCalledWith({
120120
amount: 123.45,
@@ -125,40 +125,39 @@ describe('MoneyEditComponent', () => {
125125
it('should handle invalid amount input with letters', () => {
126126
component.amount = 100;
127127
component.displayAmount = 'abc123def'; // Contains letters which get stripped
128-
128+
129129
component.onAmountChange();
130130
component.onAmountBlur();
131-
131+
132132
expect(component.amount).toBe(123);
133133
expect(component.displayAmount).toBe('123.00');
134134
});
135135

136136
it('should handle completely invalid input', () => {
137137
component.amount = 100;
138138
component.displayAmount = 'invalid'; // All letters, becomes empty after strip
139-
139+
140140
component.onAmountChange();
141-
142-
// @ts-expect-error
141+
143142
expect(component.amount).toBe('');
144143
expect(component.displayAmount).toBe('');
145144
});
146145

147146
it('should handle invalid amount input when amount is empty', () => {
148147
component.amount = '';
149148
component.displayAmount = 'invalid';
150-
149+
151150
component.onAmountChange();
152-
151+
153152
expect(component.displayAmount).toBe('');
154153
});
155154

156155
it('should respect allow_negative configuration', () => {
157156
component.allowNegative = false;
158157
component.displayAmount = '-123.45';
159-
158+
160159
component.onAmountChange();
161-
160+
162161
expect(component.amount).toBe(123.45);
163162
});
164163

@@ -175,9 +174,9 @@ describe('MoneyEditComponent', () => {
175174
allow_negative: false
176175
}
177176
};
178-
177+
179178
component.configureFromWidgetParams();
180-
179+
181180
expect(component.defaultCurrency).toBe('EUR');
182181
expect(component.showCurrencySelector).toBe(true);
183182
expect(component.decimalPlaces).toBe(3);
@@ -187,25 +186,25 @@ describe('MoneyEditComponent', () => {
187186
it('should return correct display value', () => {
188187
component.amount = 123.45;
189188
component.selectedCurrency = 'USD';
190-
189+
191190
const displayValue = component.displayValue;
192-
191+
193192
expect(displayValue).toBe('$123.45');
194193
});
195194

196195
it('should return correct placeholder', () => {
197196
component.selectedCurrency = 'EUR';
198-
197+
199198
const placeholder = component.placeholder;
200-
199+
201200
expect(placeholder).toBe('Enter amount in Euro');
202201
});
203202

204203
it('should find selected currency data', () => {
205204
component.selectedCurrency = 'GBP';
206-
205+
207206
const currencyData = component.selectedCurrencyData;
208-
207+
209208
expect(currencyData.code).toBe('GBP');
210209
expect(currencyData.name).toBe('British Pound');
211210
expect(currencyData.symbol).toBe('£');
@@ -214,9 +213,9 @@ describe('MoneyEditComponent', () => {
214213
it('should emit empty value when amount is cleared', () => {
215214
component.amount = '';
216215
spyOn(component.onFieldChange, 'emit');
217-
216+
218217
component.updateValue();
219-
218+
220219
expect(component.onFieldChange.emit).toHaveBeenCalledWith('');
221220
});
222-
});
221+
});

frontend/src/app/components/ui-components/record-edit-fields/money/money.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class MoneyEditComponent extends BaseEditFieldComponent implements OnInit
146146
}
147147
}
148148

149-
private formatAmount(amount: number | string): string {
149+
public formatAmount(amount: number | string): string {
150150
if (amount === '' || amount === null || amount === undefined) {
151151
return '';
152152
}
@@ -160,7 +160,7 @@ export class MoneyEditComponent extends BaseEditFieldComponent implements OnInit
160160
return numericAmount.toFixed(this.decimalPlaces);
161161
}
162162

163-
private updateValue(): void {
163+
public updateValue(): void {
164164
if (this.amount === '' || this.amount === null || this.amount === undefined) {
165165
this.value = '';
166166
} else {
@@ -202,4 +202,4 @@ export class MoneyEditComponent extends BaseEditFieldComponent implements OnInit
202202
displayCurrencyFn(currency: Money): string {
203203
return currency ? `${currency.flag || ''} ${currency.code} - ${currency.name}` : '';
204204
}
205-
}
205+
}

0 commit comments

Comments
 (0)