-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from overture-stack/rc/1.0.0
🔖 Rc/1.0.0
- Loading branch information
Showing
27 changed files
with
528 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import DMSAdminContact from './DMSAdminContact'; | ||
import { ErrorPageLayout } from './PageLayout'; | ||
|
||
const ClientError = () => { | ||
return ( | ||
<ErrorPageLayout errorTitle="Oops! Something went wrong" subtitle="Oops! Something went wrong"> | ||
An unknown error has occurred. If the problem persists, contact the <DMSAdminContact /> for | ||
help. | ||
</ErrorPageLayout> | ||
); | ||
}; | ||
|
||
export default ClientError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import styled from '@emotion/styled'; | ||
import { getConfig } from '../global/config'; | ||
import StyledLink from './Link'; | ||
|
||
const Span = styled('span')` | ||
line-height: 24px; | ||
`; | ||
|
||
const DMSAdminContact = () => { | ||
const { NEXT_PUBLIC_ADMIN_EMAIL } = getConfig(); | ||
const Component = NEXT_PUBLIC_ADMIN_EMAIL ? StyledLink : Span; | ||
return <Component href={`mailto:${NEXT_PUBLIC_ADMIN_EMAIL}`}>DMS administrator</Component>; | ||
}; | ||
|
||
export const GenericHelpMessage = () => ( | ||
<span> | ||
Please try again. If the problem persists, please contact the <DMSAdminContact /> for help | ||
troubleshooting the issue. | ||
</span> | ||
); | ||
|
||
export default DMSAdminContact; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React from 'react'; | ||
|
||
import { DMS_EMAIL_SETTING_URL } from '../../global/utils/constants'; | ||
import providerMap from '../../global/utils/providerTypeMap'; | ||
import StyledLink from '../Link'; | ||
import { ErrorPageLayout } from '../PageLayout'; | ||
import { ProviderType } from '../../global/types'; | ||
import DMSAdminContact from '../DMSAdminContact'; | ||
|
||
enum EgoLoginError { | ||
NO_PRIMARY_EMAIL = 'no_primary_email', | ||
ACCESS_DENIED = 'access_denied', | ||
} | ||
|
||
const errorSubtitles: { [k in EgoLoginError]: string } = { | ||
no_primary_email: 'No Primary Email Found', | ||
access_denied: 'Unable to log in', | ||
}; | ||
|
||
const isValidProviderType = (providerType: ProviderType) => | ||
Object.values(ProviderType).includes(providerType); | ||
|
||
const Error403 = ({ query }: { query: { error_type: EgoLoginError; provider_type?: string } }) => { | ||
const { error_type: errorType, provider_type: providerType } = query; | ||
const providerTypeDisplayName = isValidProviderType(providerType as ProviderType) | ||
? providerMap[providerType as ProviderType].displayName | ||
: 'identity provider'; | ||
|
||
switch (errorType) { | ||
case EgoLoginError.NO_PRIMARY_EMAIL: | ||
return ( | ||
<ErrorPageLayout | ||
subtitle={`Error 403 - ${errorSubtitles[errorType]}`} | ||
errorTitle={`${errorSubtitles[errorType]}`} | ||
> | ||
No primary email could be found on your {providerTypeDisplayName} profile. An email is | ||
required to log in to the Data Explorer. Make sure an email exists on your{' '} | ||
{providerTypeDisplayName} profile and that it is accessible by external parties (i.e. not | ||
private). See{' '} | ||
<StyledLink href={DMS_EMAIL_SETTING_URL} target="_blank"> | ||
here | ||
</StyledLink>{' '} | ||
for instructions on how to do this. | ||
</ErrorPageLayout> | ||
); | ||
case EgoLoginError.ACCESS_DENIED: | ||
return ( | ||
<ErrorPageLayout | ||
subtitle={`Error 403 - ${errorSubtitles[errorType]}`} | ||
errorTitle={`${errorSubtitles[errorType]}`} | ||
> | ||
You have denied the DMS access to your {providerTypeDisplayName} profile or cancelled your | ||
log in attempt. Please try again and approve access for {providerTypeDisplayName}, or log | ||
in with a different provider for which you would prefer to allow access. | ||
</ErrorPageLayout> | ||
); | ||
default: | ||
return ( | ||
<ErrorPageLayout | ||
subtitle="Error 403 - Permission required" | ||
errorTitle="Permission required" | ||
> | ||
You do not have permission to access the requested page. Please check that you have | ||
entered the correct URL. If the problem persists, contact the <DMSAdminContact /> for | ||
help. | ||
</ErrorPageLayout> | ||
); | ||
} | ||
}; | ||
|
||
export default Error403; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import DMSAdminContact from '../DMSAdminContact'; | ||
import { ErrorPageLayout } from '../PageLayout'; | ||
|
||
const Error404 = () => { | ||
return ( | ||
<ErrorPageLayout errorTitle="404: Page not found" subtitle="Error 404 - Page not found"> | ||
The page you requested could not be found. Please check that you have entered the correct URL. | ||
If the problem persists, contact the <DMSAdminContact /> for help. | ||
</ErrorPageLayout> | ||
); | ||
}; | ||
|
||
export default Error404; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import DMSAdminContact from '../DMSAdminContact'; | ||
import { ErrorPageLayout } from '../PageLayout'; | ||
|
||
const Error500 = () => { | ||
return ( | ||
<ErrorPageLayout errorTitle="500: Server Error" subtitle="Error 500 - Server Error"> | ||
The page you requested could not be accessed due to a server error. If the problem persists, | ||
please contact the <DMSAdminContact /> for help. | ||
</ErrorPageLayout> | ||
); | ||
}; | ||
|
||
export default Error500; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.