Skip to content

Commit

Permalink
Add sso error (#846)
Browse files Browse the repository at this point in the history
* Add error type

* Some fixes

* Fixes
  • Loading branch information
imsitnikov authored Apr 12, 2024
1 parent 91ac4de commit 0db11d4
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/shared/constants/error-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ export const ErrorContentTypes = {
NEW_LOCAL_FEDERATION_USER: 'new-local-federation-user',
INACCESSIBLE_ON_MOBILE: 'inaccessible-on-mobile',
NOT_AUTHENTICATED: 'not-authenticated',
FORBIDDEN_SSO: 'forbidden-sso',
};
1 change: 1 addition & 0 deletions src/shared/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type Lang = 'en' | 'ru';
export interface LandingLayoutPageError {
errorType: string;
title?: string;
isHtmlInTitle?: boolean;
description?: string;
pageTitle?: RenderParams<{DL: DLGlobalData}>['title'];
pageMeta?: RenderParams<{DL: DLGlobalData}>['meta'];
Expand Down
10 changes: 8 additions & 2 deletions src/ui/components/ErrorContent/ErrorContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ErrorContent extends React.PureComponent {
static propTypes = {
className: PropTypes.string,
title: PropTypes.string,
isHtmlInTitle: PropTypes.bool,
description: PropTypes.node,
type: PropTypes.oneOf(Object.values(ErrorContentTypes)),
action: PropTypes.shape({
Expand Down Expand Up @@ -98,13 +99,17 @@ class ErrorContent extends React.PureComponent {
}

renderTitle() {
const {title = i18n('label_error-general'), hideTitle} = this.props;
const {title = i18n('label_error-general'), isHtmlInTitle = false, hideTitle} = this.props;

if (hideTitle) {
return null;
}

return <div className={b('title')}>{title}</div>;
if (isHtmlInTitle) {
return <div className={b('title')} dangerouslySetInnerHTML={{__html: title}}></div>;
} else {
return <div className={b('title')}>{title}</div>;
}
}

renderDescription() {
Expand Down Expand Up @@ -258,6 +263,7 @@ class ErrorContent extends React.PureComponent {
case ErrorContentTypes.CLOUD_FOLDER_ACCESS_DENIED:
case ErrorContentTypes.NO_ENTRY_ACCESS:
case ErrorContentTypes.AUTH_DENIED:
case ErrorContentTypes.FORBIDDEN_SSO:
imageName = 'noAccess';
break;
case ErrorContentTypes.ERROR:
Expand Down
16 changes: 16 additions & 0 deletions src/ui/components/ErrorContent/ErrorContent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
#{$class}__title {
width: 100%;
text-align: center;

a {
color: var(--g-color-text-link);

&:visited {
color: var(--g-color-text-link);
}
}
}

#{$class}__description {
Expand Down Expand Up @@ -64,6 +72,14 @@
font-weight: 500;
font-size: var(--g-text-header-1-font-size);
line-height: var(--g-text-header-1-line-height);

a {
color: var(--g-color-text-link);

&:visited {
color: var(--g-color-text-link);
}
}
}

&__content {
Expand Down
20 changes: 2 additions & 18 deletions src/ui/components/Navigation/Base/NavigationBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,8 @@ class NavigationBase extends React.Component {
break;
}
case CreateMenuValue.Connection: {
if (this.props.isOnlyCollectionsMode) {
this.props.openDialog({
id: DIALOG_CREATE_ENTRY_IN_WORKBOOK,
props: {
initialCollectionId: null,
entryType: 'connection',
onApply: () => {
this.closeNavigation();
},
onClose: () => {
this.props.closeDialog();
},
},
});
} else {
history.push(`/connections/new${query}`);
this.closeNavigation();
}
history.push(`/connections/new${query}`);
this.closeNavigation();
break;
}
case CreateMenuValue.Dataset: {
Expand Down
1 change: 1 addition & 0 deletions src/ui/store/reducers/asideHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const TypesHeaderWithoutNavigation = [
ErrorContentTypes.AUTH_DENIED,
ErrorContentTypes.NOT_FOUND_BY_RESOLVE_TENANT,
ErrorContentTypes.NOT_AUTHENTICATED,
ErrorContentTypes.FORBIDDEN_SSO,
];

export function getLandingNavigationSettings() {
Expand Down

0 comments on commit 0db11d4

Please sign in to comment.