Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
122 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 | ||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"> | ||
<changeSet author="markfickett" id="changelog-9-ws-index-fix"> | ||
<dropIndex indexName="idx_workspace_rp" tableName="workspace"></dropIndex> | ||
<createIndex indexName="idx_workspace_rp_notunique" tableName="workspace"> | ||
<column name="rp_review_requested"/> | ||
<column name="rp_approved"/> | ||
</createIndex> | ||
</changeSet> | ||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,14 @@ | ||
ul { | ||
list-style-item: none; | ||
} | ||
li { | ||
display: flex; | ||
align-items: flex-end; | ||
margin: 0.5rem; | ||
} | ||
h3 { | ||
margin-top: 0; | ||
} | ||
.purpose, .review-buttons { | ||
flex: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,23 @@ | ||
<h2>Review Research Purposes</h2> | ||
<div *ngIf="contentLoaded; else contentLoading"> | ||
<ul> | ||
<li *ngFor="let ws of workspaces"> | ||
<div class="purpose"> | ||
<h3>{{ws.name}}</h3> | ||
<p>by {{ws.creator}}</p> | ||
<p *ngIf="ws.description">{{ws.description}}</p> | ||
<p *ngIf="ws.researchPurpose.additionalNotes">{{ws.researchPurpose.additionalNotes}}</p> | ||
</div> | ||
<div class="review-buttons"> | ||
<button (click)="approve(ws, true)">Approve</button> | ||
<button (click)="approve(ws, false)">Reject</button> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
<ng-template #contentLoading> | ||
<div class="loading-area"> | ||
<span class="spinner spinner-md" style="padding-top: 1rem"></span> | ||
<span class="loading-text">Loading workspaces for review...</span> | ||
</div> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,58 @@ | ||
import {Component, OnInit, Inject} from '@angular/core'; | ||
import {Router, ActivatedRoute} from '@angular/router'; | ||
import {StringFilter, Comparator} from 'clarity-angular'; | ||
import {DOCUMENT} from '@angular/platform-browser'; | ||
import {Observable} from 'rxjs/Observable'; | ||
|
||
import {ErrorHandlingService} from 'app/services/error-handling.service'; | ||
|
||
import {Workspace} from 'generated'; | ||
import {WorkspacesService} from 'generated'; | ||
import {ResearchPurposeReviewRequest} from 'generated'; | ||
|
||
|
||
/** | ||
* Review Workspace research purposes. Users with the REVIEW_RESEARCH_PURPOSE permission use this | ||
* to view other users' workspaces for which a review has been requested, and approve/reject them. | ||
*/ | ||
// TODO(RW-85) Design this UI. Current implementation is a rough sketch. | ||
@Component({ | ||
templateUrl: './component.html', | ||
styleUrls: ['./component.css'] | ||
}) | ||
export class ReviewComponent implements OnInit { | ||
workspaces: Workspace[] = []; | ||
contentLoaded = false; | ||
|
||
constructor( | ||
private router: Router, | ||
private errorHandlingService: ErrorHandlingService, | ||
private workspacesService: WorkspacesService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.errorHandlingService.retryApi(this.workspacesService.getWorkspacesForReview()) | ||
.subscribe( | ||
workspacesResp => { | ||
for (const ws of workspacesResp.items) { | ||
this.workspaces.push(ws); | ||
} | ||
this.contentLoaded = true; | ||
}); | ||
} | ||
|
||
approve(workspace: Workspace, approved: boolean): void { | ||
const request = <ResearchPurposeReviewRequest>{ | ||
approved: approved, | ||
}; | ||
this.errorHandlingService.retryApi(this.workspacesService.reviewWorkspace( | ||
workspace.namespace, workspace.id, request)) | ||
.subscribe( | ||
resp => { | ||
const i = this.workspaces.indexOf(workspace, 0); | ||
if (i >= 0) { | ||
this.workspaces.splice(i, 1); | ||
} | ||
}); | ||
} | ||
} |