@digital-ai/dot-components 4.17.0 → 4.17.2

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.
Files changed (31) hide show
  1. package/index.esm.js +461 -199
  2. package/package.json +1 -1
  3. package/src/lib/components/analytics/dashboard-utils/DashboardUtils.d.ts +2 -0
  4. package/src/lib/components/analytics/metadata-api/MetadataApiProvider.d.ts +4 -3
  5. package/src/lib/components/analytics/metadata-api/openapi/index.d.ts +7 -0
  6. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardCopyBody.d.ts +4 -0
  7. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardCreateBody.d.ts +4 -4
  8. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardPatchBody.d.ts +4 -4
  9. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardPutBody.d.ts +4 -4
  10. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardView.d.ts +4 -4
  11. package/src/lib/components/analytics/metadata-api/openapi/models/Entity.d.ts +1 -0
  12. package/src/lib/components/analytics/metadata-api/openapi/models/Error.d.ts +1 -1
  13. package/src/lib/components/analytics/metadata-api/openapi/models/HealthCheckResponse.d.ts +4 -0
  14. package/src/lib/components/analytics/metadata-api/openapi/models/OriginInstance.d.ts +1 -0
  15. package/src/lib/components/analytics/metadata-api/openapi/models/ProductConfigurationItem.d.ts +5 -0
  16. package/src/lib/components/analytics/metadata-api/openapi/models/ProductConfigurationItemCreate.d.ts +8 -0
  17. package/src/lib/components/analytics/metadata-api/openapi/models/ProductOrigin.d.ts +10 -0
  18. package/src/lib/components/analytics/metadata-api/openapi/models/ProductView.d.ts +14 -0
  19. package/src/lib/components/analytics/metadata-api/openapi/models/ProductsResponse.d.ts +4 -0
  20. package/src/lib/components/analytics/metadata-api/openapi/services/BiService.d.ts +12 -6
  21. package/src/lib/components/analytics/metadata-api/openapi/services/CategoriesService.d.ts +4 -2
  22. package/src/lib/components/analytics/metadata-api/openapi/services/DashboardsService.d.ts +65 -20
  23. package/src/lib/components/analytics/metadata-api/openapi/services/EntitiesService.d.ts +10 -5
  24. package/src/lib/components/analytics/metadata-api/openapi/services/EntityAttributesService.d.ts +12 -6
  25. package/src/lib/components/analytics/metadata-api/openapi/services/EntityClassService.d.ts +10 -5
  26. package/src/lib/components/analytics/metadata-api/openapi/services/HelpContentService.d.ts +10 -5
  27. package/src/lib/components/analytics/metadata-api/openapi/services/MrProxyService.d.ts +40 -0
  28. package/src/lib/components/analytics/metadata-api/openapi/services/OriginInstancesService.d.ts +10 -5
  29. package/src/lib/components/analytics/metadata-api/openapi/services/OriginsService.d.ts +10 -5
  30. package/src/lib/components/analytics/metadata-api/openapi/services/ProductsService.d.ts +53 -0
  31. package/src/lib/components/analytics/metadata-api/openapi/services/UtilityService.d.ts +10 -1
package/index.esm.js CHANGED
@@ -9436,12 +9436,13 @@ class DashboardsService {
9436
9436
  /**
9437
9437
  * Get a list of Dashboards.
9438
9438
  * Return a list of Dashboard definitions, filtered by query parameters.
9439
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9439
9440
  * @param start Offset of the first fetched item.
9440
9441
  * @param count Maximum number of fetched items.
9441
9442
  * @param sort Sort ordering to apply to the query.
9442
9443
  * @param filter List of filters (each filter is a separate query param, and they are OR'ed).
9443
9444
  *
9444
- * * **Filterable field names**: author_fullname, author_id, bi_type, categories, created_dt, description, external_embedding_id, external_id, id, is_ootb_dashboard, lifecycle_state, modified_parent_id, name, target_apps, updated_by_fullname, updated_by_id, updated_dt
9445
+ * * **Filterable field names**: author_fullname, author_id, bi_type, categories, created_dt, dataset_id, description, external_embedding_id, external_id, id, is_ootb_dashboard, lifecycle_state, name, target_apps, updated_by_fullname, updated_by_id, updated_dt
9445
9446
  * * **Searchable field names**: author_fullname, categories, description, name, updated_by_fullname
9446
9447
  *
9447
9448
  * @param favorite Boolean flag to only return dashboards marked as favorites.
@@ -9455,15 +9456,19 @@ class DashboardsService {
9455
9456
  * @param lifecycleState String match on Dashboard lifecycle state - 'DRAFT' or 'PUBLISHED'.
9456
9457
  * @param name String match on Dashboard name.
9457
9458
  * @param targetApp String match on the Dashboard target application - 'AGILITY', 'CONTINUOUSTEST', 'DEPLOY', 'RELEASE', 'TEAMFORGE', 'CHANGERISKPREDICTION', or APPLICATIONSECURITY.
9459
+ * @param viewModified Return dashboards with modified changes if they exist for this user.
9458
9460
  * @returns DashboardViewPagedResponse OK
9459
9461
  * @returns Error Default error response
9460
9462
  * @throws ApiError
9461
9463
  */
9462
- static getDashboardsService(start, count = 20, sort = 'id', filter, favorite = null, q = null, authorFullname = null, authorId = null, biType = 'MICROSTRATEGY', description = null, id = null, isOotbDashboard = null, lifecycleState = null, name = null, targetApp = null) {
9464
+ static getDashboards(xDigitalaiAccountId = null, start, count = 20, sort = 'id', filter, favorite = null, q = null, authorFullname = null, authorId = null, biType = 'MICROSTRATEGY', description = null, id = null, isOotbDashboard = null, lifecycleState = null, name = null, targetApp = null, viewModified = false) {
9463
9465
  return __awaiter(this, void 0, void 0, function* () {
9464
9466
  const result = yield request({
9465
9467
  method: 'GET',
9466
9468
  path: `/metadata/bi/dashboards`,
9469
+ headers: {
9470
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9471
+ },
9467
9472
  query: {
9468
9473
  start: start,
9469
9474
  count: count,
@@ -9479,7 +9484,8 @@ class DashboardsService {
9479
9484
  is_ootb_dashboard: isOotbDashboard,
9480
9485
  lifecycle_state: lifecycleState,
9481
9486
  name: name,
9482
- target_app: targetApp
9487
+ target_app: targetApp,
9488
+ view_modified: viewModified
9483
9489
  },
9484
9490
  errors: {
9485
9491
  400: `An unknown parameter was specified.`,
@@ -9494,15 +9500,19 @@ class DashboardsService {
9494
9500
  * Create a Dashboard definition.
9495
9501
  * Creates a Dashboard definition.
9496
9502
  * @param requestBody
9503
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9497
9504
  * @returns DashboardView Dashboard created.
9498
9505
  * @returns Error Default error response
9499
9506
  * @throws ApiError
9500
9507
  */
9501
- static postDashboardsService(requestBody) {
9508
+ static postDashboards(requestBody, xDigitalaiAccountId = null) {
9502
9509
  return __awaiter(this, void 0, void 0, function* () {
9503
9510
  const result = yield request({
9504
9511
  method: 'POST',
9505
9512
  path: `/metadata/bi/dashboards`,
9513
+ headers: {
9514
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9515
+ },
9506
9516
  body: requestBody,
9507
9517
  mediaType: 'application/json',
9508
9518
  errors: {
@@ -9518,24 +9528,23 @@ class DashboardsService {
9518
9528
  * Get one Dashboard definition.
9519
9529
  * Return a single Dashboard definition, selected by ID.
9520
9530
  * @param dashboardId
9521
- * @param viewModified Return the dashboard with modified changes if they exist for this user.
9531
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9522
9532
  * @returns DashboardView OK
9523
9533
  * @returns Error Default error response
9524
9534
  * @throws ApiError
9525
9535
  */
9526
- static getDashboardsService1(dashboardId, viewModified = false) {
9536
+ static getDashboard(dashboardId, xDigitalaiAccountId = null) {
9527
9537
  return __awaiter(this, void 0, void 0, function* () {
9528
9538
  const result = yield request({
9529
9539
  method: 'GET',
9530
9540
  path: `/metadata/bi/dashboards/${dashboardId}`,
9531
- query: {
9532
- view_modified: viewModified
9541
+ headers: {
9542
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9533
9543
  },
9534
9544
  errors: {
9535
9545
  400: `An unknown parameter was specified.`,
9536
9546
  401: `Could not resolve a valid Tenant from the provided API Token.`,
9537
- 404: `The dashboard could not be found.`,
9538
- 422: `Unprocessable Entity`
9547
+ 404: `The dashboard could not be found.`
9539
9548
  }
9540
9549
  });
9541
9550
  return result.body;
@@ -9546,16 +9555,20 @@ class DashboardsService {
9546
9555
  * Sets a Dashboard definition, selected by ID.
9547
9556
  * @param dashboardId
9548
9557
  * @param requestBody
9558
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9549
9559
  * @param isSync Sync the dashboard with BI
9550
9560
  * @returns DashboardView Dashboard updated.
9551
9561
  * @returns Error Default error response
9552
9562
  * @throws ApiError
9553
9563
  */
9554
- static putDashboardsService(dashboardId, requestBody, isSync = null) {
9564
+ static putDashboard(dashboardId, requestBody, xDigitalaiAccountId = null, isSync = null) {
9555
9565
  return __awaiter(this, void 0, void 0, function* () {
9556
9566
  const result = yield request({
9557
9567
  method: 'PUT',
9558
9568
  path: `/metadata/bi/dashboards/${dashboardId}`,
9569
+ headers: {
9570
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9571
+ },
9559
9572
  query: {
9560
9573
  is_sync: isSync
9561
9574
  },
@@ -9577,16 +9590,20 @@ class DashboardsService {
9577
9590
  * Updates a Dashboard definition, selected by ID.
9578
9591
  * @param dashboardId
9579
9592
  * @param requestBody
9593
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9580
9594
  * @param isSync Sync the dashboard with BI
9581
9595
  * @returns DashboardView Dashboard updated.
9582
9596
  * @returns Error Default error response
9583
9597
  * @throws ApiError
9584
9598
  */
9585
- static patchDashboardsService(dashboardId, requestBody, isSync = null) {
9599
+ static patchDashboard(dashboardId, requestBody, xDigitalaiAccountId = null, isSync = null) {
9586
9600
  return __awaiter(this, void 0, void 0, function* () {
9587
9601
  const result = yield request({
9588
9602
  method: 'PATCH',
9589
9603
  path: `/metadata/bi/dashboards/${dashboardId}`,
9604
+ headers: {
9605
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9606
+ },
9590
9607
  query: {
9591
9608
  is_sync: isSync
9592
9609
  },
@@ -9607,33 +9624,97 @@ class DashboardsService {
9607
9624
  * Delete a Dashboard definition.
9608
9625
  * Deletes a single Dashboard definition, selected by ID.
9609
9626
  * @param dashboardId
9627
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9610
9628
  * @returns Error Default error response
9611
9629
  * @throws ApiError
9612
9630
  */
9613
- static deleteDashboardsService(dashboardId) {
9631
+ static deleteDashboard(dashboardId, xDigitalaiAccountId = null) {
9614
9632
  return __awaiter(this, void 0, void 0, function* () {
9615
9633
  const result = yield request({
9616
9634
  method: 'DELETE',
9617
- path: `/metadata/bi/dashboards/${dashboardId}`
9635
+ path: `/metadata/bi/dashboards/${dashboardId}`,
9636
+ headers: {
9637
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9638
+ }
9618
9639
  });
9619
9640
  return result.body;
9620
9641
  });
9621
9642
  }
9622
9643
  /**
9623
- * Publish modifications to a dashboard
9624
- * Publish modifications to a dashboard
9644
+ * Get one in-progress Dashboard definition.
9645
+ * Return a single Dashboard definition with pending changes, selected by ID.
9625
9646
  * @param dashboardId
9647
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9648
+ * @returns DashboardView OK
9649
+ * @returns Error Default error response
9650
+ * @throws ApiError
9651
+ */
9652
+ static getInProgressDashboard(dashboardId, xDigitalaiAccountId = null) {
9653
+ return __awaiter(this, void 0, void 0, function* () {
9654
+ const result = yield request({
9655
+ method: 'GET',
9656
+ path: `/metadata/bi/dashboards/${dashboardId}/inprogress`,
9657
+ headers: {
9658
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9659
+ },
9660
+ errors: {
9661
+ 400: `An unknown parameter was specified.`,
9662
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
9663
+ 404: `The dashboard could not be found.`
9664
+ }
9665
+ });
9666
+ return result.body;
9667
+ });
9668
+ }
9669
+ /**
9670
+ * Create an edit-in-progress version of the dashboard
9671
+ * Create an edit-in-progress version of the dashboard while leaving the original unchanged.
9672
+ * @param dashboardId
9673
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9626
9674
  * @param requestBody
9627
- * @param isSync Sync the dashboard with BI
9628
- * @returns DashboardView Dashboard published.
9675
+ * @returns DashboardView Edit-in-progress dashboard created.
9629
9676
  * @returns Error Default error response
9630
9677
  * @throws ApiError
9631
9678
  */
9632
- static postDashboardsService1(dashboardId, requestBody, isSync = null) {
9679
+ static postInProgressDashboard(dashboardId, xDigitalaiAccountId = null, requestBody) {
9633
9680
  return __awaiter(this, void 0, void 0, function* () {
9634
9681
  const result = yield request({
9635
9682
  method: 'POST',
9636
- path: `/metadata/bi/dashboards/${dashboardId}/publish`,
9683
+ path: `/metadata/bi/dashboards/${dashboardId}/inprogress`,
9684
+ headers: {
9685
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9686
+ },
9687
+ body: requestBody,
9688
+ mediaType: 'application/json',
9689
+ errors: {
9690
+ 400: `The provided data is not valid.`,
9691
+ 404: `The dashboard could not be found.`,
9692
+ 409: `Unable to update object because IDs are different.`,
9693
+ 422: `Unprocessable Entity`
9694
+ }
9695
+ });
9696
+ return result.body;
9697
+ });
9698
+ }
9699
+ /**
9700
+ * Sets a single Dashboard in-progress definition.
9701
+ * Sets a Dashboard definition with pending changes, selected by ID.
9702
+ * @param dashboardId
9703
+ * @param requestBody
9704
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9705
+ * @param isSync Sync the dashboard with BI
9706
+ * @returns DashboardView Dashboard updated.
9707
+ * @returns Error Default error response
9708
+ * @throws ApiError
9709
+ */
9710
+ static putInProgressDashboard(dashboardId, requestBody, xDigitalaiAccountId = null, isSync = null) {
9711
+ return __awaiter(this, void 0, void 0, function* () {
9712
+ const result = yield request({
9713
+ method: 'PUT',
9714
+ path: `/metadata/bi/dashboards/${dashboardId}/inprogress`,
9715
+ headers: {
9716
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9717
+ },
9637
9718
  query: {
9638
9719
  is_sync: isSync
9639
9720
  },
@@ -9643,6 +9724,7 @@ class DashboardsService {
9643
9724
  400: `The provided data is not valid.`,
9644
9725
  401: `Could not resolve a valid Tenant from the provided API Token.`,
9645
9726
  404: `The dashboard could not be found.`,
9727
+ 409: `Unable to update object because IDs are different.`,
9646
9728
  422: `Unprocessable Entity`
9647
9729
  }
9648
9730
  });
@@ -9650,22 +9732,62 @@ class DashboardsService {
9650
9732
  });
9651
9733
  }
9652
9734
  /**
9653
- * Revert modifications to a dashboard
9654
- * Revert modifications to a dashboard
9735
+ * Updates a single Dashboard in-progress definition.
9736
+ * Updates a Dashboard definition with pending changes, selected by ID.
9655
9737
  * @param dashboardId
9656
- * @returns DashboardView Dashboard changes reverted.
9738
+ * @param requestBody
9739
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9740
+ * @param isSync Sync the dashboard with BI
9741
+ * @returns DashboardView Dashboard updated.
9657
9742
  * @returns Error Default error response
9658
9743
  * @throws ApiError
9659
9744
  */
9660
- static postDashboardsService2(dashboardId) {
9745
+ static patchInProgressDashboard(dashboardId, requestBody, xDigitalaiAccountId = null, isSync = null) {
9661
9746
  return __awaiter(this, void 0, void 0, function* () {
9662
9747
  const result = yield request({
9663
- method: 'POST',
9664
- path: `/metadata/bi/dashboards/${dashboardId}/revert`,
9748
+ method: 'PATCH',
9749
+ path: `/metadata/bi/dashboards/${dashboardId}/inprogress`,
9750
+ headers: {
9751
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9752
+ },
9753
+ query: {
9754
+ is_sync: isSync
9755
+ },
9756
+ body: requestBody,
9757
+ mediaType: 'application/json',
9665
9758
  errors: {
9666
9759
  400: `The provided data is not valid.`,
9667
9760
  401: `Could not resolve a valid Tenant from the provided API Token.`,
9668
- 404: `The dashboard could not be found.`
9761
+ 404: `The dashboard could not be found.`,
9762
+ 409: `Unable to update object because IDs are different.`,
9763
+ 422: `Unprocessable Entity`
9764
+ }
9765
+ });
9766
+ return result.body;
9767
+ });
9768
+ }
9769
+ /**
9770
+ * Revert in-progress changes.
9771
+ * Discards edit in progress dashboard changes.
9772
+ * @param dashboardId
9773
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9774
+ * @param publish Publish changes to the original dashboard and delete the in-progress version.
9775
+ * @returns Error Default error response
9776
+ * @throws ApiError
9777
+ */
9778
+ static deleteInProgressDashboard(dashboardId, xDigitalaiAccountId = null, publish = false) {
9779
+ return __awaiter(this, void 0, void 0, function* () {
9780
+ const result = yield request({
9781
+ method: 'DELETE',
9782
+ path: `/metadata/bi/dashboards/${dashboardId}/inprogress`,
9783
+ headers: {
9784
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9785
+ },
9786
+ query: {
9787
+ publish: publish
9788
+ },
9789
+ errors: {
9790
+ 422: `Unprocessable Entity`
9669
9791
  }
9670
9792
  });
9671
9793
  return result.body;
@@ -9675,16 +9797,20 @@ class DashboardsService {
9675
9797
  * Create a copy of existing dashboard
9676
9798
  * Create a copy of existing dashboard
9677
9799
  * @param dashboardId
9800
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9678
9801
  * @param requestBody
9679
9802
  * @returns DashboardView Dashboard copied.
9680
9803
  * @returns Error Default error response
9681
9804
  * @throws ApiError
9682
9805
  */
9683
- static postDashboardsService3(dashboardId, requestBody) {
9806
+ static copyDashboard(dashboardId, xDigitalaiAccountId = null, requestBody) {
9684
9807
  return __awaiter(this, void 0, void 0, function* () {
9685
9808
  const result = yield request({
9686
9809
  method: 'POST',
9687
9810
  path: `/metadata/bi/dashboards/${dashboardId}/copy`,
9811
+ headers: {
9812
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9813
+ },
9688
9814
  body: requestBody,
9689
9815
  mediaType: 'application/json',
9690
9816
  errors: {
@@ -9700,15 +9826,19 @@ class DashboardsService {
9700
9826
  * Favorite a dashboard
9701
9827
  * Favorite a dashboard
9702
9828
  * @param dashboardId
9829
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9703
9830
  * @returns DashboardView Dashboard favorited.
9704
9831
  * @returns Error Default error response
9705
9832
  * @throws ApiError
9706
9833
  */
9707
- static postDashboardsService4(dashboardId) {
9834
+ static favoriteDashboard(dashboardId, xDigitalaiAccountId = null) {
9708
9835
  return __awaiter(this, void 0, void 0, function* () {
9709
9836
  const result = yield request({
9710
9837
  method: 'POST',
9711
9838
  path: `/metadata/bi/dashboards/${dashboardId}/favorite`,
9839
+ headers: {
9840
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9841
+ },
9712
9842
  errors: {
9713
9843
  400: `The provided data is not valid.`,
9714
9844
  404: `The dashboard could not be found.`
@@ -9721,15 +9851,19 @@ class DashboardsService {
9721
9851
  * Un-favorite a dashboard
9722
9852
  * Un-favorite a dashboard
9723
9853
  * @param dashboardId
9854
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9724
9855
  * @returns DashboardView Dashboard un-favorited.
9725
9856
  * @returns Error Default error response
9726
9857
  * @throws ApiError
9727
9858
  */
9728
- static deleteDashboardsService1(dashboardId) {
9859
+ static unfavoriteDashboard(dashboardId, xDigitalaiAccountId = null) {
9729
9860
  return __awaiter(this, void 0, void 0, function* () {
9730
9861
  const result = yield request({
9731
9862
  method: 'DELETE',
9732
9863
  path: `/metadata/bi/dashboards/${dashboardId}/favorite`,
9864
+ headers: {
9865
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9866
+ },
9733
9867
  errors: {
9734
9868
  400: `The provided data is not valid.`,
9735
9869
  404: `The dashboard could not be found.`
@@ -9741,6 +9875,7 @@ class DashboardsService {
9741
9875
  /**
9742
9876
  * Get Metadata (categories and authors)
9743
9877
  * Return all Metadata for dashboards optionally filtered by the given parameters
9878
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9744
9879
  * @param filter List of filters (each filter is a separate query param, and they are OR'ed).
9745
9880
  *
9746
9881
  * * **Filterable field names**: author_fullname, bi_type, categories, created_dt, description, is_ootb_dashboard, lifecycle_state, name, updated_by_fullname, updated_dt
@@ -9754,11 +9889,14 @@ class DashboardsService {
9754
9889
  * @returns Error Default error response
9755
9890
  * @throws ApiError
9756
9891
  */
9757
- static getDashboardsMetadata(filter, targetApp = null, biType = 'MICROSTRATEGY', isOotbDashboard = null, lifecycleState = null) {
9892
+ static getDashboardsMetadata(xDigitalaiAccountId = null, filter, targetApp = null, biType = 'MICROSTRATEGY', isOotbDashboard = null, lifecycleState = null) {
9758
9893
  return __awaiter(this, void 0, void 0, function* () {
9759
9894
  const result = yield request({
9760
9895
  method: 'GET',
9761
9896
  path: `/metadata/bi/dashboards/metadata`,
9897
+ headers: {
9898
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9899
+ },
9762
9900
  query: {
9763
9901
  filter: filter,
9764
9902
  target_app: targetApp,
@@ -9781,15 +9919,19 @@ class HelpContentService {
9781
9919
  /**
9782
9920
  * Gets help content definitions.
9783
9921
  * Return help content definitions.
9922
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9784
9923
  * @returns HelpContentPagedResponse OK
9785
9924
  * @returns Error Default error response
9786
9925
  * @throws ApiError
9787
9926
  */
9788
- static getHelpContent() {
9927
+ static getHelpContent(xDigitalaiAccountId = null) {
9789
9928
  return __awaiter(this, void 0, void 0, function* () {
9790
9929
  const result = yield request({
9791
9930
  method: 'GET',
9792
9931
  path: `/metadata/bi/helpcontent`,
9932
+ headers: {
9933
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9934
+ },
9793
9935
  errors: {
9794
9936
  400: `An unknown parameter was specified.`,
9795
9937
  401: `Could not resolve a valid Tenant from the provided API Token.`
@@ -9802,15 +9944,19 @@ class HelpContentService {
9802
9944
  * Upload an HTML file to be displayed as help content.
9803
9945
  * Upload help content.
9804
9946
  * @param requestBody
9947
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9805
9948
  * @returns HelpContent Content uploaded.
9806
9949
  * @returns Error Default error response
9807
9950
  * @throws ApiError
9808
9951
  */
9809
- static createHelpContent(requestBody) {
9952
+ static createHelpContent(requestBody, xDigitalaiAccountId = null) {
9810
9953
  return __awaiter(this, void 0, void 0, function* () {
9811
9954
  const result = yield request({
9812
9955
  method: 'POST',
9813
9956
  path: `/metadata/bi/helpcontent`,
9957
+ headers: {
9958
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9959
+ },
9814
9960
  body: requestBody,
9815
9961
  errors: {
9816
9962
  400: `The provided data is not valid.`,
@@ -9825,15 +9971,19 @@ class HelpContentService {
9825
9971
  * Get a help content definition.
9826
9972
  * Return a single help content definition, selected by ID.
9827
9973
  * @param helpContentId
9974
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9828
9975
  * @returns HelpContent OK
9829
9976
  * @returns Error Default error response
9830
9977
  * @throws ApiError
9831
9978
  */
9832
- static getHelpContentById(helpContentId) {
9979
+ static getHelpContentById(helpContentId, xDigitalaiAccountId = null) {
9833
9980
  return __awaiter(this, void 0, void 0, function* () {
9834
9981
  const result = yield request({
9835
9982
  method: 'GET',
9836
9983
  path: `/metadata/bi/helpcontent/${helpContentId}`,
9984
+ headers: {
9985
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
9986
+ },
9837
9987
  errors: {
9838
9988
  400: `An unknown parameter was specified.`,
9839
9989
  401: `Could not resolve a valid Tenant from the provided API Token.`,
@@ -9848,15 +9998,19 @@ class HelpContentService {
9848
9998
  * Update a single help content definition, selected by ID.
9849
9999
  * @param helpContentId
9850
10000
  * @param requestBody
10001
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9851
10002
  * @returns HelpContent OK
9852
10003
  * @returns Error Default error response
9853
10004
  * @throws ApiError
9854
10005
  */
9855
- static putHelpContentById(helpContentId, requestBody) {
10006
+ static putHelpContentById(helpContentId, requestBody, xDigitalaiAccountId = null) {
9856
10007
  return __awaiter(this, void 0, void 0, function* () {
9857
10008
  const result = yield request({
9858
10009
  method: 'PUT',
9859
10010
  path: `/metadata/bi/helpcontent/${helpContentId}`,
10011
+ headers: {
10012
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
10013
+ },
9860
10014
  body: requestBody,
9861
10015
  errors: {
9862
10016
  400: `An unknown parameter was specified.`,
@@ -9872,14 +10026,18 @@ class HelpContentService {
9872
10026
  * Delete a help content definition.
9873
10027
  * Delete a single help content definition, selected by ID.
9874
10028
  * @param helpContentId
10029
+ * @param xDigitalaiAccountId Perform the requested operation in the context of the Digital.ai account represented by this GUID. <em>Requires elevated permissions.</em>
9875
10030
  * @returns Error Default error response
9876
10031
  * @throws ApiError
9877
10032
  */
9878
- static deleteHelpContentById(helpContentId) {
10033
+ static deleteHelpContentById(helpContentId, xDigitalaiAccountId = null) {
9879
10034
  return __awaiter(this, void 0, void 0, function* () {
9880
10035
  const result = yield request({
9881
10036
  method: 'DELETE',
9882
10037
  path: `/metadata/bi/helpcontent/${helpContentId}`,
10038
+ headers: {
10039
+ 'X-Digitalai-Account-ID': xDigitalaiAccountId
10040
+ },
9883
10041
  errors: {
9884
10042
  400: `An unknown parameter was specified.`,
9885
10043
  401: `Could not resolve a valid Tenant from the provided API Token.`,
@@ -9897,69 +10055,76 @@ function DotDashboardStatusPill({
9897
10055
  currentUser,
9898
10056
  modifiedAuthorUser
9899
10057
  }) {
9900
- if (dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT) {
9901
- return jsx(DotTooltip, {
9902
- title: "This dashboard has not yet been published. It is not visible to end users or in Digital.ai applications.",
9903
- placement: "top",
9904
- children: jsx(DotPill, {
9905
- label: "Draft",
9906
- size: "small",
9907
- variant: "outlined",
9908
- status: "in-progress"
9909
- })
9910
- });
9911
- } else if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED && dashboard.is_being_modified && currentUser) {
9912
- if (dashboard.modified_author_id === currentUser.id && canEdit) {
9913
- return jsx(DotTooltip, {
9914
- 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.",
9915
- placement: "top",
9916
- children: jsx(DotPill, {
9917
- label: "Edit in progress",
9918
- size: "small",
9919
- variant: "outlined",
9920
- status: "warning"
9921
- })
9922
- });
9923
- } else {
9924
- const lockedPublished = jsx(DotPill, {
9925
- label: "Published",
9926
- icon: jsx(DotIcon, {
10058
+ let tooltipTitle;
10059
+ let pillLabel;
10060
+ let pillStatus;
10061
+ let pillIcon;
10062
+ const isInProgressDashboard = dashboard.in_progress_changes || dashboard.parent_id;
10063
+ if (isInProgressDashboard) {
10064
+ const authorIsCurrentUser = dashboard.in_progress_changes ? dashboard.in_progress_changes.author_id === (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id) : dashboard.author_id === (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id);
10065
+ if (authorIsCurrentUser) {
10066
+ // AUTHOR IS USER, DASHBOARD IS EDIT IN PROGRESS, USER IS EDITING
10067
+ if (canEdit) {
10068
+ tooltipTitle = '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.';
10069
+ pillLabel = 'Edit in progress';
10070
+ pillStatus = 'warning';
10071
+ pillIcon = null;
10072
+ }
10073
+ // AUTHOR IS USER, DASHBOARD IS EDIT IN PROGRESS, USER IS VIEWING
10074
+ else {
10075
+ tooltipTitle = 'You are viewing the published version of this dashboard which you are currently editing.';
10076
+ pillLabel = 'Published';
10077
+ pillStatus = 'success';
10078
+ pillIcon = jsx(DotIcon, {
9927
10079
  iconId: "lock"
9928
- }),
9929
- size: "small",
9930
- variant: "outlined",
9931
- status: "success"
9932
- });
9933
- if (modifiedAuthorUser) {
9934
- const modifiedAuthorUserFullName = `${modifiedAuthorUser.given_name} ${modifiedAuthorUser.family_name}`;
9935
- 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.`;
9936
- return jsx(DotTooltip, {
9937
- title: tooltip,
9938
- placement: "top",
9939
- children: lockedPublished
9940
- });
9941
- } else {
9942
- // If we don't have the user and the dashboard is being modified, we assume that the user is a Digital.ai
9943
- // Support or Admin user.
9944
- return jsx(DotTooltip, {
9945
- title: `This dashboard is currently being edited by Digital.ai and it is locked for editing by other users.`,
9946
- placement: "top",
9947
- children: lockedPublished
9948
10080
  });
9949
10081
  }
9950
10082
  }
10083
+ // AUTHOR IS NOT USER, DASHBOARD IS EDIT IN PROGRESS
10084
+ else if (modifiedAuthorUser) {
10085
+ tooltipTitle = `${modifiedAuthorUser.given_name} ${modifiedAuthorUser.family_name} is currently editing this dashboard and it is locked for editing by other users.`;
10086
+ pillLabel = 'Published';
10087
+ pillStatus = 'success';
10088
+ pillIcon = jsx(DotIcon, {
10089
+ iconId: "lock"
10090
+ });
10091
+ }
10092
+ // AUTHOR IS UNKNOWN, DASHBOARD IS EDIT IN PROGRESS
10093
+ else {
10094
+ tooltipTitle = 'This dashboard is currently being edited by Digital.ai and it is locked for editing by other users.';
10095
+ pillLabel = 'Published';
10096
+ pillStatus = 'success';
10097
+ pillIcon = jsx(DotIcon, {
10098
+ iconId: "lock"
10099
+ });
10100
+ }
9951
10101
  } else {
9952
- return jsx(DotTooltip, {
9953
- title: "The latest version of this dashboard is published and visible to end users.",
9954
- placement: "top",
9955
- children: jsx(DotPill, {
9956
- status: "success",
9957
- label: "Published",
9958
- size: "small",
9959
- variant: "outlined"
9960
- })
9961
- });
10102
+ // DASHBOARD IS DRAFT
10103
+ if (dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT) {
10104
+ tooltipTitle = 'This dashboard has not yet been published. It is not visible to end users or in Digital.ai applications.';
10105
+ pillLabel = 'Draft';
10106
+ pillStatus = 'in-progress';
10107
+ pillIcon = null;
10108
+ }
10109
+ // DASHBOARD IS PUBLISHED
10110
+ else {
10111
+ tooltipTitle = 'The latest version of this dashboard is published and visible to end users.';
10112
+ pillLabel = 'Published';
10113
+ pillStatus = 'success';
10114
+ pillIcon = null;
10115
+ }
9962
10116
  }
10117
+ return jsx(DotTooltip, {
10118
+ title: tooltipTitle,
10119
+ placement: "top",
10120
+ children: jsx(DotPill, {
10121
+ label: pillLabel,
10122
+ icon: pillIcon,
10123
+ size: "small",
10124
+ variant: "outlined",
10125
+ status: pillStatus
10126
+ })
10127
+ });
9963
10128
  }
9964
10129
 
9965
10130
  const helpContent = {
@@ -9991,8 +10156,7 @@ const dashboard1 = {
9991
10156
  help_content_id: helpContent.id,
9992
10157
  filter_configuration: [],
9993
10158
  favorite: false,
9994
- updated_dt: '2023-11-22T06:42:07.952000+00:00',
9995
- is_being_modified: false
10159
+ updated_dt: '2023-11-22T06:42:07.952000+00:00'
9996
10160
  };
9997
10161
  const dashboard2 = {
9998
10162
  author_fullname: 'Dashboard2 Author',
@@ -10032,7 +10196,7 @@ const dashboard3 = {
10032
10196
  created_dt: '2023-11-21T04:42:07.872000+00:00',
10033
10197
  id: 'id3',
10034
10198
  lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
10035
- application_instances: [],
10199
+ application_instances: ['2'],
10036
10200
  categories: [],
10037
10201
  bi_type: DashboardView.bi_type.MICROSTRATEGY,
10038
10202
  is_ootb_dashboard: true,
@@ -10094,20 +10258,19 @@ const dashboard5 = {
10094
10258
  favorite: false,
10095
10259
  updated_dt: '2023-11-21T04:42:07.951000+00:00'
10096
10260
  };
10097
- // Dashboard with in-progress edits
10098
- const dashboard6 = {
10261
+ const dashboard6InProgress = {
10099
10262
  author_fullname: 'Dashboard6 Author',
10100
- author_id: 'id6a',
10263
+ author_id: 'id123',
10101
10264
  target_apps: ['AGILITY'],
10102
10265
  external_id: '6',
10103
- name: 'Test dashboard 6',
10266
+ name: 'Test dashboard 6 (modified)',
10104
10267
  description: '',
10105
10268
  dashboard_url: 'https://test.com',
10106
10269
  server_url: 'https://test.com',
10107
10270
  external_embedding_id: null,
10108
10271
  created_dt: '2023-11-22T06:42:07.872000+00:00',
10109
10272
  id: 'id6',
10110
- lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
10273
+ lifecycle_state: DashboardView.lifecycle_state.DRAFT,
10111
10274
  application_instances: [],
10112
10275
  categories: [],
10113
10276
  bi_type: DashboardView.bi_type.MICROSTRATEGY,
@@ -10121,9 +10284,17 @@ const dashboard6 = {
10121
10284
  filter_configuration: [],
10122
10285
  favorite: false,
10123
10286
  updated_dt: '2023-11-22T06:42:07.952000+00:00',
10124
- is_being_modified: true,
10125
- modified_author_id: 'id123'
10287
+ parent_id: 'id6'
10126
10288
  };
10289
+ // Dashboard with in-progress edits
10290
+ const dashboard6 = Object.assign(Object.assign({}, dashboard6InProgress), {
10291
+ author_id: 'id6a',
10292
+ name: 'Test dashboard 6',
10293
+ id: 'id6',
10294
+ lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
10295
+ in_progress_changes: dashboard6InProgress,
10296
+ parent_id: null
10297
+ });
10127
10298
  const dummyDashboards = [dashboard1, dashboard2, dashboard3, dashboard4, dashboard5, dashboard6];
10128
10299
  const getCategoriesMock = {
10129
10300
  categories: {
@@ -10217,19 +10388,6 @@ const handleUpdateDashboard = (dashboards, updatedDashboard) => {
10217
10388
  return dashboards ? [...dashboards] : dashboards;
10218
10389
  };
10219
10390
  const DotMetadataApiContext = createContext(null);
10220
- const accountHeaderKey = 'X-Digitalai-Account-ID';
10221
- function setAccountIdHeader(accountId) {
10222
- const headers = OpenAPI.HEADERS;
10223
- if (accountId) {
10224
- if (!headers || accountHeaderKey in headers && headers[accountHeaderKey] !== accountId) {
10225
- OpenAPI.HEADERS = {
10226
- [accountHeaderKey]: accountId
10227
- };
10228
- }
10229
- } else if (headers) {
10230
- OpenAPI.HEADERS = null;
10231
- }
10232
- }
10233
10391
  const DotMetadataApiProvider = ({
10234
10392
  accountOverrideId,
10235
10393
  apiUrl,
@@ -10252,8 +10410,7 @@ const DotMetadataApiProvider = ({
10252
10410
  const MOCK_API_URL = 'https://demo-mock-api';
10253
10411
  const retrieveMetadata = useCallback((appType, isPublishedOnly) => {
10254
10412
  setMetadataLoading(true);
10255
- setAccountIdHeader(accountId);
10256
- return cancelablePromise(DashboardsService.getDashboardsMetadata(undefined, appType, undefined, undefined, isPublishedOnly ? 'PUBLISHED' : undefined)).then(response => {
10413
+ return cancelablePromise(DashboardsService.getDashboardsMetadata(accountId, undefined, appType, undefined, undefined, isPublishedOnly ? 'PUBLISHED' : undefined)).then(response => {
10257
10414
  setMetadataLoading(false);
10258
10415
  setDashboardsError(null);
10259
10416
  const key = metadataKey(isPublishedOnly);
@@ -10310,9 +10467,8 @@ const DotMetadataApiProvider = ({
10310
10467
  const results = dummyDashboards.filter(dashboard => (name === null || name === void 0 ? void 0 : name.toLowerCase()) === dashboard.name.toLowerCase());
10311
10468
  return Promise.resolve(results);
10312
10469
  }
10313
- setAccountIdHeader(accountId);
10314
10470
  setDashboardSearchLoading(true);
10315
- return cancelablePromise(DashboardsService.getDashboardsService(start, count, sort, filter, favorite, q, authorFullname, authorId, biType, description, id, isOotbDashboard, lifecycleState, name, targetApp)).then(response => {
10471
+ return cancelablePromise(DashboardsService.getDashboards(accountId, start, count, sort, filter, favorite, q, authorFullname, authorId, biType, description, id, isOotbDashboard, lifecycleState, name, targetApp)).then(response => {
10316
10472
  setDashboardsError(null);
10317
10473
  return response.results;
10318
10474
  }).catch(error => {
@@ -10326,12 +10482,23 @@ const DotMetadataApiProvider = ({
10326
10482
  }
10327
10483
  }).finally(() => setDashboardSearchLoading(false));
10328
10484
  },
10329
- deleteDashboard: dashboardId => {
10330
- setAccountIdHeader(accountId);
10331
- return cancelablePromise(DashboardsService.deleteDashboardsService(dashboardId)).then(() => {
10485
+ deleteDashboard: dashboardToDelete => {
10486
+ let deletePromise;
10487
+ // If we're dealing with an in-progress dashboard, we need to delete in-progress dashboard first, then delete
10488
+ // the parent dashboard.
10489
+ if (dashboardToDelete.in_progress_changes || dashboardToDelete.parent_id) {
10490
+ // Use the parent ID if it exists (in-progress dashboard) or the current ID (published dashboard)
10491
+ const dashboardId = dashboardToDelete.parent_id ? dashboardToDelete.parent_id : dashboardToDelete.id;
10492
+ deletePromise = cancelablePromise(DashboardsService.deleteInProgressDashboard(dashboardId, accountOverrideId, false).then(() => {
10493
+ return DashboardsService.deleteDashboard(dashboardId, accountOverrideId);
10494
+ }));
10495
+ } else {
10496
+ deletePromise = cancelablePromise(DashboardsService.deleteDashboard(dashboardToDelete.id, accountOverrideId));
10497
+ }
10498
+ return deletePromise.then(() => {
10332
10499
  setDashboardsError(null);
10333
10500
  if (dashboards) {
10334
- setDashboards(dashboards.filter(dashboard => dashboard.id !== dashboardId));
10501
+ setDashboards(dashboards.filter(dashboard => dashboard.id !== dashboardToDelete.id));
10335
10502
  }
10336
10503
  return true;
10337
10504
  }).catch(error => {
@@ -10340,8 +10507,7 @@ const DotMetadataApiProvider = ({
10340
10507
  });
10341
10508
  },
10342
10509
  duplicateDashboard: (dashboardId, dashboard) => {
10343
- setAccountIdHeader(accountId);
10344
- return cancelablePromise(DashboardsService.postDashboardsService3(dashboardId, dashboard)).then(response => {
10510
+ return cancelablePromise(DashboardsService.copyDashboard(dashboardId, accountId, dashboard)).then(response => {
10345
10511
  setDashboardsError(null);
10346
10512
  setMetadata(null);
10347
10513
  if (dashboards) {
@@ -10356,33 +10522,35 @@ const DotMetadataApiProvider = ({
10356
10522
  return null;
10357
10523
  });
10358
10524
  },
10359
- publishDashboardChanges: (dashboardId, dashboard, isSync) => __awaiter(void 0, void 0, void 0, function* () {
10360
- setAccountIdHeader(accountId);
10361
- return cancelablePromise(DashboardsService.postDashboardsService1(dashboardId, dashboard, isSync)).then(response => {
10525
+ publishDashboardChanges: (dashboardId, updatePayload, isSync) => __awaiter(void 0, void 0, void 0, function* () {
10526
+ return cancelablePromise(DashboardsService.patchInProgressDashboard(dashboardId, updatePayload, accountId, isSync).then(() => {
10527
+ return DashboardsService.deleteInProgressDashboard(dashboardId, accountId, true);
10528
+ }).then(() => {
10529
+ return DashboardsService.getDashboard(dashboardId, accountId);
10530
+ })).then(dashboard => {
10362
10531
  setDashboardsError(null);
10363
- setDashboards(orig => handleUpdateDashboard(orig, response));
10364
- return response;
10532
+ setDashboards(orig => handleUpdateDashboard(orig, dashboard));
10533
+ return dashboard;
10365
10534
  }).catch(error => setDashboardsError(error));
10366
10535
  }),
10367
10536
  revertDashboardChanges: dashboardId => __awaiter(void 0, void 0, void 0, function* () {
10368
- setAccountIdHeader(accountId);
10369
- return cancelablePromise(DashboardsService.postDashboardsService2(dashboardId)).then(response => {
10537
+ return cancelablePromise(DashboardsService.deleteInProgressDashboard(dashboardId, accountId, false).then(() => {
10538
+ return DashboardsService.getDashboard(dashboardId, accountId);
10539
+ })).then(dashboard => {
10370
10540
  setDashboardsError(null);
10371
- setDashboards(orig => handleUpdateDashboard(orig, response));
10372
- return response;
10541
+ setDashboards(orig => handleUpdateDashboard(orig, dashboard));
10542
+ return dashboard;
10373
10543
  }).catch(error => setDashboardsError(error));
10374
10544
  }),
10375
- getDashboard: (dashboardId, viewModified) => {
10376
- setAccountIdHeader(accountOverrideId);
10377
- return cancelablePromise(viewModified === undefined ? DashboardsService.getDashboardsService1(dashboardId) : DashboardsService.getDashboardsService1(dashboardId, viewModified)).then(response => {
10545
+ getDashboard: dashboardId => {
10546
+ return cancelablePromise(DashboardsService.getDashboard(dashboardId, accountId)).then(response => {
10378
10547
  setDashboardsError(null);
10379
10548
  return response;
10380
10549
  }).catch(error => setDashboardsError(error));
10381
10550
  },
10382
10551
  favoriteDashboard: (dashboardId, favoriteValue) => {
10383
- setAccountIdHeader(accountId);
10384
10552
  if (favoriteValue) {
10385
- return cancelablePromise(DashboardsService.postDashboardsService4(dashboardId)).then(response => {
10553
+ return cancelablePromise(DashboardsService.favoriteDashboard(dashboardId, accountId)).then(response => {
10386
10554
  setDashboardsError(null);
10387
10555
  setDashboards(orig => handleUpdateDashboard(orig, response));
10388
10556
  return response;
@@ -10391,7 +10559,7 @@ const DotMetadataApiProvider = ({
10391
10559
  return null;
10392
10560
  });
10393
10561
  } else {
10394
- return cancelablePromise(DashboardsService.deleteDashboardsService1(dashboardId)).then(response => {
10562
+ return cancelablePromise(DashboardsService.unfavoriteDashboard(dashboardId)).then(response => {
10395
10563
  setDashboardsError(null);
10396
10564
  setDashboards(orig => handleUpdateDashboard(orig, response));
10397
10565
  return response;
@@ -10401,15 +10569,40 @@ const DotMetadataApiProvider = ({
10401
10569
  });
10402
10570
  }
10403
10571
  },
10404
- updateDashboard: (dashboardId, dashboard, isSync = false) => __awaiter(void 0, void 0, void 0, function* () {
10572
+ updateDashboard: (dashboard, updatePayload, isSync = false) => __awaiter(void 0, void 0, void 0, function* () {
10573
+ if (OpenAPI.BASE === MOCK_API_URL) {
10574
+ setDashboardsError(null);
10575
+ return Promise.resolve(Object.assign(Object.assign({}, dashboard), {
10576
+ id: dashboard.id
10577
+ }));
10578
+ }
10579
+ let response;
10580
+ try {
10581
+ if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED && !dashboard.in_progress_changes) {
10582
+ response = yield DashboardsService.postInProgressDashboard(dashboard.id, accountId, updatePayload);
10583
+ }
10584
+ // If we're updating an in-progress dashboard, use the in-progress API
10585
+ else if (dashboard.in_progress_changes || dashboard.parent_id) {
10586
+ response = yield DashboardsService.patchInProgressDashboard(dashboard.id, updatePayload, accountId, isSync);
10587
+ } else {
10588
+ response = yield DashboardsService.patchDashboard(dashboard.id, updatePayload, accountId, isSync);
10589
+ }
10590
+ setDashboardsError(null);
10591
+ setMetadata(null);
10592
+ setDashboards(orig => handleUpdateDashboard(orig, response));
10593
+ return response;
10594
+ } catch (error) {
10595
+ setDashboardsError(error);
10596
+ }
10597
+ }),
10598
+ createInProgressDashboard: (dashboardId, dashboard) => __awaiter(void 0, void 0, void 0, function* () {
10405
10599
  if (OpenAPI.BASE === MOCK_API_URL) {
10406
10600
  setDashboardsError(null);
10407
10601
  return Promise.resolve(Object.assign(Object.assign({}, dashboard), {
10408
10602
  id: dashboardId
10409
10603
  }));
10410
10604
  }
10411
- setAccountIdHeader(accountId);
10412
- return cancelablePromise(DashboardsService.patchDashboardsService(dashboardId, dashboard, isSync)).then(response => {
10605
+ return cancelablePromise(DashboardsService.postInProgressDashboard(dashboardId, accountId, dashboard)).then(response => {
10413
10606
  setDashboardsError(null);
10414
10607
  setMetadata(null);
10415
10608
  setDashboards(orig => handleUpdateDashboard(orig, response));
@@ -10462,8 +10655,7 @@ const DotMetadataApiProvider = ({
10462
10655
  setHelpContentLoading(false);
10463
10656
  return helpContent;
10464
10657
  } else {
10465
- setAccountIdHeader(accountId);
10466
- return cancelablePromise(HelpContentService.getHelpContentById(helpContentId)).then(response => {
10658
+ return cancelablePromise(HelpContentService.getHelpContentById(helpContentId, accountId)).then(response => {
10467
10659
  setHelpContentLoading(false);
10468
10660
  return response.content;
10469
10661
  }).catch(error => {
@@ -11368,10 +11560,13 @@ function DotDashboardDialog({
11368
11560
  }, []);
11369
11561
  const handleSubmit = useCallback(isDone => __awaiter(this, void 0, void 0, function* () {
11370
11562
  setIsLoadingSubmit(true);
11563
+ // If this dashboard has a parent_id set, it means we are in an in-progress state and we need to use the ID
11564
+ // of the parent dashboard when updating
11371
11565
  const useFormValues = Object.assign(Object.assign({}, formValues), {
11372
- id: editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.id
11566
+ id: (editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.parent_id) ? editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.parent_id : editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.id
11373
11567
  });
11374
11568
  const validName = yield validateName(useFormValues.name);
11569
+ // If we fail name validation, set the nameError and don't call the submit function because it will fail.
11375
11570
  if (validName) {
11376
11571
  yield onSubmit(useFormValues, isDone);
11377
11572
  }
@@ -11694,6 +11889,16 @@ const DotImpactDialog = ({
11694
11889
  });
11695
11890
  };
11696
11891
 
11892
+ // Check if the dashboard has edit in progress changes for the current user.
11893
+ const editInProgressByUser = (dashboard, userId) => {
11894
+ if (dashboard.in_progress_changes) {
11895
+ return dashboard.in_progress_changes.author_id === userId;
11896
+ } else if (dashboard.parent_id) {
11897
+ return dashboard.author_id === userId;
11898
+ }
11899
+ return false;
11900
+ };
11901
+
11697
11902
  const InlineMessage = styled(DotTypography)`
11698
11903
  ${({
11699
11904
  theme
@@ -11755,6 +11960,7 @@ const productNameCategoryMap = {
11755
11960
  */
11756
11961
  function ActivePublishMessage({
11757
11962
  applicationList,
11963
+ dashboardDefaultAppInstanceId,
11758
11964
  dashboardName,
11759
11965
  initialCategories,
11760
11966
  published,
@@ -11798,7 +12004,15 @@ function ActivePublishMessage({
11798
12004
  title: category
11799
12005
  }));
11800
12006
  setCategoryOptions(newCategoryOptions);
11801
- selectedCategoryOptions.push(...newCategoryOptions.filter(o => initialCategories.includes(o.title)));
12007
+ // If we're editing an edit in progress dashboard, don't compare the categories passed in to the ones on the
12008
+ // server. These categories will not exist there until the dashboard is published.
12009
+ if (editInProgress) {
12010
+ selectedCategoryOptions.push(...initialCategories.map(category => ({
12011
+ title: category
12012
+ })));
12013
+ } else {
12014
+ selectedCategoryOptions.push(...newCategoryOptions.filter(o => initialCategories.includes(o.title)));
12015
+ }
11802
12016
  setSelectedCategories(selectedCategoryOptions);
11803
12017
  });
11804
12018
  } else {
@@ -11809,8 +12023,14 @@ function ActivePublishMessage({
11809
12023
  }
11810
12024
  }, [selectedApp]);
11811
12025
  useEffect(() => {
11812
- const selectedAppCategories = selectedCategories.map(c => c.title);
11813
- onChange(selectedApp, selectedAppCategories);
12026
+ // NOTE: selectedCategories is set to an empty list by default, so if pass in a default value for the application,
12027
+ // it will trigger selectedApp to update and this will get triggered before selectedCategories is set. The onChange
12028
+ // callback updates the `initialCategories` param, which triggers a re-render with any selected categories cleared
12029
+ // out, which is why we need this check.
12030
+ if (selectedCategories.length > 0) {
12031
+ const selectedAppCategories = selectedCategories.map(c => c.title);
12032
+ onChange(selectedApp, selectedAppCategories);
12033
+ }
11814
12034
  }, [selectedApp, selectedCategories]);
11815
12035
  const handleApplicationSelect = useCallback((_event, value, _reason) => {
11816
12036
  if (value === null) {
@@ -11834,6 +12054,13 @@ function ActivePublishMessage({
11834
12054
  title: newCategory
11835
12055
  }]);
11836
12056
  }, [selectedCategories]);
12057
+ const getApplicationSelectDefaultValue = (appList, targetAppId) => {
12058
+ if (targetAppId) {
12059
+ const app = appList.find(a => a.id === targetAppId);
12060
+ return app ? app.name : undefined;
12061
+ }
12062
+ return appList.length > 0 ? appList[0].name : undefined;
12063
+ };
11837
12064
  if (published) {
11838
12065
  return jsxs(StyledPublishConfirmDiv, {
11839
12066
  children: [jsxs(DotAlertBanner, {
@@ -11883,7 +12110,7 @@ function ActivePublishMessage({
11883
12110
  }), requiresApplication && jsxs(StyledAppSelectDiv, {
11884
12111
  children: [jsx(StyledAppSelectDotAutoComplete, {
11885
12112
  "data-testid": "publish-app-select",
11886
- defaultValue: applicationList.length > 0 ? applicationList[0].name : undefined,
12113
+ defaultValue: getApplicationSelectDefaultValue(applicationList, dashboardDefaultAppInstanceId),
11887
12114
  freesolo: false,
11888
12115
  multiple: false,
11889
12116
  filterSelectedOptions: true,
@@ -12020,7 +12247,7 @@ function DotDashboardPublishConfirm({
12020
12247
  setPublishing(null);
12021
12248
  setPublished(false);
12022
12249
  } else {
12023
- setPublishCategories(dashboardToPublish.categories || []);
12250
+ setPublishCategories((dashboardToPublish.in_progress_changes ? dashboardToPublish.in_progress_changes.categories : dashboardToPublish.categories) || []);
12024
12251
  setRequiresApplication(dashboardToPublish.target_apps.includes('AGILITY') || dashboardToPublish.target_apps.includes('RELEASE') || dashboardToPublish.target_apps.includes('CONTINUOUSTEST') || dashboardToPublish.target_apps.includes('TEAMFORGE') || dashboardToPublish.target_apps.includes('DEPLOY'));
12025
12252
  setRequiresCategories(dashboardToPublish.target_apps.includes('AGILITY') || dashboardToPublish.target_apps.includes('RELEASE') || dashboardToPublish.target_apps.includes('CONTINUOUSTEST') || dashboardToPublish.target_apps.includes('TEAMFORGE'));
12026
12253
  }
@@ -12031,9 +12258,6 @@ function DotDashboardPublishConfirm({
12031
12258
  setUnpublished(false);
12032
12259
  }
12033
12260
  }, [dashboardToUnpublish]);
12034
- const editInProgressByCurrentUser = dashboard => {
12035
- return currentUser && dashboard.is_being_modified && dashboard.modified_author_id === currentUser.id;
12036
- };
12037
12261
  const handlePublish = useCallback(() => {
12038
12262
  const patchDashboard = {
12039
12263
  lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
@@ -12042,8 +12266,8 @@ function DotDashboardPublishConfirm({
12042
12266
  };
12043
12267
  // If we're publishing a dashboard that is being modified by the current user, we need to use the
12044
12268
  // publishDashboardChanges method to commit the changes to the published dashboard.
12045
- const publishMethod = editInProgressByCurrentUser(dashboardToPublish) ? publishDashboardChanges : updateDashboard;
12046
- setPublishing(cancelablePromise(publishMethod(dashboardToPublish.id, patchDashboard).then(updatedDashboard => {
12269
+ const publishMethod = editInProgressByUser(dashboardToPublish, currentUser.id) ? publishDashboardChanges(dashboardToPublish.id, patchDashboard) : updateDashboard(dashboardToPublish, patchDashboard);
12270
+ setPublishing(cancelablePromise(publishMethod.then(updatedDashboard => {
12047
12271
  setPublished(true);
12048
12272
  onStatusChanged(updatedDashboard);
12049
12273
  enqueueMessage('Dashboard has been published!', 'success');
@@ -12058,7 +12282,7 @@ function DotDashboardPublishConfirm({
12058
12282
  onClose();
12059
12283
  }, [publishing, onClose]);
12060
12284
  const handleUnpublish = useCallback(() => {
12061
- setUnpublishing(cancelablePromise(updateDashboard(dashboardToUnpublish.id, {
12285
+ setUnpublishing(cancelablePromise(updateDashboard(dashboardToUnpublish, {
12062
12286
  lifecycle_state: DashboardView.lifecycle_state.DRAFT
12063
12287
  }).then(updatedDashboard => {
12064
12288
  setUnpublished(true);
@@ -12074,9 +12298,9 @@ function DotDashboardPublishConfirm({
12074
12298
  }
12075
12299
  onClose();
12076
12300
  }, [unpublishing, onClose]);
12077
- const handlePublishChange = useCallback((selectedApplication, selectedCategories) => {
12078
- setPublishAppInstance(selectedApplication);
12079
- setPublishCategories(selectedCategories);
12301
+ const handlePublishChange = useCallback((_selectedApplication, _selectedCategories) => {
12302
+ setPublishAppInstance(_selectedApplication);
12303
+ setPublishCategories(_selectedCategories);
12080
12304
  }, []);
12081
12305
  const canSubmit = useCallback(() => {
12082
12306
  if (requiresApplication && publishAppInstance === null) {
@@ -12087,7 +12311,7 @@ function DotDashboardPublishConfirm({
12087
12311
  const getPublishButtonLabel = dashboard => {
12088
12312
  if (published) {
12089
12313
  return 'Got it';
12090
- } else if (editInProgressByCurrentUser(dashboard)) {
12314
+ } else if (editInProgressByUser(dashboard, currentUser.id)) {
12091
12315
  return 'Yes, publish changes';
12092
12316
  } else {
12093
12317
  return 'Publish';
@@ -12099,7 +12323,7 @@ function DotDashboardPublishConfirm({
12099
12323
  closeOnSubmit: false,
12100
12324
  hasPrimaryAction: publishing === null || published,
12101
12325
  open: dashboardToPublish !== null,
12102
- title: editInProgressByCurrentUser(dashboardToPublish) ? 'Publish changes' : 'Publish to application',
12326
+ title: editInProgressByUser(dashboardToPublish, currentUser.id) ? 'Publish changes' : 'Publish to application',
12103
12327
  submitButtonProps: {
12104
12328
  'data-testid': 'publish-confirm-button',
12105
12329
  disabled: !canSubmit(),
@@ -12109,13 +12333,14 @@ function DotDashboardPublishConfirm({
12109
12333
  onSubmit: published ? handleCancelPublish : handlePublish,
12110
12334
  children: jsx(ActivePublishMessage, {
12111
12335
  applicationList: filteredApplications,
12336
+ dashboardDefaultAppInstanceId: (dashboardToPublish === null || dashboardToPublish === void 0 ? void 0 : dashboardToPublish.application_instances) ? dashboardToPublish === null || dashboardToPublish === void 0 ? void 0 : dashboardToPublish.application_instances[0] : null,
12112
12337
  dashboardName: dashboardToPublish === null || dashboardToPublish === void 0 ? void 0 : dashboardToPublish.name,
12113
12338
  initialCategories: publishCategories,
12114
12339
  published: published,
12115
12340
  publishing: publishing !== null,
12116
12341
  onChange: handlePublishChange,
12117
12342
  requiresApplication: requiresApplication,
12118
- editInProgress: editInProgressByCurrentUser(dashboardToPublish)
12343
+ editInProgress: editInProgressByUser(dashboardToPublish, currentUser.id)
12119
12344
  })
12120
12345
  }), dashboardToUnpublish !== null && jsx(DotDialog, {
12121
12346
  cancelButtonVisible: !unpublished,
@@ -12172,7 +12397,19 @@ const StyledDotMenu = styled(DotMenu)`
12172
12397
  `;
12173
12398
 
12174
12399
  const disabledPropsMessage = 'Dashboard properties cannot be modified while the dashboard editor is active. If you need to make property changes, please close the editor.';
12175
- const inProgressEditMessage = 'This is a published dashboard; changes will not be visible to other users until you publish the updated dashboard.';
12400
+ const inProgressEditMessage = 'This is a published dashboard. Changes will not be visible to other users until you publish the updated dashboard.';
12401
+ // This component could be dealing with either a Dashboard with in_progress_changes set, or the actual
12402
+ // in_progress_changes object itself, which will have parent_id set.
12403
+ // The Dashboard Table/Grid will always give the parent dashboard, while in the editor we will be dealing with the
12404
+ // in_progress_changes object. This function accounts for both cases
12405
+ const dashboardLocked = (dashboard, userId) => {
12406
+ if (dashboard.in_progress_changes) {
12407
+ return dashboard.in_progress_changes.author_id !== userId;
12408
+ } else if (dashboard.parent_id) {
12409
+ return dashboard.author_id !== userId;
12410
+ }
12411
+ return false;
12412
+ };
12176
12413
  function DotDashboardOptionsMenu({
12177
12414
  dashboard,
12178
12415
  currentUser,
@@ -12224,7 +12461,7 @@ function DotDashboardOptionsMenu({
12224
12461
  }
12225
12462
  }, [dashboard, isEdit]);
12226
12463
  const handleSubmitEditProperties = useCallback((data, isDone) => __awaiter(this, void 0, void 0, function* () {
12227
- return updateDashboard(dashboard.id, {
12464
+ return updateDashboard(dashboard, {
12228
12465
  name: data.name,
12229
12466
  description: data.description,
12230
12467
  categories: data.categories,
@@ -12236,11 +12473,12 @@ function DotDashboardOptionsMenu({
12236
12473
  }
12237
12474
  });
12238
12475
  }), [dashboard, onUpdatedProperties, updateDashboard]);
12239
- const isDraft = dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT;
12240
- const isPublished = dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED;
12241
- const dashboardLocked = isPublished && currentUser && dashboard.is_being_modified && dashboard.modified_author_id !== currentUser.id;
12476
+ // NOTE: Edit in Progress dashboards with parent_id are always in a DRAFT state, even though
12477
+ // the parent is in a PUBLISHED state. We need to treat it like a published dashboard.
12478
+ const isDraft = !dashboard.parent_id && dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT;
12479
+ const isPublished = dashboard.parent_id || dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED;
12242
12480
  const menuItems = [];
12243
- if (!isEdit && onViewMode && !dashboard.is_ootb_dashboard && !dashboardLocked) {
12481
+ if (!isEdit && onViewMode && !dashboard.is_ootb_dashboard && !dashboardLocked(dashboard, currentUser.id)) {
12244
12482
  menuItems.push({
12245
12483
  children: jsx(DotButton, {
12246
12484
  ariaLabel: "Edit dashboard",
@@ -12253,7 +12491,7 @@ function DotDashboardOptionsMenu({
12253
12491
  key: 'edit'
12254
12492
  });
12255
12493
  }
12256
- if (onUpdatedProperties && !dashboard.is_ootb_dashboard && !dashboardLocked) {
12494
+ if (onUpdatedProperties && !dashboard.is_ootb_dashboard && !dashboardLocked(dashboard, currentUser.id)) {
12257
12495
  let menuItem = jsx(DotButton, {
12258
12496
  ariaLabel: "Edit dashboard properties",
12259
12497
  className: isEdit ? 'disabled-menu-item' : '',
@@ -12304,7 +12542,7 @@ function DotDashboardOptionsMenu({
12304
12542
  key: 'duplicate'
12305
12543
  });
12306
12544
  }
12307
- if (onStartDelete && !dashboard.is_ootb_dashboard && !dashboardLocked) {
12545
+ if (onStartDelete && !dashboard.is_ootb_dashboard && !dashboardLocked(dashboard, currentUser.id)) {
12308
12546
  menuItems.push({
12309
12547
  children: jsx(DotButton, {
12310
12548
  ariaLabel: "Delete dashboard",
@@ -12319,7 +12557,7 @@ function DotDashboardOptionsMenu({
12319
12557
  }
12320
12558
  // If this is a published dashboard, with in-progress changes, and the user is the author of the changes,
12321
12559
  // show the republish, revert, and view original options.
12322
- if (isPublished && currentUser && dashboard.is_being_modified && dashboard.modified_author_id === currentUser.id) {
12560
+ if (isPublished && currentUser && editInProgressByUser(dashboard, currentUser.id)) {
12323
12561
  if (onStartStatusChange) {
12324
12562
  menuItems.push({
12325
12563
  children: jsx(DotButton, {
@@ -12425,7 +12663,8 @@ function DotDashboardOptionsMenu({
12425
12663
  setIsEditPropertiesDialogOpen(false);
12426
12664
  }, []);
12427
12665
  const messages = [];
12428
- if (dashboard.is_being_modified || dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED) {
12666
+ // Show a message if we're editing an in-progress or Published dashboard (that will be moved to in-progress)
12667
+ if (dashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED || dashboard.in_progress_changes || dashboard.parent_id) {
12429
12668
  messages.push(inProgressEditMessage);
12430
12669
  }
12431
12670
  return menuItems.length > 0 ? jsxs(Fragment, {
@@ -12440,7 +12679,7 @@ function DotDashboardOptionsMenu({
12440
12679
  open: isEditPropertiesDialogOpen,
12441
12680
  onClose: handleCloseEditProperties,
12442
12681
  onSubmit: handleSubmitEditProperties,
12443
- editDashboard: dashboard
12682
+ editDashboard: editInProgressByUser(dashboard, currentUser.id) && dashboard.in_progress_changes ? dashboard.in_progress_changes : dashboard
12444
12683
  }), jsx(DotIconButton, {
12445
12684
  className: "expand-button",
12446
12685
  "data-testid": "card-header-action-button",
@@ -12560,6 +12799,20 @@ function FullscreenButton({
12560
12799
  onClick: () => onToggleFullscreen(true)
12561
12800
  });
12562
12801
  }
12802
+ function getDashboardDeleteMessage(dashboard) {
12803
+ // Use a custom message to show if there are in-progress edits to warn the user that their data will be lost.
12804
+ if (dashboard.in_progress_changes || dashboard.parent_id) {
12805
+ const dashboardName = dashboard.in_progress_changes ? dashboard.in_progress_changes.name : dashboard.name;
12806
+ return jsxs(Fragment, {
12807
+ children: [jsxs(DotTypography, {
12808
+ children: ["This dashboard has in-progress edits. This will permanently DELETE", ' ', jsx("strong", {
12809
+ children: dashboardName
12810
+ }), " along with the Published version. Some data may be lost."]
12811
+ }), jsx("br", {})]
12812
+ });
12813
+ }
12814
+ return null;
12815
+ }
12563
12816
  function DotDashboardActions({
12564
12817
  applications,
12565
12818
  dashboard,
@@ -12625,8 +12878,8 @@ function DotDashboardActions({
12625
12878
  setDashboardToDelete(null);
12626
12879
  }, []);
12627
12880
  const handleDeleteSubmit = useCallback(() => __awaiter(this, void 0, void 0, function* () {
12628
- const dashboardId = dashboardToDelete.id;
12629
- return cancelablePromise(deleteDashboard(dashboardId)).then(deleted => {
12881
+ const dashboardId = dashboardToDelete.parent_id ? dashboardToDelete.parent_id : dashboardToDelete.id;
12882
+ return cancelablePromise(deleteDashboard(dashboardToDelete)).then(deleted => {
12630
12883
  setDashboardToDelete(null);
12631
12884
  onDeleted(dashboardId, deleted);
12632
12885
  });
@@ -12641,14 +12894,15 @@ function DotDashboardActions({
12641
12894
  description: data.description,
12642
12895
  categories: data.categories
12643
12896
  };
12644
- return duplicateDashboard(dashboard.id, copyData).then(result => {
12897
+ const dashboardId = dashboard.parent_id ? dashboard.parent_id : dashboard.id;
12898
+ return duplicateDashboard(dashboardId, copyData).then(result => {
12645
12899
  if (result && 'id' in result) {
12646
12900
  onDuplicated && onDuplicated(result, isDone);
12647
12901
  }
12648
12902
  });
12649
12903
  }, [dashboard, onDuplicated]);
12650
12904
  const handleRevertSubmit = useCallback(() => __awaiter(this, void 0, void 0, function* () {
12651
- const dashboardId = dashboardToRevert.id;
12905
+ const dashboardId = dashboardToRevert.parent_id ? dashboardToRevert.parent_id : dashboardToRevert.id;
12652
12906
  return cancelablePromise(revertDashboardChanges(dashboardId)).then(result => {
12653
12907
  setDashboardToRevert(null);
12654
12908
  onRevertChanges && onRevertChanges(result);
@@ -12657,8 +12911,9 @@ function DotDashboardActions({
12657
12911
  });
12658
12912
  }), [dashboardToRevert, onRevertChanges, onStatusChanged]);
12659
12913
  const handleViewOriginal = useCallback(() => __awaiter(this, void 0, void 0, function* () {
12660
- const dashboardId = dashboard.id;
12661
- return cancelablePromise(getDashboard(dashboardId, false)).then(result => {
12914
+ // If we're viewing an in-progress dashboard we need to use the parent_id to get the original
12915
+ const dashboardId = dashboard.parent_id ? dashboard.parent_id : dashboard.id;
12916
+ return cancelablePromise(getDashboard(dashboardId)).then(result => {
12662
12917
  onViewOriginal && onViewOriginal(result);
12663
12918
  });
12664
12919
  }), [dashboard, onViewOriginal]);
@@ -12698,8 +12953,9 @@ function DotDashboardActions({
12698
12953
  }), dashboardToDelete && jsx(DotImpactDialog, {
12699
12954
  onCancel: handleDeleteClose,
12700
12955
  onSubmit: handleDeleteSubmit,
12701
- record: dashboardToDelete.name,
12702
- impact: dashboardToDelete.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED ? 'high' : 'medium',
12956
+ record: dashboardToDelete.in_progress_changes ? dashboardToDelete.in_progress_changes.name : dashboardToDelete.name,
12957
+ message: getDashboardDeleteMessage(dashboardToDelete),
12958
+ impact: dashboardToDelete.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED || dashboardToDelete.parent_id ? 'high' : 'medium',
12703
12959
  open: true
12704
12960
  }), dashboardToRevert && jsx(DotImpactDialog, {
12705
12961
  onCancel: handleRevertClose,
@@ -12804,8 +13060,10 @@ function DotDashboardBanner({
12804
13060
  });
12805
13061
  }
12806
13062
  function getDashboardBanner(dashboard, isEdit, onExitEditMode, onPublishChanges, currentUser, modifiedAuthorUser) {
12807
- if (dashboard.is_being_modified && currentUser && isEdit) {
12808
- if (dashboard.modified_author_id === currentUser.id) {
13063
+ // If we're editing an In-Progress dashboard, show the publish message
13064
+ // NOTE: This will be the In-progess dashboard with the parent_id set.
13065
+ if (dashboard.parent_id && currentUser) {
13066
+ if (dashboard.author_id === currentUser.id) {
12809
13067
  // We're in Edit mode for a published dashboard, and the dashboard is being modified by the current user.
12810
13068
  return jsx(DotDashboardBanner, {
12811
13069
  bannerSeverity: "warning",
@@ -12817,21 +13075,25 @@ function getDashboardBanner(dashboard, isEdit, onExitEditMode, onPublishChanges,
12817
13075
  onPublishChanges(dashboard);
12818
13076
  }
12819
13077
  });
12820
- } else if (dashboard.modified_author_id !== currentUser.id && modifiedAuthorUser) {
12821
- // We're in View mode for a published dashboard that is being edited by someone else.
12822
- const bannerText = jsx(DotTypography, {
12823
- children: jsxs("div", {
12824
- children: ["This Dashboard is currently being edited by", ' ', jsxs("strong", {
12825
- children: [modifiedAuthorUser.given_name, " ", modifiedAuthorUser.family_name]
12826
- }), ". You will be able to see the updated dashboard once the changes are published."]
12827
- })
12828
- });
12829
- return jsx(DotDashboardBanner, {
12830
- bannerSeverity: "warning",
12831
- bannerText: bannerText
12832
- });
12833
13078
  }
12834
13079
  }
13080
+ // If we're viewing another user's Locked In-progress dashboard, show the edit message
13081
+ // NOTE: This will be the parent dashboard with in_progress_changes set, since we don't want
13082
+ // to show the user the in-progress changes if they're not editing the dashboard.
13083
+ else if (dashboard.in_progress_changes && dashboard.in_progress_changes.author_id !== currentUser.id && modifiedAuthorUser) {
13084
+ // We're in View mode for a published dashboard that is being edited by someone else.
13085
+ const bannerText = jsx(DotTypography, {
13086
+ children: jsxs("div", {
13087
+ children: ["This Dashboard is currently being edited by", ' ', jsxs("strong", {
13088
+ children: [modifiedAuthorUser.given_name, " ", modifiedAuthorUser.family_name]
13089
+ }), ". You will be able to see the updated dashboard once the changes are published."]
13090
+ })
13091
+ });
13092
+ return jsx(DotDashboardBanner, {
13093
+ bannerSeverity: "warning",
13094
+ bannerText: bannerText
13095
+ });
13096
+ }
12835
13097
  }
12836
13098
  function DotDashboardHeader({
12837
13099
  accountId,
@@ -12929,7 +13191,7 @@ function DotDashboardHeader({
12929
13191
  onViewOriginal: onViewOriginal,
12930
13192
  currentUser: currentUser ? currentUser : null
12931
13193
  })]
12932
- }), dashboard && dashboard.lifecycle_state === 'PUBLISHED' && getDashboardBanner(dashboard, isEdit, onExitEditMode, handleStartPublishChanges, currentUser ? currentUser : null, modifiedAuthorUser ? modifiedAuthorUser : null)]
13194
+ }), dashboard && (dashboard.in_progress_changes || dashboard.parent_id) && getDashboardBanner(dashboard, isEdit, onExitEditMode, handleStartPublishChanges, currentUser ? currentUser : null, modifiedAuthorUser ? modifiedAuthorUser : null)]
12933
13195
  });
12934
13196
  }
12935
13197