@digital-ai/dot-components 3.14.0 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -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: [],
@@ -10795,7 +10855,8 @@ function ActivePublishMessage({
10795
10855
  initialCategories,
10796
10856
  published,
10797
10857
  publishing,
10798
- onChange
10858
+ onChange,
10859
+ requiresApplication
10799
10860
  }) {
10800
10861
  const [selectedApp, setSelectedApp] = useState(applicationList.length > 0 ? applicationList[0] : null);
10801
10862
  const [selectedCategories, setSelectedCategories] = useState([]);
@@ -10845,9 +10906,7 @@ function ActivePublishMessage({
10845
10906
  useEffect(() => {
10846
10907
  const selectedAppCategories = selectedCategories.map(c => c.title);
10847
10908
  onChange(selectedApp, selectedAppCategories);
10848
- // selectedApp is excluded from dependency list on purpose
10849
- // since selectedCategories is always updated when selectedApp changes
10850
- }, [selectedCategories]);
10909
+ }, [selectedApp, selectedCategories]);
10851
10910
  const handleApplicationSelect = useCallback((_event, value, _reason) => {
10852
10911
  if (value === null) {
10853
10912
  setSelectedApp(null);
@@ -10877,12 +10936,16 @@ function ActivePublishMessage({
10877
10936
  children: ["Success! ", jsx("strong", {
10878
10937
  children: dashboardName
10879
10938
  }), " has been published."]
10880
- }), jsxs(DotTypography, {
10939
+ }), selectedApp ? jsxs(DotTypography, {
10881
10940
  children: ["To view your newly published dashboard in", ' ', jsxs("strong", {
10882
10941
  children: ["\"", selectedApp.name, "\""]
10883
10942
  }), ", go to the", ' ', jsx("strong", {
10884
10943
  children: "'Digital.ai Analytics'"
10885
10944
  }), " section and explore."]
10945
+ }) : jsxs(DotTypography, {
10946
+ children: ["To view your newly published dashboard, go to the", ' ', jsx("strong", {
10947
+ children: "'Digital.ai Analytics'"
10948
+ }), " section and explore."]
10886
10949
  })]
10887
10950
  });
10888
10951
  }
@@ -10892,12 +10955,16 @@ function ActivePublishMessage({
10892
10955
  ariaLabel: "Publishing",
10893
10956
  "data-testid": "publishing-spinner",
10894
10957
  size: "24px"
10895
- }), jsxs(InlineMessage, {
10958
+ }), selectedApp ? jsxs(InlineMessage, {
10896
10959
  children: ["Publishing ", jsxs("strong", {
10897
10960
  children: ["\"", dashboardName, "\""]
10898
10961
  }), " to", ' ', jsxs("strong", {
10899
10962
  children: ["\"", selectedApp.name, "\""]
10900
10963
  }), "."]
10964
+ }) : jsxs(InlineMessage, {
10965
+ children: ["Publishing ", jsxs("strong", {
10966
+ children: ["\"", dashboardName, "\""]
10967
+ }), "."]
10901
10968
  })]
10902
10969
  });
10903
10970
  }
@@ -10907,8 +10974,8 @@ function ActivePublishMessage({
10907
10974
  severity: "info",
10908
10975
  children: ["By clicking publish to application,", ' ', jsxs("strong", {
10909
10976
  children: ["\"", dashboardName, "\""]
10910
- }), " will be visible in the application instance."]
10911
- }), jsxs(StyledAppSelectDiv, {
10977
+ }), " will be visible", ' ', requiresApplication ? 'in the application instance.' : 'to dashboard viewers.']
10978
+ }), requiresApplication && jsxs(StyledAppSelectDiv, {
10912
10979
  children: [jsx(StyledAppSelectDotAutoComplete, {
10913
10980
  "data-testid": "publish-app-select",
10914
10981
  defaultValue: applicationList.length > 0 ? applicationList[0].name : undefined,
@@ -10955,7 +11022,7 @@ function ActivePublishMessage({
10955
11022
  placeholder: "Select categories",
10956
11023
  value: selectedCategories,
10957
11024
  filterSelectedOptions: true
10958
- }), jsxs(DotTypography, {
11025
+ }), requiresApplication && jsxs(DotTypography, {
10959
11026
  children: ["You are about to publish ", jsxs("strong", {
10960
11027
  children: ["\"", dashboardName, "\""]
10961
11028
  }), ". Click", ' ', "the publish button to promote it to the selected instance."]
@@ -11022,6 +11089,8 @@ function DotDashboardPublishConfirm({
11022
11089
  const [unpublished, setUnpublished] = useState(false);
11023
11090
  const [publishAppInstance, setPublishAppInstance] = useState(null);
11024
11091
  const [publishCategories, setPublishCategories] = useState([]);
11092
+ const [requiresApplication, setRequiresApplication] = useState(true);
11093
+ const [requiresCategories, setRequiresCategories] = useState(true);
11025
11094
  const filteredApplications = applicationList === null || applicationList === void 0 ? void 0 : applicationList.filter(application => {
11026
11095
  return dashboardToPublish && application.logo_product_name in productNameCategoryMap && dashboardToPublish.target_apps.includes(productNameCategoryMap[application.logo_product_name]);
11027
11096
  });
@@ -11042,6 +11111,8 @@ function DotDashboardPublishConfirm({
11042
11111
  setPublished(false);
11043
11112
  } else {
11044
11113
  setPublishCategories(dashboardToPublish.categories || []);
11114
+ setRequiresApplication(!(dashboardToPublish.target_apps.includes('CHANGERISKPREDICTION') && dashboardToPublish.target_apps.length === 1));
11115
+ setRequiresCategories(dashboardToPublish.target_apps.includes('AGILITY') || dashboardToPublish.target_apps.includes('RELEASE') || dashboardToPublish.target_apps.includes('CONTINUOUSTEST') || dashboardToPublish.target_apps.includes('TEAMFORGE'));
11045
11116
  }
11046
11117
  }, [dashboardToPublish]);
11047
11118
  useEffect(() => {
@@ -11053,7 +11124,7 @@ function DotDashboardPublishConfirm({
11053
11124
  const handlePublish = useCallback(() => {
11054
11125
  const patchDashboard = {
11055
11126
  lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
11056
- application_instances: [publishAppInstance.id],
11127
+ application_instances: publishAppInstance ? [publishAppInstance.id] : [],
11057
11128
  categories: publishCategories
11058
11129
  };
11059
11130
  setPublishing(cancelablePromise(updateDashboard(dashboardToPublish.id, patchDashboard).then(updatedDashboard => {
@@ -11091,7 +11162,12 @@ function DotDashboardPublishConfirm({
11091
11162
  setPublishAppInstance(selectedApplication);
11092
11163
  setPublishCategories(selectedCategories);
11093
11164
  }, []);
11094
- const canSubmit = publishAppInstance && !((publishAppInstance === null || publishAppInstance === void 0 ? void 0 : publishAppInstance.logo_product_name) && publishAppInstance.logo_product_name in productNameCategoryMap && publishCategories.length === 0);
11165
+ const canSubmit = useCallback(() => {
11166
+ if (requiresApplication && publishAppInstance === null) {
11167
+ return false;
11168
+ }
11169
+ return !(requiresCategories && publishCategories.length === 0);
11170
+ }, [publishAppInstance, publishCategories, requiresApplication, requiresCategories]);
11095
11171
  return jsxs(Fragment, {
11096
11172
  children: [dashboardToPublish !== null && jsx(DotDialog, {
11097
11173
  cancelButtonVisible: !published,
@@ -11101,7 +11177,7 @@ function DotDashboardPublishConfirm({
11101
11177
  title: "Publish to application",
11102
11178
  submitButtonProps: {
11103
11179
  'data-testid': 'publish-confirm-button',
11104
- disabled: !canSubmit,
11180
+ disabled: !canSubmit(),
11105
11181
  label: published ? 'Got it' : 'Publish'
11106
11182
  },
11107
11183
  onCancel: handleCancelPublish,
@@ -11112,7 +11188,8 @@ function DotDashboardPublishConfirm({
11112
11188
  initialCategories: publishCategories,
11113
11189
  published: published,
11114
11190
  publishing: publishing !== null,
11115
- onChange: handlePublishChange
11191
+ onChange: handlePublishChange,
11192
+ requiresApplication: requiresApplication
11116
11193
  })
11117
11194
  }), dashboardToUnpublish !== null && jsx(DotDialog, {
11118
11195
  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.0",
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
  */