-
Notifications
You must be signed in to change notification settings - Fork 28
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
Conversation
80e865a
to
1c5a477
Compare
1c5a477
to
2c157a8
Compare
49d0a3f
to
b49966f
Compare
/lgtm |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
15 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
5 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/hold |
Signed-off-by: Aviv Turgeman <aturgema@redhat.com>
Signed-off-by: Aviv Turgeman <aturgema@redhat.com>
b49966f
to
2afd37f
Compare
/unhold |
/lgtm |
[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 |
@@ -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/*"] |
There was a problem hiding this comment.
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 ../../../ ?
There was a problem hiding this comment.
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
const mpObj = vmiObj?.status?.migrationState?.migrationPolicyName | ||
? (mps || []).find( | ||
(mp) => mp?.metadata?.name === vmiObj?.status?.migrationState?.migrationPolicyName, |
There was a problem hiding this comment.
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
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, | ||
}; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion? @metalice
export const iconMapper = { | ||
Pending: InProgressIcon, | ||
Scheduling: InProgressIcon, | ||
Scheduled: InProgressIcon, | ||
PreparingTarget: InProgressIcon, | ||
TargetReady: InProgressIcon, | ||
Paused: PausedIcon, | ||
Running: SyncAltIcon, | ||
Succeeded: GreenCheckCircleIcon, | ||
Failed: RedExclamationCircleIcon, | ||
}; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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'; | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing type?
...getStatusFilter(t), | ||
...getSourceNodeFilter(vmis, t), | ||
...getTargetNodeFilter(vmis, t), | ||
]; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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={{ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont have migrationpolicymodel?
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing type
Signed-off-by: Aviv Turgeman aturgema@redhat.com
📝 Description
🎥 Demo
migrations_table.mp4