@centreon/js-config 23.10.53 → 23.10.55

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.
@@ -416,6 +416,41 @@ Cypress.Commands.add(
416
416
  }
417
417
  );
418
418
 
419
+ Cypress.Commands.add(
420
+ 'insertDashboardWithWidget',
421
+ (dashboardBody, patchBody) => {
422
+ cy.request({
423
+ body: {
424
+ ...dashboardBody
425
+ },
426
+ method: 'POST',
427
+ url: '/centreon/api/latest/configuration/dashboards'
428
+ }).then((response) => {
429
+ const dashboardId = response.body.id;
430
+ cy.waitUntil(
431
+ () => {
432
+ return cy
433
+ .request({
434
+ method: 'GET',
435
+ url: `/centreon/api/latest/configuration/dashboards/${dashboardId}`
436
+ })
437
+ .then((getResponse) => {
438
+ return getResponse.body && getResponse.body.id === dashboardId;
439
+ });
440
+ },
441
+ {
442
+ timeout: 10000
443
+ }
444
+ );
445
+ cy.request({
446
+ body: patchBody,
447
+ method: 'PATCH',
448
+ url: `/centreon/api/latest/configuration/dashboards/${dashboardId}`
449
+ });
450
+ });
451
+ }
452
+ );
453
+
419
454
  interface ShareDashboardToUserProps {
420
455
  dashboardName: string;
421
456
  role: string;
@@ -430,6 +465,30 @@ interface ListingRequestResult {
430
465
  };
431
466
  }
432
467
 
468
+ interface PatchDashboardBody {
469
+ panels: Array<{
470
+ layout: {
471
+ height: number;
472
+ min_height: number;
473
+ min_width: number;
474
+ width: number;
475
+ x: number;
476
+ y: number;
477
+ };
478
+ name: string;
479
+ widget_settings: {
480
+ options: {
481
+ description: {
482
+ content: string;
483
+ enabled: boolean;
484
+ };
485
+ name: string;
486
+ };
487
+ };
488
+ widget_type: string;
489
+ }>;
490
+ }
491
+
433
492
  Cypress.Commands.add(
434
493
  'shareDashboardToUser',
435
494
  ({ dashboardName, userName, role }: ShareDashboardToUserProps): void => {
@@ -502,6 +561,11 @@ declare global {
502
561
  hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
503
562
  insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
504
563
  insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
564
+ insertDashboardWithWidget: (
565
+ dashboard: Dashboard,
566
+ patch: PatchDashboardBody
567
+ ) => Cypress.Chainable;
568
+
505
569
  loginByTypeOfUser: ({
506
570
  jsonName,
507
571
  loginViaApi
@@ -5,6 +5,7 @@ import { execSync } from 'child_process';
5
5
 
6
6
  import { defineConfig } from 'cypress';
7
7
  import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter';
8
+ import { config as configDotenv } from 'dotenv';
8
9
 
9
10
  import esbuildPreprocessor from './esbuild-preprocessor';
10
11
  import plugins from './plugins';
@@ -14,6 +15,7 @@ interface ConfigurationOptions {
14
15
  cypressFolder?: string;
15
16
  dockerName?: string;
16
17
  env?: Record<string, unknown>;
18
+ envFile?: string;
17
19
  isDevelopment?: boolean;
18
20
  specPattern: string;
19
21
  }
@@ -23,8 +25,13 @@ export default ({
23
25
  cypressFolder,
24
26
  isDevelopment,
25
27
  dockerName,
26
- env
28
+ env,
29
+ envFile
27
30
  }: ConfigurationOptions): Cypress.ConfigOptions => {
31
+ if (envFile) {
32
+ configDotenv({ path: envFile });
33
+ }
34
+
28
35
  const resultsFolder = `${cypressFolder || '.'}/results`;
29
36
 
30
37
  const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
@@ -53,7 +60,7 @@ export default ({
53
60
  },
54
61
  env: {
55
62
  ...env,
56
- OPENID_IMAGE_VERSION: '23.04',
63
+ OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
57
64
  WEB_IMAGE_OS: 'alma9',
58
65
  WEB_IMAGE_VERSION: webImageVersion,
59
66
  dockerName: dockerName || 'centreon-dev'
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": "23.10.53",
4
+ "version": "23.10.55",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -53,6 +53,7 @@
53
53
  "cypress-multi-reporters": "^1.6.3",
54
54
  "cypress-terminal-report": "^5.3.6",
55
55
  "dockerode": "^3.3.5",
56
+ "dotenv": "^16.3.1",
56
57
  "esbuild": "^0.19.3",
57
58
  "mochawesome": "^7.1.3"
58
59
  }