Skip to content

Commit

Permalink
Chore (release): 6.3.0 (#2015)
Browse files Browse the repository at this point in the history
* Disable shrinking of the query textbox (#1995)

* Fix: Update Forbidden-403 message (#1997)

* Fix: Persist snippet tabs (#1958)

* Set sample url regardless of version (#2004)

* Fix: Return undefined when account type is not established (#2000)

* Revert "Feature: Add PHP Snippets tab. (#1923)" (#2012)

* Bump version to 6.3.0
  • Loading branch information
ElinorW authored Aug 10, 2022
1 parent 97ca0df commit f695350
Show file tree
Hide file tree
Showing 22 changed files with 113 additions and 89 deletions.
33 changes: 10 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graph-explorer-v2",
"version": "6.2.0",
"version": "6.3.0",
"private": true,
"dependencies": {
"@augloop/types-core": "file:packages/types-core-2.16.189.tgz",
Expand Down
19 changes: 8 additions & 11 deletions src/app/services/actions/profile-action-creators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function getBetaProfile(): Promise<IBetaProfile> {
const profileType = getProfileType(userInfo);
return { ageGroup, profileType };
} catch (error) {
return { ageGroup: 0, profileType: ACCOUNT_TYPE.MSA };
return { ageGroup: 0, profileType: ACCOUNT_TYPE.UNDEFINED };
}
}

Expand Down Expand Up @@ -151,17 +151,14 @@ export async function getProfileResponse(): Promise<IProfileResponse> {
}

export async function getTenantInfo(profileType: ACCOUNT_TYPE) {
if(profileType===ACCOUNT_TYPE.AAD) {
try{
query.sampleUrl = USER_ORGANIZATION_URL;
const { userInfo: tenant } = await getProfileResponse();
return tenant.value[0]?.displayName;
} catch (error: any) {
return '';
}
}
if(profileType===ACCOUNT_TYPE.MSA) {
return 'Personal';
}
return '';
try{
query.sampleUrl = USER_ORGANIZATION_URL;
const { userInfo: tenant } = await getProfileResponse();
return tenant.value[0]?.displayName;
} catch (error: any) {
return '';
}
}
7 changes: 2 additions & 5 deletions src/app/services/actions/query-action-creator-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@ function createAuthenticatedRequest(
authProvider,
msalAuthOptions
)
const graphRequest = GraphClient.getInstance()
return GraphClient.getInstance()
.api(encodeHashCharacters(query))
.middlewareOptions([middlewareOptions])
.headers(sampleHeaders)
.responseType(ResponseType.RAW);

return graphRequest;
}

export function makeGraphRequest(scopes: string[]): Function {
Expand Down Expand Up @@ -212,8 +210,7 @@ export async function generateResponseDownloadUrl(
if (fileContents) {
const buffer = await response.arrayBuffer();
const blob = new Blob([buffer], { type: contentType });
const downloadUrl = URL.createObjectURL(blob);
return downloadUrl;
return URL.createObjectURL(blob);
}
} catch (error) {
return null;
Expand Down
10 changes: 9 additions & 1 deletion src/app/services/actions/snippet-action-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { parseSampleUrl } from '../../utils/sample-url-generation';
import {
GET_SNIPPET_ERROR,
GET_SNIPPET_PENDING,
GET_SNIPPET_SUCCESS
GET_SNIPPET_SUCCESS,
SET_SNIPPET_TAB_SUCCESS
} from '../redux-constants';

export function getSnippetSuccess(response: string): IAction {
Expand All @@ -28,6 +29,13 @@ export function getSnippetPending(): any {
};
}

export function setSnippetTabSuccess(response: string): any {
return {
type: SET_SNIPPET_TAB_SUCCESS,
response
}
}

export function getSnippet(language: string): Function {
return async (dispatch: Function, getState: Function) => {
const { devxApi, sampleQuery } = getState();
Expand Down
16 changes: 14 additions & 2 deletions src/app/services/reducers/snippet-reducer.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,45 @@
import { IAction } from '../../../types/action';
import { GET_SNIPPET_ERROR, GET_SNIPPET_PENDING, GET_SNIPPET_SUCCESS } from '../redux-constants';
import {
GET_SNIPPET_ERROR, GET_SNIPPET_PENDING, GET_SNIPPET_SUCCESS,
SET_SNIPPET_TAB_SUCCESS
} from '../redux-constants';
import { ISnippet } from '../../../types/snippets';

const initialState: ISnippet = {
pending: false,
data: {},
error: null
error: null,
snippetTab: 'csharp'
};

export function snippets(state = initialState, action: IAction): any {
switch (action.type) {
case GET_SNIPPET_SUCCESS:
return {
...state,
pending: false,
data: action.response as object,
error: null
};
case GET_SNIPPET_ERROR:
return {
...state,
pending: false,
data: null,
error: action.response as object
};
case GET_SNIPPET_PENDING:
return {
...state,
pending: true,
data: null,
error: null
};
case SET_SNIPPET_TAB_SUCCESS:
return {
...state,
snippetTab: action.response
}
default:
return state;
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/services/redux-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ export const GET_POLICY_ERROR = 'GET_POLICY_ERROR';
export const GET_POLICY_PENDING = 'GET_POLICY_PENDING';
export const RESOURCEPATHS_ADD_SUCCESS = 'RESOURCEPATHS_ADD_SUCCESS';
export const RESOURCEPATHS_DELETE_SUCCESS = 'RESOURCEPATHS_DELETE_SUCCESS';
export const BULK_ADD_HISTORY_ITEMS_SUCCESS = 'BULK_ADD_HISTORY_ITEMS_SUCCESS'
export const BULK_ADD_HISTORY_ITEMS_SUCCESS = 'BULK_ADD_HISTORY_ITEMS_SUCCESS';
export const SET_SNIPPET_TAB_SUCCESS = 'SET_SNIPPET_TAB_SUCCESS';
6 changes: 3 additions & 3 deletions src/app/views/query-response/QueryResponse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { sanitizeQueryUrl } from '../../utils/query-url-sanitization';
import { expandResponseArea } from '../../services/actions/response-expanded-action-creator';
import { translateMessage } from '../../utils/translate-messages';
import { copy } from '../common/copy';
import { getPivotItems, onPivotItemClick } from './pivot-items/pivot-items';
import { GetPivotItems, onPivotItemClick } from './pivot-items/pivot-items';
import './query-response.scss';
import { IRootState } from '../../../types/root';
import { CopyButton } from '../common/copy/CopyButton';
Expand Down Expand Up @@ -124,7 +124,7 @@ const QueryResponse = (props: IQueryResponseProps) => {
className={'pivot-response'}
selectedKey={currentTab}
>
{getPivotItems()}
{GetPivotItems()}
<PivotItem
headerText='Expand'
key='expand'
Expand Down Expand Up @@ -158,7 +158,7 @@ const QueryResponse = (props: IQueryResponseProps) => {
<Pivot className='pivot-response'
onLinkClick={(pivotItem) => onModalPivotItemClicked(pivotItem)}
selectedKey={currentTab}>
{getPivotItems()}
{GetPivotItems()}
</Pivot>
</Modal>
}
Expand Down
3 changes: 1 addition & 2 deletions src/app/views/query-response/pivot-items/pivot-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { queryResponseStyles } from '../queryResponse.styles';
import { Response } from '../response';
import { Snippets } from '../snippets';

export const getPivotItems = () => {
export const GetPivotItems = () => {

const { graphExplorerMode: mode, sampleQuery, graphResponse: { body } } = useSelector((state: IRootState) => state);

Expand Down Expand Up @@ -90,7 +90,6 @@ export const getPivotItems = () => {
<div id={'response-headers-tab'}><ResponseHeaders/></div>
</PivotItem>
];

if (mode === Mode.Complete) {
pivotItems.push(
<PivotItem
Expand Down
22 changes: 20 additions & 2 deletions src/app/views/query-response/snippets/Snippets.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { Pivot } from '@fluentui/react';
import { Pivot, PivotItem } from '@fluentui/react';
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';

import { componentNames, telemetry } from '../../../../telemetry';
import { IRootState } from '../../../../types/root';
import { setSnippetTabSuccess } from '../../../services/actions/snippet-action-creator';
import { renderSnippets } from './snippets-helper';

function GetSnippets() {
const dispatch = useDispatch();
const { snippets } = useSelector((state: IRootState) => state);
const supportedLanguages = {
'CSharp': {
sdkDownloadLink: 'https://aka.ms/csharpsdk',
Expand All @@ -28,7 +33,20 @@ function GetSnippets() {
}
};

return <Pivot>{renderSnippets(supportedLanguages)}</Pivot>;
const handlePivotItemClick = (pivotItem?: PivotItem) => {
if (!pivotItem) {
return;
}
dispatch(setSnippetTabSuccess(pivotItem.props.itemKey!))
}

return <Pivot
className={'pivot-response'}
selectedKey={snippets.snippetTab}
onLinkClick={handlePivotItemClick}
>
{renderSnippets(supportedLanguages)}
</Pivot>;
}
export const Snippets = telemetry.trackReactComponent(
GetSnippets,
Expand Down
1 change: 1 addition & 0 deletions src/app/views/query-response/snippets/snippets-helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function renderSnippets(supportedLanguages: ISupportedLanguages) {
headerButtonProps={{
'aria-controls': `${language}-tab`
}}
itemKey={language}
>
<Snippet language={language} snippetInfo={supportedLanguages} />
</PivotItem>
Expand Down
8 changes: 7 additions & 1 deletion src/app/views/query-runner/QueryRunner.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export const queryRunnerStyles = () => {
verbSelector: {
title: {
paddingRight: 0,
color: '#ffffff !important'
color: '#ffffff !important',
background: ''
},
caretDown: {
color: '#ffffff !important'
Expand All @@ -15,6 +16,11 @@ export const queryRunnerStyles = () => {
border: '1px solid',
width: '100%'
}
},
queryButtonStyles: {
root: {
flexBasis: '75px'
}
}
};
};
Loading

0 comments on commit f695350

Please sign in to comment.