@digital-ai/dot-components 4.22.0 → 4.23.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 +83 -22
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -10594,6 +10594,31 @@ const dashboard6 = Object.assign(Object.assign({}, dashboard6InProgress), {
|
|
|
10594
10594
|
in_progress_changes: dashboard6InProgress,
|
|
10595
10595
|
parent_id: null
|
|
10596
10596
|
});
|
|
10597
|
+
({
|
|
10598
|
+
author_fullname: 'Dashboard7 Author',
|
|
10599
|
+
author_id: 'id7a',
|
|
10600
|
+
target_apps: ['AGILITY'],
|
|
10601
|
+
external_id: '7',
|
|
10602
|
+
name: 'dummy dashboard 7',
|
|
10603
|
+
description: '',
|
|
10604
|
+
dashboard_url: 'https://test.com',
|
|
10605
|
+
server_url: 'https://test.com',
|
|
10606
|
+
external_embedding_id: null,
|
|
10607
|
+
created_dt: '2023-11-21T04:42:07.872000+00:00',
|
|
10608
|
+
id: 'id7',
|
|
10609
|
+
lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
|
|
10610
|
+
application_instances: ['2'],
|
|
10611
|
+
categories: [],
|
|
10612
|
+
bi_type: DashboardView.bi_type.MICROSTRATEGY,
|
|
10613
|
+
is_ootb_dashboard: false,
|
|
10614
|
+
thumbnail: '',
|
|
10615
|
+
external_object: {},
|
|
10616
|
+
embed_config: {},
|
|
10617
|
+
help_content_id: helpContent.id,
|
|
10618
|
+
filter_configuration: [],
|
|
10619
|
+
favorite: false,
|
|
10620
|
+
updated_dt: '2023-11-21T04:42:07.951000+00:00'
|
|
10621
|
+
});
|
|
10597
10622
|
const dummyDashboards = [dashboard1, dashboard2, dashboard3, dashboard4, dashboard5, dashboard6];
|
|
10598
10623
|
const getCategoriesMock = {
|
|
10599
10624
|
categories: {
|
|
@@ -10877,13 +10902,19 @@ const DotMetadataApiProvider = ({
|
|
|
10877
10902
|
}
|
|
10878
10903
|
let response;
|
|
10879
10904
|
try {
|
|
10880
|
-
if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED &&
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10905
|
+
if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED && updatePayload.lifecycle_state !== DashboardPatchBody.lifecycle_state.DRAFT) {
|
|
10906
|
+
if (dashboard.in_progress_changes) {
|
|
10907
|
+
// If the dashboard is published and has in-progress changes, we need to update the in-progress dashboard
|
|
10908
|
+
response = yield DashboardsService.patchInProgressDashboard(dashboard.id, updatePayload, accountId, isSync);
|
|
10909
|
+
} else {
|
|
10910
|
+
// If the dashboard is published and has no in-progress changes, we need to create an in-progress dashboard
|
|
10911
|
+
response = yield DashboardsService.postInProgressDashboard(dashboard.id, accountId, updatePayload);
|
|
10912
|
+
}
|
|
10913
|
+
} else if (dashboard.parent_id) {
|
|
10914
|
+
// If the dashboard is in progress (has a parent_id), we need to update the in-progress dashboard
|
|
10915
|
+
response = yield DashboardsService.patchInProgressDashboard(dashboard.parent_id, updatePayload, accountId, isSync);
|
|
10886
10916
|
} else {
|
|
10917
|
+
// If the dashboard is in draft state, we can update it directly
|
|
10887
10918
|
response = yield DashboardsService.patchDashboard(dashboard.id, updatePayload, accountId, isSync);
|
|
10888
10919
|
}
|
|
10889
10920
|
setDashboardsError(null);
|
|
@@ -12632,6 +12663,9 @@ function DotDashboardPublishConfirm({
|
|
|
12632
12663
|
};
|
|
12633
12664
|
return jsxs(Fragment, {
|
|
12634
12665
|
children: [dashboardToPublish !== null && jsx(DotDialog, {
|
|
12666
|
+
cancelButtonProps: {
|
|
12667
|
+
'data-testid': 'publish-cancel-button'
|
|
12668
|
+
},
|
|
12635
12669
|
cancelButtonVisible: !published,
|
|
12636
12670
|
closeOnSubmit: false,
|
|
12637
12671
|
hasPrimaryAction: publishing === null || published,
|
|
@@ -12656,6 +12690,9 @@ function DotDashboardPublishConfirm({
|
|
|
12656
12690
|
editInProgress: editInProgressByUser(dashboardToPublish, currentUser.id)
|
|
12657
12691
|
})
|
|
12658
12692
|
}), dashboardToUnpublish !== null && jsx(DotDialog, {
|
|
12693
|
+
cancelButtonProps: {
|
|
12694
|
+
'data-testid': 'unpublish-cancel-button'
|
|
12695
|
+
},
|
|
12659
12696
|
cancelButtonVisible: !unpublished,
|
|
12660
12697
|
closeOnSubmit: false,
|
|
12661
12698
|
hasPrimaryAction: unpublishing === null || unpublished,
|
|
@@ -12830,19 +12867,35 @@ function DotDashboardOptionsMenu({
|
|
|
12830
12867
|
key: 'edit-props'
|
|
12831
12868
|
});
|
|
12832
12869
|
}
|
|
12833
|
-
if (onStartStatusChange && !dashboard.is_ootb_dashboard
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12870
|
+
if (onStartStatusChange && !dashboard.is_ootb_dashboard) {
|
|
12871
|
+
if (isDraft) {
|
|
12872
|
+
menuItems.push({
|
|
12873
|
+
key: 'publish',
|
|
12874
|
+
children: jsx(DotButton, {
|
|
12875
|
+
ariaLabel: "Publish dashboard",
|
|
12876
|
+
type: "text",
|
|
12877
|
+
"data-testid": `publish-dashboard-button-${dashboard.id}`,
|
|
12878
|
+
startIcon: jsx(DotIcon, {
|
|
12879
|
+
iconId: "send-airplane"
|
|
12880
|
+
}),
|
|
12881
|
+
children: "Publish"
|
|
12882
|
+
})
|
|
12883
|
+
});
|
|
12884
|
+
}
|
|
12885
|
+
if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED && !dashboard.in_progress_changes) {
|
|
12886
|
+
menuItems.push({
|
|
12887
|
+
key: 'unpublish',
|
|
12888
|
+
children: jsx(DotButton, {
|
|
12889
|
+
ariaLabel: "Unpublish dashboard",
|
|
12890
|
+
type: "text",
|
|
12891
|
+
"data-testid": `unpublish-dashboard-button-${dashboard.id}`,
|
|
12892
|
+
startIcon: jsx(DotIcon, {
|
|
12893
|
+
iconId: "undo"
|
|
12894
|
+
}),
|
|
12895
|
+
children: "Unpublish"
|
|
12896
|
+
})
|
|
12897
|
+
});
|
|
12898
|
+
}
|
|
12846
12899
|
}
|
|
12847
12900
|
if (onStartDuplicate) {
|
|
12848
12901
|
menuItems.push({
|
|
@@ -12971,6 +13024,9 @@ function DotDashboardOptionsMenu({
|
|
|
12971
13024
|
case 'publish':
|
|
12972
13025
|
onStartStatusChange(dashboard, DashboardView.lifecycle_state.PUBLISHED);
|
|
12973
13026
|
break;
|
|
13027
|
+
case 'unpublish':
|
|
13028
|
+
onStartStatusChange(dashboard, DashboardView.lifecycle_state.DRAFT);
|
|
13029
|
+
break;
|
|
12974
13030
|
}
|
|
12975
13031
|
handleMenuClose();
|
|
12976
13032
|
}, [menuItems, handleMenuClose]);
|
|
@@ -13185,9 +13241,14 @@ function DotDashboardActions({
|
|
|
13185
13241
|
setDashboardToPublish(null);
|
|
13186
13242
|
setDashboardToUnpublish(null);
|
|
13187
13243
|
}, []);
|
|
13188
|
-
const handleStartStatusChange = useCallback(() => {
|
|
13189
|
-
|
|
13190
|
-
|
|
13244
|
+
const handleStartStatusChange = useCallback((dashboardView, newStatus) => {
|
|
13245
|
+
if (newStatus === DashboardView.lifecycle_state.DRAFT) {
|
|
13246
|
+
setDashboardToUnpublish(dashboard);
|
|
13247
|
+
setDashboardToPublish(null);
|
|
13248
|
+
} else {
|
|
13249
|
+
setDashboardToPublish(dashboard);
|
|
13250
|
+
setDashboardToUnpublish(null);
|
|
13251
|
+
}
|
|
13191
13252
|
}, [dashboard]);
|
|
13192
13253
|
const handleDeleteClose = useCallback(() => {
|
|
13193
13254
|
setDashboardToDelete(null);
|