Skip to content

Commit c8f5eae

Browse files
committed
Consistent type and module imports
1 parent a088909 commit c8f5eae

39 files changed

+302
-281
lines changed

.spelling.dic

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1+
ACEEE
2+
ASHRAE
3+
BEPS
4+
BRICR
5+
Consolas
6+
Goel
7+
Graw
18
Lokalise
9+
Macumber
10+
NREL
11+
Supriya
212
Unsubscription
313
comstock
414
dotenvx
515
flippable
16+
fontsource
617
importfiles
718
importrecord
819
jsverse
20+
kgal
921
luxon
1022
mapquest
11-
taxlot
12-
taxlots
13-
transloco
14-
ubid
15-
fontsource
16-
Consolas
17-
BRICR
18-
ACEEE
19-
Goel
20-
Supriya
21-
Macumber
22-
Graw
23-
NREL
24-
opblock
2523
noopener
2624
noreferrer
25+
opblock
26+
scrollbars
2727
scrollblock
28+
taxlot
29+
taxlots
30+
transloco
2831
twotone
29-
scrollbars
32+
ubid

src/@seed/api/audit-template/audit-template.service.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { HttpClient, type HttpErrorResponse } from '@angular/common/http'
1+
import type { HttpErrorResponse } from '@angular/common/http'
2+
import { HttpClient } from '@angular/common/http'
23
import { inject, Injectable } from '@angular/core'
3-
import { catchError, map, type Observable, ReplaySubject, Subject, takeUntil } from 'rxjs'
4+
import type { Observable } from 'rxjs'
5+
import { catchError, map, ReplaySubject, Subject, takeUntil } from 'rxjs'
46
import { ErrorService } from '@seed/services/error/error.service'
57
import { UserService } from '../user'
68
import type {
@@ -23,14 +25,14 @@ export class AuditTemplateService {
2325

2426
constructor() {
2527
this._reportTypes.next([
26-
{ name: 'ASHRAE Level 2 Report' }, // cspell:disable-line
28+
{ name: 'ASHRAE Level 2 Report' },
2729
{ name: 'Atlanta Report' },
2830
{ name: 'Baltimore Energy Audit Report' },
2931
{ name: 'Berkeley Report' },
3032
{ name: 'BRICR Phase 0/1' },
3133
{ name: 'Brisbane Energy Audit Report' },
32-
{ name: 'DC BEPS Energy Audit Report' }, // cspell:disable-line
33-
{ name: 'DC BEPS RCx Report' }, // cspell:disable-line
34+
{ name: 'DC BEPS Energy Audit Report' },
35+
{ name: 'DC BEPS RCx Report' },
3436
{ name: 'Demo City Report' },
3537
{ name: 'Denver Energy Audit Report' },
3638
{ name: 'EE-RLF Template' },

src/@seed/api/cycle/cycle.service.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { HttpErrorResponse } from '@angular/common/http'
22
import { HttpClient } from '@angular/common/http'
33
import { inject, Injectable } from '@angular/core'
4-
import { type Observable, Subject, switchMap } from 'rxjs'
5-
import { BehaviorSubject, catchError, map, takeUntil, tap } from 'rxjs'
4+
import type { Observable } from 'rxjs'
5+
import { BehaviorSubject, catchError, map, Subject, switchMap, takeUntil, tap } from 'rxjs'
66
import { OrganizationService } from '@seed/api/organization'
77
import { ErrorService } from '@seed/services'
88
import { SnackbarService } from 'app/core/snackbar/snackbar.service'
@@ -25,7 +25,8 @@ export class CycleService {
2525
.pipe(
2626
takeUntil(this._unsubscribeAll$),
2727
switchMap(({ org_id }) => this.get(org_id)),
28-
).subscribe()
28+
)
29+
.subscribe()
2930
}
3031

3132
get(orgId: number): Observable<Cycle[]> {

src/@seed/api/derived-column/derived-column.service.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { HttpClient, type HttpErrorResponse } from '@angular/common/http'
1+
import type { HttpErrorResponse } from '@angular/common/http'
2+
import { HttpClient } from '@angular/common/http'
23
import { inject, Injectable } from '@angular/core'
3-
import { catchError, map, type Observable, Subject, switchMap, takeUntil, tap } from 'rxjs'
4+
import type { Observable } from 'rxjs'
5+
import { catchError, map, Subject, switchMap, takeUntil, tap } from 'rxjs'
46
import { ErrorService } from '@seed/services/error/error.service'
57
import { SnackbarService } from 'app/core/snackbar/snackbar.service'
68
import { OrganizationService } from '../organization'
@@ -24,7 +26,8 @@ export class DerivedColumnService {
2426
.pipe(
2527
takeUntil(this._unsubscribeAll$),
2628
switchMap(({ org_id }) => this.get(org_id)),
27-
).subscribe()
29+
)
30+
.subscribe()
2831
}
2932

3033
get(orgId: number): Observable<DerivedColumn[]> {

src/@seed/api/meters/meter-types.service.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { HttpClient, type HttpErrorResponse } from '@angular/common/http'
1+
import type { HttpErrorResponse } from '@angular/common/http'
2+
import { HttpClient } from '@angular/common/http'
23
import { inject, Injectable } from '@angular/core'
3-
import { catchError, map, type Observable, ReplaySubject, Subject, takeUntil, tap } from 'rxjs'
4+
import type { Observable } from 'rxjs'
5+
import { catchError, map, ReplaySubject, Subject, takeUntil, tap } from 'rxjs'
46
import { ErrorService } from '@seed/services/error/error.service'
57
import type { MeterTypeWithUnitsResponse, MeterWithUnits } from './meter-types.types'
68

src/@seed/api/organization/organization.service.ts

+37-39
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ export class OrganizationService {
4141

4242
constructor() {
4343
// Fetch current org data whenever user org id changes
44-
this._userService.currentOrganizationId$.pipe(
45-
takeUntil(this._unsubscribeAll$),
46-
switchMap((organizationId) => {
47-
return combineLatest([
48-
this.getById(organizationId),
49-
this.getOrganizationUsers(organizationId),
50-
this.getOrganizationAccessLevelTree(organizationId),
51-
])
52-
}),
53-
).subscribe()
44+
this._userService.currentOrganizationId$
45+
.pipe(
46+
takeUntil(this._unsubscribeAll$),
47+
switchMap((organizationId) => {
48+
return combineLatest([
49+
this.getById(organizationId),
50+
this.getOrganizationUsers(organizationId),
51+
this.getOrganizationAccessLevelTree(organizationId),
52+
])
53+
}),
54+
)
55+
.subscribe()
5456
}
5557

5658
get(org_id?: number): Observable<Organization[]> | Observable<Organization> {
@@ -81,39 +83,35 @@ export class OrganizationService {
8183

8284
getOrganizationUsers(orgId: number): Observable<OrganizationUser[]> {
8385
const url = `/api/v3/organizations/${orgId}/users/`
84-
return this._httpClient
85-
.get<OrganizationUsersResponse>(url)
86-
.pipe(
87-
map((response) => response.users.sort((a, b) => naturalSort(a.last_name, b.last_name))),
88-
tap((users) => {
89-
this._organizationUsers.next(users)
90-
}),
91-
catchError((error: HttpErrorResponse) => {
92-
return this._errorService.handleError(error, 'Error fetching organization users')
93-
}),
94-
)
86+
return this._httpClient.get<OrganizationUsersResponse>(url).pipe(
87+
map((response) => response.users.sort((a, b) => naturalSort(a.last_name, b.last_name))),
88+
tap((users) => {
89+
this._organizationUsers.next(users)
90+
}),
91+
catchError((error: HttpErrorResponse) => {
92+
return this._errorService.handleError(error, 'Error fetching organization users')
93+
}),
94+
)
9595
}
9696

9797
getOrganizationAccessLevelTree(orgId: number): Observable<AccessLevelTree> {
9898
const url = `/api/v3/organizations/${orgId}/access_levels/tree`
99-
return this._httpClient
100-
.get<AccessLevelTreeResponse>(url)
101-
.pipe(
102-
map((response) => {
103-
// update response to include more usable accessLevelInstancesByDepth
104-
this._accessLevelInstancesByDepth = this._calculateAccessLevelInstancesByDepth(response.access_level_tree, 0)
105-
return {
106-
accessLevelNames: response.access_level_names,
107-
accessLevelInstancesByDepth: this._accessLevelInstancesByDepth,
108-
}
109-
}),
110-
tap((accessLevelTree) => {
111-
this._accessLevelTree.next(accessLevelTree)
112-
}),
113-
catchError((error: HttpErrorResponse) => {
114-
return this._errorService.handleError(error, 'Error fetching organization access level tree')
115-
}),
116-
)
99+
return this._httpClient.get<AccessLevelTreeResponse>(url).pipe(
100+
map((response) => {
101+
// update response to include more usable accessLevelInstancesByDepth
102+
this._accessLevelInstancesByDepth = this._calculateAccessLevelInstancesByDepth(response.access_level_tree, 0)
103+
return {
104+
accessLevelNames: response.access_level_names,
105+
accessLevelInstancesByDepth: this._accessLevelInstancesByDepth,
106+
}
107+
}),
108+
tap((accessLevelTree) => {
109+
this._accessLevelTree.next(accessLevelTree)
110+
}),
111+
catchError((error: HttpErrorResponse) => {
112+
return this._errorService.handleError(error, 'Error fetching organization access level tree')
113+
}),
114+
)
117115
}
118116

119117
deleteOrganizationUser(userId: number, orgId: number) {

src/@seed/components/label/label.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, Input } from '@angular/core'
2-
import { type Label } from '@seed/api/label'
2+
import type { Label } from '@seed/api/label'
33
import { SharedImports } from '@seed/directives'
44

55
@Component({

src/@seed/services/better/better.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'
22
import { inject, Injectable } from '@angular/core'
33
import type { Observable } from 'rxjs'
44
import { catchError, map, of } from 'rxjs'
5-
import { type BetterTokenVerificationResponse } from './better.types'
5+
import type { BetterTokenVerificationResponse } from './better.types'
66

77
@Injectable({ providedIn: 'root' })
88
export class BetterService {

src/app/layout/common/organization-selector/organization-selector.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { CommonModule } from '@angular/common'
21
import type { OnDestroy, OnInit } from '@angular/core'
32
import { Component, inject, ViewEncapsulation } from '@angular/core'
43
import { MatButtonModule } from '@angular/material/button'
5-
import { MatIcon } from '@angular/material/icon'
4+
import { MatIconModule } from '@angular/material/icon'
65
import { MatMenuModule } from '@angular/material/menu'
76
import { Subject, takeUntil } from 'rxjs'
87
import { OrganizationService } from '@seed/api/organization/organization.service'
@@ -15,7 +14,7 @@ import { UserService } from '@seed/api/user'
1514
templateUrl: './organization-selector.component.html',
1615
encapsulation: ViewEncapsulation.None,
1716
exportAs: 'organization-selector',
18-
imports: [CommonModule, MatMenuModule, MatButtonModule, MatIcon],
17+
imports: [MatButtonModule, MatIconModule, MatMenuModule],
1918
})
2019
export class OrganizationSelectorComponent implements OnInit, OnDestroy {
2120
private _organizationService = inject(OrganizationService)

src/app/modules/organizations/cycles/cycles.component.ts

+6-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CommonModule } from '@angular/common'
21
import type { OnDestroy, OnInit } from '@angular/core'
32
import { Component, inject } from '@angular/core'
43
import { MatButtonModule } from '@angular/material/button'
@@ -9,23 +8,13 @@ import { Subject, takeUntil, tap } from 'rxjs'
98
import type { Cycle } from '@seed/api/cycle'
109
import { CycleService } from '@seed/api/cycle/cycle.service'
1110
import { PageComponent, TableContainerComponent } from '@seed/components'
12-
import { SharedImports } from '@seed/directives'
1311
import { DeleteModalComponent } from './modal/delete-modal.component'
1412
import { FormModalComponent } from './modal/form-modal.component'
1513

1614
@Component({
1715
selector: 'seed-organizations-cycles',
1816
templateUrl: './cycles.component.html',
19-
imports: [
20-
CommonModule,
21-
MatButtonModule,
22-
MatDialogModule,
23-
MatIconModule,
24-
MatTableModule,
25-
PageComponent,
26-
SharedImports,
27-
TableContainerComponent,
28-
],
17+
imports: [MatButtonModule, MatDialogModule, MatIconModule, MatTableModule, PageComponent, TableContainerComponent],
2918
})
3019
export class CyclesComponent implements OnDestroy, OnInit {
3120
private _cycleService = inject(CycleService)
@@ -38,12 +27,11 @@ export class CyclesComponent implements OnDestroy, OnInit {
3827
cyclesColumns = ['id', 'name', 'start', 'end', 'actions']
3928

4029
ngOnInit(): void {
41-
this._cycleService.cycles$.pipe(takeUntil(this._unsubscribeAll$))
42-
.subscribe((cycles) => {
43-
this.cyclesDataSource.data = cycles
44-
this._orgId = cycles[0]?.organization
45-
this._existingNames = cycles.map((cycle) => cycle.name)
46-
})
30+
this._cycleService.cycles$.pipe(takeUntil(this._unsubscribeAll$)).subscribe((cycles) => {
31+
this.cyclesDataSource.data = cycles
32+
this._orgId = cycles[0]?.organization
33+
this._existingNames = cycles.map((cycle) => cycle.name)
34+
})
4735
}
4836

4937
refreshCycles(): void {

src/app/modules/organizations/cycles/modal/delete-modal.component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CommonModule } from '@angular/common'
21
import type { OnDestroy } from '@angular/core'
32
import { Component, inject } from '@angular/core'
43
import { MatButtonModule } from '@angular/material/button'
@@ -15,7 +14,7 @@ import { SnackbarService } from 'app/core/snackbar/snackbar.service'
1514
@Component({
1615
selector: 'seed-cycles-delete-modal',
1716
templateUrl: './delete-modal.component.html',
18-
imports: [AlertComponent, CommonModule, MatButtonModule, MatDialogModule, MatProgressBarModule],
17+
imports: [AlertComponent, MatButtonModule, MatDialogModule, MatProgressBarModule],
1918
})
2019
export class DeleteModalComponent implements OnDestroy {
2120
private _cycleService = inject(CycleService)

src/app/modules/organizations/cycles/modal/form-modal.component.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CommonModule, DatePipe } from '@angular/common'
1+
import { DatePipe } from '@angular/common'
22
import type { OnDestroy, OnInit } from '@angular/core'
33
import { Component, inject } from '@angular/core'
44
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'
@@ -31,15 +31,14 @@ export const MY_DATE_FORMATS = {
3131
templateUrl: './form-modal.component.html',
3232
providers: [DatePipe, { provide: MAT_DATE_FORMATS, useValue: MY_DATE_FORMATS }],
3333
imports: [
34-
CommonModule,
34+
FormsModule,
3535
MatButtonModule,
36+
MatDatepickerModule,
3637
MatDialogModule,
3738
MatFormFieldModule,
38-
FormsModule,
3939
MatInputModule,
40-
MatDatepickerModule,
41-
ReactiveFormsModule,
4240
MatNativeDateModule,
41+
ReactiveFormsModule,
4342
],
4443
})
4544
export class FormModalComponent implements OnDestroy, OnInit {

src/app/modules/organizations/derived-columns/derived-columns.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { MatIconModule } from '@angular/material/icon'
66
import { MatTableDataSource, MatTableModule } from '@angular/material/table'
77
import { ActivatedRoute, Router } from '@angular/router'
88
import { map, Subject, takeUntil } from 'rxjs'
9-
import { type DerivedColumn, DerivedColumnService } from '@seed/api/derived-column'
9+
import type { DerivedColumn } from '@seed/api/derived-column'
10+
import { DerivedColumnService } from '@seed/api/derived-column'
1011
import { InventoryTabComponent, PageComponent, TableContainerComponent } from '@seed/components'
1112
import { SharedImports } from '@seed/directives'
1213
import { naturalSort } from '@seed/utils'
@@ -48,7 +49,6 @@ export class DerivedColumnsComponent implements OnDestroy, OnInit {
4849
.pipe(
4950
takeUntil(this._unsubscribeAll$),
5051
map((derivedColumns) => derivedColumns.sort((a, b) => naturalSort(a.name, b.name))),
51-
5252
)
5353

5454
.subscribe((derivedColumns) => {

src/app/modules/organizations/derived-columns/modal/delete-modal.component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CommonModule } from '@angular/common'
21
import type { OnDestroy } from '@angular/core'
32
import { Component, inject } from '@angular/core'
43
import { MatButtonModule } from '@angular/material/button'
@@ -12,7 +11,7 @@ import { AlertComponent } from '@seed/components'
1211
@Component({
1312
selector: 'seed-derived-column-delete-modal',
1413
templateUrl: './delete-modal.component.html',
15-
imports: [AlertComponent, CommonModule, MatButtonModule, MatDialogModule, MatProgressBarModule],
14+
imports: [AlertComponent, MatButtonModule, MatDialogModule, MatProgressBarModule],
1615
})
1716
export class DeleteModalComponent implements OnDestroy {
1817
private _derivedColumnService = inject(DerivedColumnService)

0 commit comments

Comments
 (0)