@centreon/js-config 24.6.1 → 24.6.2
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.
|
@@ -141,12 +141,12 @@ Cypress.Commands.add(
|
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
interface Contact {
|
|
144
|
+
GUIAccess?: boolean;
|
|
144
145
|
admin?: boolean;
|
|
145
146
|
alias?: string | null;
|
|
146
147
|
authenticationType?: 'local' | 'ldap';
|
|
147
148
|
email: string;
|
|
148
149
|
enableNotifications?: boolean;
|
|
149
|
-
GUIAccess?: boolean;
|
|
150
150
|
language?: string;
|
|
151
151
|
name: string;
|
|
152
152
|
password: string;
|
|
@@ -203,7 +203,7 @@ Cypress.Commands.add(
|
|
|
203
203
|
|
|
204
204
|
interface ContactGroup {
|
|
205
205
|
alias?: string | null;
|
|
206
|
-
contacts: string
|
|
206
|
+
contacts: Array<string>;
|
|
207
207
|
name: string;
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -449,7 +449,7 @@ Cypress.Commands.add(
|
|
|
449
449
|
|
|
450
450
|
interface ServiceGroup {
|
|
451
451
|
alias?: string | null;
|
|
452
|
-
hostsAndServices: string
|
|
452
|
+
hostsAndServices: Array<Array<string>>;
|
|
453
453
|
name: string;
|
|
454
454
|
}
|
|
455
455
|
|
|
@@ -500,8 +500,8 @@ Cypress.Commands.add(
|
|
|
500
500
|
|
|
501
501
|
interface ACLGroup {
|
|
502
502
|
alias?: string | null;
|
|
503
|
-
|
|
504
|
-
|
|
503
|
+
contactGroups?: Array<string>;
|
|
504
|
+
contacts?: Array<string>;
|
|
505
505
|
name: string;
|
|
506
506
|
}
|
|
507
507
|
|
|
@@ -525,7 +525,7 @@ Cypress.Commands.add(
|
|
|
525
525
|
})
|
|
526
526
|
.then(() => {
|
|
527
527
|
if (contacts) {
|
|
528
|
-
contacts.
|
|
528
|
+
contacts.forEach((contact) => {
|
|
529
529
|
cy.executeActionViaClapi({
|
|
530
530
|
bodyContent: {
|
|
531
531
|
action: 'ADDCONTACT',
|
|
@@ -536,7 +536,7 @@ Cypress.Commands.add(
|
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
if (contactGroups) {
|
|
539
|
-
contactGroups.
|
|
539
|
+
contactGroups.forEach((contactGroup) => {
|
|
540
540
|
cy.executeActionViaClapi({
|
|
541
541
|
bodyContent: {
|
|
542
542
|
action: 'ADDCONTACTGROUP',
|
|
@@ -551,11 +551,11 @@ Cypress.Commands.add(
|
|
|
551
551
|
);
|
|
552
552
|
|
|
553
553
|
interface ACLMenu {
|
|
554
|
-
name: string;
|
|
555
|
-
rule?: string[];
|
|
556
554
|
alias?: string | null;
|
|
557
555
|
includeChildren?: boolean;
|
|
556
|
+
name: string;
|
|
558
557
|
readOnly?: boolean;
|
|
558
|
+
rule?: Array<string>;
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
Cypress.Commands.add(
|
|
@@ -580,30 +580,31 @@ Cypress.Commands.add(
|
|
|
580
580
|
}
|
|
581
581
|
})
|
|
582
582
|
.then(() => {
|
|
583
|
-
if (rule.length
|
|
583
|
+
if (rule.length === 0) {
|
|
584
584
|
return cy.wrap(null);
|
|
585
585
|
}
|
|
586
586
|
|
|
587
587
|
let ruleCommand = '';
|
|
588
|
-
rule.
|
|
588
|
+
rule.forEach((rulePage, index) => {
|
|
589
589
|
ruleCommand += rulePage + (index == rule.length - 1 ? '' : ';');
|
|
590
590
|
});
|
|
591
591
|
cy.executeActionViaClapi({
|
|
592
592
|
bodyContent: {
|
|
593
|
-
action
|
|
593
|
+
action,
|
|
594
594
|
object: 'ACLMENU',
|
|
595
595
|
values: `${name};${children};${ruleCommand}`
|
|
596
596
|
}
|
|
597
597
|
});
|
|
598
|
+
|
|
598
599
|
return cy.wrap(null);
|
|
599
600
|
});
|
|
600
601
|
}
|
|
601
602
|
);
|
|
602
603
|
|
|
603
604
|
interface ACLAction {
|
|
604
|
-
|
|
605
|
+
actions?: Array<Action>;
|
|
605
606
|
description: string;
|
|
606
|
-
|
|
607
|
+
name: string;
|
|
607
608
|
}
|
|
608
609
|
|
|
609
610
|
Cypress.Commands.add(
|
|
@@ -618,12 +619,12 @@ Cypress.Commands.add(
|
|
|
618
619
|
}
|
|
619
620
|
})
|
|
620
621
|
.then(() => {
|
|
621
|
-
if (actions.length
|
|
622
|
+
if (actions.length === 0) {
|
|
622
623
|
return cy.wrap(null);
|
|
623
624
|
}
|
|
624
625
|
|
|
625
626
|
let actionCommand = '';
|
|
626
|
-
actions.
|
|
627
|
+
actions.forEach((action, index) => {
|
|
627
628
|
actionCommand += action + (index == actions.length - 1 ? '' : '|');
|
|
628
629
|
});
|
|
629
630
|
cy.executeActionViaClapi({
|
|
@@ -633,20 +634,22 @@ Cypress.Commands.add(
|
|
|
633
634
|
values: `${name};${actionCommand}`
|
|
634
635
|
}
|
|
635
636
|
});
|
|
637
|
+
|
|
636
638
|
return cy.wrap(null);
|
|
637
639
|
});
|
|
638
640
|
}
|
|
639
641
|
);
|
|
640
642
|
|
|
641
643
|
interface ACLResource {
|
|
642
|
-
name: string;
|
|
643
644
|
alias?: string | null;
|
|
645
|
+
name: string;
|
|
644
646
|
}
|
|
645
647
|
|
|
646
648
|
Cypress.Commands.add(
|
|
647
649
|
'addACLResource',
|
|
648
650
|
({ name, alias = null }: ACLResource): Cypress.Chainable => {
|
|
649
651
|
const ACLResourcesAlias = alias === null ? name : alias;
|
|
652
|
+
|
|
650
653
|
return cy.executeActionViaClapi({
|
|
651
654
|
bodyContent: {
|
|
652
655
|
action: 'ADD',
|
|
@@ -64,10 +64,52 @@ Cypress.Commands.add(
|
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
+
interface Downtime {
|
|
68
|
+
host: string;
|
|
69
|
+
service?: string | null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
Cypress.Commands.add(
|
|
73
|
+
'waitForDowntime',
|
|
74
|
+
(downtime: Downtime): Cypress.Chainable => {
|
|
75
|
+
cy.log('Checking hosts in database');
|
|
76
|
+
|
|
77
|
+
let query = `SELECT COUNT(d.downtime_id) AS count_downtimes FROM downtimes as d
|
|
78
|
+
INNER JOIN hosts as h ON h.host_id = d.host_id AND h.name = '${downtime.host}'`;
|
|
79
|
+
if (downtime.service) {
|
|
80
|
+
query += ` INNER JOIN services as s ON s.service_id = d.service_id AND s.description = '${downtime.service}'`;
|
|
81
|
+
}
|
|
82
|
+
query += ` WHERE d.started=1`;
|
|
83
|
+
if (!downtime.service) {
|
|
84
|
+
query += ` AND d.service_id = 0`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
cy.log(query);
|
|
88
|
+
|
|
89
|
+
cy.waitUntil(() => {
|
|
90
|
+
return cy
|
|
91
|
+
.requestOnDatabase({
|
|
92
|
+
database: 'centreon_storage',
|
|
93
|
+
query
|
|
94
|
+
})
|
|
95
|
+
.then(([rows]) => {
|
|
96
|
+
const foundDowntimesCount = rows.length ? rows[0].count_downtimes : 0;
|
|
97
|
+
|
|
98
|
+
cy.log('Downtime count in database', foundDowntimesCount);
|
|
99
|
+
|
|
100
|
+
return cy.wrap(foundDowntimesCount > 0);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return cy.wrap(null);
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
67
108
|
declare global {
|
|
68
109
|
namespace Cypress {
|
|
69
110
|
interface Chainable {
|
|
70
111
|
submitResults: (props: Array<SubmitResult>) => Cypress.Chainable;
|
|
112
|
+
waitForDowntime: (downtime: Downtime) => Cypress.Chainable;
|
|
71
113
|
}
|
|
72
114
|
}
|
|
73
115
|
}
|
package/cypress/e2e/tasks.ts
CHANGED
|
@@ -157,7 +157,7 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
157
157
|
user: 'centreon'
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
-
const [rows, fields] = await client.
|
|
160
|
+
const [rows, fields] = await client.query(query);
|
|
161
161
|
|
|
162
162
|
await client.end();
|
|
163
163
|
|
|
@@ -211,6 +211,7 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
211
211
|
WEB_IMAGE: webImage
|
|
212
212
|
})
|
|
213
213
|
.withProfiles(...profiles)
|
|
214
|
+
.withStartupTimeout(120000)
|
|
214
215
|
.withWaitStrategy(
|
|
215
216
|
'web-1',
|
|
216
217
|
Wait.forAll([
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/js-config",
|
|
3
3
|
"description": "Centreon Frontend shared build configuration",
|
|
4
|
-
"version": "24.6.
|
|
4
|
+
"version": "24.6.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"prettier": "^3.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@badeball/cypress-cucumber-preprocessor": "^20.0.
|
|
25
|
-
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.
|
|
24
|
+
"@badeball/cypress-cucumber-preprocessor": "^20.0.7",
|
|
25
|
+
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.1",
|
|
26
26
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
27
27
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
28
|
-
"@tsconfig/node16": "^16.1.
|
|
29
|
-
"@tsconfig/node20": "^20.1.
|
|
28
|
+
"@tsconfig/node16": "^16.1.3",
|
|
29
|
+
"@tsconfig/node20": "^20.1.4",
|
|
30
30
|
"@types/cypress-cucumber-preprocessor": "^4.0.5",
|
|
31
31
|
"cypress": "^13.6.4",
|
|
32
32
|
"cypress-multi-reporters": "^1.6.4",
|
|
33
|
-
"cypress-terminal-report": "^6.0
|
|
33
|
+
"cypress-terminal-report": "^6.1.0",
|
|
34
34
|
"cypress-wait-until": "^3.0.1",
|
|
35
35
|
"dotenv": "^16.4.5",
|
|
36
|
-
"esbuild": "^0.
|
|
36
|
+
"esbuild": "^0.21.5",
|
|
37
37
|
"eslint": "^8.53.0",
|
|
38
38
|
"eslint-config-airbnb": "19.0.4",
|
|
39
39
|
"eslint-config-prettier": "^8.5.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
53
53
|
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
54
54
|
"mochawesome": "^7.1.3",
|
|
55
|
-
"mysql2": "^3.
|
|
55
|
+
"mysql2": "^3.10.1",
|
|
56
56
|
"tar-fs": "^3.0.6",
|
|
57
57
|
"testcontainers": "^10.9.0"
|
|
58
58
|
}
|