Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-2180 (pull request #550)
Browse files Browse the repository at this point in the history
Fixed error message on timeout

Approved-by: Bill Smith
Approved-by: Jonathan Johnson
  • Loading branch information
rmathis authored and Jonathan Johnson committed Nov 1, 2021
2 parents 2ef41dc + c56d1e9 commit bc8ea11
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ message.invalid-signing=Unless the response or the assertions are signed, SAML s

message.session-timeout-heading=Session timed out
message.session-timeout-body=Your session has timed out. Please login again.
message.session-timeout=An error has occurred while saving. Your session may have timed out.

tooltip.entity-id=Entity ID
tooltip.service-provider-name=Service Provider Name (Dashboard Display Only)
Expand Down
14 changes: 11 additions & 3 deletions ui/src/app/metadata/view/MetadataWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { Wizard } from '../wizard/Wizard';
import { useMetadataEntity } from '../hooks/api';
import { createNotificationAction, NotificationTypes, useNotificationDispatcher } from '../../notifications/hoc/Notifications';
import { Prompt, useHistory } from 'react-router';
import { useTranslator } from '../../i18n/hooks';

export function MetadataWizard ({type, data, onCallback}) {

const history = useHistory();
const translator = useTranslator();

const { post, loading, response } = useMetadataEntity(type === 'source' ? 'source' : 'provider');

Expand All @@ -19,15 +21,21 @@ export function MetadataWizard ({type, data, onCallback}) {
const [blocking, setBlocking] = React.useState(false);

async function save(metadata) {
console.log(metadata);
await post('', metadata);
if (response.ok) {
setBlocking(false);
history.push(`/dashboard/metadata/manager/${type === 'source' ? 'resolvers' : 'providers'}`);
} else {
const { errorCode, errorMessage, cause } = response.data;
let msg;
if (response.status) {
const { errorCode, errorMessage, cause } = response.data;
msg = `${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`;
} else {
msg = translator('message.session-timeout');
}

notificationDispatch(createNotificationAction(
`${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`,
msg,
NotificationTypes.ERROR
));
}
Expand Down
7 changes: 4 additions & 3 deletions ui/src/app/metadata/wizard/MetadataSourceWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ import { useMetadataDefinitionContext, useMetadataSchemaContext, useMetadataDefi
import { useMetadataFormDispatcher, setFormDataAction, setFormErrorAction, useMetadataFormData, useMetadataFormErrors } from '../hoc/MetadataFormContext';
import { MetadataConfiguration } from '../component/MetadataConfiguration';
import { Configuration } from '../hoc/Configuration';
import { useMetadataEntity, useMetadataSources } from '../hooks/api';
import { useMetadataSources } from '../hooks/api';

import Translate from '../../i18n/components/translate';
import { checkChanges } from '../hooks/utility';
import { useUserGroup } from '../../core/user/UserContext';


export function MetadataSourceWizard ({ onShowNav, onSave, block }) {
export function MetadataSourceWizard ({ onShowNav, onSave, block, loading }) {

const { loading } = useMetadataEntity('source');
const group = useUserGroup();

const { data } = useMetadataSources({
Expand Down Expand Up @@ -61,6 +60,8 @@ export function MetadataSourceWizard ({ onShowNav, onSave, block }) {
const validator = useMetadataDefinitionValidator(data, null, group);
const warnings = definition.warnings && definition.warnings(metadata);

React.useEffect(() => console.log(loading), [loading]);

return (
<>
<div className="row mb-4">
Expand Down

0 comments on commit bc8ea11

Please sign in to comment.