@digital-ai/dot-components 4.3.2 → 4.3.4

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/index.esm.js CHANGED
@@ -9603,6 +9603,7 @@ class HelpContentService {
9603
9603
 
9604
9604
  function DotDashboardStatusPill({
9605
9605
  dashboard,
9606
+ canEdit,
9606
9607
  currentUser,
9607
9608
  modifiedAuthorUser
9608
9609
  }) {
@@ -9618,7 +9619,7 @@ function DotDashboardStatusPill({
9618
9619
  })
9619
9620
  });
9620
9621
  } else if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED && dashboard.is_being_modified && currentUser) {
9621
- if (dashboard.modified_author_id === currentUser.id) {
9622
+ if (dashboard.modified_author_id === currentUser.id && canEdit) {
9622
9623
  return jsx(DotTooltip, {
9623
9624
  title: "You are currently editing this dashboard and the latest changes have not yet been published. Other users cannot edit this dashboard while you are editing it.",
9624
9625
  placement: "top",
@@ -9641,13 +9642,20 @@ function DotDashboardStatusPill({
9641
9642
  });
9642
9643
  if (modifiedAuthorUser) {
9643
9644
  const modifiedAuthorUserFullName = `${modifiedAuthorUser.given_name} ${modifiedAuthorUser.family_name}`;
9645
+ const tooltip = dashboard.modified_author_id === currentUser.id ? 'You are viewing the published version of this dashboard which you are currently editing.' : `${modifiedAuthorUserFullName} is currently editing this dashboard and it is locked for editing by other users.`;
9644
9646
  return jsx(DotTooltip, {
9645
- title: `${modifiedAuthorUserFullName} is currently editing this dashboard and it is locked for editing by other users.`,
9647
+ title: tooltip,
9646
9648
  placement: "top",
9647
9649
  children: lockedPublished
9648
9650
  });
9649
9651
  } else {
9650
- return lockedPublished;
9652
+ // If we don't have the user and the dashboard is being modified, we assume that the user is a Digital.ai
9653
+ // Support or Admin user.
9654
+ return jsx(DotTooltip, {
9655
+ title: `This dashboard is currently being edited by Digital.ai and it is locked for editing by other users.`,
9656
+ placement: "top",
9657
+ children: lockedPublished
9658
+ });
9651
9659
  }
9652
9660
  }
9653
9661
  } else {
@@ -10589,6 +10597,7 @@ const DashboardDetailsSectionHeading = ({
10589
10597
  });
10590
10598
  };
10591
10599
  const DotDashboardDetailsView = ({
10600
+ canEdit,
10592
10601
  className,
10593
10602
  dashboard,
10594
10603
  onClose,
@@ -10684,6 +10693,7 @@ const DotDashboardDetailsView = ({
10684
10693
  children: jsx(DotDashboardStatusPill, {
10685
10694
  dashboard: dashboard,
10686
10695
  currentUser: currentUser ? currentUser : null,
10696
+ canEdit: canEdit,
10687
10697
  modifiedAuthorUser: modifiedAuthorUser ? modifiedAuthorUser : null
10688
10698
  })
10689
10699
  }), jsx(DashboardDetailsField, {
@@ -11845,7 +11855,7 @@ const StyledDotMenu = styled(DotMenu)`
11845
11855
  z-index: 9999;
11846
11856
 
11847
11857
  &.dot-menu {
11848
- min-width: 200px;
11858
+ min-width: 260px;
11849
11859
 
11850
11860
  .dot-ul .dot-li {
11851
11861
  padding: 0;
@@ -11953,7 +11963,7 @@ function DotDashboardOptionsMenu({
11953
11963
  key: 'edit'
11954
11964
  });
11955
11965
  }
11956
- if (onUpdatedProperties && !dashboard.is_ootb_dashboard) {
11966
+ if (onUpdatedProperties && !dashboard.is_ootb_dashboard && !dashboardLocked) {
11957
11967
  let menuItem = jsx(DotButton, {
11958
11968
  ariaLabel: "Edit dashboard properties",
11959
11969
  className: isEdit ? 'disabled-menu-item' : '',
@@ -12020,39 +12030,43 @@ function DotDashboardOptionsMenu({
12020
12030
  // If this is a published dashboard, with in-progress changes, and the user is the author of the changes,
12021
12031
  // show the republish, revert, and view original options.
12022
12032
  if (isPublished && currentUser && dashboard.is_being_modified && dashboard.modified_author_id === currentUser.id) {
12023
- menuItems.push({
12024
- children: jsx(DotButton, {
12025
- ariaLabel: "Publish changes",
12026
- type: "text",
12027
- startIcon: jsx(DotIcon, {
12028
- iconId: "send-airplane"
12033
+ if (onStartStatusChange) {
12034
+ menuItems.push({
12035
+ children: jsx(DotButton, {
12036
+ ariaLabel: "Publish changes",
12037
+ type: "text",
12038
+ startIcon: jsx(DotIcon, {
12039
+ iconId: "send-airplane"
12040
+ }),
12041
+ children: "Publish changes"
12029
12042
  }),
12030
- children: "Publish changes"
12031
- }),
12032
- key: 'republish'
12033
- });
12034
- menuItems.push({
12035
- children: jsx(DotButton, {
12036
- ariaLabel: "Revert to original",
12037
- type: "text",
12038
- startIcon: jsx(DotIcon, {
12039
- iconId: "undo"
12043
+ key: 'republish'
12044
+ });
12045
+ }
12046
+ if (onStartRevert) {
12047
+ menuItems.push({
12048
+ children: jsx(DotButton, {
12049
+ ariaLabel: "Revert to original",
12050
+ type: "text",
12051
+ startIcon: jsx(DotIcon, {
12052
+ iconId: "undo"
12053
+ }),
12054
+ children: "Revert to original"
12040
12055
  }),
12041
- children: "Revert to original"
12042
- }),
12043
- key: 'revert'
12044
- });
12045
- menuItems.push({
12046
- children: jsx(DotButton, {
12047
- ariaLabel: "Open published dashboard",
12048
- type: "text",
12049
- startIcon: jsx(DotIcon, {
12050
- iconId: "visibility-on"
12056
+ key: 'revert'
12057
+ });
12058
+ menuItems.push({
12059
+ children: jsx(DotButton, {
12060
+ ariaLabel: "Open published dashboard",
12061
+ type: "text",
12062
+ startIcon: jsx(DotIcon, {
12063
+ iconId: "visibility-on"
12064
+ }),
12065
+ children: "Open published dashboard"
12051
12066
  }),
12052
- children: "Open published dashboard"
12053
- }),
12054
- key: 'original'
12055
- });
12067
+ key: 'original'
12068
+ });
12069
+ }
12056
12070
  }
12057
12071
  if (onDetails) {
12058
12072
  if (menuItems.length > 0) {
@@ -12601,6 +12615,7 @@ function DotDashboardHeader({
12601
12615
  variant: "h2",
12602
12616
  children: [backButton, dashboard === null || dashboard === void 0 ? void 0 : dashboard.name]
12603
12617
  }), showStatus && dashboard && jsx(DotDashboardStatusPill, {
12618
+ canEdit: canEdit,
12604
12619
  dashboard: dashboard,
12605
12620
  currentUser: currentUser ? currentUser : null,
12606
12621
  modifiedAuthorUser: modifiedAuthorUser ? modifiedAuthorUser : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "4.3.2",
3
+ "version": "4.3.4",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -3,22 +3,21 @@ import { CommonProps } from '../../CommonProps';
3
3
  import { DashboardView } from '../metadata-api/openapi';
4
4
  import { UserModel } from '../../core-api/openapi';
5
5
  interface CommonDashboardDetailsProps extends CommonProps {
6
+ canEdit: boolean;
7
+ currentUser?: UserModel;
8
+ modifiedAuthorUser?: UserModel;
6
9
  onClose?: (event: MouseEvent | KeyboardEvent) => void;
7
10
  onFavorite?: (dashboardId: string, favoriteValue: boolean) => void;
8
11
  yOffset?: number;
9
12
  zIndex?: number;
10
13
  }
11
14
  interface DashboardDetailsViewProps extends CommonDashboardDetailsProps {
12
- currentUser?: UserModel;
13
15
  dashboard: DashboardView;
14
- modifiedAuthorUser?: UserModel;
15
16
  open: boolean;
16
17
  }
17
- export declare const DotDashboardDetailsView: ({ className, dashboard, onClose, onFavorite, open, yOffset, zIndex, currentUser, modifiedAuthorUser, }: DashboardDetailsViewProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const DotDashboardDetailsView: ({ canEdit, className, dashboard, onClose, onFavorite, open, yOffset, zIndex, currentUser, modifiedAuthorUser, }: DashboardDetailsViewProps) => import("react/jsx-runtime").JSX.Element;
18
19
  export interface DashboardDetailsProps extends CommonDashboardDetailsProps {
19
- currentUser?: UserModel;
20
20
  dashboard?: DashboardView;
21
- modifiedAuthorUser?: UserModel;
22
21
  }
23
22
  export declare const DotDashboardDetails: ({ dashboard, onClose, onFavorite, currentUser, modifiedAuthorUser, ...commonProps }: DashboardDetailsProps) => import("react/jsx-runtime").JSX.Element;
24
23
  export {};
@@ -1,9 +1,10 @@
1
1
  import { DashboardView } from '../metadata-api/openapi';
2
2
  import { UserModel } from '../../core-api/openapi';
3
3
  interface DashboardStatusPillProps {
4
+ canEdit: boolean;
4
5
  currentUser?: UserModel;
5
6
  dashboard: DashboardView;
6
7
  modifiedAuthorUser?: UserModel;
7
8
  }
8
- declare function DotDashboardStatusPill({ dashboard, currentUser, modifiedAuthorUser, }: Readonly<DashboardStatusPillProps>): import("react/jsx-runtime").JSX.Element;
9
+ declare function DotDashboardStatusPill({ dashboard, canEdit, currentUser, modifiedAuthorUser, }: Readonly<DashboardStatusPillProps>): import("react/jsx-runtime").JSX.Element;
9
10
  export { DashboardStatusPillProps, DotDashboardStatusPill };