Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add Graph Explorer header #1682

Merged
merged 121 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
2d4a5d9
move terms to the bottom
ElinorW Apr 13, 2022
5a16bf1
Merge branch 'dev' into feature/sign-in-header
ElinorW Apr 21, 2022
909b278
rename settings
ElinorW Apr 21, 2022
a3b3409
move label and feedback button
ElinorW Apr 21, 2022
1de80d0
add header
ElinorW Apr 21, 2022
ae67167
disable test
ElinorW Apr 21, 2022
b98888a
move authentication section
ElinorW Apr 22, 2022
70259b7
add notification
ElinorW Apr 22, 2022
0f0f015
Merge branch 'dev' into feature/sign-in-header
ElinorW Apr 22, 2022
a7e917f
add profile sign out
ElinorW Apr 25, 2022
7571211
remove authentication section
ElinorW Apr 25, 2022
8def5aa
remove sign out option
ElinorW Apr 25, 2022
c472c2d
style sign in button
ElinorW Apr 25, 2022
66221a0
style sign in button
ElinorW Apr 25, 2022
6f239b5
update sign in button
ElinorW Apr 25, 2022
880f5f5
add resize button
ElinorW Apr 25, 2022
b3cf1dc
remove unused imports
ElinorW Apr 25, 2022
e543b90
add sandbox menu item
ElinorW Apr 25, 2022
00e8c29
add documentation and github links
ElinorW Apr 25, 2022
64e79b0
move permissions setting
ElinorW Apr 26, 2022
ac42518
remove unused imports
ElinorW Apr 26, 2022
a887366
Task: page layout (#1683)
Onokaev Apr 26, 2022
3162240
add profile dropdown
ElinorW Apr 26, 2022
77477c4
cleanup
ElinorW Apr 26, 2022
34a6181
clean up
ElinorW Apr 27, 2022
e28beb7
fix profile personas
ElinorW Apr 27, 2022
768d498
add sidebar icons
ElinorW Apr 28, 2022
2723ca3
code cleanup
ElinorW Apr 28, 2022
4eb81fc
hide icons in mobile view
ElinorW Apr 28, 2022
547d222
Task: Profile callout styles (#1686)
Onokaev Apr 30, 2022
09e2bb5
Task: Extend sidebar content space (#1709)
Onokaev May 4, 2022
93ecf41
Merge branch 'dev' into feature/sign-in-header
ElinorW May 4, 2022
35c1409
add sign in with a different account
ElinorW May 5, 2022
08f21b8
remove redundant step
ElinorW May 5, 2022
6e149ce
add dismiss button
ElinorW May 5, 2022
a34b94b
Fix: panel overlay (#1714)
Onokaev May 6, 2022
d5ae30c
add tenant information
ElinorW May 9, 2022
550a514
remove scrollbar from menu (#1717)
Onokaev May 9, 2022
41b1169
remove unused import
ElinorW May 9, 2022
6d1683b
Merge branch 'feature/sign-in-header' of https://github.com/microsoft…
ElinorW May 9, 2022
97d7292
clean code smells
ElinorW May 9, 2022
8787c6c
re-arrange options
ElinorW May 10, 2022
7fc98c8
update tenant info display
ElinorW May 10, 2022
29f2864
move authenticate message
ElinorW May 10, 2022
292638b
remove unused code
ElinorW May 10, 2022
a3ecb17
code clean up
ElinorW May 10, 2022
f12cf74
Merge branch 'dev' into feature/sign-in-header
ElinorW May 11, 2022
c9e86ad
Fix: align right header items (#1720)
Onokaev May 11, 2022
2ee2980
code cleanup
ElinorW May 11, 2022
6bb3e18
Merge branch 'feature/sign-in-header' of https://github.com/microsoft…
ElinorW May 11, 2022
c25b0b6
update header details
ElinorW May 11, 2022
e7b187f
change minimize icon and rearrage header items
ElinorW May 11, 2022
b273371
style header items
ElinorW May 11, 2022
983f7a1
remove flex-wrap property (#1737)
Onokaev May 17, 2022
dc85665
update settings and help menu
ElinorW May 17, 2022
b712813
add hover effect
ElinorW May 17, 2022
9358b57
add border
ElinorW May 17, 2022
fee9652
change hover colour
ElinorW May 17, 2022
1d327ab
Merge branch 'dev' into feature/sign-in-header
ElinorW May 17, 2022
54bf9ac
Merge branch 'dev' into feature/sign-in-header
ElinorW May 18, 2022
d5348f3
fix linting error
ElinorW May 18, 2022
6ce8526
update styling
ElinorW May 18, 2022
2281b51
code cleanup
ElinorW May 18, 2022
1d23353
moving files for proper organization
ElinorW May 18, 2022
1b77507
code cleanup
ElinorW May 18, 2022
032bc17
update and localize strings
ElinorW May 18, 2022
f78bd70
adjust height
ElinorW May 23, 2022
8e37d9e
adjust heights
ElinorW May 23, 2022
746d2d7
update UI
ElinorW May 24, 2022
b10c5f9
align heights and widths
ElinorW May 24, 2022
1d19d9b
add icon
ElinorW May 24, 2022
241738f
update profile callout
ElinorW May 24, 2022
19fa239
Task: Move permissions button (#1755)
Onokaev May 24, 2022
4090f46
move response messages
ElinorW May 24, 2022
f76ccd9
hide tenant info in mobile view
ElinorW May 24, 2022
7ea3efd
update profile alignment
ElinorW May 24, 2022
834c732
update paths
ElinorW May 24, 2022
b046291
Task: Increase help and settings box sizes (#1756)
Onokaev May 24, 2022
e3954e4
use graph client to fetch org
ElinorW May 24, 2022
fea1256
remove loclization
ElinorW May 24, 2022
44e3538
Merge branch 'dev' into feature/sign-in-header
ElinorW May 24, 2022
124eb00
add tenant validation
ElinorW May 25, 2022
53e2357
fix icon placement
ElinorW May 26, 2022
07edec8
fix auth icon size (#1759)
Onokaev May 27, 2022
4b5859c
Fix: Restore permissions styles (#1761)
Onokaev May 30, 2022
1125990
add tooltip on sidebar icons
ElinorW May 30, 2022
98d4998
add border on menu dropdowns
ElinorW May 30, 2022
bcdbd40
adjust heights
ElinorW May 30, 2022
e9216db
Revert "adjust heights"
ElinorW May 30, 2022
291e595
Limits sidebar resize (#1769)
Onokaev Jun 2, 2022
034b90a
Merge branch 'dev' into feature/sign-in-header
ElinorW Jun 2, 2022
9380aa1
add graph explorer documentation
ElinorW Jun 2, 2022
6dce868
style menu position
ElinorW Jun 2, 2022
5951b2f
add telemetry for graph docs link
ElinorW Jun 2, 2022
4ca9435
update profile styling
ElinorW Jun 2, 2022
dc38871
update main header styles
ElinorW Jun 2, 2022
4309cb4
update sign in with other account method
ElinorW Jun 2, 2022
412b91d
update popUp request
ElinorW Jun 2, 2022
d893624
Task: tenant name ellipsis (#1799)
Onokaev Jun 6, 2022
79608d3
adjust sidebar width
ElinorW Jun 8, 2022
51e7239
Revert "Task: tenant name ellipsis (#1799)" (#1818)
ElinorW Jun 8, 2022
c50e9b1
Merge branch 'feature/sign-in-header' of https://github.com/microsoft…
ElinorW Jun 8, 2022
b699fe9
Merge branch 'dev' into feature/sign-in-header
ElinorW Jun 8, 2022
e8bb9de
center icon
ElinorW Jun 8, 2022
19c2084
update to consent permissions
ElinorW Jun 8, 2022
c7b8a9c
remove margin
ElinorW Jun 8, 2022
95c4de0
Merge branch 'feature/sign-in-header' of https://github.com/microsoft…
ElinorW Jun 8, 2022
903bc40
remove unused comment
ElinorW Jun 8, 2022
d05dc69
remove query running state
ElinorW Jun 8, 2022
772a421
refactor function
ElinorW Jun 8, 2022
7d6ead7
update string
ElinorW Jun 8, 2022
d390149
add typings
ElinorW Jun 9, 2022
736e941
Merge branch 'dev' into feature/sign-in-header
ElinorW Jun 9, 2022
22be5a8
remove unused code
ElinorW Jun 9, 2022
28b4341
Merge branch 'feature/sign-in-header' of https://github.com/microsoft…
ElinorW Jun 9, 2022
bf34786
update tryIt look
ElinorW Jun 9, 2022
38233c7
fix unnecessary assertion
ElinorW Jun 9, 2022
47fc1b5
add error handling
ElinorW Jun 9, 2022
c856c1c
remove duplicates
ElinorW Jun 9, 2022
2d502d7
update icon in mobile screen
ElinorW Jun 9, 2022
ba23b01
Merge branch 'feature/sign-in-header' of https://github.com/microsoft…
ElinorW Jun 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@babel/core": "7.17.9",
"@babel/runtime": "7.18.3",
"@fluentui/react": "8.72.1",
"@fluentui/react-icons-mdl2": "1.3.8",
"@microsoft/applicationinsights-react-js": "3.3.4",
"@microsoft/applicationinsights-web": "2.7.6",
"@microsoft/microsoft-graph-client": "3.0.2",
Expand Down
23 changes: 20 additions & 3 deletions src/app/services/actions/profile-action-creators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import {
BETA_USER_INFO_URL,
DEFAULT_USER_SCOPES,
USER_INFO_URL,
USER_ORGANIZATION_URL,
USER_PICTURE_URL
} from '../graph-constants';
import {
PROFILE_REQUEST_ERROR,
PROFILE_REQUEST_SUCCESS
} from '../redux-constants';
import { makeGraphRequest, parseResponse } from './query-action-creator-util';
import { queryRunningStatus } from './query-loading-action-creators';

interface IBetaProfile {
ageGroup: number;
Expand Down Expand Up @@ -54,13 +54,13 @@ const query: IQuery = {

export function getProfileInfo(): Function {
return async (dispatch: Function) => {
dispatch(queryRunningStatus(true));
try {
const profile: IUser = await getProfileInformation();
const { profileType, ageGroup } = await getBetaProfile();
profile.profileType = profileType;
profile.ageGroup = ageGroup;
profile.profileImageUrl = await getProfileImage();
profile.tenant= await getTenantInfo(profileType);
dispatch(profileRequestSuccess(profile));
} catch (error) {
dispatch(profileRequestError({ error }));
Expand All @@ -75,7 +75,8 @@ export async function getProfileInformation(): Promise<IUser> {
emailAddress: '',
profileImageUrl: '',
profileType: ACCOUNT_TYPE.UNDEFINED,
ageGroup: 0
ageGroup: 0,
tenant: ''
};
try {
query.sampleUrl = USER_INFO_URL;
Expand Down Expand Up @@ -148,3 +149,19 @@ export async function getProfileResponse(): Promise<IProfileResponse> {
response
};
}

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 '';
}
1 change: 1 addition & 0 deletions src/app/services/graph-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ export const ADAPTIVE_CARD_URL =
export const GRAPH_TOOOLKIT_EXAMPLE_URL = 'https://mgt.dev/?path=/story';
export const MOZILLA_CORS_DOCUMENTATION_LINK =
'https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS';
export const USER_ORGANIZATION_URL = `${GRAPH_URL}/v1.0/organization`;
4 changes: 2 additions & 2 deletions src/app/services/reducers/dimensions-reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { RESIZE_SUCCESS } from '../redux-constants';
const initialState: IDimensions = {
request: {
width: '100%',
height: '40%'
height: '38%'
},
response: {
width: '100%',
height: '60%'
height: '50%'
},
sidebar: {
width: '26%',
Expand Down
13 changes: 9 additions & 4 deletions src/app/views/App.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const appStyles = (theme: ITheme) => {
background: theme.semanticColors.bodyBackground,
color: theme.semanticColors.bodyText,
paddingTop: theme.spacing.s1,
width: '100%',
height: '100%',
paddingRight: '15px',
paddingLeft: '4px',
paddingBottom: '5px',
marginLeft: 'auto',
marginRight: 'auto'
},
Expand All @@ -24,13 +24,16 @@ export const appStyles = (theme: ITheme) => {
sidebar: {
background: theme.palette.neutralLighter,
paddingRight: 10,
marginRight: 10
paddingLeft: 10,
marginRight: 10,
marginBottom: 9
},
sidebarMini: {
background: theme.palette.neutralLighter,
maxWidth: '65px',
minWidth: '55px',
padding: 10
padding: 10,
marginBottom: 9
},
layoutExtra: {
minWidth: '95%',
Expand Down Expand Up @@ -69,7 +72,9 @@ export const appStyles = (theme: ITheme) => {
marginTop: 5
},
statusAreaFullScreen: {
marginTop: 10
marginTop: 6,
position: 'relative',
bottom: 0
},
vResizeHandle: {
zIndex: 1,
Expand Down
85 changes: 19 additions & 66 deletions src/app/views/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Announced, getTheme, IStackTokens, ITheme, styled } from '@fluentui/react';
import { Announced, getTheme, ITheme, styled } from '@fluentui/react';
import { Resizable } from 're-resizable';
import React, { Component } from 'react';
import { injectIntl } from 'react-intl';
Expand All @@ -24,24 +24,18 @@ import { GRAPH_URL } from '../services/graph-constants';
import { parseSampleUrl } from '../utils/sample-url-generation';
import { substituteTokens } from '../utils/token-helpers';
import { translateMessage } from '../utils/translate-messages';
import {
appTitleDisplayOnFullScreen,
appTitleDisplayOnMobileScreen
} from './app-sections/AppTitle';
import { headerMessaging } from './app-sections/HeaderMessaging';
import { StatusMessages, TermsOfUseMessage } from './app-sections';
import { appStyles } from './App.styles';
import { Authentication } from './authentication';
import { classNames } from './classnames';
import { createShareLink } from './common/share';
import { QueryResponse } from './query-response';
import { QueryRunner } from './query-runner';
import { parse } from './query-runner/util/iframe-message-parser';
import { Settings } from './settings';
import { Sidebar } from './sidebar/Sidebar';
import { FeedbackButton } from './app-sections/FeedbackButton';
import { MainHeader } from './main-header/MainHeader';

interface IAppProps {
export interface IAppProps {
theme?: ITheme;
styles?: object;
intl: any;
Expand Down Expand Up @@ -295,30 +289,6 @@ class App extends Component<IAppProps, IAppState> {

};

public displayAuthenticationSection = (minimised: boolean) => {
return (
<div
style={{
display: minimised ? 'block' : 'flex',
justifyContent: minimised ? '' : 'center',
alignItems: minimised ? '' : 'center',
marginLeft: minimised ? '' : '-0.9em'
}}>
<div className={minimised ? '' : 'col-9'}>
<Authentication />
</div>
{minimised &&
<div className={minimised ? '' : 'col-2'} style={{ position: 'relative', left: '-9px' }}>
<FeedbackButton />
</div>
}
<div className={minimised ? '' : 'col-2'}>
<Settings />
</div>
</div>
);
};

private setSidebarProperties() {
const { sidebarProperties } = this.props;
const properties = { ...sidebarProperties };
Expand Down Expand Up @@ -409,11 +379,6 @@ class App extends Component<IAppProps, IAppState> {
mobileScreen, showSidebar
});

const stackTokens: IStackTokens = {
childrenGap: 10,
padding: 10
};

if (mobileScreen) {
layout = sidebarWidth = 'ms-Grid-col ms-sm12';
sideWidth = '100%';
Expand All @@ -431,6 +396,11 @@ class App extends Component<IAppProps, IAppState> {
// @ts-ignore
<ThemeContext.Provider value={this.props.appTheme}>
<div className={`ms-Grid ${classes.app}`} style={{ paddingLeft: mobileScreen && '15px' }}>
<MainHeader
minimised={minimised}
toggleSidebar={this.toggleSidebar}
mobileScreen={mobileScreen}
/>
<Announced
message={
!showSidebar
Expand All @@ -443,7 +413,6 @@ class App extends Component<IAppProps, IAppState> {
marginRight: showSidebar || (graphExplorerMode === Mode.TryIt) && '-20px',
flexDirection: (graphExplorerMode === Mode.TryIt) ? 'column' : 'row'
}}>

{graphExplorerMode === Mode.Complete && (
<Resizable
onResize={(e: any, direction: any, ref: any) => {
Expand All @@ -452,40 +421,24 @@ class App extends Component<IAppProps, IAppState> {
}
}}
className={`ms-Grid-col ms-sm12 ms-md4 ms-lg4 ${sidebarWidth} resizable-sidebar`}
minWidth={'4'}
minWidth={'71'}
maxWidth={maxWidth}
enable={{
right: true
}}
handleClasses={{
right: classes.vResizeHandle
}}
bounds={'window'}
bounds={'parent'}
size={{
width: sideWidth,
height: ''
}}
>

{mobileScreen && appTitleDisplayOnMobileScreen(
stackTokens,
classes,
this.toggleSidebar
)}

{!mobileScreen && appTitleDisplayOnFullScreen(
classes,
minimised,
this.toggleSidebar
)}

<hr className={classes.separator} />

{this.displayAuthenticationSection(minimised)}
<hr className={classes.separator} />

{showSidebar && ( <Sidebar currentTab = { this.state.sidebarTabSelection }
setSidebarTabSelection = { this.setSidebarTabSelection } /> ) }
<Sidebar currentTab = { this.state.sidebarTabSelection }
thewahome marked this conversation as resolved.
Show resolved Hide resolved
setSidebarTabSelection = { this.setSidebarTabSelection } showSidebar={showSidebar}
toggleSidebar={this.toggleSidebar}
mobileScreen={mobileScreen}/>
</Resizable>
)}
{graphExplorerMode === Mode.TryIt &&
Expand All @@ -502,13 +455,10 @@ class App extends Component<IAppProps, IAppState> {
width: graphExplorerMode === Mode.TryIt ? '100%' : contentWidth,
height: contentHeight
}}
style={!sidebarProperties.showSidebar && !mobileScreen ? { marginLeft: '8px' } : {}}
style={!sidebarProperties.showSidebar && !mobileScreen ? { marginLeft: '8px', flex: 1 } : {flex: 1}}
>
<div style={{ marginBottom: 8 }} >
<div style={{ marginBottom: 8}} >
<QueryRunner onSelectVerb={this.handleSelectVerb} />
<div style={mobileScreen ? this.statusAreaMobileStyle : this.statusAreaFullScreenStyle}>
<TermsOfUseMessage />
</div>
</div>

<div>
Expand All @@ -520,6 +470,9 @@ class App extends Component<IAppProps, IAppState> {
</Resizable>
)}
</div>
<div style={mobileScreen ? this.statusAreaMobileStyle : this.statusAreaFullScreenStyle}>
<TermsOfUseMessage />
</div>
</div>
</ThemeContext.Provider>
);
Expand Down
Loading