Skip to content

Commit

Permalink
Release: v4.1.2 (#558)
Browse files Browse the repository at this point in the history
* shows message to direct users to the full graph explorer

* hides the auth tab in try it

* add function to delete items in bulk from storage

* enables removal of bulk items from state

* adds functionality to remove items in bulk from UI

* changes text to get more features

* increases padding between spinner and message

* disables query sharing from the try-it experience

* disables response expansion in try it

* prevents response flickering after version change

* attempts to fix sign in errors in edge

* abstracts the create share link functionality

* appends created share link to the try-it full experience url

* renames query to shareableLink

* reduces code into one-liner

* renames action to be triggered

* sets the production url as the share location

* adds dialog to confirm deletion

* fixes linting error

* stops showing authentication text when minimised

* adds localisation for history delete

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* Check for instumentation key

* Fix prop errors

* Refactor getInstrumentationKey

* Remove unused variable

* increases spacing in profile to show names properly

* changes wording and colour on info bar

* shares link with authentication token

* Sanitise url

* commit translated contents

* adds the language to the share liink

* commit translated contents

* replaces access token with email address in share link

* adds a dialog to prompt mismatched users to login

* commit translated contents

* commit translated contents

* commit translated contents

* renames auth tab and snippets tabs

* improves display of auth token

* renames the Officedev link

* adds modify permissions labelling

* changes naming styles to sentence case

* changes wording on delete history feature

* adds tooltip message to share query and expand response button

* adds a close button to expanded response

* commit translated contents

* fixes re-rendering problems on query response

* Experiment: Check if a user can switch context without logging in

* shows message instead of components when history items are missing

* Fix lint errors

* commit translated contents

* commit translated contents

* commit translated contents

* Ask user to sign in if no session id

* Asks user to log in if they do not have a session id

* changes implementation from using an email to a session id

* adds the language to the share link

* commit translated contents

* checks authentication status before creating link

* adds the category to filters in the sidebar

* bumps version to 4.0.5

* commit translated contents

* commit translated contents

* commit translated contents

* adds tests for sample url generation

* adds checks to url generation steps

* utilises the parseUrl function for consistency

* prevents fetching of scopes if url is invalid

* fixes permissions error when url invalid

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* Get instrumentation key from window object

* Use dot instead of string

* refactors showProfile logic to show correct profile

* enhance vertical alignment

* handles errors in catch statements; line spacing improvements

* fixes faulty url encoding in the url

* only show get requests - anonymous try-it

* prepares march 17 2020 release

* Bump acorn from 5.7.3 to 5.7.4

Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](acornjs/acorn@5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <support@github.com>

* shows long endpoints

* increases padding in search texts

* give context to the search place holder

* moves files to feature folders

* enables headers scrolling

* remove cartoon references

* adds icons to pivot items

* displays icons only when on mobile view

* adds  an authentication required icon

* displays tip after 403 error

* change header names and add them to localisation

* adds descriptive text to permissions tab

* remove har as a property of Ihistory item

* export query

* exports bulk items

* change modify permissions message

* add aria controls to localization; hide icon when logged in

* append category name to exported history item

* change the privacy statement layout and words

* change empty access token wording

* adds a descriptive phrase below the samples tab

* fix linting errors

* adds headers tp share query link

* refactor sample headers to display shared headers

* fix linting errors

* remove request headers reducers tests

* change default value

* use autolayout grids

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* fixes enter key press not running new query

* add tooltips to the pivot items

* add tooltip to request pivot items

* fix linting errors

* bump to v4.1.0

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* Fix: align try it scroll bars (#478)

* Feature: list all permissions (#477)

* change samples endpoint

* creates a new setting to handle permissions

* changes permission to allow panel view and tab view

* allow consent of multiple items at a go

* enhance action creator to take state's url

* enhance permissions hooks to enable dispatch fetchScopes

* perform search when sample url changes

* change snippets to use state devX api url

* fix failing test

* fix liniting errors

* subscribe permissions to selected verb

* move consent function to action creator for reusability

* displays the permissions in order when in the panel

* adds sorting tests

* remove bulk permissions consent

* create groups to categorise permissions

* convert to class component :-(

* select multiiple permissions for consent

* accessibility edits

* Improve messaging

* display message of empty permissions

* use object destructuring

* change settings class component to hooks to fix close/reopen bug

* Feature: Display blue dot present adaptive cards (#493)

* create blue dot on tab

* abstract adaptive cards lookup function

* display dot on adaptive cards title when card template is present

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* Fix: responsive views (#496)

* add app sections to make app.tsx more readable

* treat screens with width less than 992px as mobile screens
At point 992 is where the screen breaks

* Fix: provide account choice on sign in (#497)

* commit translated contents

* Fix: Share query errors (#501)

* fixes header undefined error when sharing link

* add null check for headers passed from url

* Fix: Stop Infinite spinning when login fails (#492)

* stop infinite spinning and display error

* add status text to localisation

* fix failing internationalization

* FIx: Build static assets for master & dev (#498)

* Build static assets for master & dev

* Build prod assets with prod client id

* Fix typo

* Fix typo in yml

* Fix: try it logout (#502)

* displays authentication section

* enables logging out using a popup

* add try it check when displaying authentication

* Feature: add locale to headers devxapi (#500)

* add accept-language to queries to the devxApi

* remove localisation from sample queries

* add placeholder texts to localisation

* reuse locale code to enable url overriding

* add reference to new translation files

* delete unused translation files

* add try catch to sample queries fetch

* Fix: Remove redundant authentication (#518)

* Task: responsive sidebar (#519)

* bump breakpoint to 1260px

* remove comments

* Task: translate key value pair (#517)

* Task: Remove opt out toggle (#516)

* remove opt out toggle

* remove opt out function

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* commit translated contents

* Task: GA bug bash (#526)

* add tooltip on the sample query name

* add current locale to all links

* fix permissions column misalignment

* fix permissions tooltip mismatch

* Fix: sidebar http methods (#527)

* fixes unresponsive method badge

* adds horizontal scrolling to the sidebar

* Fix: Portuguese locale not loading (#529)

* Task: refine permission column sizes (#528)

* Fix: Misaligned sidebar elements (#530)

* Task: localised login popup (#534)

* Task: display settings icon mobile view (#535)

* display the auth and settings on sidebar in mobile view

* align auth to the left instead of indented

* only show adaptive card after response is set

* Release: 4.1.1 (#536)

* bump to version 4.1.1

* create build files for 4.1.1

* Fix: remove duplicate content type header (#537)

* dispatch thrown response

* remove content type header

* add comment on the reliance on the graph client

* bump version to 4.1.2

* create build files

Co-authored-by: Japheth Obala <japhethobalak@gmail.com>
Co-authored-by: olprod <olprod@microsoft.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
4 people committed May 28, 2020
1 parent c896880 commit 233a6ae
Show file tree
Hide file tree
Showing 73 changed files with 1,352 additions and 2,665 deletions.
10 changes: 9 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ steps:
- script: |
npm run build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
env:
REACT_APP_CLIENT_ID: $(REACT_APP_STAGING_CLIENT_ID)
displayName: 'Build staging assets'
displayName: 'Build static assets for staging'
- script: |
npm run build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
env:
REACT_APP_CLIENT_ID: $(REACT_APP_PROD_CLIENT_ID)
displayName: 'Build static assets for prod'
- task: PublishCodeCoverageResults@1
inputs:
Expand Down
2 changes: 1 addition & 1 deletion build/asset-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"index.html": "/index.html",
"json.worker.js": "/json.worker.js",
"json.worker.js.map": "/json.worker.js.map",
"precache-manifest.09207e68141989280db47ff10042ddd8.js": "/precache-manifest.09207e68141989280db47ff10042ddd8.js",
"precache-manifest.6b3ae80a3dbb52db4cc0a9cb32ba8421.js": "/precache-manifest.6b3ae80a3dbb52db4cc0a9cb32ba8421.js",
"service-worker.js": "/service-worker.js"
}
22 changes: 22 additions & 0 deletions build/precache-manifest.6b3ae80a3dbb52db4cc0a9cb32ba8421.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
self.__precacheManifest = [
{
"revision": "eff8b10bfc942d1fc21a",
"url": "/static/js/graph-explorer-v2.js"
},
{
"revision": "eff8b10bfc942d1fc21a",
"url": "/static/css/graph-explorer-v2.css"
},
{
"revision": "dabb6794539dcffa626977241f045733",
"url": "/json.worker.js"
},
{
"revision": "c3777c4227ca9d1a9defdec7a4629805",
"url": "/index.html"
},
{
"revision": "28fb5d03fade2944cf2e027e36c7517b",
"url": "/editor.worker.js"
}
];
2 changes: 1 addition & 1 deletion build/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js");

importScripts(
"/precache-manifest.09207e68141989280db47ff10042ddd8.js"
"/precache-manifest.6b3ae80a3dbb52db4cc0a9cb32ba8421.js"
);

workbox.clientsClaim();
Expand Down
20 changes: 10 additions & 10 deletions build/static/js/graph-explorer-v2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/static/js/graph-explorer-v2.js.map

Large diffs are not rendered by default.

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": "4.1.0",
"version": "4.1.2",
"private": true,
"dependencies": {
"@babel/core": "7.2.2",
Expand Down
35 changes: 1 addition & 34 deletions src/app/services/actions/adaptive-cards-action-creator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as AdaptiveCardsTemplateAPI from 'adaptivecards-templating';
import { IAction } from '../../../types/action';
import { IQuery } from '../../../types/query-runner';
import { parseSampleUrl } from '../../utils/sample-url-generation';
import { lookupTemplate } from '../../utils/adaptive-cards-lookup';
import {
FETCH_ADAPTIVE_CARD_ERROR ,
FETCH_ADAPTIVE_CARD_PENDING,
Expand Down Expand Up @@ -70,36 +70,3 @@ export function getAdaptiveCard(payload: string, sampleQuery: IQuery): Function
});
};
}

function lookupTemplate(sampleQuery: IQuery): string {
if (sampleQuery) {
const { requestUrl, search } = parseSampleUrl(sampleQuery.sampleUrl);
const query = requestUrl + search;
// find if the url of the request has a template mapped to it
for (const templateMapKey in templateMap) {
if (templateMap.hasOwnProperty(templateMapKey)) {
// check if the template matches a specific pattern while ignoring case
const isMatch = new RegExp(templateMapKey + '$', 'i').test('/' + query);
if (isMatch) {
return templateMap[templateMapKey];
}
}
}
}
return '';
}

const templateMap: any = {
'/groups' : 'Groups.json',
'/me': 'Profile.json',
'/me/directReports' : 'Users.json',
'/me/drive/root/children': 'Files.json',
'/me/drive/recent' : 'Files.json',
'/me/manager': 'Profile.json',
'/me/memberOf' : 'Groups.json',
'/me/messages' : 'Messages.json',
'/sites/([^/?]+)' : 'Site.json',
'/sites/([^/?]+)/sites' : 'Sites.json',
'/users' : 'Users.json',
'/users/([^/?]+)' : 'Profile.json'
};
4 changes: 3 additions & 1 deletion src/app/services/actions/auth-action-creators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IAction } from '../../../types/action';
import { Mode } from '../../../types/enums';
import { logOut } from '../graph-client/msal-service';
import { logOut, logOutPopUp } from '../graph-client/msal-service';
import { GET_AUTH_TOKEN_SUCCESS, GET_CONSENTED_SCOPES_SUCCESS, LOGOUT_SUCCESS } from '../redux-constants';

export function getAuthTokenSuccess(response: string): IAction {
Expand Down Expand Up @@ -28,6 +28,8 @@ export function signOut() {
const { graphExplorerMode } = getState();
if (graphExplorerMode === Mode.Complete) {
logOut();
} else {
logOutPopUp();
}
dispatch(signOutSuccess(''));
};
Expand Down
88 changes: 54 additions & 34 deletions src/app/services/actions/permissions-action-creator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { geLocale } from '../../../appLocale';
import { IAction } from '../../../types/action';
import { IQuery } from '../../../types/query-runner';
import { IRequestOptions } from '../../../types/request';
import { FETCH_SCOPES_ERROR, FETCH_SCOPES_SUCCESS } from '../redux-constants';
import { parseSampleUrl } from '../../utils/sample-url-generation';
import { acquireNewAccessToken } from '../graph-client/msal-service';
import { FETCH_SCOPES_ERROR, FETCH_SCOPES_PENDING, FETCH_SCOPES_SUCCESS } from '../redux-constants';
import { getAuthTokenSuccess, getConsentedScopesSuccess } from './auth-action-creators';

export function fetchScopesSuccess(response: object): IAction {
return {
Expand All @@ -9,47 +14,62 @@ export function fetchScopesSuccess(response: object): IAction {
};
}

export function fetchScopesPending(): any {
return {
type: FETCH_SCOPES_PENDING,
};
}

export function fetchScopesError(response: object): IAction {
return {
type: FETCH_SCOPES_ERROR,
response,
};
}

export function fetchScopes(): Function {
export function fetchScopes(query?: IQuery): Function {
return async (dispatch: Function, getState: Function) => {
const { sampleQuery: { sampleUrl, selectedVerb } } = getState();
const urlObject: URL = new URL(sampleUrl);
const createdAt = new Date().toISOString();
// remove the prefix i.e. beta or v1.0 and any possible extra '/' character at the end
const requestUrl = urlObject.pathname.substr(5).replace(/\/$/, '');
const permissionsUrl = 'https://graphexplorerapi.azurewebsites.net/api/GraphExplorerPermissions?requesturl=' +
requestUrl + '&method=' + selectedVerb;

const headers = {
'Content-Type': 'application/json',
};

const options: IRequestOptions = { headers };

return fetch(permissionsUrl, options)
.then(res => res.json())
.then(res => {
if (res.error) {
throw (res.error);
try {
const { devxApi } = getState();
let permissionsUrl = `${devxApi}/permissions`;

if (query) {
const { requestUrl, sampleUrl } = parseSampleUrl(query.sampleUrl);

if (!sampleUrl) {
throw new Error('url is invalid');
}
dispatch(fetchScopesSuccess(res));
})
.catch(() => {
const duration = (new Date()).getTime() - new Date(createdAt).getTime();
const response = {
/* Return 'Forbidden' regardless of error, as this was a
permission-centric operation with regards to user context */
statusText: 'Forbidden',
status: '403',
duration
};
return dispatch(fetchScopesError(response));
});

permissionsUrl = `${permissionsUrl}?requesturl=/${requestUrl}&method=${query.selectedVerb}`;
}

const headers = {
'Content-Type': 'application/json',
'Accept-Language': geLocale
};

const options: IRequestOptions = { headers };

dispatch(fetchScopesPending());

const response = await fetch(permissionsUrl, options);
if (response.ok) {
const scopes = await response.json();
return dispatch(fetchScopesSuccess(scopes));
}
throw (response);
} catch (error) {
return dispatch(fetchScopesError(error));
}
};
}

export function consentToScopes(scopes: string[]): Function {
return async (dispatch: Function) => {
const authResponse = await acquireNewAccessToken(scopes);
if (authResponse && authResponse.accessToken) {
dispatch(getAuthTokenSuccess(authResponse.accessToken));
dispatch(getConsentedScopesSuccess(authResponse.scopes));
}
};
}
16 changes: 8 additions & 8 deletions src/app/services/actions/query-action-creator-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ export async function anonymousRequest(dispatch: Function, query: IQuery) {
const escapedUrl = encodeURIComponent(query.sampleUrl);
const graphUrl = `https://proxy.apisandbox.msdn.microsoft.com/svc?url=${escapedUrl}`;
const sampleHeaders: any = {};

if (query.sampleHeaders) {
if (query.sampleHeaders && query.sampleHeaders.length > 0) {
query.sampleHeaders.forEach(header => {
if (header.name !== '' && header.value !== '') {
sampleHeaders[header.name] = header.value;
}
sampleHeaders[header.name] = header.value;
});
}

Expand Down Expand Up @@ -101,11 +98,14 @@ const makeRequest = (httpVerb: string, scopes: string[]): Function => {
const sampleHeaders: any = {};
sampleHeaders.SdkVersion = 'GraphExplorer/4.0';

if (query.sampleHeaders) {
if (query.sampleHeaders && query.sampleHeaders.length > 0) {
query.sampleHeaders.forEach(header => {
if (header.name !== '' && header.value !== '') {
sampleHeaders[header.name] = header.value;

// We are relying on the graph client to set the content type header.
if (header.name.toLowerCase() === 'content-type') {
return;
}
sampleHeaders[header.name] = header.value;
});
}

Expand Down
29 changes: 14 additions & 15 deletions src/app/services/actions/samples-action-creators.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { geLocale } from '../../../appLocale';
import { IAction } from '../../../types/action';
import { IRequestOptions } from '../../../types/request';
import { SAMPLES_FETCH_ERROR, SAMPLES_FETCH_PENDING, SAMPLES_FETCH_SUCCESS } from '../redux-constants';
Expand All @@ -24,29 +25,27 @@ export function fetchSamplesPending(): any {

export function fetchSamples(): Function {
return async (dispatch: Function, getState: Function) => {
const devxApi = getState().devxApi;
const samplesUrl = `${devxApi}/api/GraphExplorerSamples`;
const { devxApi } = getState();
const samplesUrl = `${devxApi}/samples`;

const headers = {
'Content-Type': 'application/json',
'Accept-Language': geLocale
};

const options: IRequestOptions = { headers };

dispatch(fetchSamplesPending());

return fetch(samplesUrl, options)
.then(res => res.json())
.then(res => {
if (res.error) {
throw (res.error);
}
dispatch(fetchSamplesSuccess(res.sampleQueries));
return res.products;
})
.catch(error => {
dispatch(fetchSamplesError(error));
});

try {
const response = await fetch(samplesUrl, options);
if (!response.ok) {
throw response;
}
const res = await response.json();
return dispatch(fetchSamplesSuccess(res.sampleQueries));
} catch (error) {
return dispatch(fetchSamplesError({ error }));
}
};
}
Loading

0 comments on commit 233a6ae

Please sign in to comment.