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

Bug 1836801: Filter Disk Import activity that does not have progress yet #5476

Merged
merged 1 commit into from May 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,23 +1,35 @@
import * as React from 'react';
import * as _ from 'lodash';
import { ActivityProgress } from '@console/shared/src/components/dashboard/activity-card/ActivityItem';
import ActivityItem, {
ActivityProgress,
} from '@console/shared/src/components/dashboard/activity-card/ActivityItem';
import { ResourceLink } from '@console/internal/components/utils';
import { referenceForModel } from '@console/internal/module/k8s';
import { K8sActivityProps } from '@console/plugin-sdk';
import { VirtualMachineModel } from '../../../models';

export const DiskImportActivity: React.FC<K8sActivityProps> = ({ resource }) => (
<ActivityProgress
title="Importing VM disk"
progress={parseInt(_.get(resource, 'status.progress', 0), 10)}
>
const VM_IMPORT_TITLE = 'Importing VM disk';

export const DiskImportActivity: React.FC<K8sActivityProps> = ({ resource }) => {
const progress = parseInt(resource?.status?.progress, 10);
const vmLink = (
<ResourceLink
kind={referenceForModel(VirtualMachineModel)}
name={resource.metadata.ownerReferences[0].name}
namespace={resource.metadata.namespace}
/>
</ActivityProgress>
);
);
return Number.isNaN(progress) ? (
<>
<ActivityItem>{VM_IMPORT_TITLE}</ActivityItem>
{vmLink}
</>
) : (
<ActivityProgress title={VM_IMPORT_TITLE} progress={progress}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we include a key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, sorry - no need to have it here

{vmLink}
</ActivityProgress>
);
};

export const V2VImportActivity: React.FC<K8sActivityProps> = ({ resource }) => {
const vmName = _.get(resource.metadata.ownerReferences, '[0].name');
Expand Down