Skip to content

Commit

Permalink
Removes 'Access Query Parameters' from the resources' context menu (#…
Browse files Browse the repository at this point in the history
…1338)

* remov 'Access Query Params' from context menu

* restore resources tab for review

* remove unused enum type

* remove unused code on the ResourceExplorer file
  • Loading branch information
Onokaev authored Jan 19, 2022
1 parent a32fff6 commit e4a7cd6
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 47 deletions.
38 changes: 1 addition & 37 deletions src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -48,9 +46,6 @@ const unstyledResourceExplorer = (props: any) => {
}, [filteredPayload.children.length]);

const [isolated, setIsolated] = useState<any>(null);
const [panelIsOpen, setPanelIsOpen] = useState<boolean>(false);
const [panelContext, setPanelContext] = useState<any>(null);
const [panelHeaderText, setPanelHeaderText] = useState('');
const [searchText, setSearchText] = useState<string>('');

const performSearch = (needle: string, haystack: IResource[]) => {
Expand Down Expand Up @@ -154,31 +149,13 @@ const unstyledResourceExplorer = (props: any) => {
setItems(createList(filtered.children, version));
}

const dismissPanel = () => {
setPanelIsOpen(!panelIsOpen);
setPanelContext(null);
}

const clickLink = (ev?: React.MouseEvent<HTMLElement>) => {
ev!.preventDefault();
}

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
});
}
}

Expand Down Expand Up @@ -256,19 +233,6 @@ const unstyledResourceExplorer = (props: any) => {
}}
onLinkClick={clickLink}
className={classes.queryList} />

<Panel
isOpen={panelIsOpen}
onDismiss={dismissPanel}
closeButtonAriaLabel='Close'
headerText={panelHeaderText}
type={PanelType.medium}
>
{panelContext && panelContext.activity === 'show-query-parameters' && <QueryParameters
context={panelContext.context}
version={version}
/>}
</Panel>
</section >
);
}
Expand Down
7 changes: 0 additions & 7 deletions src/app/views/sidebar/resource-explorer/ResourceLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/telemetry/component-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/types/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

0 comments on commit e4a7cd6

Please sign in to comment.