Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
</div>
</div>
</div>
<p-sidebar [(visible)]="revisionSidePanel!" position="right" [modal]="true" styleClass="revisions-sidebar">
<app-revisions-list [review]="review"></app-revisions-list>
<p-sidebar [(visible)]="revisionSideBarVisible" position="right" [modal]="true" styleClass="revisions-sidebar">
<app-revisions-list
[review]="review"
[revisionSideBarVisible]="revisionSideBarVisible"></app-revisions-list>
</p-sidebar>
<app-footer></app-footer>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ReviewPageComponent implements OnInit {
apiRevisions: APIRevision[] = [];
activeAPIRevision : APIRevision | undefined = undefined;
diffAPIRevision : APIRevision | undefined = undefined;
revisionSidePanel : boolean | undefined = undefined;
revisionSideBarVisible : boolean = false;
reviewPageNavigation : TreeNode[] = [];
language: string | undefined;
languageSafeName: string | undefined;
Expand Down Expand Up @@ -103,7 +103,7 @@ export class ReviewPageComponent implements OnInit {
this.sideMenu = [
{
icon: 'bi bi-clock-history',
command: () => { this.revisionSidePanel = !this.revisionSidePanel; }
command: () => { this.revisionSideBarVisible = !this.revisionSideBarVisible; }
}
];
}
Expand Down Expand Up @@ -408,7 +408,7 @@ export class ReviewPageComponent implements OnInit {
break;
}
}
}
}

ngOnDestroy() {
this.workerService.terminateWorker();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { environment } from 'src/environments/environment';
})
export class RevisionsListComponent implements OnInit, OnChanges {
@Input() review : Review | undefined = undefined;
@Input() revisionSideBarVisible : boolean = false;

@ViewChild("revisionCreationFileUpload") revisionCreationFileUpload!: FileUpload;

Expand Down Expand Up @@ -107,6 +108,11 @@ export class RevisionsListComponent implements OnInit, OnChanges {
this.showSelectionActions = false;
this.showDiffButton = false;
}

if (changes['revisionSideBarVisible'] && changes['revisionSideBarVisible'].currentValue == false) {
this.createRevisionSidebarVisible = false;
this.optionsSidebarVisible = false;
}
}

/**
Expand Down Expand Up @@ -231,14 +237,14 @@ export class RevisionsListComponent implements OnInit, OnChanges {
viewDiffOfSelectedAPIRevisions() {
if (this.selectedRevisions.length == 2)
{
this.apiRevisionsService.openDiffOfAPIRevisions(this.review!.id, this.selectedRevisions[0].id, this.selectedRevisions[1].id, this.router.url);
this.apiRevisionsService.openDiffOfAPIRevisions(this.selectedRevisions[0], this.selectedRevisions[1], this.router.url);
}
}

viewRevision(apiRevision: APIRevision) {
if (!this.showDeletedAPIRevisions)
{
this.apiRevisionsService.openAPIRevisionPage(apiRevision.reviewId, apiRevision.id, this.router.url);
this.apiRevisionsService.openAPIRevisionPage(apiRevision, this.router.url);
}
}

Expand Down Expand Up @@ -471,7 +477,7 @@ export class RevisionsListComponent implements OnInit, OnChanges {
this.createRevisionSidebarVisible = false;
this.creatingRevision = false;
this.crButtonText = "Create Review";
this.apiRevisionsService.openAPIRevisionPage(response.reviewId, response.id, this.router.url);
this.apiRevisionsService.openAPIRevisionPage(response, this.router.url);
}
},
error: (error: any) => {
Expand Down
21 changes: 21 additions & 0 deletions src/dotnet/APIView/ClientSPA/src/app/_models/revision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,30 @@ export enum CodePanelRowDatatype {
CommentThread = "commentThread"
}

export enum ParserStyle {
Flat = "Flat",
Tree = "Tree"
}

export interface APICodeFileModel {
fileId: string;
name: string;
versionString: string;
parserStyle: string;
languageVariant: string;
hasOriginal: boolean;
creationDate: Date;
runAnalysis: boolean;
packageName: string;
fileName: string;
packageVersion: string;
crossLanguagePackageId: string;
}

export interface APIRevision {
id: string
reviewId: string
files: APICodeFileModel[];
packageName: string
language: string
apiRevisionType: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Observable, map } from 'rxjs';


import { PaginatedResult } from 'src/app/_models/pagination';
import { APIRevision } from 'src/app/_models/revision';
import { APIRevision, ParserStyle } from 'src/app/_models/revision';
import { ConfigService } from '../config/config.service';


Expand Down Expand Up @@ -126,14 +126,24 @@ export class RevisionsService {
});
}

openDiffOfAPIRevisions(reviewId: string, activeAPIRevisionId: string, diffAPIRevisionsId: string, currentRoute: string) {
openDiffOfAPIRevisions(activeAPIRevision: APIRevision, diffAPIRevision: APIRevision, currentRoute: string) {
const target = (currentRoute.includes("review")) ? '_self' : '_blank';
window.open(this.configService.webAppUrl + `Assemblies/Review/${reviewId}?revisionId=${activeAPIRevisionId}&diffOnly=False&doc=False&diffRevisionId=${diffAPIRevisionsId}`, target);

if (activeAPIRevision.files[0].parserStyle === "tree") {
window.open(`/review/${activeAPIRevision.reviewId}?activeApiRevisionId=${activeAPIRevision.id}&diffApiRevisionId=${diffAPIRevision.id}`, target);
} else {
window.open(this.configService.webAppUrl + `Assemblies/Review/${activeAPIRevision.reviewId}?revisionId=${activeAPIRevision.id}&diffOnly=False&doc=False&diffRevisionId=${diffAPIRevision.id}`, target);
}
}

openAPIRevisionPage(reviewId: string, activeAPIRevisionId: string, currentRoute: string) {
openAPIRevisionPage(apiRevision: APIRevision, currentRoute: string) {
const target = (currentRoute.includes("review")) ? '_self' : '_blank';
window.open(this.configService.webAppUrl + `Assemblies/Review/${reviewId}?revisionId=${activeAPIRevisionId}`, target);

if (apiRevision.files[0].parserStyle === "tree") {
window.open(`/review/${apiRevision.reviewId}?activeApiRevisionId=${apiRevision.id}`, target);
} else {
window.open(this.configService.webAppUrl + `Assemblies/Review/${apiRevision.reviewId}?revisionId=${apiRevision.id}`, target);
}
}

updateSelectedReviewers(reviewId: string, apiRevisionId: string, reviewers: Set<string>): Observable<APIRevision> {
Expand Down