From 69a16f877aa56eedec4d30ba06473dc5cafa17cc Mon Sep 17 00:00:00 2001 From: Kean Mariotti Date: Wed, 21 Dec 2022 15:01:47 +0000 Subject: [PATCH 1/2] Rename Angular components internal/wrapped properties A Christmas present for pablogamito@ Test: npm run build:all && npm run test:all Change-Id: I64c8a80b02de61874e56ea33eeb99f7a0d4afe9b --- .../timeline/timeline.component.spec.ts | 16 +++++----- .../components/timeline/timeline.component.ts | 30 +++++++++---------- .../components/rects/rects.component.ts | 26 ++++++++-------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tools/winscope-ng/src/app/components/timeline/timeline.component.spec.ts b/tools/winscope-ng/src/app/components/timeline/timeline.component.spec.ts index 0bc0a5240..3f6b45e64 100644 --- a/tools/winscope-ng/src/app/components/timeline/timeline.component.spec.ts +++ b/tools/winscope-ng/src/app/components/timeline/timeline.component.spec.ts @@ -122,22 +122,22 @@ describe("TimelineComponent", () => { it("processes active trace input and updates selected traces", () => { component.activeViewTraceTypes = [TraceType.SURFACE_FLINGER]; - expect(component.wrappedActiveTrace).toEqual(TraceType.SURFACE_FLINGER); + expect(component.internalActiveTrace).toEqual(TraceType.SURFACE_FLINGER); expect(component.selectedTraces).toEqual([TraceType.SURFACE_FLINGER]); component.activeViewTraceTypes = [TraceType.SURFACE_FLINGER]; - expect(component.wrappedActiveTrace).toEqual(TraceType.SURFACE_FLINGER); + expect(component.internalActiveTrace).toEqual(TraceType.SURFACE_FLINGER); expect(component.selectedTraces).toEqual([TraceType.SURFACE_FLINGER]); component.activeViewTraceTypes = [TraceType.TRANSACTIONS]; - expect(component.wrappedActiveTrace).toEqual(TraceType.TRANSACTIONS); + expect(component.internalActiveTrace).toEqual(TraceType.TRANSACTIONS); expect(component.selectedTraces).toEqual([ TraceType.SURFACE_FLINGER, TraceType.TRANSACTIONS ]); component.activeViewTraceTypes = [TraceType.WINDOW_MANAGER]; - expect(component.wrappedActiveTrace).toEqual(TraceType.WINDOW_MANAGER); + expect(component.internalActiveTrace).toEqual(TraceType.WINDOW_MANAGER); expect(component.selectedTraces).toEqual([ TraceType.SURFACE_FLINGER, TraceType.TRANSACTIONS, @@ -145,7 +145,7 @@ describe("TimelineComponent", () => { ]); component.activeViewTraceTypes = [TraceType.PROTO_LOG]; - expect(component.wrappedActiveTrace).toEqual(TraceType.PROTO_LOG); + expect(component.internalActiveTrace).toEqual(TraceType.PROTO_LOG); expect(component.selectedTraces).toEqual([ TraceType.TRANSACTIONS, TraceType.WINDOW_MANAGER, @@ -155,15 +155,15 @@ describe("TimelineComponent", () => { it("handles undefined active trace input", () => { component.activeViewTraceTypes = undefined; - expect(component.wrappedActiveTrace).toBeUndefined(); + expect(component.internalActiveTrace).toBeUndefined(); expect(component.selectedTraces).toEqual([]); component.activeViewTraceTypes = [TraceType.SURFACE_FLINGER]; - expect(component.wrappedActiveTrace).toEqual(TraceType.SURFACE_FLINGER); + expect(component.internalActiveTrace).toEqual(TraceType.SURFACE_FLINGER); expect(component.selectedTraces).toEqual([TraceType.SURFACE_FLINGER]); component.activeViewTraceTypes = undefined; - expect(component.wrappedActiveTrace).toEqual(TraceType.SURFACE_FLINGER); + expect(component.internalActiveTrace).toEqual(TraceType.SURFACE_FLINGER); expect(component.selectedTraces).toEqual([TraceType.SURFACE_FLINGER]); }); diff --git a/tools/winscope-ng/src/app/components/timeline/timeline.component.ts b/tools/winscope-ng/src/app/components/timeline/timeline.component.ts index 64f547710..c0176e881 100644 --- a/tools/winscope-ng/src/app/components/timeline/timeline.component.ts +++ b/tools/winscope-ng/src/app/components/timeline/timeline.component.ts @@ -284,10 +284,10 @@ export class TimelineComponent implements TimelineComponentDependencyInversion { throw Error("Timeline component doesn't support viewers with dependencies length !== 1"); } - this.wrappedActiveTrace = types[0]; + this.internalActiveTrace = types[0]; - if (!this.selectedTraces.includes(this.wrappedActiveTrace)) { - this.selectedTraces.push(this.wrappedActiveTrace); + if (!this.selectedTraces.includes(this.internalActiveTrace)) { + this.selectedTraces.push(this.internalActiveTrace); } if (this.selectedTraces.length > this.MAX_SELECTED_TRACES) { @@ -297,7 +297,7 @@ export class TimelineComponent implements TimelineComponentDependencyInversion { this.selectedTracesFormControl.setValue(this.selectedTraces); } - public wrappedActiveTrace: TraceType|undefined = undefined; + public internalActiveTrace: TraceType|undefined = undefined; @Input() timelineData!: TimelineData; @Input() availableTraces: TraceType[] = []; @@ -404,7 +404,7 @@ export class TimelineComponent implements TimelineComponentDependencyInversion { } isOptionDisabled(trace: TraceType) { - if (this.wrappedActiveTrace === trace) { + if (this.internalActiveTrace === trace) { return true; } @@ -440,33 +440,33 @@ export class TimelineComponent implements TimelineComponentDependencyInversion { } hasPrevEntry(): boolean { - if (!this.wrappedActiveTrace || - (this.timelineData.getTimelines().get(this.wrappedActiveTrace)?.length ?? 0) === 0) { + if (!this.internalActiveTrace || + (this.timelineData.getTimelines().get(this.internalActiveTrace)?.length ?? 0) === 0) { return false; } - return this.timelineData.getPreviousTimestampFor(this.wrappedActiveTrace) !== undefined; + return this.timelineData.getPreviousTimestampFor(this.internalActiveTrace) !== undefined; } hasNextEntry(): boolean { - if (!this.wrappedActiveTrace || - (this.timelineData.getTimelines().get(this.wrappedActiveTrace)?.length ?? 0) === 0) { + if (!this.internalActiveTrace || + (this.timelineData.getTimelines().get(this.internalActiveTrace)?.length ?? 0) === 0) { return false; } - return this.timelineData.getNextTimestampFor(this.wrappedActiveTrace) !== undefined; + return this.timelineData.getNextTimestampFor(this.internalActiveTrace) !== undefined; } moveToPreviousEntry() { - if (!this.wrappedActiveTrace) { + if (!this.internalActiveTrace) { return; } - this.timelineData.moveToPreviousTimestampFor(this.wrappedActiveTrace); + this.timelineData.moveToPreviousTimestampFor(this.internalActiveTrace); } moveToNextEntry() { - if (!this.wrappedActiveTrace) { + if (!this.internalActiveTrace) { return; } - this.timelineData.moveToNextTimestampFor(this.wrappedActiveTrace); + this.timelineData.moveToNextTimestampFor(this.internalActiveTrace); } humanElapsedTimeInputChange(event: Event) { diff --git a/tools/winscope-ng/src/viewers/components/rects/rects.component.ts b/tools/winscope-ng/src/viewers/components/rects/rects.component.ts index ffc3adae9..5e8009387 100644 --- a/tools/winscope-ng/src/viewers/components/rects/rects.component.ts +++ b/tools/winscope-ng/src/viewers/components/rects/rects.component.ts @@ -99,10 +99,10 @@ import {Mapper3D} from "./mapper3d";
-