@digital-ai/dot-components 3.13.3 → 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
@@ -2738,7 +2738,8 @@ const DotLink = ({
2738
2738
  tabIndex = 0,
2739
2739
  target,
2740
2740
  tooltip,
2741
- underline = 'always'
2741
+ underline = 'always',
2742
+ variant = 'body1'
2742
2743
  }) => {
2743
2744
  const rootClasses = useStylesWithRootClass(rootClassName$1c, className);
2744
2745
  useEffect(() => {
@@ -2777,6 +2778,7 @@ const DotLink = ({
2777
2778
  tabIndex: tabIndex,
2778
2779
  target: target,
2779
2780
  underline: underline,
2781
+ variant: variant,
2780
2782
  children: children
2781
2783
  })
2782
2784
  });
@@ -2840,13 +2842,23 @@ const StyledList = styled(List)`
2840
2842
  `;
2841
2843
 
2842
2844
  const getChevronIcon = (nestedListType, isOpened) => {
2843
- if (nestedListType !== 'expandable') {
2844
- return 'chevron-right';
2845
- }
2846
- if (isOpened) {
2847
- return 'chevron-up';
2845
+ switch (nestedListType) {
2846
+ case 'drawer':
2847
+ {
2848
+ return 'chevron-right';
2849
+ }
2850
+ case 'expandable':
2851
+ {
2852
+ if (isOpened) {
2853
+ return 'chevron-up';
2854
+ }
2855
+ return 'chevron-down';
2856
+ }
2857
+ case 'menu':
2858
+ {
2859
+ return 'arrow-right';
2860
+ }
2848
2861
  }
2849
- return 'chevron-down';
2850
2862
  };
2851
2863
  // Used in DotSidebar, DotList, DotListItem to determine
2852
2864
  // if the sidebar should be open or closed based on what target the user clicks
@@ -3860,7 +3872,8 @@ const styledListItemElement = elementType => {
3860
3872
  }
3861
3873
 
3862
3874
  &.${flyoutListItemClassName} {
3863
- padding: 0;
3875
+ padding: ${theme.spacing(1)};
3876
+ text-decoration: none;
3864
3877
  }
3865
3878
 
3866
3879
  &:hover {
@@ -3888,7 +3901,7 @@ const styledListItemElement = elementType => {
3888
3901
  }
3889
3902
 
3890
3903
  .${flyoutItemLinkClassName} .MuiIcon-root {
3891
- margin-right: ${theme.spacing(4)};
3904
+ margin-right: ${theme.spacing(1)};
3892
3905
  }
3893
3906
 
3894
3907
  .dot-icon i:before {
@@ -9353,7 +9366,7 @@ const dashboard1 = {
9353
9366
  dashboard_url: 'https://test.com',
9354
9367
  server_url: 'https://test.com',
9355
9368
  external_embedding_id: null,
9356
- created_dt: '2023-11-22T06:42:07.872000',
9369
+ created_dt: '2023-11-22T06:42:07.872000+00:00',
9357
9370
  id: 'id1',
9358
9371
  lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9359
9372
  application_instances: [],
@@ -9367,7 +9380,8 @@ const dashboard1 = {
9367
9380
  embed_config: {},
9368
9381
  help_content_id: helpContent.id,
9369
9382
  filter_configuration: [],
9370
- favorite: false
9383
+ favorite: false,
9384
+ updated_dt: '2023-11-22T06:42:07.952000+00:00'
9371
9385
  };
9372
9386
  const dashboard2 = {
9373
9387
  author_fullname: 'Dashboard2 Author',
@@ -9379,7 +9393,7 @@ const dashboard2 = {
9379
9393
  dashboard_url: 'https://test.com',
9380
9394
  server_url: 'https://test.com',
9381
9395
  external_embedding_id: null,
9382
- created_dt: '2023-11-22T05:42:07.872000',
9396
+ created_dt: '2023-11-22T05:42:07.872000+00:00',
9383
9397
  id: 'id2',
9384
9398
  lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9385
9399
  application_instances: [],
@@ -9391,7 +9405,8 @@ const dashboard2 = {
9391
9405
  embed_config: {},
9392
9406
  help_content_id: helpContent.id,
9393
9407
  filter_configuration: [],
9394
- favorite: true
9408
+ favorite: true,
9409
+ updated_dt: '2023-11-22T05:42:07.951000+00:00'
9395
9410
  };
9396
9411
  const dashboard3 = {
9397
9412
  author_fullname: 'Dashboard3 Author',
@@ -9403,7 +9418,7 @@ const dashboard3 = {
9403
9418
  dashboard_url: 'https://test.com',
9404
9419
  server_url: 'https://test.com',
9405
9420
  external_embedding_id: null,
9406
- created_dt: '2023-11-21T04:42:07.872000',
9421
+ created_dt: '2023-11-21T04:42:07.872000+00:00',
9407
9422
  id: 'id3',
9408
9423
  lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
9409
9424
  application_instances: [],
@@ -9415,15 +9430,67 @@ const dashboard3 = {
9415
9430
  embed_config: {},
9416
9431
  help_content_id: helpContent.id,
9417
9432
  filter_configuration: [],
9418
- favorite: false
9433
+ favorite: false,
9434
+ updated_dt: '2023-11-21T04:42:07.951000+00:00'
9419
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
+ });
9420
9486
  const getCategoriesMock = {
9421
9487
  categories: {
9422
9488
  AGILITY: ['Scrum Master', 'DevOps Manager', 'Release Train Engineer', 'Agility Analytics'],
9423
9489
  CONTINUOUSTEST: ['User', 'Project Admin', 'Cloud Admin'],
9424
9490
  DEPLOY: [],
9425
9491
  RELEASE: ['DevOps COE', 'Engineering Manager', 'Release Manager', 'Platform Engineer', 'Platform Product Manager'],
9426
- TEAMFORGE: ['Scrum Master']
9492
+ TEAMFORGE: ['Scrum Master'],
9493
+ CHANGERISKPREDICTION: []
9427
9494
  }
9428
9495
  };
9429
9496
  const getAuthorsMock = [{
@@ -9435,6 +9502,9 @@ const getAuthorsMock = [{
9435
9502
  }, {
9436
9503
  id: dashboard3.author_id,
9437
9504
  full_name: dashboard3.author_fullname
9505
+ }, {
9506
+ id: dashboard4.author_id,
9507
+ full_name: dashboard4.author_fullname
9438
9508
  }];
9439
9509
  const accountId = 'acct1';
9440
9510
  const applicationId = 'app1';
@@ -10486,6 +10556,9 @@ const DashboardAppTypeOptions = [
10486
10556
  }, {
10487
10557
  option: 'TeamForge',
10488
10558
  value: 'TEAMFORGE'
10559
+ }, {
10560
+ option: 'Change Risk Prediction',
10561
+ value: 'CHANGERISKPREDICTION'
10489
10562
  }];
10490
10563
  const initialFormState = {
10491
10564
  categories: [],
@@ -10782,7 +10855,8 @@ function ActivePublishMessage({
10782
10855
  initialCategories,
10783
10856
  published,
10784
10857
  publishing,
10785
- onChange
10858
+ onChange,
10859
+ requiresApplication
10786
10860
  }) {
10787
10861
  const [selectedApp, setSelectedApp] = useState(applicationList.length > 0 ? applicationList[0] : null);
10788
10862
  const [selectedCategories, setSelectedCategories] = useState([]);
@@ -10832,9 +10906,7 @@ function ActivePublishMessage({
10832
10906
  useEffect(() => {
10833
10907
  const selectedAppCategories = selectedCategories.map(c => c.title);
10834
10908
  onChange(selectedApp, selectedAppCategories);
10835
- // selectedApp is excluded from dependency list on purpose
10836
- // since selectedCategories is always updated when selectedApp changes
10837
- }, [selectedCategories]);
10909
+ }, [selectedApp, selectedCategories]);
10838
10910
  const handleApplicationSelect = useCallback((_event, value, _reason) => {
10839
10911
  if (value === null) {
10840
10912
  setSelectedApp(null);
@@ -10864,12 +10936,16 @@ function ActivePublishMessage({
10864
10936
  children: ["Success! ", jsx("strong", {
10865
10937
  children: dashboardName
10866
10938
  }), " has been published."]
10867
- }), jsxs(DotTypography, {
10939
+ }), selectedApp ? jsxs(DotTypography, {
10868
10940
  children: ["To view your newly published dashboard in", ' ', jsxs("strong", {
10869
10941
  children: ["\"", selectedApp.name, "\""]
10870
10942
  }), ", go to the", ' ', jsx("strong", {
10871
10943
  children: "'Digital.ai Analytics'"
10872
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."]
10873
10949
  })]
10874
10950
  });
10875
10951
  }
@@ -10879,12 +10955,16 @@ function ActivePublishMessage({
10879
10955
  ariaLabel: "Publishing",
10880
10956
  "data-testid": "publishing-spinner",
10881
10957
  size: "24px"
10882
- }), jsxs(InlineMessage, {
10958
+ }), selectedApp ? jsxs(InlineMessage, {
10883
10959
  children: ["Publishing ", jsxs("strong", {
10884
10960
  children: ["\"", dashboardName, "\""]
10885
10961
  }), " to", ' ', jsxs("strong", {
10886
10962
  children: ["\"", selectedApp.name, "\""]
10887
10963
  }), "."]
10964
+ }) : jsxs(InlineMessage, {
10965
+ children: ["Publishing ", jsxs("strong", {
10966
+ children: ["\"", dashboardName, "\""]
10967
+ }), "."]
10888
10968
  })]
10889
10969
  });
10890
10970
  }
@@ -10894,8 +10974,8 @@ function ActivePublishMessage({
10894
10974
  severity: "info",
10895
10975
  children: ["By clicking publish to application,", ' ', jsxs("strong", {
10896
10976
  children: ["\"", dashboardName, "\""]
10897
- }), " will be visible in the application instance."]
10898
- }), jsxs(StyledAppSelectDiv, {
10977
+ }), " will be visible", ' ', requiresApplication ? 'in the application instance.' : 'to dashboard viewers.']
10978
+ }), requiresApplication && jsxs(StyledAppSelectDiv, {
10899
10979
  children: [jsx(StyledAppSelectDotAutoComplete, {
10900
10980
  "data-testid": "publish-app-select",
10901
10981
  defaultValue: applicationList.length > 0 ? applicationList[0].name : undefined,
@@ -10942,7 +11022,7 @@ function ActivePublishMessage({
10942
11022
  placeholder: "Select categories",
10943
11023
  value: selectedCategories,
10944
11024
  filterSelectedOptions: true
10945
- }), jsxs(DotTypography, {
11025
+ }), requiresApplication && jsxs(DotTypography, {
10946
11026
  children: ["You are about to publish ", jsxs("strong", {
10947
11027
  children: ["\"", dashboardName, "\""]
10948
11028
  }), ". Click", ' ', "the publish button to promote it to the selected instance."]
@@ -11009,6 +11089,8 @@ function DotDashboardPublishConfirm({
11009
11089
  const [unpublished, setUnpublished] = useState(false);
11010
11090
  const [publishAppInstance, setPublishAppInstance] = useState(null);
11011
11091
  const [publishCategories, setPublishCategories] = useState([]);
11092
+ const [requiresApplication, setRequiresApplication] = useState(true);
11093
+ const [requiresCategories, setRequiresCategories] = useState(true);
11012
11094
  const filteredApplications = applicationList === null || applicationList === void 0 ? void 0 : applicationList.filter(application => {
11013
11095
  return dashboardToPublish && application.logo_product_name in productNameCategoryMap && dashboardToPublish.target_apps.includes(productNameCategoryMap[application.logo_product_name]);
11014
11096
  });
@@ -11029,6 +11111,8 @@ function DotDashboardPublishConfirm({
11029
11111
  setPublished(false);
11030
11112
  } else {
11031
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'));
11032
11116
  }
11033
11117
  }, [dashboardToPublish]);
11034
11118
  useEffect(() => {
@@ -11040,7 +11124,7 @@ function DotDashboardPublishConfirm({
11040
11124
  const handlePublish = useCallback(() => {
11041
11125
  const patchDashboard = {
11042
11126
  lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
11043
- application_instances: [publishAppInstance.id],
11127
+ application_instances: publishAppInstance ? [publishAppInstance.id] : [],
11044
11128
  categories: publishCategories
11045
11129
  };
11046
11130
  setPublishing(cancelablePromise(updateDashboard(dashboardToPublish.id, patchDashboard).then(updatedDashboard => {
@@ -11078,7 +11162,12 @@ function DotDashboardPublishConfirm({
11078
11162
  setPublishAppInstance(selectedApplication);
11079
11163
  setPublishCategories(selectedCategories);
11080
11164
  }, []);
11081
- 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]);
11082
11171
  return jsxs(Fragment, {
11083
11172
  children: [dashboardToPublish !== null && jsx(DotDialog, {
11084
11173
  cancelButtonVisible: !published,
@@ -11088,7 +11177,7 @@ function DotDashboardPublishConfirm({
11088
11177
  title: "Publish to application",
11089
11178
  submitButtonProps: {
11090
11179
  'data-testid': 'publish-confirm-button',
11091
- disabled: !canSubmit,
11180
+ disabled: !canSubmit(),
11092
11181
  label: published ? 'Got it' : 'Publish'
11093
11182
  },
11094
11183
  onCancel: handleCancelPublish,
@@ -11099,7 +11188,8 @@ function DotDashboardPublishConfirm({
11099
11188
  initialCategories: publishCategories,
11100
11189
  published: published,
11101
11190
  publishing: publishing !== null,
11102
- onChange: handlePublishChange
11191
+ onChange: handlePublishChange,
11192
+ requiresApplication: requiresApplication
11103
11193
  })
11104
11194
  }), dashboardToUnpublish !== null && jsx(DotDialog, {
11105
11195
  cancelButtonVisible: !unpublished,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "3.13.3",
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
  */
@@ -1,5 +1,6 @@
1
1
  import { KeyboardEvent, MouseEvent, PointerEvent, ReactNode } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
+ import { TypographyVariant } from '../typography/Typography';
3
4
  export type LinkColor = 'initial' | 'inherit' | 'primary' | 'secondary' | 'textPrimary' | 'textSecondary' | 'error';
4
5
  export type LinkUnderline = 'always' | 'hover' | 'none';
5
6
  export type LinkTarget = '_blank' | '_self';
@@ -26,5 +27,7 @@ export interface LinkProps extends CommonProps {
26
27
  tooltip?: string;
27
28
  /** underline the link */
28
29
  underline?: LinkUnderline;
30
+ /** Applies the theme typography styles. */
31
+ variant?: TypographyVariant;
29
32
  }
30
- export declare const DotLink: ({ ariaLabel, ariaRole, children, className, color, "data-pendoid": dataPendoId, "data-testid": dataTestId, href, onClick, onMouseEnter, onPointerDown, rel, tabIndex, target, tooltip, underline, }: LinkProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const DotLink: ({ ariaLabel, ariaRole, children, className, color, "data-pendoid": dataPendoId, "data-testid": dataTestId, href, onClick, onMouseEnter, onPointerDown, rel, tabIndex, target, tooltip, underline, variant, }: LinkProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import { NestedListType } from './models';
2
- export declare const getChevronIcon: (nestedListType: NestedListType, isOpened: boolean) => "chevron-right" | "chevron-up" | "chevron-down";
2
+ export declare const getChevronIcon: (nestedListType: NestedListType, isOpened: boolean) => "chevron-right" | "chevron-up" | "chevron-down" | "arrow-right";
3
3
  export declare const shouldToggleOpen: (classNames: string) => boolean;