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

fix(uploads): fix archive upload modal invalid labels popover #998

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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