@centreon/js-config 24.4.30 → 24.4.31
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.
|
@@ -62,7 +62,6 @@ interface Query {
|
|
|
62
62
|
|
|
63
63
|
export interface InterceptAPIRequestProps<T> {
|
|
64
64
|
alias: string;
|
|
65
|
-
delay?: number;
|
|
66
65
|
method: Method;
|
|
67
66
|
path: string;
|
|
68
67
|
query?: Query;
|
|
@@ -78,8 +77,7 @@ Cypress.Commands.add(
|
|
|
78
77
|
response,
|
|
79
78
|
alias,
|
|
80
79
|
query,
|
|
81
|
-
statusCode = 200
|
|
82
|
-
delay = 500
|
|
80
|
+
statusCode = 200
|
|
83
81
|
}: InterceptAPIRequestProps<T>): void => {
|
|
84
82
|
cy.interceptRequest(
|
|
85
83
|
method,
|
|
@@ -88,14 +86,14 @@ Cypress.Commands.add(
|
|
|
88
86
|
const getQuery = req?.url?.searchParams?.get(query?.name);
|
|
89
87
|
if (query && equals(query.value, getQuery)) {
|
|
90
88
|
return res(
|
|
91
|
-
ctx.delay(
|
|
89
|
+
ctx.delay(500),
|
|
92
90
|
ctx.json(response),
|
|
93
91
|
ctx.status(statusCode)
|
|
94
92
|
);
|
|
95
93
|
}
|
|
96
94
|
if (!getQuery && isNil(query)) {
|
|
97
95
|
return res(
|
|
98
|
-
ctx.delay(
|
|
96
|
+
ctx.delay(500),
|
|
99
97
|
ctx.json(response),
|
|
100
98
|
ctx.status(statusCode)
|
|
101
99
|
);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
2
|
|
|
3
|
-
import { Action } from 'e2e/features/ACLs/commands';
|
|
4
|
-
|
|
5
3
|
const apiBase = '/centreon/api';
|
|
6
4
|
const apiActionV1 = `${apiBase}/index.php`;
|
|
7
5
|
|
|
@@ -498,172 +496,9 @@ Cypress.Commands.add(
|
|
|
498
496
|
}
|
|
499
497
|
);
|
|
500
498
|
|
|
501
|
-
interface ACLGroup {
|
|
502
|
-
alias?: string | null;
|
|
503
|
-
contacts?: string[];
|
|
504
|
-
contactGroups?: string[];
|
|
505
|
-
name: string;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
Cypress.Commands.add(
|
|
509
|
-
'addACLGroup',
|
|
510
|
-
({
|
|
511
|
-
alias = null,
|
|
512
|
-
contacts = [],
|
|
513
|
-
contactGroups = [],
|
|
514
|
-
name
|
|
515
|
-
}: ACLGroup): Cypress.Chainable => {
|
|
516
|
-
const ACLGroupALias = alias === null ? name : alias;
|
|
517
|
-
|
|
518
|
-
return cy
|
|
519
|
-
.executeActionViaClapi({
|
|
520
|
-
bodyContent: {
|
|
521
|
-
action: 'ADD',
|
|
522
|
-
object: 'ACLGROUP',
|
|
523
|
-
values: `${name};${ACLGroupALias}`
|
|
524
|
-
}
|
|
525
|
-
})
|
|
526
|
-
.then(() => {
|
|
527
|
-
if (contacts) {
|
|
528
|
-
contacts.map((contact) => {
|
|
529
|
-
cy.executeActionViaClapi({
|
|
530
|
-
bodyContent: {
|
|
531
|
-
action: 'ADDCONTACT',
|
|
532
|
-
object: 'ACLGROUP',
|
|
533
|
-
values: `${name};${contact}`
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
if (contactGroups) {
|
|
539
|
-
contactGroups.map((contactGroup) => {
|
|
540
|
-
cy.executeActionViaClapi({
|
|
541
|
-
bodyContent: {
|
|
542
|
-
action: 'ADDCONTACTGROUP',
|
|
543
|
-
object: 'ACLGROUP',
|
|
544
|
-
values: `${name};${contactGroup}`
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
);
|
|
552
|
-
|
|
553
|
-
interface ACLMenu {
|
|
554
|
-
name: string;
|
|
555
|
-
rule?: string[];
|
|
556
|
-
alias?: string | null;
|
|
557
|
-
includeChildren?: boolean;
|
|
558
|
-
readOnly?: boolean;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
Cypress.Commands.add(
|
|
562
|
-
'addACLMenu',
|
|
563
|
-
({
|
|
564
|
-
name,
|
|
565
|
-
rule = [],
|
|
566
|
-
alias = null,
|
|
567
|
-
includeChildren = true,
|
|
568
|
-
readOnly = false
|
|
569
|
-
}: ACLMenu): Cypress.Chainable => {
|
|
570
|
-
const ACLMenuAlias = alias === null ? name : alias;
|
|
571
|
-
const action = readOnly ? 'GRANTRO' : 'GRANTRW';
|
|
572
|
-
const children = includeChildren ? '1' : '0';
|
|
573
|
-
|
|
574
|
-
return cy
|
|
575
|
-
.executeActionViaClapi({
|
|
576
|
-
bodyContent: {
|
|
577
|
-
action: 'ADD',
|
|
578
|
-
object: 'ACLMENU',
|
|
579
|
-
values: `${name};${ACLMenuAlias}`
|
|
580
|
-
}
|
|
581
|
-
})
|
|
582
|
-
.then(() => {
|
|
583
|
-
if (rule.length == 0) {
|
|
584
|
-
return cy.wrap(null);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
let ruleCommand = '';
|
|
588
|
-
rule.map((rulePage, index) => {
|
|
589
|
-
ruleCommand += rulePage + (index == rule.length - 1 ? '' : ';');
|
|
590
|
-
});
|
|
591
|
-
cy.executeActionViaClapi({
|
|
592
|
-
bodyContent: {
|
|
593
|
-
action: action,
|
|
594
|
-
object: 'ACLMENU',
|
|
595
|
-
values: `${name};${children};${ruleCommand}`
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
return cy.wrap(null);
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
);
|
|
602
|
-
|
|
603
|
-
interface ACLAction {
|
|
604
|
-
name: string;
|
|
605
|
-
description: string;
|
|
606
|
-
actions?: Action[];
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
Cypress.Commands.add(
|
|
610
|
-
'addACLAction',
|
|
611
|
-
({ name, description, actions = [] }: ACLAction): Cypress.Chainable => {
|
|
612
|
-
return cy
|
|
613
|
-
.executeActionViaClapi({
|
|
614
|
-
bodyContent: {
|
|
615
|
-
action: 'ADD',
|
|
616
|
-
object: 'ACLACTION',
|
|
617
|
-
values: `${name};${description}`
|
|
618
|
-
}
|
|
619
|
-
})
|
|
620
|
-
.then(() => {
|
|
621
|
-
if (actions.length == 0) {
|
|
622
|
-
return cy.wrap(null);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
let actionCommand = '';
|
|
626
|
-
actions.map((action, index) => {
|
|
627
|
-
actionCommand += action + (index == actions.length - 1 ? '' : '|');
|
|
628
|
-
});
|
|
629
|
-
cy.executeActionViaClapi({
|
|
630
|
-
bodyContent: {
|
|
631
|
-
action: 'GRANT',
|
|
632
|
-
object: 'ACLACTION',
|
|
633
|
-
values: `${name};${actionCommand}`
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
return cy.wrap(null);
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
);
|
|
640
|
-
|
|
641
|
-
interface ACLResource {
|
|
642
|
-
name: string;
|
|
643
|
-
alias?: string | null;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
Cypress.Commands.add(
|
|
647
|
-
'addACLResource',
|
|
648
|
-
({ name, alias = null }: ACLResource): Cypress.Chainable => {
|
|
649
|
-
const ACLResourcesAlias = alias === null ? name : alias;
|
|
650
|
-
return cy.executeActionViaClapi({
|
|
651
|
-
bodyContent: {
|
|
652
|
-
action: 'ADD',
|
|
653
|
-
object: 'ACLRESOURCE',
|
|
654
|
-
values: `${name};${ACLResourcesAlias}`
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
);
|
|
659
|
-
|
|
660
499
|
declare global {
|
|
661
500
|
namespace Cypress {
|
|
662
501
|
interface Chainable {
|
|
663
|
-
addACLAction: (props: ACLAction) => Cypress.Chainable;
|
|
664
|
-
addACLGroup: (props: ACLGroup) => Cypress.Chainable;
|
|
665
|
-
addACLMenu: (props: ACLMenu) => Cypress.Chainable;
|
|
666
|
-
addACLResource: (props: ACLResource) => Cypress.Chainable;
|
|
667
502
|
addCheckCommand: (props: CheckCommand) => Cypress.Chainable;
|
|
668
503
|
addContact: (props: Contact) => Cypress.Chainable;
|
|
669
504
|
addContactGroup: (props: ContactGroup) => Cypress.Chainable;
|
|
@@ -59,7 +59,7 @@ export default ({
|
|
|
59
59
|
},
|
|
60
60
|
env: {
|
|
61
61
|
...env,
|
|
62
|
-
DATABASE_IMAGE: 'bitnami/mariadb:10.
|
|
62
|
+
DATABASE_IMAGE: 'bitnami/mariadb:10.5',
|
|
63
63
|
OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
64
64
|
SAML_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
65
65
|
WEB_IMAGE_OS: 'alma9',
|
package/cypress/e2e/tasks.ts
CHANGED
|
@@ -106,7 +106,7 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
106
106
|
const { exitCode, output } = await getContainer(name).exec([
|
|
107
107
|
'bash',
|
|
108
108
|
'-c',
|
|
109
|
-
|
|
109
|
+
command
|
|
110
110
|
]);
|
|
111
111
|
|
|
112
112
|
return { exitCode, output };
|
package/package.json
CHANGED