From 5fdc5c207debbbe1849880d9dbefe8e6b05a3dc0 Mon Sep 17 00:00:00 2001 From: madalynrose Date: Tue, 16 Aug 2022 08:57:35 -0700 Subject: [PATCH 1/5] fix instance-details --- src/common/components/cards/instance-details.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/components/cards/instance-details.tsx b/src/common/components/cards/instance-details.tsx index 28589104577..9bc91ed1163 100644 --- a/src/common/components/cards/instance-details.tsx +++ b/src/common/components/cards/instance-details.tsx @@ -66,7 +66,7 @@ export const InstanceDetails = NamedFC('InstanceDetails', cardSelectionMessageCreator.toggleCardSelection(result.ruleId, result.uid, event); }; - const hiddenButton = React.useRef(null); + const hiddenButton = React.useRef(null); const cardHighlightingProperties = isHighlightSupported ? { onClick: (_: React.SyntheticEvent): void => { @@ -124,7 +124,7 @@ const renderCardRowsForPropertyBag = ( props: InstanceDetailsProps, ) => { let propertyIndex = 0; - const cardRows = []; + const cardRows: JSX.Element[] = []; forOwn(propertyBag, (propertyData, propertyName) => { const propertyConfig = props.deps.getPropertyConfigById(propertyName); if (!isEmpty(propertyConfig)) { From c8f910aa55b039ec5a9193f8f1b0294c1fd5eafb Mon Sep 17 00:00:00 2001 From: madalynrose Date: Tue, 16 Aug 2022 09:13:37 -0700 Subject: [PATCH 2/5] fix hamburger menu assessment selection --- src/background/actions/action-payloads.ts | 2 +- src/common/extension-telemetry-events.ts | 2 +- src/common/telemetry-data-factory.ts | 4 ++-- src/popup/actions/popup-action-message-creator.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/background/actions/action-payloads.ts b/src/background/actions/action-payloads.ts index 2ca8c8c9869..186025f323d 100644 --- a/src/background/actions/action-payloads.ts +++ b/src/background/actions/action-payloads.ts @@ -90,7 +90,7 @@ export interface ChangeInstanceSelectionPayload extends AssessmentActionInstance } export interface UpdateSelectedDetailsViewPayload extends BaseActionPayload { - detailsViewType: VisualizationType; + detailsViewType: VisualizationType | null; pivotType: DetailsViewPivotType; } diff --git a/src/common/extension-telemetry-events.ts b/src/common/extension-telemetry-events.ts index ac512dbb88c..b61d5af6301 100644 --- a/src/common/extension-telemetry-events.ts +++ b/src/common/extension-telemetry-events.ts @@ -137,7 +137,7 @@ export type ExportFastPassResultsTelemetryData = { } & ExportResultsTelemetryData; export type DetailsViewOpenTelemetryData = { - selectedTest: string; + selectedTest: string | null; } & BaseTelemetryData; export type DetailsViewOpenedTelemetryData = { diff --git a/src/common/telemetry-data-factory.ts b/src/common/telemetry-data-factory.ts index 0a1d43f529b..e1091644d7a 100644 --- a/src/common/telemetry-data-factory.ts +++ b/src/common/telemetry-data-factory.ts @@ -204,12 +204,12 @@ export class TelemetryDataFactory { public forOpenDetailsView( event: SupportedMouseEvent, - visualizationType: VisualizationType, + visualizationType: VisualizationType | null, source: TelemetryEventSource, ): DetailsViewOpenTelemetryData { return { ...this.withTriggeredByAndSource(event, source), - selectedTest: VisualizationType[visualizationType], + selectedTest: visualizationType == null ? null : VisualizationType[visualizationType], }; } diff --git a/src/popup/actions/popup-action-message-creator.ts b/src/popup/actions/popup-action-message-creator.ts index 054f7223d3c..a4e007f009a 100644 --- a/src/popup/actions/popup-action-message-creator.ts +++ b/src/popup/actions/popup-action-message-creator.ts @@ -59,7 +59,7 @@ export class PopupActionMessageCreator { public openDetailsView( event: SupportedMouseEvent, - viewType: VisualizationType, + viewType: VisualizationType | null, source: TelemetryEventSource, pivotType: DetailsViewPivotType, ): void { From c167cd0e9e72e97137711d0c81398e6496f69afb Mon Sep 17 00:00:00 2001 From: madalynrose Date: Wed, 17 Aug 2022 07:35:07 -0700 Subject: [PATCH 3/5] make containerClassName optional for result section --- src/common/components/cards/needs-review-instances-section.tsx | 1 - src/common/components/cards/result-section.tsx | 2 +- .../__snapshots__/needs-review-instances-section.test.tsx.snap | 3 --- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/common/components/cards/needs-review-instances-section.tsx b/src/common/components/cards/needs-review-instances-section.tsx index c215ec8eb04..c47a415786a 100644 --- a/src/common/components/cards/needs-review-instances-section.tsx +++ b/src/common/components/cards/needs-review-instances-section.tsx @@ -31,7 +31,6 @@ export const NeedsReviewInstancesSection = NamedFC( deps={deps} title="Instances to review" results={cardsViewData.cards.unknown} - containerClassName={null} outcomeType="review" badgeCount={count} userConfigurationStoreData={userConfigurationStoreData} diff --git a/src/common/components/cards/result-section.tsx b/src/common/components/cards/result-section.tsx index 98e8975b864..aa5de3e2f77 100644 --- a/src/common/components/cards/result-section.tsx +++ b/src/common/components/cards/result-section.tsx @@ -17,7 +17,7 @@ export type ResultSectionDeps = ResultSectionContentDeps; export type ResultSectionProps = Omit & Omit & { - containerClassName: string; + containerClassName?: string; deps: ResultSectionDeps; sectionHeadingLevel: HeadingLevel; }; diff --git a/src/tests/unit/tests/common/components/cards/__snapshots__/needs-review-instances-section.test.tsx.snap b/src/tests/unit/tests/common/components/cards/__snapshots__/needs-review-instances-section.test.tsx.snap index 482066229ce..09aa804c0b4 100644 --- a/src/tests/unit/tests/common/components/cards/__snapshots__/needs-review-instances-section.test.tsx.snap +++ b/src/tests/unit/tests/common/components/cards/__snapshots__/needs-review-instances-section.test.tsx.snap @@ -7,7 +7,6 @@ exports[`NeedsReviewInstancesSection renders null results 1`] = `null`; exports[`NeedsReviewInstancesSection renders with alerting off 1`] = ` Date: Wed, 17 Aug 2022 08:47:23 -0700 Subject: [PATCH 4/5] move fixInstructionProcessor from props to deps for instances --- src/common/components/cards/rules-with-instances.tsx | 4 ---- .../cards/__snapshots__/rules-with-instances.test.tsx.snap | 3 ++- .../common/components/cards/rules-with-instances.test.tsx | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/common/components/cards/rules-with-instances.tsx b/src/common/components/cards/rules-with-instances.tsx index d559cb7a76c..3815c5a2cfb 100644 --- a/src/common/components/cards/rules-with-instances.tsx +++ b/src/common/components/cards/rules-with-instances.tsx @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { FixInstructionProcessor } from 'common/components/fix-instruction-processor'; import { CardSelectionMessageCreator } from 'common/message-creators/card-selection-message-creator'; import { NamedFC } from 'common/react/named-fc'; import * as React from 'react'; @@ -27,7 +26,6 @@ export type RulesWithInstancesDeps = RuleContentDeps & export type RulesWithInstancesProps = { deps: RulesWithInstancesDeps; - fixInstructionProcessor: FixInstructionProcessor; rules: CardRuleResult[]; outcomeType: InstanceOutcomeType; userConfigurationStoreData: UserConfigurationStoreData; @@ -44,7 +42,6 @@ export const RulesWithInstances = NamedFC( ({ rules, outcomeType, - fixInstructionProcessor, deps, userConfigurationStoreData, targetAppInfo, @@ -73,7 +70,6 @@ export const RulesWithInstances = NamedFC( key={`${rule.id}-rule-group`} deps={deps} rule={rule} - fixInstructionProcessor={fixInstructionProcessor} userConfigurationStoreData={userConfigurationStoreData} targetAppInfo={targetAppInfo} cardSelectionMessageCreator={cardSelectionMessageCreator} diff --git a/src/tests/unit/tests/common/components/cards/__snapshots__/rules-with-instances.test.tsx.snap b/src/tests/unit/tests/common/components/cards/__snapshots__/rules-with-instances.test.tsx.snap index aa184924ee3..99f8bc016a6 100644 --- a/src/tests/unit/tests/common/components/cards/__snapshots__/rules-with-instances.test.tsx.snap +++ b/src/tests/unit/tests/common/components/cards/__snapshots__/rules-with-instances.test.tsx.snap @@ -15,9 +15,9 @@ exports[`RulesWithInstances renders 1`] = ` deps={ Object { "collapsibleControl": [Function], + "fixInstructionProcessor": [typemoq mock object], } } - fixInstructionProcessor={[typemoq mock object]} rule={ Object { "description": "sample-description", @@ -69,6 +69,7 @@ exports[`RulesWithInstances renders 1`] = ` deps={ Object { "collapsibleControl": [Function], + "fixInstructionProcessor": [typemoq mock object], } } header={ diff --git a/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx b/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx index 05f21b217fc..a000aa15556 100644 --- a/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx +++ b/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx @@ -31,13 +31,13 @@ describe('RulesWithInstances', () => { collapsibleControl: (props: CollapsibleComponentCardsProps) => ( ), + fixInstructionProcessor: fixInstructionProcessorMock.object } as RulesWithInstancesDeps; const outcomeCounterStub = () => 5; const wrapped = shallow( Date: Mon, 22 Aug 2022 07:41:56 -0700 Subject: [PATCH 5/5] format fix --- .../tests/common/components/cards/rules-with-instances.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx b/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx index a000aa15556..083b1123d21 100644 --- a/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx +++ b/src/tests/unit/tests/common/components/cards/rules-with-instances.test.tsx @@ -31,7 +31,7 @@ describe('RulesWithInstances', () => { collapsibleControl: (props: CollapsibleComponentCardsProps) => ( ), - fixInstructionProcessor: fixInstructionProcessorMock.object + fixInstructionProcessor: fixInstructionProcessorMock.object, } as RulesWithInstancesDeps; const outcomeCounterStub = () => 5;