Skip to content

Commit

Permalink
Bug 1889213: The error message of uploading failure is not clear enough
Browse files Browse the repository at this point in the history
  • Loading branch information
glekner committed Jan 5, 2021
1 parent a8da4af commit 3c79432
Showing 1 changed file with 21 additions and 11 deletions.
Expand Up @@ -18,9 +18,11 @@ import {
SplitItem,
} from '@patternfly/react-core';
import { ErrorCircleOIcon, InProgressIcon } from '@patternfly/react-icons';
import { PodKind } from '@console/internal/module/k8s';
import { history, resourcePath } from '@console/internal/components/utils';
import { getName, getNamespace } from '@console/shared';
import { PodModel } from '@console/internal/models';
import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook';
import { DataUpload } from '../cdi-upload-provider';
import { getProgressVariant } from '../upload-pvc-popover';
import { killUploadPVC } from '../../../k8s/requests/cdi-upload/cdi-upload-requests';
Expand Down Expand Up @@ -143,6 +145,12 @@ const ErrorStatus: React.FC<ErrorStatusProps> = ({ error, onErrorClick }) => (

const CDIInitErrorStatus: React.FC<CDIInitErrorStatus> = ({ onErrorClick, pvcName, namespace }) => {
const [shouldKillDv, setShouldKillDv] = React.useState(true);
const [pod, podLoaded, podError] = useK8sWatchResource<PodKind>({
kind: PodModel.kind,
namespace,
name: `cdi-upload-${pvcName}`,
});

return (
<>
<EmptyStateIcon icon={ErrorCircleOIcon} color="#cf1010" />
Expand Down Expand Up @@ -189,17 +197,19 @@ const CDIInitErrorStatus: React.FC<CDIInitErrorStatus> = ({ onErrorClick, pvcNam
>
Back to Form {shouldKillDv && '(Deletes DV)'}
</Button>
<EmptyStateSecondaryActions>
<Button
id="cdi-upload-check-logs"
onClick={() =>
history.push(`${resourcePath(PodModel.kind, `cdi-upload-${pvcName}`, namespace)}/logs`)
}
variant="link"
>
Check Logs
</Button>
</EmptyStateSecondaryActions>
{podLoaded && !podError && pod && (
<EmptyStateSecondaryActions>
<Button
id="cdi-upload-check-logs"
onClick={() =>
history.push(`${resourcePath(PodModel.kind, pod?.metadata?.name, namespace)}/logs`)
}
variant="link"
>
Check Logs
</Button>
</EmptyStateSecondaryActions>
)}
</>
);
};
Expand Down

0 comments on commit 3c79432

Please sign in to comment.