Skip to content

Commit

Permalink
chore(release): 4.3.0 (#852)
Browse files Browse the repository at this point in the history
* Fix: support different content types (#814)

* Feature: Add Adaptive cards  JSON Schema code (#828)

* Feature: samples testing (#833)

* Feature: Adds 'Report an Issue' menu option (#834)

* Feature: clickable links on message bar (#835)

* fix: intermittent create page error (#837)

* Fix: Add 'Maximize sidebar' aria-label (#842)

* Task: upgrade technologies (#844)

* Fix: expand maxWidth allow more humanName chars (#764)

* Fix: autocomplete options not displaying (#847)

* fix: adaptive cards destroy (#848)

* Fix: Graph Explorer link colors (#846)

* Fix: Adaptive cards instrumentation (#849)

* Fix: adjust column width (#850)

* Task: prevent storing access token (#851)

Co-authored-by: jobala <japhethobalak@gmail.com>
Co-authored-by: Charles Wahome <thewahome.cw@gmail.com>
Co-authored-by: OfficeGlobal <47977325+OfficeGlobal@users.noreply.github.com>
Co-authored-by: OfficeGlobal <OfficeGlobal@microsoft.com>
Co-authored-by: Azure Static Web Apps <opensource@microsoft.com>
Co-authored-by: Millicent Achieng <achieng.milli@gmail.com>
Co-authored-by: Sébastien Levert <sebastienlevert@users.noreply.github.com>
Co-authored-by: Ezrqn Kemboi <ezrqnkemboi@gmail.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Joseph Ngugi <jngugi88@gmail.com>
Co-authored-by: Maggie Kimani <maggiekim42@gmail.com>
  • Loading branch information
12 people committed Feb 16, 2021
1 parent 5207e09 commit 32cfa71
Show file tree
Hide file tree
Showing 44 changed files with 4,250 additions and 25,946 deletions.
2 changes: 1 addition & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ module.exports = function (webpackEnv) {
maxChunks: 1,
}),
new MonacoWebpackPlugin({
languages: ['json', 'javascript', 'java', 'objective-c', 'csharp']
languages: ['json', 'javascript', 'java', 'objective-c', 'csharp', 'html']
}),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin(
Expand Down
29,429 changes: 3,715 additions & 25,714 deletions package-lock.json

Large diffs are not rendered by default.

35 changes: 21 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "graph-explorer-v2",
"version": "4.2.0",
"version": "4.3.0",
"private": true,
"dependencies": {
"@babel/core": "7.2.2",
"@babel/core": "7.12.13",
"@babel/eslint-parser": "7.12.13",
"@microsoft/applicationinsights-react-js": "2.3.1",
"@microsoft/applicationinsights-web": "2.3.1",
"@microsoft/microsoft-graph-client": "2.1.0",
Expand All @@ -13,10 +14,9 @@
"adaptivecards": "1.2.3",
"adaptivecards-templating": "1.4.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "9.0.0",
"babel-loader": "8.0.5",
"babel-plugin-named-asset-import": "0.3.1",
"babel-preset-react-app": "7.0.1",
"babel-loader": "8.2.2",
"babel-plugin-named-asset-import": "0.3.7",
"babel-preset-react-app": "10.0.0",
"bfj": "6.1.1",
"bootstrap": "4.3.1",
"case-sensitive-paths-webpack-plugin": "2.2.0",
Expand Down Expand Up @@ -71,7 +71,7 @@
"sass-loader": "7.1.0",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.2.2",
"typescript": "3.3.3",
"typescript": "4.1.5",
"url-loader": "1.1.2",
"webpack": "4.28.3",
"webpack-dev-server": "3.11.0",
Expand Down Expand Up @@ -114,27 +114,34 @@
"@types/redux-logger": "3.0.7",
"@types/redux-mock-store": "1.0.0",
"@types/selenium-webdriver": "4.0.6",
"@typescript-eslint/eslint-plugin": "3.10.1",
"@typescript-eslint/eslint-plugin-tslint": "3.5.0",
"@typescript-eslint/parser": "3.10.1",
"@typescript-eslint/eslint-plugin": "4.15.0",
"@typescript-eslint/eslint-plugin-tslint": "4.15.0",
"@typescript-eslint/parser": "4.15.0",
"axe-core": "3.4.2",
"axe-sarif-converter": "2.3.0",
"axe-webdriverjs": "2.3.0",
"babel-jest": "23.6.0",
"chromedriver": "^84.0.1",
"axios": "0.21.1",
"babel-jest": "26.6.3",
"braces": "2.3.1",
"chromedriver": "^88.0.0",
"enzyme": "3.9.0",
"enzyme-adapter-react-16": "1.9.1",
"eslint": "5.16.0",
"jest-fetch-mock": "2.1.1",
"immer": "8.0.1",
"jest-fetch-mock": "3.0.3",
"node-fetch": "2.6.1",
"node-notifier": "8.0.1",
"react-test-renderer": "16.8.3",
"redux-logger": "3.0.6",
"redux-mock-store": "1.5.3",
"selenium-webdriver": "4.0.0-alpha.7",
"serialize-javascript": "3.1.0",
"standard-version": "8.0.2",
"start-server-and-test": "1.11.7",
"ts-jest": "25.2.0",
"tslint": "5.12.1",
"tslint-config-prettier": "1.18.0",
"tslint-react": "4.0.0"
"tslint-react": "4.0.0",
"yargs-parser": "13.1.2"
}
}
10 changes: 5 additions & 5 deletions src/app/services/actions/auth-action-creators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Mode } from '../../../types/enums';
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 {
export function getAuthTokenSuccess(response: boolean): any {
return {
type: GET_AUTH_TOKEN_SUCCESS,
response,
Expand All @@ -16,7 +16,7 @@ export function getConsentedScopesSuccess(response: string[]): IAction {
};
}

export function signOutSuccess(response: string): IAction {
export function signOutSuccess(response: boolean): any {
return {
type: LOGOUT_SUCCESS,
response,
Expand All @@ -31,12 +31,12 @@ export function signOut() {
} else {
logOutPopUp();
}
dispatch(signOutSuccess(''));
dispatch(signOutSuccess(false));
};
}

export function signIn(token: string) {
return (dispatch: Function) => dispatch(getAuthTokenSuccess(token));
export function signIn() {
return (dispatch: Function) => dispatch(getAuthTokenSuccess(true));
}

export function storeScopes(consentedScopes: string[]) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/actions/autocomplete-action-creators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export function fetchAutocompletePending(): any {

export function fetchAutoCompleteOptions(url: string, version: string): Function {
return async (dispatch: Function, getState: Function) => {
const devxApi = getState().devxApi;
const devxApiUrl = getState().devxApi.baseUrl;
dispatch(fetchAutocompletePending());
const autoOptions = await suggestions.getSuggestions(url, devxApi, version);
const autoOptions = await suggestions.getSuggestions(url, devxApiUrl, version);
if (autoOptions) {
return dispatch(fetchAutocompleteSuccess(autoOptions));
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/services/actions/devxApi-action-creators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IAction } from '../../../types/action';
import { SET_DEVX_API_URL_SUCCESS } from '../redux-constants';

export function setDevxApiUrl(response: string): any {
export function setDevxApiUrl(response: object): IAction {
return {
type: SET_DEVX_API_URL_SUCCESS,
response,
Expand Down
9 changes: 7 additions & 2 deletions src/app/services/actions/permissions-action-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export function fetchScopes(query?: IQuery): Function {
return async (dispatch: Function, getState: Function) => {
try {
const { devxApi } = getState();
let permissionsUrl = `${devxApi}/permissions`;
let permissionsUrl = `${devxApi.baseUrl}/permissions`;

let hasUrl = false; // whether permissions are for a specific url

if (query) {
Expand All @@ -49,6 +50,10 @@ export function fetchScopes(query?: IQuery): Function {
hasUrl = true;
}

if (devxApi.parameters) {
permissionsUrl = `${permissionsUrl}${query ? '&' : '?'}${devxApi.parameters}`;
}

const headers = {
'Content-Type': 'application/json',
'Accept-Language': geLocale
Expand Down Expand Up @@ -83,7 +88,7 @@ export function consentToScopes(scopes: string[]): Function {
return async (dispatch: Function) => {
const authResponse = await acquireNewAccessToken(scopes);
if (authResponse && authResponse.accessToken) {
dispatch(getAuthTokenSuccess(authResponse.accessToken));
dispatch(getAuthTokenSuccess(true));
dispatch(getConsentedScopesSuccess(authResponse.scopes));
}
};
Expand Down
13 changes: 6 additions & 7 deletions src/app/services/actions/query-action-creator-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ export function isImageResponse(contentType: string | undefined) {
}

export function getContentType(headers: Headers) {
const full = headers.get('content-type');
if (full) {
const delimiterPos = full.indexOf(';');
const contentType = headers.get('content-type');
if (contentType) {
const delimiterPos = contentType.indexOf(';');
if (delimiterPos !== -1) {
return full.substr(0, delimiterPos);
return contentType.substr(0, delimiterPos);
} else {
return full;
return contentType;
}
}
}
Expand All @@ -81,8 +81,7 @@ export function parseResponse(response: any, respHeaders: any): Promise<any> {
return response.json();

case ContentType.XML:
return response.text();

case ContentType.HTML:
case ContentType.TextPlain:
return response.text();

Expand Down
4 changes: 3 additions & 1 deletion src/app/services/actions/samples-action-creators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export function fetchSamplesPending(): any {
export function fetchSamples(): Function {
return async (dispatch: Function, getState: Function) => {
const { devxApi } = getState();
const samplesUrl = `${devxApi}/samples`;
let samplesUrl = `${devxApi.baseUrl}/samples`;

samplesUrl = (devxApi.parameters) ? `${samplesUrl}?${devxApi.parameters}` : `${samplesUrl}`;

const headers = {
'Content-Type': 'application/json',
Expand Down
43 changes: 22 additions & 21 deletions src/app/services/graph-client/msal-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ const defaultUserScopes = DEFAULT_USER_SCOPES.split(' ');
const loginType = getLoginType();
msalApplication.handleRedirectCallback(authCallback);

const loginRequest: AuthenticationParameters = {
scopes: defaultUserScopes,
authority: getAuthority(),
prompt: 'select_account',
redirectUri: getCurrentUri().toLowerCase(),
extraQueryParameters: { mkt: geLocale }
};

export function getSessionId() {
const account = msalApplication.getAccount();

Expand All @@ -16,6 +24,11 @@ export function getSessionId() {
}
}

export async function getToken() {
const authResponse = await msalApplication.acquireTokenSilent(loginRequest);
return authResponse;
}

// get current uri for redirect uri purpose
// ref - https://github.com/AzureAD/microsoft-authentication-library-for
// -js/blob/9274fac6d100a6300eb2faa4c94aa2431b1ca4b0/lib/msal-browser/src/utils/BrowserUtils.ts#L49
Expand All @@ -24,27 +37,19 @@ function getCurrentUri(): string {
}

function getAuthority(): string {
// support for tenanted endpoint
const urlParams = new URLSearchParams(location.search);
let tenant = urlParams.get('tenant');
// support for tenanted endpoint
const urlParams = new URLSearchParams(location.search);
let tenant = urlParams.get('tenant');

if (tenant === null) {
tenant = 'common';
if (tenant === null) {
tenant = 'common';
}

return `https://login.microsoftonline.com/${tenant}/`;
}

export async function logIn(sessionId = ''): Promise<any> {

const loginRequest: AuthenticationParameters = {
scopes: defaultUserScopes,
authority: getAuthority(),
prompt: 'select_account',
redirectUri: getCurrentUri().toLowerCase(),
extraQueryParameters: { mkt: geLocale }
};

if (sessionId !== '') {
loginRequest.sid = sessionId;

Expand All @@ -61,11 +66,10 @@ export async function logIn(sessionId = ''): Promise<any> {
if (loginType === LoginType.Popup) {
try {
await msalApplication.loginPopup(loginRequest);
const authResponse = await msalApplication.acquireTokenSilent(loginRequest);
return authResponse;
return await getToken();
} catch (error) {
if (requiresInteraction(error)) {
return acquireTokenWIthInteraction(loginRequest);
return acquireTokenWIthInteraction();
} else {
throw error;
}
Expand All @@ -75,7 +79,7 @@ export async function logIn(sessionId = ''): Promise<any> {
}
}

async function acquireTokenWIthInteraction(loginRequest: AuthenticationParameters) {
async function acquireTokenWIthInteraction() {
try {
const authResponse = await msalApplication.acquireTokenPopup(loginRequest);
return authResponse;
Expand Down Expand Up @@ -116,10 +120,7 @@ export function logOutPopUp() {
* @returns {Promise.<any>}
*/
export async function acquireNewAccessToken(scopes: string[] = []): Promise<any> {
const loginRequest: AuthenticationParameters = {
scopes,
authority: getAuthority(),
};
loginRequest.scopes = scopes;
if (loginType === LoginType.Popup) {
try {
const authResponse = await msalApplication.acquireTokenPopup(loginRequest);
Expand Down
7 changes: 6 additions & 1 deletion src/app/services/reducers/devxApi-reducers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { IAction } from '../../../types/action';
import { IDevxAPI } from '../../../types/devx-api';
import { DEVX_API_URL } from '../graph-constants';
import { SET_DEVX_API_URL_SUCCESS } from '../redux-constants';

export function devxApi(state: string = DEVX_API_URL, action: IAction): any {
const initialState: IDevxAPI = {
baseUrl: DEVX_API_URL,
parameters: ''
};
export function devxApi(state: IDevxAPI = initialState, action: IAction): any {
switch (action.type) {

case SET_DEVX_API_URL_SUCCESS:
Expand Down
24 changes: 24 additions & 0 deletions src/app/utils/status-message.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export function replaceLinks(message: string): string {
const urls = extractUrl(message);
if (urls) {
for (let index = 0; index < urls.length; index++) {
const url = urls[index];
message = message.replace(url, `$${index}`);
}
}
return message;
}

export function convertArrayToObject(array: any[]): object {
const initialValue = {};
return array.reduce((obj, item, index) => {
return {
...obj,
[`$${index}`]: item,
};
}, initialValue);
};

export function extractUrl(value: string): string[] | null {
return value.toString().match(/\bhttps?:\/\/\S+/gi);
}
1 change: 1 addition & 0 deletions src/app/utils/token-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function substituteTokens(query: IQuery, profile: object) {
if (!substitutedValue) {
continue;
}
// @ts-ignore
query[queryField] = (query[queryField] as string).replace(`{${token.placeholder}}`, substitutedValue);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/views/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class App extends Component<IAppProps, IAppState> {
<div style={{ marginBottom: 8 }}>
<QueryRunner onSelectVerb={this.handleSelectVerb} />
</div>
{statusMessages(queryState, actions)}
{statusMessages(queryState, sampleQuery, actions)}
{termsOfUseMessage(termsOfUse, actions, classes, geLocale)}
{
// @ts-ignore
Expand Down
Loading

0 comments on commit 32cfa71

Please sign in to comment.