Skip to content

Commit a160fcb

Browse files
authored
Fixes various bugs (#41)
* only list profiles on cc * extra data and dc icons on clp and detail * filter on summary * filter style * fix dependency bug on org change * summary refactor * generic delete - groups, clp * delete modal inv list * delete modal org column mappings * delete modal cycle * delete modal goal * delete modal derived cols * delete modal email temps * delete modal labels * delete modal members * standardize modal headers * lint * icon
1 parent fb206c4 commit a160fcb

79 files changed

Lines changed: 533 additions & 702 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class AnalysisService {
2323
}
2424

2525
summary(orgId: number, cycleId: number): Observable<AnalysisSummary> {
26-
const url = `/api/v3/analyses/stats/?cycle_id=${cycleId}&organization_id=${orgId}`
26+
const url = `/api/v4/analyses/stats/?cycle_id=${cycleId}&organization_id=${orgId}`
2727
return this._httpClient.get<AnalysisSummary>(url).pipe(
2828
catchError((error: HttpErrorResponse) => {
2929
return this._errorService.handleError(error, 'Error fetching analysis summary')
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
export type AnalysisSummary = {
2-
'column_settings fields and counts': Record<string, number>;
2+
stats: AnalysisSummaryStats[];
33
number_extra_data_fields: number;
44
status: string;
55
total_records: number;
66
}
7+
8+
export type AnalysisSummaryStats = {
9+
column_name: string;
10+
count: number;
11+
display_name: string;
12+
is_extra_data: boolean;
13+
}

src/app/modules/organizations/email-templates/modal/delete-modal.component.html renamed to src/@seed/components/delete-modal/delete-modal.component.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
<!-- header -->
2-
<div class="ml-4 mt-4 flex gap-4" mat-dialog-title>
1+
<div class="mt-4 flex gap-4" mat-dialog-title>
32
<mat-icon class="text-current icon-size-5" svgIcon="fa-solid:trash-can"></mat-icon>
4-
<div class="text-2xl font-medium leading-6">Delete Email Template</div>
3+
<div class="text-2xl font-medium leading-6">Delete {{ data.model }}</div>
54
</div>
65
<mat-divider></mat-divider>
76

87
<div class="mx-4 my-10 flex justify-evenly">
9-
Are you sure you want to delete template {{ template.name }}? This action cannot be undone.
8+
Are you sure you want to delete {{ data.model.toLowerCase() }} {{ data.instance }}? This action cannot be undone.
109
</div>
1110

12-
<mat-divider></mat-divider>
13-
1411
<div class="flex justify-end">
1512
<mat-dialog-actions>
1613
<button (click)="onSubmit()" mat-raised-button color="warn">Yes</button>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Component, inject } from '@angular/core'
2+
import { MatButtonModule } from '@angular/material/button'
3+
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'
4+
import { MatDividerModule } from '@angular/material/divider'
5+
import { MatIconModule } from '@angular/material/icon'
6+
7+
@Component({
8+
selector: 'seed-delete-modal',
9+
templateUrl: './delete-modal.component.html',
10+
imports: [
11+
MatButtonModule,
12+
MatDialogModule,
13+
MatDividerModule,
14+
MatIconModule,
15+
],
16+
})
17+
export class DeleteModalComponent {
18+
private _dialogRef = inject(MatDialogRef<DeleteModalComponent>)
19+
data = inject(MAT_DIALOG_DATA) as { instance: string; model: string }
20+
21+
onSubmit() {
22+
this.close(true)
23+
}
24+
25+
close(success = false) {
26+
this._dialogRef.close(success)
27+
}
28+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './delete-modal.component'

src/@seed/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export * from './alert'
22
export * from './card'
33
export * from './clipboard'
4+
export * from './delete-modal'
45
export * from './drawer'
56
export * from './label'
67
export * from './loading-bar'

src/app/modules/column-list-profile/modal/modal.component.html

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,6 @@
6767
</div>
6868
}
6969

70-
<!-- DELETE -->
71-
@if (data.mode === 'delete') {
72-
<div class="mx-4 my-10 flex justify-evenly">Are you sure you want to delete this profile? This action cannot be undone.</div>
73-
74-
<mat-divider></mat-divider>
75-
76-
<div class="flex justify-end">
77-
<mat-dialog-actions>
78-
<button (click)="onDelete()" color="warn" mat-raised-button>Delete</button>
79-
</mat-dialog-actions>
80-
<mat-dialog-actions>
81-
<button (click)="dismiss()" mat-stroked-button>Dismiss</button>
82-
</mat-dialog-actions>
83-
</div>
84-
}
85-
8670
<!-- RENAME -->
8771
@if (data.mode === 'rename') {
8872
<div class="m-4">

src/app/modules/column-list-profile/modal/modal.component.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ export class ModalComponent {
118118
).subscribe()
119119
}
120120

121-
onDelete() {
122-
this._inventoryService.deleteColumnListProfile(this.data.orgId, this.data.profile.id).subscribe(() => {
123-
console.log('DEVELOPER NOTE: Delete function fails while in development mode, via a vite proxy error')
124-
this.close(-1)
125-
})
126-
}
127-
128121
onRename() {
129122
this.data.profile.name = this.form.get('name')?.value
130123
this._inventoryService.updateColumnListProfile(this.data.orgId, this.data.profile.id, this.data.profile).subscribe(() => {

src/app/modules/inventory-detail/detail/grid/history-grid.component.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
style="width: 100%; height: 100%"
2626
/>
2727

28-
<span class="ml-4 text-xs italic text-gray-500">
29-
<span class="material-icons align-middle ml-1 text-md text-gray-500">link</span>
30-
indicates a Derived Column
31-
</span>
28+
<!-- legend -->
29+
<div class="ml-4 text-sm italic text-gray-500">
30+
<span class="mr-4"><span class="material-icons align-middle ml-1 text-md text-gray-500">emergency</span>Extra Data Column</span>
31+
<span><span class="material-icons align-middle ml-1 text-lg text-gray-500">link</span>Derived Column</span>
32+
</div>
3233
</div>

src/app/modules/inventory-detail/detail/grid/history-grid.component.ts

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { EditStateModalComponent } from '../modal/edit-state.component'
2323

2424
ModuleRegistry.registerModules([AllCommunityModule])
2525

26+
type CellRendererParams = { value: string; data: { derived_column: number; is_extra_data: boolean } }
2627
@Component({
2728
selector: 'seed-inventory-detail-history',
2829
templateUrl: './history-grid.component.html',
@@ -119,27 +120,10 @@ export class HistoryGridComponent implements OnChanges, OnDestroy {
119120

120121
setColumnDefs() {
121122
this.columnDefs = [
122-
{
123-
field: 'field',
124-
headerName: 'Field',
125-
pinned: true,
126-
cellRenderer: ({ value }: { value: string }) => {
127-
// add 'link' icon to derived columns
128-
const isDerived = this.derivedColumnNames.has(value)
129-
return !isDerived
130-
? value
131-
: `
132-
<span style="display:inline-flex; align-items:center;">
133-
<span class="ag-icon ag-icon-linked" style="font-size: 16px; margin-right: 4px;"></span>
134-
${value}
135-
</span>
136-
`
137-
},
138-
},
139-
{
140-
field: 'state',
141-
headerName: 'Main',
142-
},
123+
{ field: 'field', headerName: 'Field', pinned: true, cellRenderer: this.fieldRenderer },
124+
{ field: 'state', headerName: 'Main' },
125+
{ field: 'derived_column', hide: true },
126+
{ field: 'is_extra_data', hide: true },
143127
]
144128

145129
for (const { filename } of this.view.history) {
@@ -152,15 +136,27 @@ export class HistoryGridComponent implements OnChanges, OnDestroy {
152136
}
153137
}
154138

139+
fieldRenderer = (params: CellRendererParams) => {
140+
const value = params.value
141+
const { derived_column, is_extra_data } = params.data
142+
if (!derived_column && !is_extra_data) return value
143+
144+
// add icon to extra data and derived columns
145+
const iconName = derived_column ? 'link' : is_extra_data ? 'emergency' : null
146+
const textSize = derived_column ? 'text-sm' : 'text-xs'
147+
return `${value} <span class="material-icons align-middle ml-1 mb-2 text-secondary ${textSize}">${iconName}</span>`
148+
}
149+
155150
setRowData() {
156151
// Transposed data. Each row is a column name (address line 1, address line 2, etc.)
157152
this.rowData = []
158153
const columnsSorted: GenericColumn[] = this.gridColumns.sort((a, b) => naturalSort(a.display_name, b.display_name))
159154

160155
for (const { column_name, display_name } of columnsSorted) {
161156
const isExtraData = this.extraDataColumnNames.has(column_name)
157+
const isDerived = this.derivedColumnNames.has(column_name)
162158
let value = isExtraData ? this.view.state.extra_data[column_name] : this.view.state[column_name]
163-
const row = { field: display_name, state: value }
159+
const row = { field: display_name, state: value, is_extra_data: isExtraData, derived_column: isDerived }
164160
for (const item of this.view.history) {
165161
value = isExtraData ? item.state.extra_data[column_name] : item.state[column_name]
166162
row[item.filename] = value

0 commit comments

Comments
 (0)