@gridsuite/commons-ui 0.102.0 → 0.103.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.
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Dialog, DialogTitle, DialogContent, Grid, Typography, Box, DialogActions } from "@mui/material";
3
3
  import { FormattedMessage } from "react-intl";
4
- import { useState, useEffect } from "react";
4
+ import { useState, useEffect, Fragment } from "react";
5
5
  import { CancelButton } from "../inputs/reactHookForm/utils/CancelButton.js";
6
6
  import { fetchUserDetails } from "../../services/userAdmin.js";
7
7
  const styles = {
@@ -12,6 +12,7 @@ const styles = {
12
12
  usedTopography: { marginLeft: "15%" }
13
13
  };
14
14
  function UserInformationDialog({ openDialog, user, onClose }) {
15
+ var _a;
15
16
  const [userDetails, setUserDetails] = useState(void 0);
16
17
  const getUserDetails = (userName) => {
17
18
  fetchUserDetails(userName).then((response) => {
@@ -25,17 +26,23 @@ function UserInformationDialog({ openDialog, user, onClose }) {
25
26
  getUserDetails(user == null ? void 0 : user.profile.sub);
26
27
  }
27
28
  }, [openDialog, user]);
29
+ const rolesString = ((_a = user == null ? void 0 : user.profile) == null ? void 0 : _a.profile) ?? "";
30
+ const rolesList = rolesString ? rolesString.split("|").map((role) => role.trim()) : [];
28
31
  return /* @__PURE__ */ jsxs(Dialog, { open: openDialog && !!user && !!userDetails, onClose, children: [
29
32
  /* @__PURE__ */ jsx(DialogTitle, { fontWeight: "bold", sx: styles.DialogTitle, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "user-information-dialog/title" }) }),
30
33
  /* @__PURE__ */ jsxs(DialogContent, { children: [
31
34
  /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, sx: styles.DialogContent, children: [
32
35
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "user-information-dialog/role" }) }) }),
33
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(
34
- FormattedMessage,
35
- {
36
- id: (userDetails == null ? void 0 : userDetails.isAdmin) ? "user-information-dialog/role-admin" : "user-information-dialog/role-user"
37
- }
38
- ) }) }),
36
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: rolesList.length > 0 ? /* @__PURE__ */ jsx(Typography, { children: rolesList.map((role, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
37
+ index > 0 && " | ",
38
+ /* @__PURE__ */ jsx(
39
+ FormattedMessage,
40
+ {
41
+ id: `user-information-dialog/${role}`,
42
+ defaultMessage: role
43
+ }
44
+ )
45
+ ] }, role)) }) : /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "user-information-dialog/no-roles" }) }) }),
39
46
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: /* @__PURE__ */ jsx(FormattedMessage, { id: "user-information-dialog/profile" }) }) }),
40
47
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: (userDetails == null ? void 0 : userDetails.profileName) === null ? /* @__PURE__ */ jsx(FormattedMessage, { id: "user-information-dialog/no-profile" }) : /* @__PURE__ */ jsx(Typography, { children: userDetails == null ? void 0 : userDetails.profileName }) })
41
48
  ] }),
@@ -30,8 +30,10 @@ export declare const topBarEn: {
30
30
  'about-dialog/module-tooltip-other': string;
31
31
  'user-information-dialog/title': string;
32
32
  'user-information-dialog/role': string;
33
- 'user-information-dialog/role-user': string;
34
- 'user-information-dialog/role-admin': string;
33
+ 'user-information-dialog/UTILISATEURS': string;
34
+ 'user-information-dialog/ADMIN': string;
35
+ 'user-information-dialog/ADMIN_EXPLORE': string;
36
+ 'user-information-dialog/no-roles': string;
35
37
  'user-information-dialog/profile': string;
36
38
  'user-information-dialog/no-profile': string;
37
39
  'user-information-dialog/quotas': string;
@@ -24,8 +24,10 @@ const topBarEn = {
24
24
  "about-dialog/module-tooltip-other": "other",
25
25
  "user-information-dialog/title": "User information",
26
26
  "user-information-dialog/role": "Role",
27
- "user-information-dialog/role-user": "Basic user",
28
- "user-information-dialog/role-admin": "Admin",
27
+ "user-information-dialog/UTILISATEURS": "User",
28
+ "user-information-dialog/ADMIN": "Admin",
29
+ "user-information-dialog/ADMIN_EXPLORE": "Admin Explore",
30
+ "user-information-dialog/no-roles": "No roles",
29
31
  "user-information-dialog/profile": "Profile",
30
32
  "user-information-dialog/no-profile": "No profile",
31
33
  "user-information-dialog/quotas": "User quotas",
@@ -30,8 +30,10 @@ export declare const topBarFr: {
30
30
  'about-dialog/module-tooltip-other': string;
31
31
  'user-information-dialog/title': string;
32
32
  'user-information-dialog/role': string;
33
- 'user-information-dialog/role-user': string;
34
- 'user-information-dialog/role-admin': string;
33
+ 'user-information-dialog/UTILISATEURS': string;
34
+ 'user-information-dialog/ADMIN': string;
35
+ 'user-information-dialog/ADMIN_EXPLORE': string;
36
+ 'user-information-dialog/no-roles': string;
35
37
  'user-information-dialog/profile': string;
36
38
  'user-information-dialog/no-profile': string;
37
39
  'user-information-dialog/quotas': string;
@@ -24,8 +24,10 @@ const topBarFr = {
24
24
  "about-dialog/module-tooltip-other": "autre",
25
25
  "user-information-dialog/title": "Informations utilisateur",
26
26
  "user-information-dialog/role": "Rôle",
27
- "user-information-dialog/role-user": "Utilisateur simple",
28
- "user-information-dialog/role-admin": "Admin",
27
+ "user-information-dialog/UTILISATEURS": "Utilisateur",
28
+ "user-information-dialog/ADMIN": "Admin",
29
+ "user-information-dialog/ADMIN_EXPLORE": "Admin Explore",
30
+ "user-information-dialog/no-roles": "Pas de rôle",
29
31
  "user-information-dialog/profile": "Profil",
30
32
  "user-information-dialog/no-profile": "Pas de profil",
31
33
  "user-information-dialog/quotas": "Quotas",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.102.0",
3
+ "version": "0.103.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",