Skip to content

Commit

Permalink
Merge pull request #440 from ncats/SR1_staging
Browse files Browse the repository at this point in the history
fixes to staging area for SR1
  • Loading branch information
NikoAnderson authored Jul 12, 2023
2 parents cd9259c + 55d2d6f commit 15f487d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ <h3>Bulk Staging Actions</h3>
</div>
<div mat-dialog-content *ngIf = "!loading">

<div *ngIf = "filtered.length == 0" >No Records Selected for bulk action. Click the checkbox next to a record in the results to select</div>
<div class = "form-row" *ngIf = "!successful"><span class = "total">{{total}} Records </span><span class ="middle-fill"></span>
<div class = "form-row" *ngIf = "!successful">
<span class = "total" *ngIf = "altStatusCount > 0">
{{total - altStatusCount}} Staged Records, {{total}} Selected Total <br/><br/>
Bulk actions will only apply records with a 'staged' import status<br/>
If checked, non 'staged' records can still be deleted after an action is selected<br/>
</span>
<span class = "total" *ngIf = "altStatusCount === 0">
{{total}} Selected Records <br/><br/>
</span>
<span class ="middle-fill"></span>
<span ><button class ="action-button" color = "primary" mat-button mat-flat-button mat-primary-button
(click) = "doAction('create')" [disabled] = "total && total == 0">Create</button></span>

Expand All @@ -13,6 +21,8 @@ <h3>Bulk Staging Actions</h3>
<span><button class ="action-button" color = "primary" mat-button mat-flat-button mat-primary-button
(click) = "doAction('reject')" [disabled] = "total && total == 0">Reject</button></span>
</div>
<div *ngIf = "filtered.length == 0" ><br/><br/>No Records Selected for bulk action. Click the checkbox next to a record in the results to select <br/><br/></div>

<div *ngIf = "filtered.length > 0 && !successful" class = "scrubber-row">
<mat-checkbox [(ngModel)] = "useScrubber"></mat-checkbox> Use Cleaning Options
</div>
Expand All @@ -27,9 +37,14 @@ <h3>Bulk Staging Actions</h3>
</td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell mat-sort-header *matHeaderCellDef> Name </th>
<th mat-header-cell *matHeaderCellDef> Name </th>
<td mat-cell *matCellDef="let list"> {{list.record._name}} </td>
</ng-container>

<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef> Status </th>
<td mat-cell *matCellDef="let list"> {{list.record._metadata.importStatus}} </td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
Expand All @@ -43,9 +58,14 @@ <h3>Bulk Staging Actions</h3>
[color]="primary"
mode = "indeterminate">
</mat-progress-spinner>
<br/><br/>
<div *ngIf = "completedRecordCount > 0">
Progress: <b>{{completedRecordCount}}</b> records processed
</div>
</div>
<div mat-dialog-content *ngIf = "successful">
<span> Import Action Successful</span>
<span> Import Action Successful.</span>
<span *ngIf = "deleteStaged"><br/><br/>Selected records deleted from staging area.</span>
</div>

<div mat-dialog-actions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ export class BulkActionDialogComponent implements OnInit {
filtered: Array<any> = [];
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<ImportDialogComponent>,
Expand All @@ -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;
Expand Down Expand Up @@ -138,6 +146,9 @@ export class BulkActionDialogComponent implements OnInit {
}

} else {
if (response && response.completedRecordCount) {
this.completedRecordCount = response.completedRecordCount;
}
setTimeout(() => {
this.processingstatus(id);
}, 200);
Expand Down
7 changes: 3 additions & 4 deletions src/app/core/admin/import-browse/import-browse.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,23 +248,22 @@ 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 => {
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 => {
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};
}
}

});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@
<span><a class ="action-button" color = "primary" [disabled] = "disabled" mat-button mat-flat-button mat-primary-button
[routerLink]="['/substances/register']"
[queryParams]="{stagingID : substance._metadata.recordId}">Edit</a></span>
<span><button class ="action-button" color = "primary" disabled mat-button mat-flat-button mat-primary-button matTooltip="Merge actions are not supported in this release "
(click) = "openMergeModal()">Merge <mat-icon svgIcon = "drop_down"></mat-icon></button></span>
<span matTooltip="Merge actions are not supported in this release " ><button class ="action-button disabled-action-button" color = "primary" disabled mat-button mat-flat-button mat-primary-button
(click) = "openMergeModal()">Merge</button></span>
<span><button class ="action-button" color = "primary" [disabled] = "disabled" mat-button mat-flat-button mat-primary-button
(click) = "doAction('reject')">Reject</button></span>

Expand Down Expand Up @@ -411,7 +411,7 @@
</ng-container>-->
<ng-container matColumnDef="merge">
<th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let record"> <span ><button color = "primary" disabled matTooltip="Merge actions are not supported in this release" (click) = "openMergeModal(record)" mat-button mat-flat-button mat-primary-button >Merge</button></span></td>
<td mat-cell *matCellDef="let record"> <span ><button class = "disabled-action-button" color = "primary" disabled matTooltip="Merge actions are not supported in this release" (click) = "openMergeModal(record)" mat-button mat-flat-button mat-primary-button >Merge</button></span></td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -42,6 +50,8 @@ margin-left: 150px !important;
font-size: 18px;
}



.action-label {
font-size:16px;
margin-right:15px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export class ImportSummaryComponent implements OnInit {
}
});
match.recordArr = newArr;
console.log(match);
});
}

Expand Down

0 comments on commit 15f487d

Please sign in to comment.