@centreon/ui 26.5.10 → 26.5.11
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
CHANGED
package/src/Dashboard/Item.tsx
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import ExpandableContainer from '../components/ExpandableContainer';
|
|
15
15
|
import type { Parameters } from '../components/ExpandableContainer/models';
|
|
16
|
-
import LoadingSkeleton from '../LoadingSkeleton';
|
|
17
16
|
import { useMemoComponent, useViewportIntersection } from '../utils';
|
|
18
17
|
import { isResizingItemAtom } from './atoms';
|
|
19
18
|
import { useDashboardItemStyles } from './Dashboard.styles';
|
|
@@ -21,7 +20,10 @@ import { useDashboardItemStyles } from './Dashboard.styles';
|
|
|
21
20
|
interface DashboardItemProps {
|
|
22
21
|
additionalMemoProps?: Array<unknown>;
|
|
23
22
|
canMove?: boolean;
|
|
24
|
-
children:
|
|
23
|
+
children: Array<
|
|
24
|
+
| ReactElement
|
|
25
|
+
| (({ isInViewport }: { isInViewport: boolean }) => ReactElement)
|
|
26
|
+
>;
|
|
25
27
|
className?: string;
|
|
26
28
|
disablePadding?: boolean;
|
|
27
29
|
header?: ReactElement | ((params: Parameters) => ReactElement);
|
|
@@ -139,15 +141,10 @@ const Item = ({
|
|
|
139
141
|
!disablePadding && classes.widgetPadding
|
|
140
142
|
)}
|
|
141
143
|
>
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
height="100%"
|
|
147
|
-
width="100%"
|
|
148
|
-
/>
|
|
149
|
-
) : (
|
|
150
|
-
children
|
|
144
|
+
{children.map((child) =>
|
|
145
|
+
typeof child === 'function'
|
|
146
|
+
? child({ isInViewport })
|
|
147
|
+
: child
|
|
151
148
|
)}
|
|
152
149
|
</div>
|
|
153
150
|
</Card>
|
|
@@ -35,6 +35,7 @@ interface UseMetricsQueryProps {
|
|
|
35
35
|
timePeriodType: number;
|
|
36
36
|
};
|
|
37
37
|
isEnabled?: boolean;
|
|
38
|
+
enforceIsEnabled?: boolean;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
interface UseMetricsQueryState {
|
|
@@ -101,7 +102,8 @@ const useGraphQuery = ({
|
|
|
101
102
|
refreshCount,
|
|
102
103
|
bypassQueryParams = false,
|
|
103
104
|
prefix,
|
|
104
|
-
isEnabled = true
|
|
105
|
+
isEnabled = true,
|
|
106
|
+
enforceIsEnabled
|
|
105
107
|
}: UseMetricsQueryProps): UseMetricsQueryState => {
|
|
106
108
|
const timePeriodToUse = equals(timePeriod?.timePeriodType, -1)
|
|
107
109
|
? {
|
|
@@ -159,9 +161,10 @@ const useGraphQuery = ({
|
|
|
159
161
|
],
|
|
160
162
|
queryOptions: {
|
|
161
163
|
enabled:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
enforceIsEnabled ??
|
|
165
|
+
(areResourcesFullfilled(resources) &&
|
|
166
|
+
!isEmpty(definedMetrics) &&
|
|
167
|
+
isEnabled),
|
|
165
168
|
refetchInterval: refreshInterval,
|
|
166
169
|
suspense: false
|
|
167
170
|
},
|
|
@@ -32,10 +32,9 @@ export const useViewportIntersection = (
|
|
|
32
32
|
observer.current.disconnect();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
observer.current = new window.IntersectionObserver(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
35
|
+
observer.current = new window.IntersectionObserver(([newEntry]) => {
|
|
36
|
+
setEntry(newEntry);
|
|
37
|
+
}, options);
|
|
39
38
|
|
|
40
39
|
if (element) {
|
|
41
40
|
observer.current.observe(element);
|