-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
091124/full conversation and revisions page (#8961)
* Add stand alone pages * Add review page layout * Make Pre tags not overflow * Refactor Modules * Add stand alone pages * Add Stand alone Conversation Page * Update failing tests
- Loading branch information
1 parent
d7456f0
commit c21d133
Showing
40 changed files
with
773 additions
and
239 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
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
11 changes: 11 additions & 0 deletions
11
.../APIView/ClientSPA/src/app/_components/conversation-page/conversation-page.component.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<app-review-page-layout | ||
[review]="review" | ||
[sideMenu]="sideMenu"> | ||
<div class="conversation-panel overflow-auto border rounded py-3"> | ||
<app-conversations | ||
[apiRevisions]="apiRevisions" | ||
[comments]="comments" | ||
[userProfile]="userProfile"> | ||
</app-conversations> | ||
</div> | ||
</app-review-page-layout> |
6 changes: 6 additions & 0 deletions
6
.../APIView/ClientSPA/src/app/_components/conversation-page/conversation-page.component.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
:host ::ng-deep { | ||
.conversation-panel{ | ||
height: calc(100vh - 130px); | ||
background-color: var(--base-fg-color); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...IView/ClientSPA/src/app/_components/conversation-page/conversation-page.component.spec.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ConversationPageComponent } from './conversation-page.component'; | ||
import { ActivatedRoute, convertToParamMap } from '@angular/router'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { ReviewPageLayoutComponent } from '../shared/review-page-layout/review-page-layout.component'; | ||
import { ConversationsComponent } from '../conversations/conversations.component'; | ||
import { NavBarComponent } from '../shared/nav-bar/nav-bar.component'; | ||
import { ReviewInfoComponent } from '../shared/review-info/review-info.component'; | ||
import { MenuModule } from 'primeng/menu'; | ||
import { FooterComponent } from '../shared/footer/footer.component'; | ||
import { MenubarModule } from 'primeng/menubar'; | ||
import { LanguageNamesPipe } from 'src/app/_pipes/language-names.pipe'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
describe('ConversationPageComponent', () => { | ||
let component: ConversationPageComponent; | ||
let fixture: ComponentFixture<ConversationPageComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
ConversationPageComponent, | ||
ConversationsComponent, | ||
NavBarComponent, | ||
FooterComponent, | ||
ReviewInfoComponent, | ||
ReviewPageLayoutComponent, | ||
LanguageNamesPipe | ||
], | ||
imports: [ | ||
BrowserAnimationsModule, | ||
HttpClientTestingModule, | ||
MenuModule, | ||
MenubarModule | ||
], | ||
providers: [ | ||
{ | ||
provide: ActivatedRoute, | ||
useValue: { | ||
snapshot: { | ||
paramMap: convertToParamMap({ reviewId: 'test' }) | ||
} | ||
} | ||
} | ||
] | ||
}); | ||
fixture = TestBed.createComponent(ConversationPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
91 changes: 91 additions & 0 deletions
91
...et/APIView/ClientSPA/src/app/_components/conversation-page/conversation-page.component.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { Component } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { MenuItem } from 'primeng/api'; | ||
import { Subject, takeUntil } from 'rxjs'; | ||
import { REVIEW_ID_ROUTE_PARAM } from 'src/app/_helpers/common-helpers'; | ||
import { CommentItemModel } from 'src/app/_models/commentItemModel'; | ||
import { Review } from 'src/app/_models/review'; | ||
import { APIRevision } from 'src/app/_models/revision'; | ||
import { UserProfile } from 'src/app/_models/userProfile'; | ||
import { CommentsService } from 'src/app/_services/comments/comments.service'; | ||
import { ReviewsService } from 'src/app/_services/reviews/reviews.service'; | ||
import { RevisionsService } from 'src/app/_services/revisions/revisions.service'; | ||
import { UserProfileService } from 'src/app/_services/user-profile/user-profile.service'; | ||
|
||
@Component({ | ||
selector: 'app-conversation-page', | ||
templateUrl: './conversation-page.component.html', | ||
styleUrls: ['./conversation-page.component.scss'] | ||
}) | ||
export class ConversationPageComponent { | ||
reviewId : string | null = null; | ||
review : Review | undefined = undefined; | ||
userProfile : UserProfile | undefined; | ||
sideMenu: MenuItem[] | undefined; | ||
comments: CommentItemModel[] = []; | ||
apiRevisions: APIRevision[] = []; | ||
|
||
apiRevisionPageSize = 50; | ||
|
||
private destroy$ = new Subject<void>(); | ||
|
||
constructor(private route: ActivatedRoute, private reviewsService: ReviewsService, private userProfileService: UserProfileService, | ||
private apiRevisionsService: RevisionsService, private commentsService: CommentsService | ||
) {} | ||
|
||
ngOnInit() { | ||
this.userProfileService.getUserProfile().subscribe( | ||
(userProfile : any) => { | ||
this.userProfile = userProfile; | ||
} | ||
); | ||
this.reviewId = this.route.snapshot.paramMap.get(REVIEW_ID_ROUTE_PARAM); | ||
this.createSideMenu(); | ||
this.loadReview(this.reviewId!); | ||
this.loadAPIRevisions(0, this.apiRevisionPageSize); | ||
this.loadComments(); | ||
} | ||
|
||
createSideMenu() { | ||
this.sideMenu = [ | ||
{ | ||
icon: 'bi bi-braces', | ||
tooltip: 'API', | ||
command: () => this.openLatestAPIReivisonForReview() | ||
} | ||
]; | ||
} | ||
|
||
loadReview(reviewId: string) { | ||
this.reviewsService.getReview(reviewId) | ||
.pipe(takeUntil(this.destroy$)).subscribe({ | ||
next: (review: Review) => { | ||
this.review = review; | ||
} | ||
}); | ||
} | ||
|
||
loadAPIRevisions(noOfItemsRead : number, pageSize: number) { | ||
this.apiRevisionsService.getAPIRevisions(noOfItemsRead, pageSize, this.reviewId!, undefined, undefined, | ||
undefined, "createdOn", undefined, undefined, undefined, true) | ||
.pipe(takeUntil(this.destroy$)).subscribe({ | ||
next: (response: any) => { | ||
this.apiRevisions = response.result; | ||
} | ||
}); | ||
} | ||
|
||
loadComments() { | ||
this.commentsService.getComments(this.reviewId!) | ||
.pipe(takeUntil(this.destroy$)).subscribe({ | ||
next: (comments: CommentItemModel[]) => { | ||
this.comments = comments; | ||
} | ||
}); | ||
} | ||
|
||
openLatestAPIReivisonForReview() { | ||
const apiRevision = this.apiRevisions.find(x => x.apiRevisionType === "Automatic") ?? this.apiRevisions[0]; | ||
this.apiRevisionsService.openAPIRevisionPage(apiRevision, this.route); | ||
} | ||
} |
9 changes: 5 additions & 4 deletions
9
src/dotnet/APIView/ClientSPA/src/app/_components/conversations/conversations.component.html
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
Oops, something went wrong.