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 @@ -5,7 +5,7 @@
[(ngModel)]="selectedActiveAPIRevision"
optionLabel="label"
inputId="active-api-revision-select"
[panelStyle]="{'width':'30dvw'}"
[panelStyle]="{'width':'40dvw'}"
[filter]="true"
[resetFilterOnHide]="true"
(onHide)="resetDropDownFilter('active')"
Expand Down Expand Up @@ -73,7 +73,7 @@
[(ngModel)]="selectedDiffAPIRevision"
optionLabel="label"
inputId="diff-api-revision-select"
[panelStyle]="{'width':'30dvw'}"
[panelStyle]="{'width':'40dvw'}"
[filter]="true"
[resetFilterOnHide]="true"
(onHide)="resetDropDownFilter('diff')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,14 @@ export class ApiRevisionOptionsComponent implements OnChanges {
});

if (dropDownMenu === "active") {
this.activeApiRevisionsMenu = filtered;
this.activeApiRevisionsMenu = filtered.filter((apiRevision: APIRevision) => apiRevision.id !== this.diffApiRevisionId);
if (this.selectedActiveAPIRevision && !this.activeApiRevisionsMenu.includes(this.selectedActiveAPIRevision)) {
this.activeApiRevisionsMenu.unshift(this.selectedActiveAPIRevision);
}
}

if (dropDownMenu === "diff") {
filtered = filtered.filter((apiRevision: APIRevision) => apiRevision.id !== this.activeApiRevisionId);
this.diffApiRevisionsMenu = filtered
this.diffApiRevisionsMenu = filtered.filter((apiRevision: APIRevision) => apiRevision.id !== this.activeApiRevisionId);
if (this.selectedDiffAPIRevision && !this.diffApiRevisionsMenu.includes(this.selectedDiffAPIRevision)) {
this.diffApiRevisionsMenu.unshift(this.selectedDiffAPIRevision);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChange
import { ActivatedRoute, Router } from '@angular/router';
import { InputSwitchOnChangeEvent } from 'primeng/inputswitch';
import { getQueryParams } from 'src/app/_helpers/router-helpers';
import { mapLanguageAliases } from 'src/app/_helpers/common-helpers';
import { FULL_DIFF_STYLE, mapLanguageAliases, NODE_DIFF_STYLE, TREE_DIFF_STYLE } from 'src/app/_helpers/common-helpers';
import { Review } from 'src/app/_models/review';
import { APIRevision } from 'src/app/_models/revision';
import { ConfigService } from 'src/app/_services/config/config.service';
Expand Down Expand Up @@ -66,9 +66,9 @@ export class ReviewPageOptionsComponent implements OnInit, OnChanges{
selectedApprovers: string[] = [];

diffStyleOptions : any[] = [
{ label: 'Full Diff', value: "full" },
{ label: 'Only Trees', value: "trees"},
{ label: 'Only Nodes', value: "nodes" }
{ label: 'Full Diff', value: FULL_DIFF_STYLE },
{ label: 'Only Trees', value: TREE_DIFF_STYLE },
{ label: 'Only Nodes', value: NODE_DIFF_STYLE }
];
selectedDiffStyle : string = this.diffStyleOptions[0];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ReviewPageComponent implements OnInit {

constructor(private route: ActivatedRoute, private router: Router, private apiRevisionsService: RevisionsService,
private reviewsService: ReviewsService, private workerService: WorkerService, private changeDetectorRef: ChangeDetectorRef,
private userProfileService: UserProfileService, private commentsService: CommentsService) {}
private userProfileService: UserProfileService) {}

ngOnInit() {
this.userProfileService.getUserProfile().subscribe(
Expand All @@ -88,7 +88,6 @@ export class ReviewPageComponent implements OnInit {
this.showLineNumbers = false;
}
});

this.route.queryParams.pipe(takeUntil(this.destroy$)).subscribe(params => {
const navigationState = this.router.getCurrentNavigation()?.extras.state;
if (!navigationState || !navigationState['skipStateUpdate']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ export const ACTIVE_API_REVISION_ID_QUERY_PARAM = "activeApiRevisionId";
export const DIFF_API_REVISION_ID_QUERY_PARAM = "diffApiRevisionId";
export const DIFF_STYLE_QUERY_PARAM = "diffStyle";
export const SCROLL_TO_NODE_QUERY_PARAM = "nId";
export const FULL_DIFF_STYLE = "full";
export const TREE_DIFF_STYLE = "trees";
export const NODE_DIFF_STYLE = "nodes";

export function getLanguageCssSafeName(language: string): string {
switch (language.toLowerCase()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ApiTreeBuilderData } from "../_models/revision";
import { CodePanelData, CodePanelNodeMetaData, CodePanelRowData, CodePanelRowDatatype } from '../_models/codePanelModels';
import { InsertCodePanelRowDataMessage, ReviewPageWorkerMessageDirective } from '../_models/insertCodePanelRowDataMessage';
import { NavigationTreeNode } from '../_models/navigationTreeModels';
import { FULL_DIFF_STYLE, NODE_DIFF_STYLE, TREE_DIFF_STYLE } from '../_helpers/common-helpers';

let codePanelData: CodePanelData | null = null;
let codePanelRowData: CodePanelRowData[] = [];
Expand All @@ -20,6 +21,9 @@ addEventListener('message', ({ data }) => {
let jsonString = new TextDecoder().decode(new Uint8Array(data));

codePanelData = JSON.parse(jsonString);
if (!codePanelData?.hasDiff) {
apiTreeBuilderData!.diffStyle = FULL_DIFF_STYLE; // If there is no diff nodes and tree diff will not work
}

buildCodePanelRows("root", navigationTree);
const codePanelRowDataMessage : InsertCodePanelRowDataMessage = {
Expand Down Expand Up @@ -68,18 +72,18 @@ function buildCodePanelRows(nodeIdHashed: string, navigationTree: NavigationTree
let buildChildren = true;
let addNodeToBuffer = false

if (nodeIdHashed !== "root" && (apiTreeBuilderData?.diffStyle === "trees" || apiTreeBuilderData?.diffStyle === "nodes") &&
if (nodeIdHashed !== "root" && (apiTreeBuilderData?.diffStyle === TREE_DIFF_STYLE || apiTreeBuilderData?.diffStyle === NODE_DIFF_STYLE) &&
(!node.isNodeWithDiffInDescendants || (!apiTreeBuilderData?.showDocumentation && !node.isNodeWithNoneDocDiffInDescendants))) {
buildNode = false;
buildChildren = false;
}

if (!buildNode && (!node.childrenNodeIdsInOrder || Object.keys(node.childrenNodeIdsInOrder).length === 0) &&
(apiTreeBuilderData?.diffStyle !== "nodes" || node.isNodeWithDiff)) {
(apiTreeBuilderData?.diffStyle !== NODE_DIFF_STYLE || node.isNodeWithDiff)) {
buildNode = true;
}

if (!node.isNodeWithDiff && apiTreeBuilderData?.diffStyle === "nodes" && (!node.childrenNodeIdsInOrder || Object.keys(node.childrenNodeIdsInOrder).length === 0)) {
if (!node.isNodeWithDiff && apiTreeBuilderData?.diffStyle === NODE_DIFF_STYLE && (!node.childrenNodeIdsInOrder || Object.keys(node.childrenNodeIdsInOrder).length === 0)) {
addNodeToBuffer = true;
}

Expand Down