From e4a7cd6d02e1a3fe100598f52c6c413d8fb827c2 Mon Sep 17 00:00:00 2001 From: EvansA Date: Wed, 19 Jan 2022 12:39:43 +0300 Subject: [PATCH] Removes 'Access Query Parameters' from the resources' context menu (#1338) * remov 'Access Query Params' from context menu * restore resources tab for review * remove unused enum type * remove unused code on the ResourceExplorer file --- .../resource-explorer/ResourceExplorer.tsx | 38 +------------------ .../resource-explorer/ResourceLink.tsx | 7 ---- src/telemetry/component-names.ts | 1 - src/types/resources.ts | 3 +- 4 files changed, 2 insertions(+), 47 deletions(-) diff --git a/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx b/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx index 149ef555e..6a2f764ff 100644 --- a/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx +++ b/src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx @@ -1,7 +1,6 @@ import { Breadcrumb, ChoiceGroup, DefaultButton, - IBreadcrumbItem, IChoiceGroupOption, INavLinkGroup, Label, Nav, Panel, - PanelType, SearchBox, Spinner, SpinnerSize, Stack, styled + IBreadcrumbItem, IChoiceGroupOption, INavLinkGroup, Label, Nav, SearchBox, Spinner, SpinnerSize, Stack, styled } from '@fluentui/react'; import React, { useEffect, useState } from 'react'; import { FormattedMessage } from 'react-intl'; @@ -15,7 +14,6 @@ import { translateMessage } from '../../../utils/translate-messages'; import { classNames } from '../../classnames'; import { sidebarStyles } from '../Sidebar.styles'; import CommandOptions from './CommandOptions'; -import QueryParameters from './panels/QueryParameters'; import { createList, getCurrentTree, getResourcePaths, @@ -48,9 +46,6 @@ const unstyledResourceExplorer = (props: any) => { }, [filteredPayload.children.length]); const [isolated, setIsolated] = useState(null); - const [panelIsOpen, setPanelIsOpen] = useState(false); - const [panelContext, setPanelContext] = useState(null); - const [panelHeaderText, setPanelHeaderText] = useState(''); const [searchText, setSearchText] = useState(''); const performSearch = (needle: string, haystack: IResource[]) => { @@ -154,11 +149,6 @@ const unstyledResourceExplorer = (props: any) => { setItems(createList(filtered.children, version)); } - const dismissPanel = () => { - setPanelIsOpen(!panelIsOpen); - setPanelContext(null); - } - const clickLink = (ev?: React.MouseEvent) => { ev!.preventDefault(); } @@ -166,19 +156,6 @@ const unstyledResourceExplorer = (props: any) => { const resourceOptionSelected = (activity: string, context: any) => { if (activity === ResourceOptions.ADD_TO_COLLECTION) { addToCollection(context); - } else { - const requestUrl = getUrlFromLink(context); - setPanelIsOpen(true); - setPanelContext({ - activity, - context - }); - setPanelHeaderText(`${requestUrl}`); - telemetry.trackEvent(eventTypes.LISTITEM_CLICK_EVENT, - { - ComponentName: componentNames.RESOURCES_QUERY_PARAMETERS_LIST_ITEM, - ResourcePath: requestUrl - }); } } @@ -256,19 +233,6 @@ const unstyledResourceExplorer = (props: any) => { }} onLinkClick={clickLink} className={classes.queryList} /> - - - {panelContext && panelContext.activity === 'show-query-parameters' && } - ); } diff --git a/src/app/views/sidebar/resource-explorer/ResourceLink.tsx b/src/app/views/sidebar/resource-explorer/ResourceLink.tsx index bd075dae3..0fa1ea3d6 100644 --- a/src/app/views/sidebar/resource-explorer/ResourceLink.tsx +++ b/src/app/views/sidebar/resource-explorer/ResourceLink.tsx @@ -106,13 +106,6 @@ const ResourceLink = (props: IResourceLinkProps) => { } if (resourceLink.type === 'path' || resourceLink.type === 'function') { - menuItems.push( - { - key: ResourceOptions.SHOW_QUERY_PARAMETERS, - text: translateMessage('Access query parameters'), - itemType: ContextualMenuItemType.Normal, - onClick: () => props.resourceOptionSelected(ResourceOptions.SHOW_QUERY_PARAMETERS, resourceLink) - }); menuItems.push( { key: ResourceOptions.ADD_TO_COLLECTION, diff --git a/src/telemetry/component-names.ts b/src/telemetry/component-names.ts index 5d168fbd0..06dc75321 100644 --- a/src/telemetry/component-names.ts +++ b/src/telemetry/component-names.ts @@ -23,7 +23,6 @@ export const HISTORY_LIST_ITEM = 'History list item'; export const SAMPLE_QUERY_LIST_ITEM = 'Sample query list item'; export const RESOURCES_SET_QUERY_LIST_ITEM = 'Resources set query list item'; export const RESOURCES_ISOLATE_QUERY_LIST_ITEM = 'Resources isolate query list item'; -export const RESOURCES_QUERY_PARAMETERS_LIST_ITEM ='Resources query parameters list item'; export const ADD_RESOURCE_TO_COLLECTION_LIST_ITEM = 'Add resource to collection list item'; // Tabs diff --git a/src/types/resources.ts b/src/types/resources.ts index df377b35a..6a95c8224 100644 --- a/src/types/resources.ts +++ b/src/types/resources.ts @@ -35,7 +35,6 @@ export interface IResourceLink extends INavLink { } export enum ResourceOptions { - ADD_TO_COLLECTION = 'add-to-collection', - SHOW_QUERY_PARAMETERS = 'show-query-parameters' + ADD_TO_COLLECTION = 'add-to-collection' }