From ae570baafe70d29ba8cfba863575bf86f626663e Mon Sep 17 00:00:00 2001 From: NikoAnderson Date: Wed, 12 Jul 2023 13:15:50 -0400 Subject: [PATCH 1/2] fixes to staging area for SR1 --- .../bulk-action-dialog.component.html | 28 ++++++++++++++++--- .../bulk-action-dialog.component.ts | 13 ++++++++- .../import-browse/import-browse.component.ts | 4 +-- .../import-summary.component.html | 6 ++-- .../import-summary.component.scss | 10 +++++++ .../import-summary.component.ts | 1 - 6 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.html b/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.html index 10ad91350..806053318 100644 --- a/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.html +++ b/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.html @@ -3,8 +3,16 @@

Bulk Staging Actions

-
No Records Selected for bulk action. Click the checkbox next to a record in the results to select
-
{{total}} Records +
+ + {{total - altStatusCount}} Staged Records, {{total}} Selected Total

+ Bulk actions will only apply records with a 'staged' import status
+ If checked, non 'staged' records can still be deleted after an action is selected
+
+ + {{total}} Selected Records

+
+ @@ -13,6 +21,8 @@

Bulk Staging Actions

+


No Records Selected for bulk action. Click the checkbox next to a record in the results to select

+
Use Cleaning Options
@@ -27,9 +37,14 @@

Bulk Staging Actions

- Name + Name {{list.record._name}} + + + Status + {{list.record._metadata.importStatus}} + @@ -43,9 +58,14 @@

Bulk Staging Actions

[color]="primary" mode = "indeterminate"> +

+
+ Progress: {{completedRecordCount}} records processed +
- Import Action Successful + Import Action Successful. +

Selected records deleted from staging area.
diff --git a/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.ts b/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.ts index 890dd2024..f9e37f8ee 100644 --- a/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.ts +++ b/src/app/core/admin/import-browse/bulk-action-dialog/bulk-action-dialog.component.ts @@ -14,11 +14,13 @@ export class BulkActionDialogComponent implements OnInit { filtered: Array = []; total: number; successful = false; - displayedColumns = ['ID', 'name']; + displayedColumns = ['ID', 'name', 'status']; loading = false; useScrubber = false; scrubberModel: any; deleteStaged = true; + altStatusCount = 0; + completedRecordCount = 0; constructor( public dialogRef: MatDialogRef, @@ -34,10 +36,16 @@ export class BulkActionDialogComponent implements OnInit { this.useScrubber = true; } if (this.records) { + this.filtered = []; + this.altStatusCount = 0; Object.keys(this.records).forEach(record => { if(this.records[record].checked) { const temp = {"ID": record, "checked": true, "record": this.records[record].substance}; this.filtered.push(temp); + if (this.records[record].substance && this.records[record].substance._metadata && this.records[record].substance._metadata.importStatus + && this.records[record].substance._metadata.importStatus !== 'staged') { + this.altStatusCount++; + } } }); this.total = this.filtered.length; @@ -138,6 +146,9 @@ export class BulkActionDialogComponent implements OnInit { } } else { + if (response && response.completedRecordCount) { + this.completedRecordCount = response.completedRecordCount; + } setTimeout(() => { this.processingstatus(id); }, 200); diff --git a/src/app/core/admin/import-browse/import-browse.component.ts b/src/app/core/admin/import-browse/import-browse.component.ts index 9158eeca1..6c1c3c03c 100644 --- a/src/app/core/admin/import-browse/import-browse.component.ts +++ b/src/app/core/admin/import-browse/import-browse.component.ts @@ -248,7 +248,6 @@ export class ImportBrowseComponent implements OnInit, AfterViewInit, OnDestroy { skipped++; } }); - console.log('added ' + added + 'records. Skipped '+skipped + ' not staged records') this.isLoading = false; this.loadingService.setLoading(false); }, error => { @@ -258,13 +257,12 @@ export class ImportBrowseComponent implements OnInit, AfterViewInit, OnDestroy { }); } else { this.substances.forEach(record => { - if ( !record._metadata.importStatus || record._metadata.importStatus !== 'imported') { if (this.bulkList[record._metadata.recordId]) { this.bulkList[record._metadata.recordId].checked = true; } else { this.bulkList[record._metadata.recordId] = {"checked": true, "substance": record}; } - } + }); } diff --git a/src/app/core/admin/import-browse/import-summary/import-summary.component.html b/src/app/core/admin/import-browse/import-summary/import-summary.component.html index 24240260c..a46c72f7f 100644 --- a/src/app/core/admin/import-browse/import-summary/import-summary.component.html +++ b/src/app/core/admin/import-browse/import-summary/import-summary.component.html @@ -367,8 +367,8 @@ Edit - + @@ -411,7 +411,7 @@ --> - + diff --git a/src/app/core/admin/import-browse/import-summary/import-summary.component.scss b/src/app/core/admin/import-browse/import-summary/import-summary.component.scss index 4d4a859e5..3722bd769 100644 --- a/src/app/core/admin/import-browse/import-summary/import-summary.component.scss +++ b/src/app/core/admin/import-browse/import-summary/import-summary.component.scss @@ -1,3 +1,11 @@ +.disabled-action-button { + cursor: not-allowed !important; +} + +.disabled-action-button:hover { + cursor: not-allowed !important; +} + .mat-card { max-width: 1228px; margin-bottom: 20px; @@ -42,6 +50,8 @@ margin-left: 150px !important; font-size: 18px; } + + .action-label { font-size:16px; margin-right:15px; diff --git a/src/app/core/admin/import-browse/import-summary/import-summary.component.ts b/src/app/core/admin/import-browse/import-summary/import-summary.component.ts index 805a9b734..fcdfede8e 100644 --- a/src/app/core/admin/import-browse/import-summary/import-summary.component.ts +++ b/src/app/core/admin/import-browse/import-summary/import-summary.component.ts @@ -151,7 +151,6 @@ export class ImportSummaryComponent implements OnInit { } }); match.recordArr = newArr; - console.log(match); }); } From 55d2d6fea8e109d03446a7483e71914d0e9fde94 Mon Sep 17 00:00:00 2001 From: NikoAnderson Date: Wed, 12 Jul 2023 16:00:14 -0400 Subject: [PATCH 2/2] add ing an alert for bulk staged select errors --- src/app/core/admin/import-browse/import-browse.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/core/admin/import-browse/import-browse.component.ts b/src/app/core/admin/import-browse/import-browse.component.ts index 6c1c3c03c..497e61fa6 100644 --- a/src/app/core/admin/import-browse/import-browse.component.ts +++ b/src/app/core/admin/import-browse/import-browse.component.ts @@ -252,8 +252,9 @@ export class ImportBrowseComponent implements OnInit, AfterViewInit, OnDestroy { this.loadingService.setLoading(false); }, error => { console.log(error); - this.isLoading = false; this.loadingService.setLoading(false); + this.isLoading = false; + alert('Error: unable to retrieve all staged results. See console for error details'); }); } else { this.substances.forEach(record => {