@digital-ai/dot-components 3.25.0 → 3.26.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/index.esm.js CHANGED
@@ -9512,25 +9512,34 @@ class HelpContentService {
9512
9512
 
9513
9513
  function DotDashboardStatusPill({
9514
9514
  dashboard,
9515
- currentUser
9515
+ currentUser,
9516
+ modifiedAuthorUser
9516
9517
  }) {
9517
9518
  if (dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT) {
9518
- return jsx(DotPill, {
9519
- label: "Draft",
9520
- size: "small",
9521
- variant: "outlined",
9522
- status: "in-progress"
9519
+ return jsx(DotTooltip, {
9520
+ title: "This dashboard has not yet been published. It is not visible to end users or in Digital.ai applications.",
9521
+ placement: "top",
9522
+ children: jsx(DotPill, {
9523
+ label: "Draft",
9524
+ size: "small",
9525
+ variant: "outlined",
9526
+ status: "in-progress"
9527
+ })
9523
9528
  });
9524
9529
  } else if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED && dashboard.is_being_modified && currentUser) {
9525
9530
  if (dashboard.modified_author_id === currentUser.id) {
9526
- return jsx(DotPill, {
9527
- label: "Edit in progress",
9528
- size: "small",
9529
- variant: "outlined",
9530
- status: "success"
9531
+ return jsx(DotTooltip, {
9532
+ 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.",
9533
+ placement: "top",
9534
+ children: jsx(DotPill, {
9535
+ label: "Edit in progress",
9536
+ size: "small",
9537
+ variant: "outlined",
9538
+ status: "success"
9539
+ })
9531
9540
  });
9532
9541
  } else {
9533
- return jsx(DotPill, {
9542
+ const lockedPublished = jsx(DotPill, {
9534
9543
  label: "Published",
9535
9544
  icon: jsx(DotIcon, {
9536
9545
  iconId: "lock"
@@ -9539,13 +9548,27 @@ function DotDashboardStatusPill({
9539
9548
  variant: "outlined",
9540
9549
  status: "success"
9541
9550
  });
9551
+ if (modifiedAuthorUser) {
9552
+ const modifiedAuthorUserFullName = `${modifiedAuthorUser.given_name} ${modifiedAuthorUser.family_name}`;
9553
+ return jsx(DotTooltip, {
9554
+ title: `${modifiedAuthorUserFullName} is currently editing this dashboard and it is locked for editing by other users.`,
9555
+ placement: "top",
9556
+ children: lockedPublished
9557
+ });
9558
+ } else {
9559
+ return lockedPublished;
9560
+ }
9542
9561
  }
9543
9562
  } else {
9544
- return jsx(DotPill, {
9545
- status: "success",
9546
- label: "Published",
9547
- size: "small",
9548
- variant: "outlined"
9563
+ return jsx(DotTooltip, {
9564
+ title: "The latest version of this dashboard is published and visible to end users.",
9565
+ placement: "top",
9566
+ children: jsx(DotPill, {
9567
+ status: "success",
9568
+ label: "Published",
9569
+ size: "small",
9570
+ variant: "outlined"
9571
+ })
9549
9572
  });
9550
9573
  }
9551
9574
  }
@@ -10468,7 +10491,8 @@ const DotDashboardDetailsView = ({
10468
10491
  open,
10469
10492
  yOffset = 56,
10470
10493
  zIndex = 990,
10471
- currentUser
10494
+ currentUser,
10495
+ modifiedAuthorUser
10472
10496
  }) => {
10473
10497
  var _a, _b;
10474
10498
  const rootClasses = useStylesWithRootClass(rootClassName$E, className);
@@ -10554,7 +10578,8 @@ const DotDashboardDetailsView = ({
10554
10578
  label: "Status",
10555
10579
  children: jsx(DotDashboardStatusPill, {
10556
10580
  dashboard: dashboard,
10557
- currentUser: currentUser ? currentUser : null
10581
+ currentUser: currentUser ? currentUser : null,
10582
+ modifiedAuthorUser: modifiedAuthorUser ? modifiedAuthorUser : null
10558
10583
  })
10559
10584
  }), jsx(DashboardDetailsField, {
10560
10585
  className: "dashboard-details-category",
@@ -10599,9 +10624,10 @@ const DotDashboardDetails = _a => {
10599
10624
  dashboard,
10600
10625
  onClose,
10601
10626
  onFavorite,
10602
- currentUser
10627
+ currentUser,
10628
+ modifiedAuthorUser
10603
10629
  } = _a,
10604
- commonProps = __rest(_a, ["dashboard", "onClose", "onFavorite", "currentUser"]);
10630
+ commonProps = __rest(_a, ["dashboard", "onClose", "onFavorite", "currentUser", "modifiedAuthorUser"]);
10605
10631
  const [_openedDashboard, _setOpenedDashboard] = useState(dashboard);
10606
10632
  const metadataApiContext = useDotMetadataApiContext();
10607
10633
  const {
@@ -10642,7 +10668,8 @@ const DotDashboardDetails = _a => {
10642
10668
  open: true,
10643
10669
  onFavorite: favoriteHandler,
10644
10670
  onClose: closeHandler,
10645
- currentUser: currentUser ? currentUser : null
10671
+ currentUser: currentUser ? currentUser : null,
10672
+ modifiedAuthorUser: modifiedAuthorUser ? modifiedAuthorUser : null
10646
10673
  }));
10647
10674
  }
10648
10675
  return null;
@@ -11798,7 +11825,7 @@ function DotDashboardOptionsMenu({
11798
11825
  onclick: handleDuplicateClick
11799
11826
  });
11800
11827
  }
11801
- if (onStartDelete && !dashboard.is_ootb_dashboard) {
11828
+ if (onStartDelete && !dashboard.is_ootb_dashboard && !dashboardLocked) {
11802
11829
  const handleDeleteClick = () => {
11803
11830
  handleMenuClose();
11804
11831
  onStartDelete(dashboard);
@@ -12121,19 +12148,17 @@ function DotDashboardActions({
12121
12148
  onViewMode && onViewMode(result, 'view');
12122
12149
  });
12123
12150
  }), [dashboardToRevert, onRevertChanges, onStatusChanged]);
12124
- const handleStartViewOriginal = useCallback(() => __awaiter(this, void 0, void 0, function* () {
12151
+ const handleViewOriginal = useCallback(() => __awaiter(this, void 0, void 0, function* () {
12125
12152
  const dashboardId = dashboard.id;
12126
12153
  return cancelablePromise(getDashboard(dashboardId, false)).then(result => {
12127
- onStatusChanged && onStatusChanged(result);
12128
- onViewMode && onViewMode(result, 'view');
12129
12154
  onViewOriginal && onViewOriginal(result);
12130
12155
  });
12131
- }), [dashboard, onViewOriginal, onStatusChanged]);
12156
+ }), [dashboard, onViewOriginal]);
12132
12157
  const handleStartDelete = useCallback(dashboardToDel => {
12133
12158
  setDashboardToDelete(dashboardToDel);
12134
12159
  }, []);
12135
- const handleStartRevert = useCallback(dashboard => {
12136
- setDashboardToRevert(dashboard);
12160
+ const handleStartRevert = useCallback(dashboardToRev => {
12161
+ setDashboardToRevert(dashboardToRev);
12137
12162
  }, []);
12138
12163
  const handleRevertClose = useCallback(() => {
12139
12164
  setDashboardToRevert(null);
@@ -12146,7 +12171,6 @@ function DotDashboardActions({
12146
12171
  const handleStartDeleteIfConfig = onDeleted ? handleStartDelete : undefined;
12147
12172
  const handleViewModeIfConfig = onViewMode && canEdit ? onViewMode : undefined;
12148
12173
  const handleRevertChangesIfConfig = onRevertChanges ? handleStartRevert : undefined;
12149
- const handleViewOriginalIfConfig = onViewOriginal ? handleStartViewOriginal : undefined;
12150
12174
  return jsxs(StyledDashboardActions, {
12151
12175
  "data-testid": "dot-dashboard-actions",
12152
12176
  children: [jsx(DotDashboardPublishConfirm, {
@@ -12186,7 +12210,7 @@ function DotDashboardActions({
12186
12210
  dashboard: dashboard,
12187
12211
  isEdit: isEdit,
12188
12212
  menuPlacement: "bottom-start",
12189
- onViewOriginal: handleViewOriginalIfConfig,
12213
+ onViewOriginal: handleViewOriginal,
12190
12214
  onViewMode: handleViewModeIfConfig,
12191
12215
  onStartStatusChange: handleStartStatusChangeIfConfig,
12192
12216
  onStartDuplicate: handleStartDuplicateIfConfig,
@@ -12278,7 +12302,7 @@ function getDashboardBanner(dashboard, isEdit, onExitEditMode, onPublishChanges,
12278
12302
  return jsx(DotDashboardBanner, {
12279
12303
  bannerSeverity: "warning",
12280
12304
  bannerText: jsx(DotTypography, {
12281
- children: "The Dashboard is currently in edit mode and only you can make changes. Publish the changes for other users to see."
12305
+ children: "The Dashboard is currently in edit mode and only you can make changes. Publish the changes for other users to see the updated dashboard."
12282
12306
  }),
12283
12307
  buttonText: "Publish changes",
12284
12308
  buttonAction: () => {
@@ -12286,18 +12310,6 @@ function getDashboardBanner(dashboard, isEdit, onExitEditMode, onPublishChanges,
12286
12310
  }
12287
12311
  });
12288
12312
  }
12289
- } else {
12290
- // We're in Edit mode for a published dashboard, but there are no staged changes saved yet.
12291
- return jsx(DotDashboardBanner, {
12292
- bannerSeverity: "info",
12293
- bannerText: jsx(DotTypography, {
12294
- children: "You are currently in Edit Mode. Any changes you make will not be visible to others until you publish the updated dashboard."
12295
- }),
12296
- buttonText: "Exit edit mode",
12297
- buttonAction: () => {
12298
- onExitEditMode(dashboard);
12299
- }
12300
- });
12301
12313
  }
12302
12314
  } else {
12303
12315
  if (currentUser && dashboard.is_being_modified && dashboard.modified_author_id !== currentUser.id && modifiedAuthorUser) {
@@ -12310,7 +12322,7 @@ function getDashboardBanner(dashboard, isEdit, onExitEditMode, onPublishChanges,
12310
12322
  })
12311
12323
  });
12312
12324
  return jsx(DotDashboardBanner, {
12313
- bannerSeverity: "info",
12325
+ bannerSeverity: "warning",
12314
12326
  bannerText: bannerText
12315
12327
  });
12316
12328
  }
@@ -12389,7 +12401,8 @@ function DotDashboardHeader({
12389
12401
  children: [backButton, dashboard === null || dashboard === void 0 ? void 0 : dashboard.name]
12390
12402
  }), showStatus && dashboard && jsx(DotDashboardStatusPill, {
12391
12403
  dashboard: dashboard,
12392
- currentUser: currentUser ? currentUser : null
12404
+ currentUser: currentUser ? currentUser : null,
12405
+ modifiedAuthorUser: modifiedAuthorUser ? modifiedAuthorUser : null
12393
12406
  })]
12394
12407
  }), jsx(DotDashboardActions, {
12395
12408
  applications: applications,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "3.25.0",
3
+ "version": "3.26.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -11,12 +11,14 @@ interface CommonDashboardDetailsProps extends CommonProps {
11
11
  interface DashboardDetailsViewProps extends CommonDashboardDetailsProps {
12
12
  currentUser?: UserModel;
13
13
  dashboard: DashboardView;
14
+ modifiedAuthorUser?: UserModel;
14
15
  open: boolean;
15
16
  }
16
- export declare const DotDashboardDetailsView: ({ className, dashboard, onClose, onFavorite, open, yOffset, zIndex, currentUser, }: DashboardDetailsViewProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const DotDashboardDetailsView: ({ className, dashboard, onClose, onFavorite, open, yOffset, zIndex, currentUser, modifiedAuthorUser, }: DashboardDetailsViewProps) => import("react/jsx-runtime").JSX.Element;
17
18
  export interface DashboardDetailsProps extends CommonDashboardDetailsProps {
18
19
  currentUser?: UserModel;
19
20
  dashboard?: DashboardView;
21
+ modifiedAuthorUser?: UserModel;
20
22
  }
21
- export declare const DotDashboardDetails: ({ dashboard, onClose, onFavorite, currentUser, ...commonProps }: DashboardDetailsProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const DotDashboardDetails: ({ dashboard, onClose, onFavorite, currentUser, modifiedAuthorUser, ...commonProps }: DashboardDetailsProps) => import("react/jsx-runtime").JSX.Element;
22
24
  export {};
@@ -3,6 +3,7 @@ import { UserModel } from '../../core-api/openapi';
3
3
  interface DashboardStatusPillProps {
4
4
  currentUser?: UserModel;
5
5
  dashboard: DashboardView;
6
+ modifiedAuthorUser?: UserModel;
6
7
  }
7
- declare function DotDashboardStatusPill({ dashboard, currentUser, }: Readonly<DashboardStatusPillProps>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DotDashboardStatusPill({ dashboard, currentUser, modifiedAuthorUser, }: Readonly<DashboardStatusPillProps>): import("react/jsx-runtime").JSX.Element;
8
9
  export { DashboardStatusPillProps, DotDashboardStatusPill };