Fixed DirectoryPickerPanel and NotificationConsoleComponent

This commit is contained in:
vaidankarswapnil
2021-07-19 11:17:17 +05:30
parent 103b3bf6c9
commit 9685e768fa
3 changed files with 15 additions and 12 deletions

View File

@@ -27,7 +27,7 @@ export interface NotificationConsoleComponentProps {
}
interface NotificationConsoleComponentState {
headerStatus: string;
headerStatus: string | undefined;
selectedFilter: string;
allConsoleData: ConsoleData[];
}
@@ -44,7 +44,7 @@ export class NotificationConsoleComponent extends React.Component<
{ key: "Error", text: "Error" },
];
private headerTimeoutId?: number;
private prevHeaderStatus: string;
private prevHeaderStatus: string | undefined;
private consoleHeaderElement?: HTMLElement;
constructor(props: NotificationConsoleComponentProps) {
@@ -99,7 +99,7 @@ export class NotificationConsoleComponent extends React.Component<
<div
className="notificationConsoleHeader"
id="notificationConsoleHeader"
ref={this.setElememntRef}
ref={this.setElememntRef as React.LegacyRef<HTMLDivElement>}
onClick={() => this.expandCollapseConsole()}
onKeyDown={(event: React.KeyboardEvent<HTMLDivElement>) => this.onExpandCollapseKeyPress(event)}
tabIndex={0}
@@ -150,7 +150,7 @@ export class NotificationConsoleComponent extends React.Component<
role="combobox"
selectedKey={this.state.selectedFilter}
options={NotificationConsoleComponent.FilterOptions}
onChange={this.onFilterSelected.bind(this)}
onChange={() => this.onFilterSelected.bind(this)}
aria-labelledby="consoleFilterLabel"
aria-label={this.state.selectedFilter}
/>
@@ -210,12 +210,12 @@ export class NotificationConsoleComponent extends React.Component<
));
}
private onFilterSelected = (event: React.ChangeEvent<HTMLSelectElement>, option: IDropdownOption): void => {
private onFilterSelected = (option: IDropdownOption): void => {
this.setState({ selectedFilter: String(option.key) });
};
private getFilteredConsoleData(): ConsoleData[] {
let filterType: ConsoleDataType;
let filterType: ConsoleDataType | undefined;
switch (this.state.selectedFilter) {
case "In Progress":
@@ -308,7 +308,8 @@ const PrPreview = (props: { pr: string }) => {
export const NotificationConsole: React.FC = () => {
const setIsExpanded = useNotificationConsole((state) => state.setIsExpanded);
const isExpanded = useNotificationConsole((state) => state.isExpanded);
const consoleData = useNotificationConsole((state) => state.consoleData);
//eslint-disable-next-line
const consoleData = useNotificationConsole((state) => state.consoleData!);
const inProgressConsoleDataIdToBeDeleted = useNotificationConsole(
(state) => state.inProgressConsoleDataIdToBeDeleted
);

View File

@@ -1,4 +1,4 @@
import { Panel, PanelType, ChoiceGroup } from "@fluentui/react";
import { ChoiceGroup, Panel, PanelType } from "@fluentui/react";
import * as React from "react";
import { useDirectories } from "../../../hooks/useDirectories";
@@ -7,7 +7,7 @@ interface Props {
dismissPanel: () => void;
tenantId: string;
armToken: string;
switchTenant: (tenantId: string) => void;
switchTenant: (tenantId: string | undefined) => void;
}
export const DirectoryPickerPanel: React.FunctionComponent<Props> = ({
@@ -29,8 +29,8 @@ export const DirectoryPickerPanel: React.FunctionComponent<Props> = ({
<ChoiceGroup
options={directories.map((dir) => ({ key: dir.tenantId, text: `${dir.displayName} (${dir.tenantId})` }))}
selectedKey={tenantId}
onChange={(event, option) => {
switchTenant(option.key);
onChange={(_event, option) => {
switchTenant(option?.key);
dismissPanel();
}}
/>

View File

@@ -134,7 +134,9 @@
"./src/quickstart.ts",
"./src/setupTests.ts",
"./src/userContext.test.ts",
"src/Common/EntityValue.tsx"
"src/Common/EntityValue.tsx",
"./src/Platform/Hosted/Components/DirectoryPickerPanel.tsx",
"./src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx"
],
"include": [
"src/CellOutputViewer/transforms/**/*",