@centreon/ui-context 23.10.17 → 24.4.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": "23.10.17",
3
+ "version": "24.4.0",
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,9 +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',
7
+ id: undefined,
8
+ isAdmin: undefined,
6
9
  isExportButtonEnabled: false,
7
- locale: navigator.language,
10
+ locale: null,
8
11
  name: '',
9
12
  themeMode: ThemeMode.light,
10
13
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
package/src/index.ts CHANGED
@@ -2,15 +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';
9
- export { ThemeMode, ListingVariant } from './types';
10
+ export { default as userPermissionsAtom } from './userPermissionsAtom';
11
+
12
+ export { ThemeMode, ListingVariant, DashboardGlobalRole } from './types';
10
13
  export {
11
14
  platformFeaturesAtom,
12
15
  featureFlagsDerivedAtom
13
- } from './platformFeaturesAtom';
16
+ } from './platformFeauresAtom';
17
+
18
+ export { browserLocaleAtom } from './browserLocaleAtom';
19
+ export { isResourceStatusFullSearchEnabledAtom } from './isResourceStatusFullSearchEnabledAtom';
14
20
 
15
21
  export type {
16
22
  User,
@@ -21,6 +27,8 @@ export type {
21
27
  CloudServices,
22
28
  Acknowledgement,
23
29
  Acl,
30
+ DashboardRolesAndPermissions,
24
31
  FeatureFlags,
25
- PlatformFeatures
32
+ PlatformFeatures,
33
+ UserPermissions
26
34
  } from './types';
@@ -0,0 +1,3 @@
1
+ import { atom } from 'jotai';
2
+
3
+ export const isResourceStatusFullSearchEnabledAtom = atom(false);
@@ -3,7 +3,6 @@ import { atom } from 'jotai';
3
3
  import { FeatureFlags, PlatformFeatures } from './types';
4
4
 
5
5
  export const platformFeaturesAtom = atom<PlatformFeatures | null>(null);
6
-
7
6
  export const featureFlagsDerivedAtom = atom<FeatureFlags | null>(
8
7
  (get): FeatureFlags => {
9
8
  const platformFeatures = get(platformFeaturesAtom);
@@ -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
@@ -5,11 +5,28 @@ export enum ListingVariant {
5
5
  extended = 'extended'
6
6
  }
7
7
 
8
+ export enum DashboardGlobalRole {
9
+ administrator = 'administrator',
10
+ creator = 'creator',
11
+ viewer = 'viewer'
12
+ }
13
+
14
+ export interface DashboardRolesAndPermissions {
15
+ createDashboards: boolean;
16
+ globalUserRole: DashboardGlobalRole;
17
+ manageAllDashboards: boolean;
18
+ viewDashboards: boolean;
19
+ }
20
+
8
21
  export interface User {
9
22
  alias: string;
23
+ canManageApiTokens: boolean;
24
+ dashboard?: DashboardRolesAndPermissions | null;
10
25
  default_page?: string | null;
26
+ id?: number;
27
+ isAdmin?: boolean;
11
28
  isExportButtonEnabled: boolean;
12
- locale: string;
29
+ locale: string | null;
13
30
  name: string;
14
31
  themeMode?: ThemeMode;
15
32
  timezone: string;
@@ -70,7 +87,9 @@ export interface Downtime {
70
87
  export interface FeatureFlags {
71
88
  adExclusionPeriods?: boolean;
72
89
  dashboard?: boolean;
90
+ dashboardPlayList?: boolean;
73
91
  notification?: boolean;
92
+ resourceStatusFilterRevamp?: boolean;
74
93
  resourceStatusTreeView?: boolean;
75
94
  vault?: boolean;
76
95
  }
@@ -79,3 +98,14 @@ export interface PlatformFeatures {
79
98
  featureFlags: FeatureFlags;
80
99
  isCloudPlatform: boolean;
81
100
  }
101
+
102
+ export interface PlatformVersions {
103
+ modules: Record<string, Version>;
104
+ web: Version;
105
+ widgets: Record<string, Version | null>;
106
+ }
107
+
108
+ export interface UserPermissions {
109
+ poller_statistics: boolean;
110
+ top_counter: boolean;
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;