// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import React from 'react'; import './FileUploadRow.scss'; import { Tooltip } from 'antd'; import CloseIcon from '../../../components/icons/CloseIcon'; import formatBytes from '../../../utils/formatBytes'; import StatusPendingIcon from '@cloudera/cuix-core/icons/react/StatusPendingIcon'; import StatusInProgressIcon from '@cloudera/cuix-core/icons/react/StatusInProgressIcon'; import StatusSuccessIcon from '@cloudera/cuix-core/icons/react/StatusSuccessIcon'; import StatusStoppedIcon from '@cloudera/cuix-core/icons/react/StatusStoppedIcon'; import StatusErrorIcon from '@cloudera/cuix-core/icons/react/StatusErrorIcon'; import { RegularFile, FileStatus } from '../../../utils/hooks/useFileUpload/types'; import { i18nReact } from '../../../utils/i18nReact'; interface FileUploadRowProps { data: RegularFile; onCancel: () => void; } const statusIcon = { [FileStatus.Pending]: , [FileStatus.Uploading]: , [FileStatus.Uploaded]: , [FileStatus.Cancelled]: , [FileStatus.Failed]: }; const FileUploadRow: React.FC = ({ data, onCancel }) => { const { t } = i18nReact.useTranslation(); return (
{statusIcon[data.status]}
{data.file.name}
{formatBytes(data.file.size)}
{data.status === FileStatus.Pending && ( )}
); }; export default FileUploadRow;