@centreon/ui-context 24.4.14 → 24.4.16

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": "24.4.14",
3
+ "version": "24.4.16",
4
4
  "description": "Centreon UI shared context",
5
5
  "main": "src/index.ts",
6
6
  "keywords": [],
@@ -0,0 +1,3 @@
1
+ import { atom } from 'jotai';
2
+
3
+ export const browserLocaleAtom = atom(navigator.language.slice(0, 2));
package/src/defaults.ts CHANGED
@@ -2,11 +2,12 @@ import { User, ThemeMode, ListingVariant } from './types';
2
2
 
3
3
  const defaultUser: User = {
4
4
  alias: '',
5
+ canManageApiTokens: false,
5
6
  default_page: '/monitoring/resources',
6
7
  id: undefined,
7
8
  isAdmin: undefined,
8
9
  isExportButtonEnabled: false,
9
- locale: navigator.language,
10
+ locale: null,
10
11
  name: '',
11
12
  themeMode: ThemeMode.light,
12
13
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
package/src/index.ts CHANGED
@@ -2,21 +2,21 @@ export { default as userAtom } from './userAtom';
2
2
  export { default as aclAtom } from './aclAtom';
3
3
  export { default as downtimeAtom } from './downtimeAtom';
4
4
  export { default as refreshIntervalAtom } from './refreshIntervalAtom';
5
+ export { default as statisticsRefreshIntervalAtom } from './statisticsRefreshIntervalAtom';
5
6
  export { default as cloudServicesAtom } from './cloudServicesAtom';
6
7
  export { default as acknowledgementAtom } from './acknowledgementAtom';
7
8
  export { default as resourceStorageOptimizationModeAtom } from './resourceStorageOptimizationMode';
8
9
  export { default as platformNameAtom } from './platformNameAtom';
10
+ export { default as userPermissionsAtom } from './userPermissionsAtom';
11
+
9
12
  export { ThemeMode, ListingVariant, DashboardGlobalRole } from './types';
10
13
  export {
11
14
  platformFeaturesAtom,
12
15
  featureFlagsDerivedAtom
13
16
  } from './platformFeauresAtom';
14
- export { isOnPublicPageAtom } from './isOnPublicPageAtom';
15
- export { additionalResourcesAtom } from './additionalResources';
16
- export {
17
- federatedModulesAtom,
18
- federatedWidgetsAtom
19
- } from './federatedModulesAndWidgetsAtoms';
17
+
18
+ export { browserLocaleAtom } from './browserLocaleAtom';
19
+ export { isResourceStatusFullSearchEnabledAtom } from './isResourceStatusFullSearchEnabledAtom';
20
20
 
21
21
  export type {
22
22
  User,
@@ -30,5 +30,5 @@ export type {
30
30
  DashboardRolesAndPermissions,
31
31
  FeatureFlags,
32
32
  PlatformFeatures,
33
- AdditionalResource
33
+ UserPermissions
34
34
  } from './types';
@@ -0,0 +1,3 @@
1
+ import { atom } from 'jotai';
2
+
3
+ export const isResourceStatusFullSearchEnabledAtom = atom(false);
@@ -0,0 +1,7 @@
1
+ import { atom } from 'jotai';
2
+
3
+ import { defaultRefreshInterval } from './defaults';
4
+
5
+ const statisticsRefreshIntervalAtom = atom(defaultRefreshInterval);
6
+
7
+ export default statisticsRefreshIntervalAtom;
package/src/types.ts CHANGED
@@ -20,12 +20,13 @@ export interface DashboardRolesAndPermissions {
20
20
 
21
21
  export interface User {
22
22
  alias: string;
23
+ canManageApiTokens: boolean;
23
24
  dashboard?: DashboardRolesAndPermissions | null;
24
25
  default_page?: string | null;
25
26
  id?: number;
26
27
  isAdmin?: boolean;
27
28
  isExportButtonEnabled: boolean;
28
- locale: string;
29
+ locale: string | null;
29
30
  name: string;
30
31
  themeMode?: ThemeMode;
31
32
  timezone: string;
@@ -98,34 +99,13 @@ export interface PlatformFeatures {
98
99
  isCloudPlatform: boolean;
99
100
  }
100
101
 
101
- export interface AdditionalResource {
102
- baseEndpoint: string;
103
- defaultMonitoringParameter?: Record<string, boolean | number | string>;
104
- label: string;
105
- resourceType: string;
102
+ export interface PlatformVersions {
103
+ modules: Record<string, Version>;
104
+ web: Version;
105
+ widgets: Record<string, Version | null>;
106
106
  }
107
107
 
108
- interface FederatedComponentsConfiguration {
109
- federatedComponents: Array<string>;
110
- panelMinHeight?: number;
111
- panelMinWidth?: number;
112
- path: string;
113
- title?: string;
114
- }
115
-
116
- interface PageComponent {
117
- children?: string;
118
- component: string;
119
- featureFlag?: string;
120
- route: string;
121
- }
122
-
123
- export interface FederatedModule {
124
- federatedComponentsConfiguration: Array<FederatedComponentsConfiguration>;
125
- federatedPages: Array<PageComponent>;
126
- moduleFederationName: string;
127
- moduleName: string;
128
- preloadScript?: string;
129
- remoteEntry: string;
130
- remoteUrl?: string;
108
+ export interface UserPermissions {
109
+ poller_statistics: boolean;
110
+ top_counter: boolean;
131
111
  }
@@ -0,0 +1,7 @@
1
+ import { atom } from 'jotai';
2
+
3
+ import { UserPermissions } from '.';
4
+
5
+ const userPermissionsAtom = atom<UserPermissions | null>(null);
6
+
7
+ export default userPermissionsAtom;
@@ -1,5 +0,0 @@
1
- import { atom } from 'jotai';
2
-
3
- import { AdditionalResource } from './types';
4
-
5
- export const additionalResourcesAtom = atom<Array<AdditionalResource>>([]);
@@ -1,7 +0,0 @@
1
- import { atom } from 'jotai';
2
-
3
- import { FederatedModule } from './types';
4
-
5
- export const federatedModulesAtom = atom<Array<FederatedModule> | null>(null);
6
-
7
- export const federatedWidgetsAtom = atom<Array<FederatedModule> | null>(null);
@@ -1,3 +0,0 @@
1
- import { atom } from 'jotai';
2
-
3
- export const isOnPublicPageAtom = atom(false);