Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -6,7 +6,7 @@
<div *uiScroll="let item of codePanelRowSource; let index = index" class="code-line" [attr.data-node-id]="item.nodeIdHashed" [ngClass]="getClassObject(item.rowClasses)">
<ng-container *ngIf="item.type === CodePanelRowDatatype.CodeLine || item.type === CodePanelRowDatatype.Documentation">
<div class="line-actions">
<span class="line-number first">{{item.lineNumber}}</span>
<span *ngIf="showLineNumbers" class="line-number first">{{item.lineNumber}}</span>
<span *ngIf="isDiffView" class="line-number second">{{item.lineNumber}}</span>
<span class="small toggle-user-comments-btn {{item.toggleCommentsClasses}}"></span>
<span class="small toggle-documentation-btn {{item.toggleDocumentationClasses}}"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class CodePanelComponent implements OnChanges{
@Input() navTreeNodIdHashed: string | undefined;
@Input() reviewId: string | undefined;
@Input() activeApiRevisionId: string | undefined;
@Input() showLineNumbers: boolean = true;

lineNumberCount : number = 0;
isLoading: boolean = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
<label class="ms-2">Documentation</label>
</li>
<li class="list-group-item">
<p-inputSwitch [(ngModel)]="showLineNumberSwitch" />
<p-inputSwitch [(ngModel)]="showLineNumbersSwitch"
(onChange)="onShowLineNumbersSwitchChange($event)" />
<label class="ms-2">Line Numbers</label>
</li>
<li class="list-group-item">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ export class ReviewPageOptionsComponent implements OnInit, OnChanges{
@Output() showSystemCommentsEmitter : EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() showDocumentationEmitter : EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() markAsViewedEmitter : EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() showLineNumbersEmitter : EventEmitter<boolean> = new EventEmitter<boolean>();

showCommentsSwitch : boolean = true;
showSystemCommentsSwitch : boolean = true;
showDocumentationSwitch : boolean = true;
showLineNumberSwitch : boolean = true;
showLeftNavigationSwitch : boolean = true;
markedAsViewSwitch : boolean = false;
showLineNumbersSwitch : boolean = true;

activeAPIRevisionIsApprovedByCurrentUser: boolean = false;
activeAPIRevisionApprovalMessage: string = '';
Expand Down Expand Up @@ -53,6 +54,9 @@ export class ReviewPageOptionsComponent implements OnInit, OnChanges{
this.showCommentsSwitch = this.userProfile?.preferences.showComments ?? true;
this.showSystemCommentsSwitch = this.userProfile?.preferences.showSystemComments ?? true;
this.showDocumentationSwitch = this.userProfile?.preferences.showDocumentation ?? false;
if (this.userProfile?.preferences.hideLineNumbers){
this.showLineNumbersSwitch = false;
}
}

ngOnChanges(changes: SimpleChanges) {
Expand All @@ -64,6 +68,9 @@ export class ReviewPageOptionsComponent implements OnInit, OnChanges{
this.showCommentsSwitch = this.userProfile?.preferences.showComments ?? this.showCommentsSwitch;
this.showSystemCommentsSwitch = this.userProfile?.preferences.showSystemComments ?? this.showSystemCommentsSwitch;
this.showDocumentationSwitch = this.userProfile?.preferences.showDocumentation ?? this.showDocumentationSwitch;
if (this.userProfile?.preferences.hideLineNumbers){
this.showLineNumbersSwitch = false;
}
}

if (changes['activeAPIRevision'] && changes['activeAPIRevision'].currentValue != undefined) {
Expand Down Expand Up @@ -113,6 +120,14 @@ export class ReviewPageOptionsComponent implements OnInit, OnChanges{
this.markAsViewedEmitter.emit(event.checked);
}

/**
* Callback for showLineNumbersSwitch Change
* @param event the Filter event
*/
onShowLineNumbersSwitchChange(event: InputSwitchOnChangeEvent) {
this.showLineNumbersEmitter.emit(event.checked);
}

setSelectedDiffStyle() {
const inputDiffStyle = this.diffStyleOptions.find(option => option.value === this.diffStyleInput);
this.selectedDiffStyle = (inputDiffStyle) ? inputDiffStyle : this.diffStyleOptions[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
[language]="language" [languageSafeName]="languageSafeName"
[reviewComments]="reviewComments" [isDiffView]="!!diffApiRevisionId"
[reviewId]="reviewId!" [activeApiRevisionId]="activeApiRevisionId!"
[navTreeNodIdHashed]="navTreeNodeIdHashed"></app-code-panel>
[navTreeNodIdHashed]="navTreeNodeIdHashed"
[showLineNumbers]="showLineNumbers"></app-code-panel>
</div>
</ng-template>
<ng-template pTemplate>
Expand All @@ -40,7 +41,8 @@
(showDocumentationEmitter)="handleShowDocumentationEmitter($event)"
(showCommentsEmitter)="handleShowCommentsEmitter($event)"
(diffStyleEmitter)="handleDiffStyleEmitter($event)"
(markAsViewedEmitter)="handleMarkAsViewedEmitter($event)"></app-review-page-options>
(markAsViewedEmitter)="handleMarkAsViewedEmitter($event)"
(showLineNumbersEmitter)="handleShowLineNumbersEmitter($event)"></app-review-page-options>
</div>
</ng-template>
</p-splitter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class ReviewPageComponent implements OnInit {
language: string | undefined;
languageSafeName: string | undefined;
navTreeNodeIdHashed : string | undefined;
showLineNumbers : boolean = true;

codePanelData: CodePanelData | null = null;
codePanelRowData: CodePanelRowData[] = [];
Expand All @@ -59,6 +60,10 @@ export class ReviewPageComponent implements OnInit {
this.userProfileService.getUserProfile().subscribe(
(userProfile : any) => {
this.userProfile = userProfile;
console.log('userProfile', userProfile)
if(this.userProfile?.preferences.hideLineNumbers) {
this.showLineNumbers = false;
}
});

this.route.queryParams.pipe(takeUntil(this.destroy$)).subscribe(params => {
Expand Down Expand Up @@ -217,6 +222,14 @@ export class ReviewPageComponent implements OnInit {
}
}

handleShowLineNumbersEmitter(state: boolean) {
let userPreferenceModel = this.userProfile?.preferences;
userPreferenceModel!.hideLineNumbers = state;
this.userProfileService.updateUserPrefernece(userPreferenceModel!).pipe(takeUntil(this.destroy$)).subscribe(() => {
this.showLineNumbers = state;
});
}

handleNavTreeNodeEmmitter(nodeIdHashed: string) {
this.navTreeNodeIdHashed = nodeIdHashed;
}
Expand Down