@digital-ai/dot-components 3.14.0 → 3.15.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.
package/index.esm.js CHANGED
@@ -9366,7 +9366,7 @@ const dashboard1 = {
9366
9366
  dashboard_url: 'https://test.com',
9367
9367
  server_url: 'https://test.com',
9368
9368
  external_embedding_id: null,
9369
- created_dt: '2023-11-22T06:42:07.872000',
9369
+ created_dt: '2023-11-22T06:42:07.872000+00:00',
9370
9370
  id: 'id1',
9371
9371
  lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9372
9372
  application_instances: [],
@@ -9380,7 +9380,8 @@ const dashboard1 = {
9380
9380
  embed_config: {},
9381
9381
  help_content_id: helpContent.id,
9382
9382
  filter_configuration: [],
9383
- favorite: false
9383
+ favorite: false,
9384
+ updated_dt: '2023-11-22T06:42:07.952000+00:00'
9384
9385
  };
9385
9386
  const dashboard2 = {
9386
9387
  author_fullname: 'Dashboard2 Author',
@@ -9392,7 +9393,7 @@ const dashboard2 = {
9392
9393
  dashboard_url: 'https://test.com',
9393
9394
  server_url: 'https://test.com',
9394
9395
  external_embedding_id: null,
9395
- created_dt: '2023-11-22T05:42:07.872000',
9396
+ created_dt: '2023-11-22T05:42:07.872000+00:00',
9396
9397
  id: 'id2',
9397
9398
  lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9398
9399
  application_instances: [],
@@ -9404,7 +9405,8 @@ const dashboard2 = {
9404
9405
  embed_config: {},
9405
9406
  help_content_id: helpContent.id,
9406
9407
  filter_configuration: [],
9407
- favorite: true
9408
+ favorite: true,
9409
+ updated_dt: '2023-11-22T05:42:07.951000+00:00'
9408
9410
  };
9409
9411
  const dashboard3 = {
9410
9412
  author_fullname: 'Dashboard3 Author',
@@ -9416,7 +9418,7 @@ const dashboard3 = {
9416
9418
  dashboard_url: 'https://test.com',
9417
9419
  server_url: 'https://test.com',
9418
9420
  external_embedding_id: null,
9419
- created_dt: '2023-11-21T04:42:07.872000',
9421
+ created_dt: '2023-11-21T04:42:07.872000+00:00',
9420
9422
  id: 'id3',
9421
9423
  lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
9422
9424
  application_instances: [],
@@ -9428,15 +9430,67 @@ const dashboard3 = {
9428
9430
  embed_config: {},
9429
9431
  help_content_id: helpContent.id,
9430
9432
  filter_configuration: [],
9431
- favorite: false
9433
+ favorite: false,
9434
+ updated_dt: '2023-11-21T04:42:07.951000+00:00'
9432
9435
  };
9436
+ const dashboard4 = {
9437
+ author_fullname: 'Dashboard4 Author',
9438
+ author_id: 'id4a',
9439
+ target_apps: ['DEPLOY'],
9440
+ external_id: '4',
9441
+ name: 'dashboard4',
9442
+ description: '',
9443
+ dashboard_url: 'https://test.com',
9444
+ server_url: 'https://test.com',
9445
+ external_embedding_id: null,
9446
+ created_dt: '2023-11-21T04:42:07.872000+00:00',
9447
+ id: 'id4',
9448
+ lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9449
+ application_instances: [],
9450
+ categories: [],
9451
+ bi_type: DashboardView.bi_type.MICROSTRATEGY,
9452
+ is_ootb_dashboard: true,
9453
+ thumbnail: '',
9454
+ external_object: {},
9455
+ embed_config: {},
9456
+ help_content_id: helpContent.id,
9457
+ filter_configuration: [],
9458
+ favorite: false,
9459
+ updated_dt: '2023-11-21T04:42:07.951000+00:00'
9460
+ };
9461
+ ({
9462
+ author_fullname: 'Dashboard5 Author',
9463
+ author_id: 'id5a',
9464
+ target_apps: ['CHANGERISKPREDICTION'],
9465
+ external_id: '5',
9466
+ name: 'dashboard5',
9467
+ description: '',
9468
+ dashboard_url: 'https://test.com',
9469
+ server_url: 'https://test.com',
9470
+ external_embedding_id: null,
9471
+ created_dt: '2023-11-21T04:42:07.872000+00:00',
9472
+ id: 'id5',
9473
+ lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9474
+ application_instances: [],
9475
+ categories: [],
9476
+ bi_type: DashboardView.bi_type.MICROSTRATEGY,
9477
+ is_ootb_dashboard: true,
9478
+ thumbnail: '',
9479
+ external_object: {},
9480
+ embed_config: {},
9481
+ help_content_id: helpContent.id,
9482
+ filter_configuration: [],
9483
+ favorite: false,
9484
+ updated_dt: '2023-11-21T04:42:07.951000+00:00'
9485
+ });
9433
9486
  const getCategoriesMock = {
9434
9487
  categories: {
9435
9488
  AGILITY: ['Scrum Master', 'DevOps Manager', 'Release Train Engineer', 'Agility Analytics'],
9436
9489
  CONTINUOUSTEST: ['User', 'Project Admin', 'Cloud Admin'],
9437
9490
  DEPLOY: [],
9438
9491
  RELEASE: ['DevOps COE', 'Engineering Manager', 'Release Manager', 'Platform Engineer', 'Platform Product Manager'],
9439
- TEAMFORGE: ['Scrum Master']
9492
+ TEAMFORGE: ['Scrum Master'],
9493
+ CHANGERISKPREDICTION: []
9440
9494
  }
9441
9495
  };
9442
9496
  const getAuthorsMock = [{
@@ -9448,6 +9502,9 @@ const getAuthorsMock = [{
9448
9502
  }, {
9449
9503
  id: dashboard3.author_id,
9450
9504
  full_name: dashboard3.author_fullname
9505
+ }, {
9506
+ id: dashboard4.author_id,
9507
+ full_name: dashboard4.author_fullname
9451
9508
  }];
9452
9509
  const accountId = 'acct1';
9453
9510
  const applicationId = 'app1';
@@ -10499,6 +10556,9 @@ const DashboardAppTypeOptions = [
10499
10556
  }, {
10500
10557
  option: 'TeamForge',
10501
10558
  value: 'TEAMFORGE'
10559
+ }, {
10560
+ option: 'Change Risk Prediction',
10561
+ value: 'CHANGERISKPREDICTION'
10502
10562
  }];
10503
10563
  const initialFormState = {
10504
10564
  categories: [],
@@ -10636,6 +10696,12 @@ function DotDashboardDialog({
10636
10696
  validateName(newName);
10637
10697
  }
10638
10698
  }, [validateName]);
10699
+ const validateRequiredFields = () => {
10700
+ if (!formValues.name) {
10701
+ return false;
10702
+ }
10703
+ return true;
10704
+ };
10639
10705
  return jsxs(StyledDashboardDialog, {
10640
10706
  cancelButtonProps: {
10641
10707
  'data-testid': 'cancel-create-dashboard-button'
@@ -10717,13 +10783,13 @@ function DotDashboardDialog({
10717
10783
  children: "Cancel"
10718
10784
  }), jsx(DotButton, {
10719
10785
  "data-testid": "save-edit-exit-dashboard-button",
10720
- disabled: isLoadingSubmit || !isDirty,
10786
+ disabled: isLoadingSubmit || !isDirty || !validateRequiredFields(),
10721
10787
  onClick: handleSubmitEditExit,
10722
10788
  type: "outlined",
10723
10789
  children: "Save and exit"
10724
10790
  }), jsx(DotButton, {
10725
10791
  "data-testid": "save-edit-continue-dashboard-button",
10726
- disabled: isLoadingSubmit,
10792
+ disabled: isLoadingSubmit || !validateRequiredFields(),
10727
10793
  onClick: handleSubmitEditContinue,
10728
10794
  type: "primary",
10729
10795
  children: isDirty ? 'Save and continue' : 'Continue'
@@ -10795,7 +10861,8 @@ function ActivePublishMessage({
10795
10861
  initialCategories,
10796
10862
  published,
10797
10863
  publishing,
10798
- onChange
10864
+ onChange,
10865
+ requiresApplication
10799
10866
  }) {
10800
10867
  const [selectedApp, setSelectedApp] = useState(applicationList.length > 0 ? applicationList[0] : null);
10801
10868
  const [selectedCategories, setSelectedCategories] = useState([]);
@@ -10845,9 +10912,7 @@ function ActivePublishMessage({
10845
10912
  useEffect(() => {
10846
10913
  const selectedAppCategories = selectedCategories.map(c => c.title);
10847
10914
  onChange(selectedApp, selectedAppCategories);
10848
- // selectedApp is excluded from dependency list on purpose
10849
- // since selectedCategories is always updated when selectedApp changes
10850
- }, [selectedCategories]);
10915
+ }, [selectedApp, selectedCategories]);
10851
10916
  const handleApplicationSelect = useCallback((_event, value, _reason) => {
10852
10917
  if (value === null) {
10853
10918
  setSelectedApp(null);
@@ -10877,12 +10942,16 @@ function ActivePublishMessage({
10877
10942
  children: ["Success! ", jsx("strong", {
10878
10943
  children: dashboardName
10879
10944
  }), " has been published."]
10880
- }), jsxs(DotTypography, {
10945
+ }), selectedApp ? jsxs(DotTypography, {
10881
10946
  children: ["To view your newly published dashboard in", ' ', jsxs("strong", {
10882
10947
  children: ["\"", selectedApp.name, "\""]
10883
10948
  }), ", go to the", ' ', jsx("strong", {
10884
10949
  children: "'Digital.ai Analytics'"
10885
10950
  }), " section and explore."]
10951
+ }) : jsxs(DotTypography, {
10952
+ children: ["To view your newly published dashboard, go to the", ' ', jsx("strong", {
10953
+ children: "'Digital.ai Analytics'"
10954
+ }), " section and explore."]
10886
10955
  })]
10887
10956
  });
10888
10957
  }
@@ -10892,12 +10961,16 @@ function ActivePublishMessage({
10892
10961
  ariaLabel: "Publishing",
10893
10962
  "data-testid": "publishing-spinner",
10894
10963
  size: "24px"
10895
- }), jsxs(InlineMessage, {
10964
+ }), selectedApp ? jsxs(InlineMessage, {
10896
10965
  children: ["Publishing ", jsxs("strong", {
10897
10966
  children: ["\"", dashboardName, "\""]
10898
10967
  }), " to", ' ', jsxs("strong", {
10899
10968
  children: ["\"", selectedApp.name, "\""]
10900
10969
  }), "."]
10970
+ }) : jsxs(InlineMessage, {
10971
+ children: ["Publishing ", jsxs("strong", {
10972
+ children: ["\"", dashboardName, "\""]
10973
+ }), "."]
10901
10974
  })]
10902
10975
  });
10903
10976
  }
@@ -10907,8 +10980,8 @@ function ActivePublishMessage({
10907
10980
  severity: "info",
10908
10981
  children: ["By clicking publish to application,", ' ', jsxs("strong", {
10909
10982
  children: ["\"", dashboardName, "\""]
10910
- }), " will be visible in the application instance."]
10911
- }), jsxs(StyledAppSelectDiv, {
10983
+ }), " will be visible", ' ', requiresApplication ? 'in the application instance.' : 'to dashboard viewers.']
10984
+ }), requiresApplication && jsxs(StyledAppSelectDiv, {
10912
10985
  children: [jsx(StyledAppSelectDotAutoComplete, {
10913
10986
  "data-testid": "publish-app-select",
10914
10987
  defaultValue: applicationList.length > 0 ? applicationList[0].name : undefined,
@@ -10955,7 +11028,7 @@ function ActivePublishMessage({
10955
11028
  placeholder: "Select categories",
10956
11029
  value: selectedCategories,
10957
11030
  filterSelectedOptions: true
10958
- }), jsxs(DotTypography, {
11031
+ }), requiresApplication && jsxs(DotTypography, {
10959
11032
  children: ["You are about to publish ", jsxs("strong", {
10960
11033
  children: ["\"", dashboardName, "\""]
10961
11034
  }), ". Click", ' ', "the publish button to promote it to the selected instance."]
@@ -11022,6 +11095,8 @@ function DotDashboardPublishConfirm({
11022
11095
  const [unpublished, setUnpublished] = useState(false);
11023
11096
  const [publishAppInstance, setPublishAppInstance] = useState(null);
11024
11097
  const [publishCategories, setPublishCategories] = useState([]);
11098
+ const [requiresApplication, setRequiresApplication] = useState(true);
11099
+ const [requiresCategories, setRequiresCategories] = useState(true);
11025
11100
  const filteredApplications = applicationList === null || applicationList === void 0 ? void 0 : applicationList.filter(application => {
11026
11101
  return dashboardToPublish && application.logo_product_name in productNameCategoryMap && dashboardToPublish.target_apps.includes(productNameCategoryMap[application.logo_product_name]);
11027
11102
  });
@@ -11042,6 +11117,8 @@ function DotDashboardPublishConfirm({
11042
11117
  setPublished(false);
11043
11118
  } else {
11044
11119
  setPublishCategories(dashboardToPublish.categories || []);
11120
+ setRequiresApplication(!(dashboardToPublish.target_apps.includes('CHANGERISKPREDICTION') && dashboardToPublish.target_apps.length === 1));
11121
+ setRequiresCategories(dashboardToPublish.target_apps.includes('AGILITY') || dashboardToPublish.target_apps.includes('RELEASE') || dashboardToPublish.target_apps.includes('CONTINUOUSTEST') || dashboardToPublish.target_apps.includes('TEAMFORGE'));
11045
11122
  }
11046
11123
  }, [dashboardToPublish]);
11047
11124
  useEffect(() => {
@@ -11053,7 +11130,7 @@ function DotDashboardPublishConfirm({
11053
11130
  const handlePublish = useCallback(() => {
11054
11131
  const patchDashboard = {
11055
11132
  lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
11056
- application_instances: [publishAppInstance.id],
11133
+ application_instances: publishAppInstance ? [publishAppInstance.id] : [],
11057
11134
  categories: publishCategories
11058
11135
  };
11059
11136
  setPublishing(cancelablePromise(updateDashboard(dashboardToPublish.id, patchDashboard).then(updatedDashboard => {
@@ -11091,7 +11168,12 @@ function DotDashboardPublishConfirm({
11091
11168
  setPublishAppInstance(selectedApplication);
11092
11169
  setPublishCategories(selectedCategories);
11093
11170
  }, []);
11094
- const canSubmit = publishAppInstance && !((publishAppInstance === null || publishAppInstance === void 0 ? void 0 : publishAppInstance.logo_product_name) && publishAppInstance.logo_product_name in productNameCategoryMap && publishCategories.length === 0);
11171
+ const canSubmit = useCallback(() => {
11172
+ if (requiresApplication && publishAppInstance === null) {
11173
+ return false;
11174
+ }
11175
+ return !(requiresCategories && publishCategories.length === 0);
11176
+ }, [publishAppInstance, publishCategories, requiresApplication, requiresCategories]);
11095
11177
  return jsxs(Fragment, {
11096
11178
  children: [dashboardToPublish !== null && jsx(DotDialog, {
11097
11179
  cancelButtonVisible: !published,
@@ -11101,7 +11183,7 @@ function DotDashboardPublishConfirm({
11101
11183
  title: "Publish to application",
11102
11184
  submitButtonProps: {
11103
11185
  'data-testid': 'publish-confirm-button',
11104
- disabled: !canSubmit,
11186
+ disabled: !canSubmit(),
11105
11187
  label: published ? 'Got it' : 'Publish'
11106
11188
  },
11107
11189
  onCancel: handleCancelPublish,
@@ -11112,7 +11194,8 @@ function DotDashboardPublishConfirm({
11112
11194
  initialCategories: publishCategories,
11113
11195
  published: published,
11114
11196
  publishing: publishing !== null,
11115
- onChange: handlePublishChange
11197
+ onChange: handlePublishChange,
11198
+ requiresApplication: requiresApplication
11116
11199
  })
11117
11200
  }), dashboardToUnpublish !== null && jsx(DotDialog, {
11118
11201
  cancelButtonVisible: !unpublished,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "3.14.0",
3
+ "version": "3.15.2",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -6,7 +6,7 @@ export type DashboardCreateBody = {
6
6
  /**
7
7
  * App types that can be targeted by the dashboard.
8
8
  */
9
- target_apps: Array<'AGILITY' | 'RELEASE' | 'DEPLOY' | 'CONTINUOUSTEST' | 'TEAMFORGE'>;
9
+ target_apps: Array<'AGILITY' | 'RELEASE' | 'DEPLOY' | 'CONTINUOUSTEST' | 'TEAMFORGE' | 'CHANGERISKPREDICTION'>;
10
10
  /**
11
11
  * Description of the dashboard.
12
12
  */
@@ -22,7 +22,7 @@ export type DashboardPatchBody = {
22
22
  /**
23
23
  * App types that can be targeted by the dashboard.
24
24
  */
25
- target_apps?: Array<'AGILITY' | 'RELEASE' | 'DEPLOY' | 'CONTINUOUSTEST' | 'TEAMFORGE'> | null;
25
+ target_apps?: Array<'AGILITY' | 'RELEASE' | 'DEPLOY' | 'CONTINUOUSTEST' | 'TEAMFORGE' | 'CHANGERISKPREDICTION'> | null;
26
26
  /**
27
27
  * (Internal) BI type of the dashboard.
28
28
  */
@@ -18,7 +18,7 @@ export type DashboardView = {
18
18
  /**
19
19
  * App types that can be targeted by the dashboard.
20
20
  */
21
- target_apps: Array<'AGILITY' | 'RELEASE' | 'DEPLOY' | 'CONTINUOUSTEST' | 'TEAMFORGE'>;
21
+ target_apps: Array<'AGILITY' | 'RELEASE' | 'DEPLOY' | 'CONTINUOUSTEST' | 'TEAMFORGE' | 'CHANGERISKPREDICTION'>;
22
22
  /**
23
23
  * Description of the dashboard.
24
24
  */