@centreon/ui 24.4.1-MON-38245-ba-tree-widget.6 → 24.4.1-MON-38194-widgets-display-optimizations.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Dashboard/Dashboard.styles.ts +5 -3
- package/src/Graph/Tree/Links.tsx +2 -15
- package/src/Graph/Tree/Tree.cypress.spec.tsx +0 -24
- package/src/Graph/Tree/Tree.stories.tsx +1 -17
- package/src/Graph/Tree/models.ts +0 -3
- package/src/ThemeProvider/index.tsx +1 -0
- package/src/components/Button/Button.styles.ts +2 -2
package/package.json
CHANGED
|
@@ -76,7 +76,7 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
|
|
|
76
76
|
border: 'none',
|
|
77
77
|
borderRadius: theme.spacing(1),
|
|
78
78
|
height: '100%',
|
|
79
|
-
paddingBottom: theme.spacing(
|
|
79
|
+
paddingBottom: theme.spacing(4),
|
|
80
80
|
width: '100%'
|
|
81
81
|
},
|
|
82
82
|
widgetContent: {
|
|
@@ -92,17 +92,19 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
|
|
|
92
92
|
'&[data-canMove="true"]': {
|
|
93
93
|
cursor: 'move'
|
|
94
94
|
},
|
|
95
|
-
padding: theme.spacing(
|
|
95
|
+
padding: theme.spacing(2.5, 2.5, 0.5),
|
|
96
96
|
position: 'relative'
|
|
97
97
|
},
|
|
98
98
|
widgetHeaderDraggable: {
|
|
99
99
|
height: '100%',
|
|
100
|
+
left: 0,
|
|
100
101
|
position: 'absolute',
|
|
102
|
+
top: 0,
|
|
101
103
|
width: '100%'
|
|
102
104
|
},
|
|
103
105
|
widgetPadding: {
|
|
104
106
|
overflowX: 'auto',
|
|
105
|
-
padding: hasHeader ? theme.spacing(1, 2,
|
|
107
|
+
padding: hasHeader ? theme.spacing(1, 2.5, 3) : theme.spacing(1, 2)
|
|
106
108
|
}
|
|
107
109
|
})
|
|
108
110
|
);
|
package/src/Graph/Tree/Links.tsx
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LinkHorizontal,
|
|
3
|
-
LinkHorizontalStep,
|
|
4
|
-
LinkHorizontalLine
|
|
5
|
-
} from '@visx/shape';
|
|
1
|
+
import { LinkHorizontal } from '@visx/shape';
|
|
6
2
|
import { HierarchyPointLink } from '@visx/hierarchy/lib/types';
|
|
7
|
-
import { always, cond, equals, T } from 'ramda';
|
|
8
3
|
|
|
9
4
|
import { useTheme } from '@mui/material';
|
|
10
5
|
|
|
@@ -14,12 +9,6 @@ interface Props<TData> extends Pick<TreeProps<TData>, 'treeLink'> {
|
|
|
14
9
|
links: Array<HierarchyPointLink<Node<TData>>>;
|
|
15
10
|
}
|
|
16
11
|
|
|
17
|
-
const getLinkComponent = cond([
|
|
18
|
-
[equals('line'), always(LinkHorizontalLine)],
|
|
19
|
-
[equals('step'), always(LinkHorizontalStep)],
|
|
20
|
-
[T, always(LinkHorizontal)]
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
12
|
const Links = <TData extends BaseProp>({
|
|
24
13
|
links,
|
|
25
14
|
treeLink
|
|
@@ -35,12 +24,10 @@ const Links = <TData extends BaseProp>({
|
|
|
35
24
|
.descendants()
|
|
36
25
|
.map((ancestor) => ancestor.data.data.id);
|
|
37
26
|
|
|
38
|
-
const LinkComponent = getLinkComponent(treeLink?.type);
|
|
39
|
-
|
|
40
27
|
const key = `${link.source.data.data.id}-${link.source.data.data.name}-${ancestorIds}_${link.target.data.data.id}-${link.target.data.data.name}-${descendantIds}`;
|
|
41
28
|
|
|
42
29
|
return (
|
|
43
|
-
<
|
|
30
|
+
<LinkHorizontal
|
|
44
31
|
data={link}
|
|
45
32
|
data-testid={`${link.source.data.data.id}_to_${link.target.data.data.id}`}
|
|
46
33
|
fill="none"
|
|
@@ -168,28 +168,4 @@ describe('Complex data tree', () => {
|
|
|
168
168
|
|
|
169
169
|
cy.makeSnapshot();
|
|
170
170
|
});
|
|
171
|
-
|
|
172
|
-
it('displays the tree with step links when a prop is set', () => {
|
|
173
|
-
initializeStandaloneTree({
|
|
174
|
-
treeLink: {
|
|
175
|
-
type: 'step'
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
cy.contains('T').should('be.visible');
|
|
180
|
-
|
|
181
|
-
cy.makeSnapshot();
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('displays the tree with line links when a prop is set', () => {
|
|
185
|
-
initializeStandaloneTree({
|
|
186
|
-
treeLink: {
|
|
187
|
-
type: 'line'
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
cy.contains('T').should('be.visible');
|
|
192
|
-
|
|
193
|
-
cy.makeSnapshot();
|
|
194
|
-
});
|
|
195
171
|
});
|
|
@@ -82,21 +82,6 @@ export const WithDefaultExpandFilter: Story = {
|
|
|
82
82
|
render: StandaloneTreeTemplate
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
export const WithStepLink: Story = {
|
|
86
|
-
args: {
|
|
87
|
-
children: SimpleContent,
|
|
88
|
-
node: {
|
|
89
|
-
height: 90,
|
|
90
|
-
width: 90
|
|
91
|
-
},
|
|
92
|
-
tree: simpleData,
|
|
93
|
-
treeLink: {
|
|
94
|
-
type: 'step'
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
render: StandaloneTreeTemplate
|
|
98
|
-
};
|
|
99
|
-
|
|
100
85
|
export const WithCustomLinks: Story = {
|
|
101
86
|
args: {
|
|
102
87
|
children: SimpleContent,
|
|
@@ -110,8 +95,7 @@ export const WithCustomLinks: Story = {
|
|
|
110
95
|
getStrokeDasharray: ({ target }) =>
|
|
111
96
|
target.status === 'ok' ? '5,5' : '0',
|
|
112
97
|
getStrokeOpacity: ({ target }) => (target.status === 'ok' ? 0.8 : 1),
|
|
113
|
-
getStrokeWidth: ({ target }) => (target.status === 'ok' ? 1 : 2)
|
|
114
|
-
type: 'line'
|
|
98
|
+
getStrokeWidth: ({ target }) => (target.status === 'ok' ? 1 : 2)
|
|
115
99
|
}
|
|
116
100
|
},
|
|
117
101
|
render: StandaloneTreeTemplate
|
package/src/Graph/Tree/models.ts
CHANGED
|
@@ -14,8 +14,6 @@ export interface BaseProp {
|
|
|
14
14
|
name: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export type Link = 'curve' | 'line' | 'step';
|
|
18
|
-
|
|
19
17
|
export interface ChildrenProps<TData> {
|
|
20
18
|
ancestors: Array<Node<TData>>;
|
|
21
19
|
depth: number;
|
|
@@ -50,6 +48,5 @@ export interface TreeProps<TData> {
|
|
|
50
48
|
) => string | number | undefined;
|
|
51
49
|
getStrokeOpacity?: (props: LinkProps<TData>) => string | number | undefined;
|
|
52
50
|
getStrokeWidth?: (props: LinkProps<TData>) => string | number | undefined;
|
|
53
|
-
type?: Link;
|
|
54
51
|
};
|
|
55
52
|
}
|
|
@@ -13,7 +13,7 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
13
13
|
paddingLeft: theme.spacing(2),
|
|
14
14
|
paddingRight: theme.spacing(2)
|
|
15
15
|
},
|
|
16
|
-
fontSize:
|
|
16
|
+
fontSize: theme.typography.button.fontSize,
|
|
17
17
|
height: 'unset',
|
|
18
18
|
lineHeight: '22px'
|
|
19
19
|
},
|
|
@@ -36,7 +36,7 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
36
36
|
color: theme.palette.primary.main
|
|
37
37
|
},
|
|
38
38
|
|
|
39
|
-
textWrap: '
|
|
39
|
+
textWrap: 'nowrap',
|
|
40
40
|
transition: 'unset'
|
|
41
41
|
}
|
|
42
42
|
}));
|