Skip to content

Commit

Permalink
fix(uploads): fix archive upload modal invalid labels popover (#998)
Browse files Browse the repository at this point in the history
(cherry picked from commit ef3cb3f)
  • Loading branch information
maxcao13 authored and mergify[bot] committed Apr 26, 2023
1 parent eb908b5 commit ce8b42e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions locales/en/public.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@
"TITLE": "Quick Starts"
}
},
"RecordingLabelFields": {
"INVALID_UPLOADS_one": "The following file did not contain valid recording metadata:",
"INVALID_UPLOADS_other": "The following files did not contain valid recording metadata:"
},
"SETTINGS": {
"AUTO_REFRESH": {
"CHECKBOX_LABEL": "Enabled",
Expand Down
1 change: 0 additions & 1 deletion src/app/Archives/ArchiveUploadModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ export const ArchiveUploadModal: React.FC<ArchiveUploadModalProps> = ({ onClose,

return (
<Modal
appendTo={portalRoot}
isOpen={props.visible}
variant={ModalVariant.large}
showClose={true}
Expand Down
3 changes: 2 additions & 1 deletion src/app/RecordingMetadata/RecordingLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ export const parseLabelsFromFile = (file: File): Observable<RecordingLabel[]> =>
value: labelObj[key],
});
});
return labels;
}
return labels;
throw new Error('No labels found in file');
})
);
};
Expand Down
8 changes: 5 additions & 3 deletions src/app/RecordingMetadata/RecordingLabelFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
} from '@patternfly/react-core';
import { CloseIcon, ExclamationCircleIcon, FileIcon, PlusCircleIcon, UploadIcon } from '@patternfly/react-icons';
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { catchError, Observable, of, zip } from 'rxjs';

export interface RecordingLabelFieldsProps {
Expand Down Expand Up @@ -82,6 +83,7 @@ export const RecordingLabelFields: React.FunctionComponent<RecordingLabelFieldsP
}) => {
const inputRef = React.useRef<HTMLInputElement>(null); // Use ref to refer to child component
const addSubscription = useSubscriptions();
const { t } = useTranslation();

const [loading, setLoading] = React.useState(false);
const [invalidUploads, setInvalidUploads] = React.useState<string[]>([]);
Expand Down Expand Up @@ -217,9 +219,9 @@ export const RecordingLabelFields: React.FunctionComponent<RecordingLabelFieldsP
headerIcon={<ExclamationCircleIcon />}
bodyContent={
<>
<Text component="h4">{`The following file${
invalidUploads.length > 1 ? 's' : ''
} did not contain valid recording metadata:`}</Text>
<Text component="h4">
{t('RecordingLabelFields.INVALID_UPLOADS', { count: invalidUploads.length })}
</Text>
<List>
{invalidUploads.map((uploadName) => (
<ListItem key={uploadName} icon={<FileIcon />}>
Expand Down

0 comments on commit ce8b42e

Please sign in to comment.