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

CNV19658: Add migrations table #759

Merged
merged 2 commits into from
Jul 18, 2022

Conversation

avivtur
Copy link
Member

@avivtur avivtur commented Jul 13, 2022

@openshift-ci openshift-ci bot requested review from glekner and pcbailey July 13, 2022 15:24
@openshift-ci openshift-ci bot added the approved This issue is something we want to fix label Jul 13, 2022
@avivtur avivtur changed the title Add migrations table [WIP] CNV19658: Add migrations table Jul 14, 2022
@avivtur avivtur changed the title [WIP] CNV19658: Add migrations table CNV19658: Add migrations table Jul 14, 2022
@avivtur avivtur force-pushed the migration_page_table branch 2 times, most recently from 49d0a3f to b49966f Compare July 17, 2022 15:37
@glekner
Copy link
Contributor

glekner commented Jul 17, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Passed code review, ready for merge label Jul 17, 2022
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

15 similar comments
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

5 similar comments
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@avivtur
Copy link
Member Author

avivtur commented Jul 18, 2022

/hold

Signed-off-by: Aviv Turgeman <aturgema@redhat.com>
Signed-off-by: Aviv Turgeman <aturgema@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Passed code review, ready for merge label Jul 18, 2022
@avivtur
Copy link
Member Author

avivtur commented Jul 18, 2022

/unhold

@glekner
Copy link
Contributor

glekner commented Jul 18, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Passed code review, ready for merge label Jul 18, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 18, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: avivtur, glekner

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot merged commit 844e576 into kubevirt-ui:main Jul 18, 2022
@@ -16,7 +16,8 @@
"paths": {
"@kubevirt-utils": ["src/utils"],
"@kubevirt-utils/*": ["src/utils/*"],
"@catalog/*": ["src/views/catalog/*"]
"@catalog/*": ["src/views/catalog/*"],
"@virtualmachines/*": ["src/views/virtualmachines/*"]
Copy link
Member

Choose a reason for hiding this comment

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

why we need it? virtualmachines isnt sharable. we just saving some ../../../ ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes its to avoid ../../......../.. pattern

Comment on lines +62 to +64
const mpObj = vmiObj?.status?.migrationState?.migrationPolicyName
? (mps || []).find(
(mp) => mp?.metadata?.name === vmiObj?.status?.migrationState?.migrationPolicyName,
Copy link
Member

Choose a reason for hiding this comment

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

consider naming migrationPolicy instead of mps, or mp

Comment on lines +16 to +40
const ONE_SECOND_IN_MS = 1000;
const ONE_MINUTE_IN_MS = 60 * ONE_SECOND_IN_MS;
const FIVE_MINUTES_IN_MS = 5 * ONE_MINUTE_IN_MS;
const FIFTEEN_MINUTES_IN_MS = 15 * ONE_MINUTE_IN_MS;
const THIRTY_MINUTES_IN_MS = 30 * ONE_MINUTE_IN_MS;
const ONE_HOUR_IN_MS = 60 * ONE_MINUTE_IN_MS;
const THREE_HOURS_IN_MS = 3 * ONE_HOUR_IN_MS;
const SIX_HOURS_IN_MS = 6 * ONE_HOUR_IN_MS;
const TWELVE_HOURS_IN_MS = 12 * ONE_HOUR_IN_MS;
const ONE_DAY_IN_MS = 24 * ONE_HOUR_IN_MS;
const TWO_DAYS_IN_MS = 2 * ONE_DAY_IN_MS;
const ONE_WEEK_IN_MS = 7 * ONE_DAY_IN_MS;

const valueToMSMapper = {
'5m': FIVE_MINUTES_IN_MS,
'15m': FIFTEEN_MINUTES_IN_MS,
'30m': THIRTY_MINUTES_IN_MS,
'1h': ONE_HOUR_IN_MS,
'3h': THREE_HOURS_IN_MS,
'6h': SIX_HOURS_IN_MS,
'12h': TWELVE_HOURS_IN_MS,
'1d': ONE_DAY_IN_MS,
'2d': TWO_DAYS_IN_MS,
'1w': ONE_WEEK_IN_MS,
};
Copy link
Member

Choose a reason for hiding this comment

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

Please export it to a more shareable place, other components I'm sure will love to use it too.

Copy link
Member Author

Choose a reason for hiding this comment

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

suggestion? @metalice

Comment on lines +20 to +30
export const iconMapper = {
Pending: InProgressIcon,
Scheduling: InProgressIcon,
Scheduled: InProgressIcon,
PreparingTarget: InProgressIcon,
TargetReady: InProgressIcon,
Paused: PausedIcon,
Running: SyncAltIcon,
Succeeded: GreenCheckCircleIcon,
Failed: RedExclamationCircleIcon,
};
Copy link
Member

Choose a reason for hiding this comment

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

Default icon for non-existing status?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope :)

filter: (selectedNodes, obj) => {
const nodeName = vmis?.find((vmi) => vmi.metadata?.name === obj?.vmiObj?.metadata?.name)
?.status?.migrationState?.targetNode;
return selectedNodes.selected?.length === 0 || selectedNodes.selected?.includes(nodeName);
Copy link
Member

Choose a reason for hiding this comment

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

?.selected

import { RowFilter } from '@openshift-console/dynamic-plugin-sdk';

import { vmimStatuses } from './statuses';

Copy link
Member

Choose a reason for hiding this comment

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

please check for all those functions that receive t as argument if you can simply import the default T , not the one from the hook, directly into this file

Copy link
Member Author

Choose a reason for hiding this comment

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

we can add a comment to utils/i18n.ts and remove this parameter, but I don't like that approach

rowFilters={filters}
onFilterChange={onFilterChange}
/>
<VirtualizedTable
Copy link
Member

Choose a reason for hiding this comment

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

missing type?

Comment on lines +59 to +62
...getStatusFilter(t),
...getSourceNodeFilter(vmis, t),
...getTargetNodeFilter(vmis, t),
];
Copy link
Member

Choose a reason for hiding this comment

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

is this a "heavy action"? should we consider memo here?

Copy link
Member Author

Choose a reason for hiding this comment

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

what do you mean by heavy action?

});

const [mps] = useK8sWatchResource<V1alpha1MigrationPolicy[]>({
groupVersionKind: {
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 use modelToGroupVersionKind or something similar here?

}
>
<ResourceLink
groupVersionKind={{
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 use modelToGroupVersionKind or something similar here?

Copy link
Member

Choose a reason for hiding this comment

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

we dont have migrationpolicymodel?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've send a PR to add this model to kubevirt-api: kubevirt-ui/kubevirt-api#23
but we need to build a new release for it


const MigrationsRow: React.FC<RowProps<MigrationTableDataLayout>> = ({ obj, activeColumnIDs }) => {
const { t } = useKubevirtTranslation();
const StatusIcon = iconMapper[obj?.vmim?.status?.phase];
Copy link
Member

Choose a reason for hiding this comment

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

iconMapper?.

}) => {
const { t } = useKubevirtTranslation();

const [isOpen, setIsOpen] = React.useState(false);
Copy link
Member

Choose a reason for hiding this comment

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

missing type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This issue is something we want to fix lgtm Passed code review, ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants