@centreon/ui 26.1.0 → 26.3.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/Graph/BarChart/BarChart.cypress.spec.tsx +3 -3
- package/src/Graph/Chart/Chart.cypress.spec.tsx +10 -10
- package/src/Graph/common/BaseChart/useComputeYAxisMaxCharacters.ts +3 -2
- package/src/Graph/common/timeSeries/index.test.ts +4 -4
- package/src/Graph/common/timeSeries/index.ts +1 -1
- package/src/components/CopyCommand/CopyCommand.cypress.spec.tsx +15 -6
package/package.json
CHANGED
|
@@ -76,14 +76,14 @@ const checkWidth = (orientation): void => {
|
|
|
76
76
|
cy.get('g[class*="visx-rows"] > line')
|
|
77
77
|
.eq(0)
|
|
78
78
|
.should('have.attr', 'x2')
|
|
79
|
-
.and('equal', '
|
|
79
|
+
.and('equal', '1133');
|
|
80
80
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
cy.get('g[class*="visx-rows"] > line')
|
|
84
84
|
.eq(0)
|
|
85
85
|
.should('have.attr', 'x2')
|
|
86
|
-
.and('equal', '
|
|
86
|
+
.and('equal', '1168');
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
describe('Bar chart', () => {
|
|
@@ -103,7 +103,7 @@ describe('Bar chart', () => {
|
|
|
103
103
|
cy.contains('Centreon-Server: Round-Trip Maximum Time').should(
|
|
104
104
|
'be.visible'
|
|
105
105
|
);
|
|
106
|
-
cy.contains('7.47
|
|
106
|
+
cy.contains('7.47 KiB').should('be.visible');
|
|
107
107
|
|
|
108
108
|
cy.makeSnapshot();
|
|
109
109
|
});
|
|
@@ -157,7 +157,7 @@ const checkGraphWidth = (): void => {
|
|
|
157
157
|
.and('equal', '392');
|
|
158
158
|
|
|
159
159
|
cy.findByTestId('graph-interaction-zone').then((graph) => {
|
|
160
|
-
expect(Number(graph[0].attributes.width.value)).to.be.greaterThan(
|
|
160
|
+
expect(Number(graph[0].attributes.width.value)).to.be.greaterThan(1167);
|
|
161
161
|
});
|
|
162
162
|
};
|
|
163
163
|
|
|
@@ -180,8 +180,8 @@ describe('Line chart', () => {
|
|
|
180
180
|
|
|
181
181
|
cy.contains('06/18/2023').should('be.visible');
|
|
182
182
|
|
|
183
|
-
cy.contains('0.
|
|
184
|
-
cy.contains('
|
|
183
|
+
cy.contains('0.44 s').should('be.visible');
|
|
184
|
+
cy.contains('75.19%').should('be.visible');
|
|
185
185
|
|
|
186
186
|
cy.makeSnapshot();
|
|
187
187
|
});
|
|
@@ -235,7 +235,7 @@ describe('Line chart', () => {
|
|
|
235
235
|
|
|
236
236
|
cy.contains('Min: 70.31').should('be.visible');
|
|
237
237
|
|
|
238
|
-
cy.findByTestId('graph-interaction-zone').realMouseMove(
|
|
238
|
+
cy.findByTestId('graph-interaction-zone').realMouseMove(1100, 100);
|
|
239
239
|
|
|
240
240
|
cy.get('[data-metric="querytime"]').should('be.visible');
|
|
241
241
|
cy.get('[data-metric="hitratio"]').should('be.visible');
|
|
@@ -533,8 +533,8 @@ describe('Line chart', () => {
|
|
|
533
533
|
|
|
534
534
|
checkGraphWidth();
|
|
535
535
|
cy.contains(':00 AM').should('be.visible');
|
|
536
|
-
cy.get('circle[cx="
|
|
537
|
-
cy.get('circle[cy="
|
|
536
|
+
cy.get('circle[cx="245.83333333333334"]').should('be.visible');
|
|
537
|
+
cy.get('circle[cy="256.7205013298516"]').should('be.visible');
|
|
538
538
|
|
|
539
539
|
cy.makeSnapshot();
|
|
540
540
|
});
|
|
@@ -592,7 +592,7 @@ describe('Line chart', () => {
|
|
|
592
592
|
cy.get('path.visx-area-closed')
|
|
593
593
|
.should('have.attr', 'stroke-dasharray')
|
|
594
594
|
.and('equals', '5 4');
|
|
595
|
-
cy.get('circle[cx="
|
|
595
|
+
cy.get('circle[cx="32.77777777777778"]').should('be.visible');
|
|
596
596
|
|
|
597
597
|
cy.makeSnapshot();
|
|
598
598
|
});
|
|
@@ -714,7 +714,7 @@ describe('Lines and bars', () => {
|
|
|
714
714
|
cy.findByLabelText('B').click();
|
|
715
715
|
|
|
716
716
|
cy.findAllByTestId('unit-selector').eq(0).should('have.value', 'B');
|
|
717
|
-
cy.contains('8.79
|
|
717
|
+
cy.contains('8.79 KiB').should('be.visible');
|
|
718
718
|
|
|
719
719
|
cy.findAllByTestId('unit-selector').eq(1).parent().click();
|
|
720
720
|
cy.findByLabelText('%').click();
|
|
@@ -748,10 +748,10 @@ describe('Lines and bars', () => {
|
|
|
748
748
|
checkGraphWidth();
|
|
749
749
|
|
|
750
750
|
cy.get(
|
|
751
|
-
'path[d="M7.
|
|
751
|
+
'path[d="M7.435261707988982,289.92398616599974 h55.91735537190083 h1v1 v100.07601383400026 a1,1 0 0 1 -1,1 h-55.91735537190083 a1,1 0 0 1 -1,-1 v-100.07601383400026 v-1h1z"]'
|
|
752
752
|
).should('be.visible');
|
|
753
753
|
cy.get(
|
|
754
|
-
'path[d="
|
|
754
|
+
'path[d="M23.81046831955923,235.36727985204413 h23.166942148760334 a17.37520661157025,17.37520661157025 0 0 1 17.37520661157025,17.37520661157025 v19.806293090815103 v17.37520661157025h-17.37520661157025 h-23.166942148760334 h-17.37520661157025v-17.37520661157025 v-19.806293090815103 a17.37520661157025,17.37520661157025 0 0 1 17.37520661157025,-17.37520661157025z"]'
|
|
755
755
|
).should('be.visible');
|
|
756
756
|
|
|
757
757
|
cy.makeSnapshot();
|
|
@@ -69,11 +69,12 @@ export const useComputeYAxisMaxCharacters = ({
|
|
|
69
69
|
]
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
+
// Always add a character space in case the algorithm does not compute the displayed value in axis.
|
|
72
73
|
const maxLeftAxisCharacters = useMemo(
|
|
73
74
|
() =>
|
|
74
75
|
isEmpty(maxLeftValue)
|
|
75
76
|
? 2
|
|
76
|
-
: Math.max(...maxLeftValue.map((value) => value.length), 2),
|
|
77
|
+
: Math.max(...maxLeftValue.map((value) => value.length), 2) + 1,
|
|
77
78
|
[maxLeftValue]
|
|
78
79
|
);
|
|
79
80
|
|
|
@@ -81,7 +82,7 @@ export const useComputeYAxisMaxCharacters = ({
|
|
|
81
82
|
() =>
|
|
82
83
|
isEmpty(maxRightValue)
|
|
83
84
|
? 5
|
|
84
|
-
: Math.max(...maxRightValue.map((value) => value.length), 5),
|
|
85
|
+
: Math.max(...maxRightValue.map((value) => value.length), 5) + 1,
|
|
85
86
|
[maxRightValue]
|
|
86
87
|
);
|
|
87
88
|
|
|
@@ -374,10 +374,10 @@ describe('timeSeries', () => {
|
|
|
374
374
|
describe(formatMetricValue, () => {
|
|
375
375
|
const cases: Array<TestCase> = [
|
|
376
376
|
[218857269, '', 1000, '218.86m'],
|
|
377
|
-
[218857269, '', 1024, '208.72
|
|
377
|
+
[218857269, '', 1024, '208.72 Mi'],
|
|
378
378
|
[0.12232323445, '', 1000, '0.12'],
|
|
379
|
-
[1024, 'B', 1000, '1
|
|
380
|
-
[1024, 'B', 1024, '1
|
|
379
|
+
[1024, 'B', 1000, '1 KiB'],
|
|
380
|
+
[1024, 'B', 1024, '1 KiB'],
|
|
381
381
|
[null, 'B', 1024, null]
|
|
382
382
|
];
|
|
383
383
|
|
|
@@ -573,7 +573,7 @@ describe('Format value with unit', () => {
|
|
|
573
573
|
return '324.23m';
|
|
574
574
|
}
|
|
575
575
|
|
|
576
|
-
return `309.21
|
|
576
|
+
return `309.21 Mi${unit}`;
|
|
577
577
|
};
|
|
578
578
|
|
|
579
579
|
const humanReadableTestCases = units.map((unit) => {
|
|
@@ -131,6 +131,21 @@ echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!';
|
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
it('copies the command to the clipboard when the button is clicked', () => {
|
|
134
|
+
cy.wrap(
|
|
135
|
+
Cypress.automation('remote:debugger:protocol', {
|
|
136
|
+
command: 'Browser.grantPermissions',
|
|
137
|
+
params: {
|
|
138
|
+
permissions: ['clipboardReadWrite', 'clipboardSanitizedWrite'],
|
|
139
|
+
origin: window.location.origin
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
cy.window()
|
|
144
|
+
.its('navigator.clipboard')
|
|
145
|
+
.then((clipboard) => {
|
|
146
|
+
cy.spy(clipboard, 'writeText').as('writeText');
|
|
147
|
+
});
|
|
148
|
+
|
|
134
149
|
initialize({
|
|
135
150
|
text: `# a simple command
|
|
136
151
|
echo "hello" | grep "hel"`,
|
|
@@ -138,12 +153,6 @@ echo "hello" | grep "hel"`,
|
|
|
138
153
|
commandToCopy: 'echo "hello" | grep "hel"'
|
|
139
154
|
});
|
|
140
155
|
|
|
141
|
-
cy.window()
|
|
142
|
-
.its('navigator.clipboard')
|
|
143
|
-
.then((clipboard) => {
|
|
144
|
-
cy.spy(clipboard, 'writeText').as('writeText');
|
|
145
|
-
});
|
|
146
|
-
|
|
147
156
|
cy.findByTestId('Copy command').click();
|
|
148
157
|
|
|
149
158
|
cy.get('@writeText').should(
|