@centreon/ui-context 25.11.2 → 26.3.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui-context",
3
- "version": "25.11.2",
3
+ "version": "26.3.0",
4
4
  "description": "Centreon UI shared context",
5
5
  "main": "src/index.ts",
6
6
  "keywords": [],
@@ -1,8 +1,6 @@
1
- import { atom } from 'jotai';
2
-
3
- import { defaultAcknowledgement } from './defaults';
4
-
5
- import { Acknowledgement } from '.';
1
+ import { atom } from "jotai";
2
+ import type { Acknowledgement } from ".";
3
+ import { defaultAcknowledgement } from "./defaults";
6
4
 
7
5
  const acknowledgementAtom = atom<Acknowledgement>(defaultAcknowledgement);
8
6
 
package/src/aclAtom.ts CHANGED
@@ -1,8 +1,6 @@
1
- import { atom } from 'jotai';
2
-
3
- import { defaultAcl } from './defaults';
4
-
5
- import { Acl } from '.';
1
+ import { atom } from "jotai";
2
+ import type { Acl } from ".";
3
+ import { defaultAcl } from "./defaults";
6
4
 
7
5
  const aclAtom = atom<Acl>(defaultAcl);
8
6
 
@@ -1,5 +1,5 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
- import { AdditionalResource } from './types';
3
+ import type { AdditionalResource } from "./types";
4
4
 
5
5
  export const additionalResourcesAtom = atom<Array<AdditionalResource>>([]);
@@ -1,3 +1,3 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
3
  export const browserLocaleAtom = atom(navigator.language.slice(0, 2));
@@ -1,4 +1,4 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
3
  const cloudServicesAtom = atom(false);
4
4
 
package/src/defaults.ts CHANGED
@@ -1,64 +1,64 @@
1
- import { ListingVariant, ThemeMode, User } from './types';
1
+ import { ListingVariant, ThemeMode, type User } from "./types";
2
2
 
3
3
  const defaultUser: User = {
4
- alias: '',
5
- canManageApiTokens: false,
6
- default_page: '/monitoring/resources',
7
- id: undefined,
8
- isAdmin: undefined,
9
- isExportButtonEnabled: false,
10
- locale: null,
11
- name: '',
12
- themeMode: ThemeMode.light,
13
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
14
- use_deprecated_pages: false,
15
- user_interface_density: ListingVariant.compact
4
+ alias: "",
5
+ canManageApiTokens: false,
6
+ default_page: "/monitoring/resources",
7
+ id: undefined,
8
+ isAdmin: undefined,
9
+ isExportButtonEnabled: false,
10
+ locale: null,
11
+ name: "",
12
+ themeMode: ThemeMode.light,
13
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
14
+ use_deprecated_pages: false,
15
+ user_interface_density: ListingVariant.compact,
16
16
  };
17
17
 
18
18
  const defaultResourceStorageOptimizationMode = false;
19
19
 
20
20
  const defaultAcl = {
21
- actions: {
22
- host: {
23
- acknowledgement: false,
24
- check: false,
25
- comment: false,
26
- disacknowledgement: false,
27
- downtime: false,
28
- submit_status: false
29
- },
30
- service: {
31
- acknowledgement: false,
32
- check: false,
33
- comment: false,
34
- disacknowledgement: false,
35
- downtime: false,
36
- submit_status: false
37
- }
38
- }
21
+ actions: {
22
+ host: {
23
+ acknowledgement: false,
24
+ check: false,
25
+ comment: false,
26
+ disacknowledgement: false,
27
+ downtime: false,
28
+ submit_status: false,
29
+ },
30
+ service: {
31
+ acknowledgement: false,
32
+ check: false,
33
+ comment: false,
34
+ disacknowledgement: false,
35
+ downtime: false,
36
+ submit_status: false,
37
+ },
38
+ },
39
39
  };
40
40
 
41
41
  const defaultDowntime = {
42
- duration: 3600,
43
- fixed: true,
44
- with_services: false
42
+ duration: 3600,
43
+ fixed: true,
44
+ with_services: false,
45
45
  };
46
46
 
47
47
  const defaultRefreshInterval = 15;
48
48
 
49
49
  const defaultAcknowledgement = {
50
- force_active_checks: false,
51
- notify: true,
52
- persistent: false,
53
- sticky: false,
54
- with_services: true
50
+ force_active_checks: false,
51
+ notify: true,
52
+ persistent: false,
53
+ sticky: false,
54
+ with_services: true,
55
55
  };
56
56
 
57
57
  export {
58
- defaultUser,
59
- defaultAcl,
60
- defaultDowntime,
61
- defaultRefreshInterval,
62
- defaultAcknowledgement,
63
- defaultResourceStorageOptimizationMode
58
+ defaultUser,
59
+ defaultAcl,
60
+ defaultDowntime,
61
+ defaultRefreshInterval,
62
+ defaultAcknowledgement,
63
+ defaultResourceStorageOptimizationMode,
64
64
  };
@@ -1,8 +1,6 @@
1
- import { atom } from 'jotai';
2
-
3
- import { defaultDowntime } from './defaults';
4
-
5
- import { Downtime } from '.';
1
+ import { atom } from "jotai";
2
+ import type { Downtime } from ".";
3
+ import { defaultDowntime } from "./defaults";
6
4
 
7
5
  const downtimeAtom = atom<Downtime>(defaultDowntime);
8
6
 
@@ -1,6 +1,6 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
- import { FederatedModule } from './types';
3
+ import type { FederatedModule } from "./types";
4
4
 
5
5
  export const federatedModulesAtom = atom<Array<FederatedModule> | null>(null);
6
6
 
package/src/index.ts CHANGED
@@ -1,43 +1,39 @@
1
- export { default as userAtom } from './userAtom';
2
- export { default as aclAtom } from './aclAtom';
3
- export { default as downtimeAtom } from './downtimeAtom';
4
- export { default as refreshIntervalAtom } from './refreshIntervalAtom';
5
- export { default as statisticsRefreshIntervalAtom } from './statisticsRefreshIntervalAtom';
6
- export { default as cloudServicesAtom } from './cloudServicesAtom';
7
- export { default as acknowledgementAtom } from './acknowledgementAtom';
8
- export { default as resourceStorageOptimizationModeAtom } from './resourceStorageOptimizationMode';
9
- export { default as platformNameAtom } from './platformNameAtom';
10
- export { default as userPermissionsAtom } from './userPermissionsAtom';
11
-
12
- export { ThemeMode, ListingVariant, DashboardGlobalRole } from './types';
1
+ export { default as acknowledgementAtom } from "./acknowledgementAtom";
2
+ export { default as aclAtom } from "./aclAtom";
3
+ export { additionalResourcesAtom } from "./additionalResources";
4
+ export { browserLocaleAtom } from "./browserLocaleAtom";
5
+ export { default as cloudServicesAtom } from "./cloudServicesAtom";
6
+ export { default as downtimeAtom } from "./downtimeAtom";
13
7
  export {
14
- platformFeaturesAtom,
15
- featureFlagsDerivedAtom
16
- } from './platformFeauresAtom';
17
-
18
- export { platformVersionsAtom } from './platformVersionsAtom';
19
-
20
- export { isOnPublicPageAtom } from './isOnPublicPageAtom';
21
- export { additionalResourcesAtom } from './additionalResources';
8
+ federatedModulesAtom,
9
+ federatedWidgetsAtom,
10
+ } from "./federatedModulesAndWidgetsAtoms";
11
+ export { isOnPublicPageAtom } from "./isOnPublicPageAtom";
12
+ export { isResourceStatusFullSearchEnabledAtom } from "./isResourceStatusFullSearchEnabledAtom";
22
13
  export {
23
- federatedModulesAtom,
24
- federatedWidgetsAtom
25
- } from './federatedModulesAndWidgetsAtoms';
26
- export { browserLocaleAtom } from './browserLocaleAtom';
27
- export { isResourceStatusFullSearchEnabledAtom } from './isResourceStatusFullSearchEnabledAtom';
28
-
14
+ featureFlagsDerivedAtom,
15
+ platformFeaturesAtom,
16
+ } from "./platformFeauresAtom";
17
+ export { default as platformNameAtom } from "./platformNameAtom";
18
+ export { platformVersionsAtom } from "./platformVersionsAtom";
19
+ export { default as refreshIntervalAtom } from "./refreshIntervalAtom";
20
+ export { default as resourceStorageOptimizationModeAtom } from "./resourceStorageOptimizationMode";
21
+ export { default as statisticsRefreshIntervalAtom } from "./statisticsRefreshIntervalAtom";
29
22
  export type {
30
- User,
31
- UserContext,
32
- ActionAcl,
33
- Actions,
34
- Downtime,
35
- CloudServices,
36
- Acknowledgement,
37
- Acl,
38
- DashboardRolesAndPermissions,
39
- FeatureFlags,
40
- PlatformFeatures,
41
- AdditionalResource,
42
- UserPermissions
43
- } from './types';
23
+ Acknowledgement,
24
+ Acl,
25
+ ActionAcl,
26
+ Actions,
27
+ AdditionalResource,
28
+ CloudServices,
29
+ DashboardRolesAndPermissions,
30
+ Downtime,
31
+ FeatureFlags,
32
+ PlatformFeatures,
33
+ User,
34
+ UserContext,
35
+ UserPermissions,
36
+ } from "./types";
37
+ export { DashboardGlobalRole, ListingVariant, ThemeMode } from "./types";
38
+ export { default as userAtom } from "./userAtom";
39
+ export { default as userPermissionsAtom } from "./userPermissionsAtom";
@@ -1,3 +1,3 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
3
  export const isOnPublicPageAtom = atom(false);
@@ -1,3 +1,3 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
3
  export const isResourceStatusFullSearchEnabledAtom = atom(false);
@@ -1,12 +1,12 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
- import { FeatureFlags, PlatformFeatures } from './types';
3
+ import type { FeatureFlags, PlatformFeatures } from "./types";
4
4
 
5
5
  export const platformFeaturesAtom = atom<PlatformFeatures | null>(null);
6
6
  export const featureFlagsDerivedAtom = atom<FeatureFlags | null>(
7
- (get): FeatureFlags => {
8
- const platformFeatures = get(platformFeaturesAtom);
7
+ (get): FeatureFlags => {
8
+ const platformFeatures = get(platformFeaturesAtom);
9
9
 
10
- return platformFeatures?.featureFlags as FeatureFlags;
11
- }
10
+ return platformFeatures?.featureFlags as FeatureFlags;
11
+ },
12
12
  );
@@ -1,4 +1,4 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
3
  const platformNameAtom = atom<string | null>(null);
4
4
 
@@ -1,5 +1,5 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
- import { PlatformVersions } from './types';
3
+ import type { PlatformVersions } from "./types";
4
4
 
5
5
  export const platformVersionsAtom = atom<PlatformVersions | null>(null);
@@ -1,6 +1,6 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
- import { defaultRefreshInterval } from './defaults';
3
+ import { defaultRefreshInterval } from "./defaults";
4
4
 
5
5
  const refreshIntervalAtom = atom(defaultRefreshInterval);
6
6
 
@@ -1,9 +1,9 @@
1
- import { atom } from 'jotai';
1
+ import { atom } from "jotai";
2
2
 
3
- import { defaultResourceStorageOptimizationMode } from './defaults';
3
+ import { defaultResourceStorageOptimizationMode } from "./defaults";
4
4
 
5
5
  const resourceStorageOptimizationModeAtom = atom(
6
- defaultResourceStorageOptimizationMode
6
+ defaultResourceStorageOptimizationMode,
7
7
  );
8
8
 
9
9
  export default resourceStorageOptimizationModeAtom;
@@ -1,5 +1,5 @@
1
- import { atom } from 'jotai';
2
- import { defaultRefreshInterval } from './defaults';
1
+ import { atom } from "jotai";
2
+ import { defaultRefreshInterval } from "./defaults";
3
3
 
4
4
  const statisticsRefreshIntervalAtom = atom(defaultRefreshInterval);
5
5
 
package/src/types.ts CHANGED
@@ -1,147 +1,147 @@
1
- import type { Dispatch, SetStateAction } from 'react';
1
+ import type { Dispatch, SetStateAction } from "react";
2
2
 
3
3
  export enum ListingVariant {
4
- compact = 'compact',
5
- extended = 'extended'
4
+ compact = "compact",
5
+ extended = "extended",
6
6
  }
7
7
 
8
8
  export enum DashboardGlobalRole {
9
- administrator = 'administrator',
10
- creator = 'creator',
11
- viewer = 'viewer'
9
+ administrator = "administrator",
10
+ creator = "creator",
11
+ viewer = "viewer",
12
12
  }
13
13
 
14
14
  export interface DashboardRolesAndPermissions {
15
- createDashboards: boolean;
16
- globalUserRole: DashboardGlobalRole;
17
- manageAllDashboards: boolean;
18
- viewDashboards: boolean;
15
+ createDashboards: boolean;
16
+ globalUserRole: DashboardGlobalRole;
17
+ manageAllDashboards: boolean;
18
+ viewDashboards: boolean;
19
19
  }
20
20
 
21
21
  export interface User {
22
- alias: string;
23
- canManageApiTokens: boolean;
24
- dashboard?: DashboardRolesAndPermissions | null;
25
- default_page?: string | null;
26
- id?: number;
27
- isAdmin?: boolean;
28
- isExportButtonEnabled: boolean;
29
- locale: string | null;
30
- name: string;
31
- themeMode?: ThemeMode;
32
- timezone: string;
33
- use_deprecated_pages: boolean;
34
- user_interface_density: ListingVariant;
22
+ alias: string;
23
+ canManageApiTokens: boolean;
24
+ dashboard?: DashboardRolesAndPermissions | null;
25
+ default_page?: string | null;
26
+ id?: number;
27
+ isAdmin?: boolean;
28
+ isExportButtonEnabled: boolean;
29
+ locale: string | null;
30
+ name: string;
31
+ themeMode?: ThemeMode;
32
+ timezone: string;
33
+ use_deprecated_pages: boolean;
34
+ user_interface_density: ListingVariant;
35
35
  }
36
36
 
37
37
  export enum ThemeMode {
38
- dark = 'dark',
39
- light = 'light'
38
+ dark = "dark",
39
+ light = "light",
40
40
  }
41
41
 
42
42
  export interface CloudServices {
43
- areCloudServicesEnabled: boolean;
44
- setAreCloudServicesEnabled: Dispatch<SetStateAction<boolean>>;
43
+ areCloudServicesEnabled: boolean;
44
+ setAreCloudServicesEnabled: Dispatch<SetStateAction<boolean>>;
45
45
  }
46
46
 
47
47
  export interface Acknowledgement {
48
- force_active_checks: boolean;
49
- notify: boolean;
50
- persistent: boolean;
51
- sticky: boolean;
52
- with_services: boolean;
48
+ force_active_checks: boolean;
49
+ notify: boolean;
50
+ persistent: boolean;
51
+ sticky: boolean;
52
+ with_services: boolean;
53
53
  }
54
54
 
55
55
  export type UserContext = {
56
- acknowledgement: Acknowledgement;
57
- acl: Acl;
58
- cloudServices: CloudServices | undefined;
59
- downtime: Downtime;
60
- refreshInterval: number;
61
- resourceStorageOptimizationMode: boolean;
56
+ acknowledgement: Acknowledgement;
57
+ acl: Acl;
58
+ cloudServices: CloudServices | undefined;
59
+ downtime: Downtime;
60
+ refreshInterval: number;
61
+ resourceStorageOptimizationMode: boolean;
62
62
  } & User;
63
63
 
64
64
  export interface ActionAcl {
65
- acknowledgement: boolean;
66
- check: boolean;
67
- comment: boolean;
68
- downtime: boolean;
69
- submit_status: boolean;
65
+ acknowledgement: boolean;
66
+ check: boolean;
67
+ comment: boolean;
68
+ downtime: boolean;
69
+ submit_status: boolean;
70
70
  }
71
71
 
72
72
  export interface Actions {
73
- host: ActionAcl;
74
- service: ActionAcl;
73
+ host: ActionAcl;
74
+ service: ActionAcl;
75
75
  }
76
76
 
77
77
  export interface Acl {
78
- actions: Actions;
78
+ actions: Actions;
79
79
  }
80
80
 
81
81
  export interface Downtime {
82
- duration: number;
83
- fixed: boolean;
84
- with_services: boolean;
82
+ duration: number;
83
+ fixed: boolean;
84
+ with_services: boolean;
85
85
  }
86
86
 
87
87
  export interface FeatureFlags {
88
- adExclusionPeriods?: boolean;
89
- notification?: boolean;
90
- vault?: boolean;
91
- mapVisxViewer?: boolean;
88
+ adExclusionPeriods?: boolean;
89
+ notification?: boolean;
90
+ vault?: boolean;
91
+ mapVisxViewer?: boolean;
92
92
  }
93
93
 
94
94
  export interface PlatformFeatures {
95
- featureFlags: FeatureFlags;
96
- isCloudPlatform: boolean;
95
+ featureFlags: FeatureFlags;
96
+ isCloudPlatform: boolean;
97
97
  }
98
98
 
99
99
  export interface AdditionalResource {
100
- baseEndpoint: string;
101
- defaultMonitoringParameter?: Record<string, boolean | number | string>;
102
- label: string;
103
- resourceType: string;
100
+ baseEndpoint: string;
101
+ defaultMonitoringParameter?: Record<string, boolean | number | string>;
102
+ label: string;
103
+ resourceType: string;
104
104
  }
105
105
 
106
106
  interface FederatedComponentsConfiguration {
107
- federatedComponents: Array<string>;
108
- panelMinHeight?: number;
109
- panelMinWidth?: number;
110
- path: string;
111
- title?: string;
107
+ federatedComponents: Array<string>;
108
+ panelMinHeight?: number;
109
+ panelMinWidth?: number;
110
+ path: string;
111
+ title?: string;
112
112
  }
113
113
 
114
114
  interface PageComponent {
115
- children?: string;
116
- component: string;
117
- featureFlag?: string;
118
- route: string;
115
+ children?: string;
116
+ component: string;
117
+ featureFlag?: string;
118
+ route: string;
119
119
  }
120
120
 
121
121
  export interface FederatedModule {
122
- federatedComponentsConfiguration: Array<FederatedComponentsConfiguration>;
123
- federatedPages: Array<PageComponent>;
124
- moduleFederationName: string;
125
- moduleName: string;
126
- preloadScript?: string;
127
- remoteEntry: string;
128
- remoteUrl?: string;
122
+ federatedComponentsConfiguration: Array<FederatedComponentsConfiguration>;
123
+ federatedPages: Array<PageComponent>;
124
+ moduleFederationName: string;
125
+ moduleName: string;
126
+ preloadScript?: string;
127
+ remoteEntry: string;
128
+ remoteUrl?: string;
129
129
  }
130
130
 
131
131
  interface Version {
132
- fix: string;
133
- major: string;
134
- minor: string;
135
- version: string;
132
+ fix: string;
133
+ major: string;
134
+ minor: string;
135
+ version: string;
136
136
  }
137
137
 
138
138
  export interface PlatformVersions {
139
- modules: Record<string, Version>;
140
- web: Version;
141
- widgets: Record<string, Version | null>;
139
+ modules: Record<string, Version>;
140
+ web: Version;
141
+ widgets: Record<string, Version | null>;
142
142
  }
143
143
 
144
144
  export interface UserPermissions {
145
- top_counter: boolean;
146
- poller_statistics: boolean;
145
+ top_counter: boolean;
146
+ poller_statistics: boolean;
147
147
  }
package/src/userAtom.ts CHANGED
@@ -1,8 +1,6 @@
1
- import { atom } from 'jotai';
2
-
3
- import { defaultUser } from './defaults';
4
-
5
- import { User } from '.';
1
+ import { atom } from "jotai";
2
+ import type { User } from ".";
3
+ import { defaultUser } from "./defaults";
6
4
 
7
5
  const userAtom = atom<User>(defaultUser);
8
6
 
@@ -1,5 +1,5 @@
1
- import { atom } from 'jotai';
2
- import { UserPermissions } from '.';
1
+ import { atom } from "jotai";
2
+ import type { UserPermissions } from ".";
3
3
 
4
4
  const userPermissionsAtom = atom<UserPermissions | null>(null);
5
5