@centreon/ui-context 24.7.7 → 24.8.1

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,13 +1,14 @@
1
1
  {
2
2
  "name": "@centreon/ui-context",
3
- "version": "24.7.7",
3
+ "version": "24.8.1",
4
4
  "description": "Centreon UI shared context",
5
5
  "main": "src/index.ts",
6
6
  "keywords": [],
7
7
  "author": "centreon@centreon.com",
8
- "license": "GPL-2.0",
8
+ "license": "MIT",
9
9
  "scripts": {
10
- "eslint": "eslint ./src --ext .ts --max-warnings 0",
11
- "eslint:fix": "pnpm eslint --fix"
10
+ "lint": "biome check ./src/ --error-on-warnings",
11
+ "lint:fix": "pnpm lint --fix",
12
+ "lint:ci": "biome ci ./src/ --error-on-warnings"
12
13
  }
13
14
  }
@@ -0,0 +1,5 @@
1
+ import { atom } from 'jotai';
2
+
3
+ import { AdditionalResource } from './types';
4
+
5
+ export const additionalResourcesAtom = atom<Array<AdditionalResource>>([]);
package/src/defaults.ts CHANGED
@@ -1,8 +1,11 @@
1
- import { User, ThemeMode, ListingVariant } from './types';
1
+ import { ListingVariant, ThemeMode, User } 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
10
  locale: navigator.language,
8
11
  name: '',
@@ -0,0 +1,7 @@
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);
package/src/index.ts CHANGED
@@ -6,11 +6,20 @@ export { default as cloudServicesAtom } from './cloudServicesAtom';
6
6
  export { default as acknowledgementAtom } from './acknowledgementAtom';
7
7
  export { default as resourceStorageOptimizationModeAtom } from './resourceStorageOptimizationMode';
8
8
  export { default as platformNameAtom } from './platformNameAtom';
9
- export { ThemeMode, ListingVariant } from './types';
9
+ export { ThemeMode, ListingVariant, DashboardGlobalRole } from './types';
10
10
  export {
11
11
  platformFeaturesAtom,
12
12
  featureFlagsDerivedAtom
13
- } from './platformFeaturesAtom';
13
+ } from './platformFeauresAtom';
14
+
15
+ export { platformVersionsAtom } from './platformVersionsAtom';
16
+
17
+ export { isOnPublicPageAtom } from './isOnPublicPageAtom';
18
+ export { additionalResourcesAtom } from './additionalResources';
19
+ export {
20
+ federatedModulesAtom,
21
+ federatedWidgetsAtom
22
+ } from './federatedModulesAndWidgetsAtoms';
14
23
 
15
24
  export type {
16
25
  User,
@@ -21,6 +30,8 @@ export type {
21
30
  CloudServices,
22
31
  Acknowledgement,
23
32
  Acl,
33
+ DashboardRolesAndPermissions,
24
34
  FeatureFlags,
25
- PlatformFeatures
35
+ PlatformFeatures,
36
+ AdditionalResource
26
37
  } from './types';
@@ -0,0 +1,3 @@
1
+ import { atom } from 'jotai';
2
+
3
+ export const isOnPublicPageAtom = 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,5 @@
1
+ import { atom } from 'jotai';
2
+
3
+ import { PlatformVersions } from './types';
4
+
5
+ export const platformVersionsAtom = atom<PlatformVersions | null>(null);
package/src/types.ts CHANGED
@@ -5,9 +5,26 @@ 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
29
  locale: string;
13
30
  name: string;
@@ -70,8 +87,11 @@ 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;
94
+ resouresTableOpenTickets: boolean;
75
95
  vault?: boolean;
76
96
  }
77
97
 
@@ -79,3 +99,48 @@ export interface PlatformFeatures {
79
99
  featureFlags: FeatureFlags;
80
100
  isCloudPlatform: boolean;
81
101
  }
102
+
103
+ export interface AdditionalResource {
104
+ baseEndpoint: string;
105
+ defaultMonitoringParameter?: Record<string, boolean | number | string>;
106
+ label: string;
107
+ resourceType: string;
108
+ }
109
+
110
+ interface FederatedComponentsConfiguration {
111
+ federatedComponents: Array<string>;
112
+ panelMinHeight?: number;
113
+ panelMinWidth?: number;
114
+ path: string;
115
+ title?: string;
116
+ }
117
+
118
+ interface PageComponent {
119
+ children?: string;
120
+ component: string;
121
+ featureFlag?: string;
122
+ route: string;
123
+ }
124
+
125
+ export interface FederatedModule {
126
+ federatedComponentsConfiguration: Array<FederatedComponentsConfiguration>;
127
+ federatedPages: Array<PageComponent>;
128
+ moduleFederationName: string;
129
+ moduleName: string;
130
+ preloadScript?: string;
131
+ remoteEntry: string;
132
+ remoteUrl?: string;
133
+ }
134
+
135
+ interface Version {
136
+ fix: string;
137
+ major: string;
138
+ minor: string;
139
+ version: string;
140
+ }
141
+
142
+ export interface PlatformVersions {
143
+ modules: Record<string, Version>;
144
+ web: Version;
145
+ widgets: Record<string, Version | null>;
146
+ }