Skip to content

Commit 35cc730

Browse files
authored
A test PR (#21)
1 parent ac822aa commit 35cc730

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed
Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
import * as React from 'react';
22

3-
import { V1VirtualMachineCondition } from '@kubevirt-ui/kubevirt-api/kubevirt';
43
import { Label, Popover, PopoverPosition } from '@patternfly/react-core';
54

6-
export const VMStatusConditionLabel: React.FC<V1VirtualMachineCondition> = React.memo(
7-
(condition) => {
8-
const preventLabelLink = React.useCallback((e) => e.preventDefault(), []);
5+
interface k8sStatusConditions {
6+
type: string;
7+
status?: string;
8+
reason?: string;
9+
message?: string;
10+
}
911

10-
const getBodyContent = React.useCallback(
11-
() => <div>{condition?.message}</div>,
12-
[condition?.message],
13-
);
12+
/**
13+
* ConditionLabel renders a k8sStatusConditions
14+
*/
15+
export const ConditionLabel: React.FC<k8sStatusConditions> = React.memo((condition) => {
16+
const preventLabelLink = React.useCallback((e) => e.preventDefault(), []);
1417

15-
return (
16-
<Popover
17-
position={PopoverPosition.top}
18-
aria-label="Condition Popover"
19-
bodyContent={getBodyContent}
20-
>
21-
<Label color="grey" isTruncated href="#" onClick={preventLabelLink}>
22-
{condition?.reason}={condition?.status}
23-
</Label>
24-
</Popover>
25-
);
26-
},
27-
);
28-
VMStatusConditionLabel.displayName = 'VMStatusConditionLabel';
18+
const getBodyContent = React.useCallback(
19+
() => <div>{condition?.message}</div>,
20+
[condition?.message],
21+
);
22+
23+
return (
24+
<Popover
25+
position={PopoverPosition.top}
26+
aria-label="Condition Popover"
27+
bodyContent={getBodyContent}
28+
>
29+
<Label color="grey" isTruncated href="#" onClick={preventLabelLink}>
30+
{condition?.reason}={condition?.status}
31+
</Label>
32+
</Popover>
33+
);
34+
});
35+
ConditionLabel.displayName = 'ConditionLabel';

src/components/status/VMStatusConditionLabelList/VMStatusConditionLabelList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import * as React from 'react';
33
import { V1VirtualMachineCondition } from '@kubevirt-ui/kubevirt-api/kubevirt';
44
import { LabelGroup } from '@patternfly/react-core';
55

6-
import { VMStatusConditionLabel } from '../VMStatusConditionLabel/VMStatusConditionLabel';
6+
import { ConditionLabel } from '../VMStatusConditionLabel/VMStatusConditionLabel';
77

88
/**
9-
* VirtualMachineCondition represents the state of VirtualMachine
9+
* VirtualMachineCondition renders a list of a k8s resource conditions
1010
* */
1111
export interface VMStatusConditionLabelListProps {
1212
conditions: V1VirtualMachineCondition[];
@@ -17,7 +17,7 @@ export const VMStatusConditionLabelList: React.FC<VMStatusConditionLabelListProp
1717
return (
1818
<LabelGroup>
1919
{conditions.map(({ message, reason, status, type }) => (
20-
<VMStatusConditionLabel
20+
<ConditionLabel
2121
key={type}
2222
message={message}
2323
reason={reason}

0 commit comments

Comments
 (0)