@finos/legend-application-studio 28.19.25 → 28.19.26

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.
@@ -49,7 +49,6 @@ import {
49
49
  MenuContentItem,
50
50
  CaretDownIcon,
51
51
  WarningIcon,
52
- PanelFormSection,
53
52
  useDragPreviewLayer,
54
53
  DragPreviewLayer,
55
54
  PanelDnDEntry,
@@ -109,6 +108,7 @@ import {
109
108
  supportInfo_deleteEmail,
110
109
  accessPoint_setClassification,
111
110
  accessPoint_setReproducible,
111
+ supportInfo_setLinkLabel,
112
112
  } from '../../../../stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
113
113
  import { LEGEND_STUDIO_TEST_ID } from '../../../../__lib__/LegendStudioTesting.js';
114
114
  import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../__lib__/LegendStudioApplicationNavigationContext.js';
@@ -1413,8 +1413,12 @@ const HomeTab = observer(
1413
1413
  );
1414
1414
 
1415
1415
  const SupportTab = observer(
1416
- (props: { product: DataProduct; isReadOnly: boolean }) => {
1417
- const { product, isReadOnly } = props;
1416
+ (props: {
1417
+ dataProductEditorState: DataProductEditorState;
1418
+ isReadOnly: boolean;
1419
+ }) => {
1420
+ const { dataProductEditorState, isReadOnly } = props;
1421
+ const product = dataProductEditorState.product;
1418
1422
  const updateSupportInfoDocumentationUrl = (
1419
1423
  val: string | undefined,
1420
1424
  ): void => {
@@ -1422,6 +1426,16 @@ const SupportTab = observer(
1422
1426
  if (product.supportInfo) {
1423
1427
  supportInfo_setDocumentationUrl(product.supportInfo, val ?? '');
1424
1428
  }
1429
+ if (!val) {
1430
+ dataProductEditorState.clearSupportInfo();
1431
+ }
1432
+ };
1433
+ const updateSupportInfoDocumentationLabel = (
1434
+ val: string | undefined,
1435
+ ): void => {
1436
+ if (product.supportInfo?.documentation) {
1437
+ supportInfo_setLinkLabel(product.supportInfo.documentation, val);
1438
+ }
1425
1439
  };
1426
1440
 
1427
1441
  const updateSupportInfoWebsite = (val: string | undefined): void => {
@@ -1429,6 +1443,14 @@ const SupportTab = observer(
1429
1443
  if (product.supportInfo) {
1430
1444
  supportInfo_setWebsite(product.supportInfo, val ?? '');
1431
1445
  }
1446
+ if (!val) {
1447
+ dataProductEditorState.clearSupportInfo();
1448
+ }
1449
+ };
1450
+ const updateSupportInfoWebsiteLabel = (val: string | undefined): void => {
1451
+ if (product.supportInfo?.website) {
1452
+ supportInfo_setLinkLabel(product.supportInfo.website, val);
1453
+ }
1432
1454
  };
1433
1455
 
1434
1456
  const updateSupportInfoFaqUrl = (val: string | undefined): void => {
@@ -1436,6 +1458,14 @@ const SupportTab = observer(
1436
1458
  if (product.supportInfo) {
1437
1459
  supportInfo_setFaqUrl(product.supportInfo, val ?? '');
1438
1460
  }
1461
+ if (!val) {
1462
+ dataProductEditorState.clearSupportInfo();
1463
+ }
1464
+ };
1465
+ const updateSupportInfoFaqLabel = (val: string | undefined): void => {
1466
+ if (product.supportInfo?.faqUrl) {
1467
+ supportInfo_setLinkLabel(product.supportInfo.faqUrl, val);
1468
+ }
1439
1469
  };
1440
1470
 
1441
1471
  const updateSupportInfoSupportUrl = (val: string | undefined): void => {
@@ -1443,6 +1473,26 @@ const SupportTab = observer(
1443
1473
  if (product.supportInfo) {
1444
1474
  supportInfo_setSupportUrl(product.supportInfo, val ?? '');
1445
1475
  }
1476
+ if (!val) {
1477
+ dataProductEditorState.clearSupportInfo();
1478
+ }
1479
+ const supportLabelOptions = ['Keystone', 'Jira', 'ServiceNow'];
1480
+ supportLabelOptions.forEach((derivedLabel) => {
1481
+ if (
1482
+ val?.includes(derivedLabel.toLowerCase()) &&
1483
+ product.supportInfo?.supportUrl
1484
+ ) {
1485
+ supportInfo_setLinkLabel(
1486
+ product.supportInfo.supportUrl,
1487
+ derivedLabel,
1488
+ );
1489
+ }
1490
+ });
1491
+ };
1492
+ const updateSupportInfoSupportLabel = (val: string | undefined): void => {
1493
+ if (product.supportInfo?.supportUrl) {
1494
+ supportInfo_setLinkLabel(product.supportInfo.supportUrl, val);
1495
+ }
1446
1496
  };
1447
1497
 
1448
1498
  const handleSupportInfoEmailAdd = (
@@ -1459,6 +1509,9 @@ const SupportTab = observer(
1459
1509
  if (product.supportInfo) {
1460
1510
  supportInfo_deleteEmail(product.supportInfo, email);
1461
1511
  }
1512
+ if (product.supportInfo?.emails.length === 0) {
1513
+ dataProductEditorState.clearSupportInfo();
1514
+ }
1462
1515
  };
1463
1516
 
1464
1517
  const SupportEmailComponent = observer(
@@ -1527,37 +1580,87 @@ const SupportTab = observer(
1527
1580
  );
1528
1581
 
1529
1582
  return (
1530
- <PanelFormSection>
1583
+ <div className="data-product-editor__support-info">
1531
1584
  <div className="panel__content__form__section__header__label">
1532
1585
  Support Information
1533
1586
  </div>
1534
1587
  <div className="panel__content__form__section__header__prompt">
1535
1588
  Configure support information for this Lakehouse Data Product.
1536
1589
  </div>
1537
- <PanelFormTextField
1538
- name="Documentation URL"
1539
- value={product.supportInfo?.documentation?.url ?? ''}
1540
- update={updateSupportInfoDocumentationUrl}
1541
- placeholder="Enter Documentation URL"
1542
- />
1543
- <PanelFormTextField
1544
- name="Website"
1545
- value={product.supportInfo?.website?.url ?? ''}
1546
- update={updateSupportInfoWebsite}
1547
- placeholder="Enter Website"
1548
- />
1549
- <PanelFormTextField
1550
- name="FAQ URL"
1551
- value={product.supportInfo?.faqUrl?.url}
1552
- update={updateSupportInfoFaqUrl}
1553
- placeholder="Enter FAQ URL"
1554
- />
1555
- <PanelFormTextField
1556
- name="Support URL"
1557
- value={product.supportInfo?.supportUrl?.url ?? ''}
1558
- update={updateSupportInfoSupportUrl}
1559
- placeholder="Enter Support URL"
1560
- />
1590
+ <div className="data-product-editor__support-info__link-container">
1591
+ <PanelFormTextField
1592
+ className="data-product-editor__support-info__input"
1593
+ name="Documentation"
1594
+ prompt="URL"
1595
+ value={product.supportInfo?.documentation?.url ?? ''}
1596
+ update={updateSupportInfoDocumentationUrl}
1597
+ placeholder="Documentation URL"
1598
+ />
1599
+ <PanelFormTextField
1600
+ className="data-product-editor__support-info__input"
1601
+ name=""
1602
+ prompt="Label"
1603
+ isReadOnly={!Boolean(product.supportInfo?.documentation)}
1604
+ value={product.supportInfo?.documentation?.label ?? ''}
1605
+ update={updateSupportInfoDocumentationLabel}
1606
+ placeholder="Documentation Label"
1607
+ />
1608
+ </div>
1609
+
1610
+ <div className="data-product-editor__support-info__link-container">
1611
+ <PanelFormTextField
1612
+ name="Website"
1613
+ prompt="URL"
1614
+ value={product.supportInfo?.website?.url ?? ''}
1615
+ update={updateSupportInfoWebsite}
1616
+ placeholder="Website URL"
1617
+ />
1618
+ <PanelFormTextField
1619
+ name=""
1620
+ prompt="Label"
1621
+ isReadOnly={!Boolean(product.supportInfo?.website)}
1622
+ value={product.supportInfo?.website?.label ?? ''}
1623
+ update={updateSupportInfoWebsiteLabel}
1624
+ placeholder="Website Label"
1625
+ />
1626
+ </div>
1627
+
1628
+ <div className="data-product-editor__support-info__link-container">
1629
+ <PanelFormTextField
1630
+ name="FAQ"
1631
+ prompt="URL"
1632
+ value={product.supportInfo?.faqUrl?.url}
1633
+ update={updateSupportInfoFaqUrl}
1634
+ placeholder="FAQ URL"
1635
+ />
1636
+ <PanelFormTextField
1637
+ name=""
1638
+ prompt="Label"
1639
+ isReadOnly={!Boolean(product.supportInfo?.faqUrl)}
1640
+ value={product.supportInfo?.faqUrl?.label}
1641
+ update={updateSupportInfoFaqLabel}
1642
+ placeholder="FAQ Label"
1643
+ />
1644
+ </div>
1645
+
1646
+ <div className="data-product-editor__support-info__link-container">
1647
+ <PanelFormTextField
1648
+ name="Support"
1649
+ prompt="URL"
1650
+ value={product.supportInfo?.supportUrl?.url ?? ''}
1651
+ update={updateSupportInfoSupportUrl}
1652
+ placeholder="Support URL"
1653
+ />
1654
+ <PanelFormTextField
1655
+ name=""
1656
+ prompt="Label"
1657
+ isReadOnly={!Boolean(product.supportInfo?.supportUrl)}
1658
+ value={product.supportInfo?.supportUrl?.label}
1659
+ update={updateSupportInfoSupportLabel}
1660
+ placeholder="Support Label"
1661
+ />
1662
+ </div>
1663
+
1561
1664
  <ListEditor
1562
1665
  title="Emails"
1563
1666
  items={product.supportInfo?.emails}
@@ -1568,7 +1671,7 @@ const SupportTab = observer(
1568
1671
  isReadOnly={isReadOnly}
1569
1672
  emptyMessage="No emails specified"
1570
1673
  />
1571
- </PanelFormSection>
1674
+ </div>
1572
1675
  );
1573
1676
  },
1574
1677
  );
@@ -1611,7 +1714,12 @@ export const DataProductEditor = observer(() => {
1611
1714
  case DATA_PRODUCT_TAB.HOME:
1612
1715
  return <HomeTab product={product} isReadOnly={isReadOnly} />;
1613
1716
  case DATA_PRODUCT_TAB.SUPPORT:
1614
- return <SupportTab product={product} isReadOnly={isReadOnly} />;
1717
+ return (
1718
+ <SupportTab
1719
+ dataProductEditorState={dataProductEditorState}
1720
+ isReadOnly={isReadOnly}
1721
+ />
1722
+ );
1615
1723
  case DATA_PRODUCT_TAB.APG:
1616
1724
  return (
1617
1725
  <AccessPointGroupTab
@@ -558,6 +558,32 @@ export class DataProductEditorState extends ElementEditorState {
558
558
  }
559
559
  }
560
560
 
561
+ clearSupportInfo(): void {
562
+ const supportInfo = this.product.supportInfo;
563
+ runInAction(() => {
564
+ //if the url is empty, the label should be too
565
+ if (supportInfo?.documentation && !supportInfo.documentation.url) {
566
+ supportInfo.documentation = undefined;
567
+ } else if (supportInfo?.website && !supportInfo.website.url) {
568
+ supportInfo.website = undefined;
569
+ } else if (supportInfo?.faqUrl && !supportInfo.faqUrl.url) {
570
+ supportInfo.faqUrl = undefined;
571
+ } else if (supportInfo?.supportUrl && !supportInfo.supportUrl.url) {
572
+ supportInfo.supportUrl = undefined;
573
+ }
574
+ //clear support info section if everything is clear
575
+ if (
576
+ !supportInfo?.documentation &&
577
+ !supportInfo?.website &&
578
+ !supportInfo?.faqUrl &&
579
+ !supportInfo?.supportUrl &&
580
+ supportInfo?.emails.length === 0
581
+ ) {
582
+ this.product.supportInfo = undefined;
583
+ }
584
+ });
585
+ }
586
+
561
587
  get product(): DataProduct {
562
588
  return guaranteeType(
563
589
  this.element,
@@ -122,33 +122,57 @@ export const dataProduct_setSupportInfoIfAbsent = action(
122
122
  },
123
123
  );
124
124
 
125
+ export const supportInfo_setLinkLabel = action(
126
+ (link: DataProductLink, label: string | undefined) => {
127
+ link.label = label;
128
+ },
129
+ );
130
+
125
131
  export const supportInfo_setDocumentationUrl = action(
126
132
  (supportInfo: SupportInfo, documentationUrl: string) => {
127
- supportInfo.documentation = observer_DataProductLink(
128
- new DataProductLink(documentationUrl),
129
- );
133
+ if (!supportInfo.documentation) {
134
+ supportInfo.documentation = observer_DataProductLink(
135
+ new DataProductLink(documentationUrl),
136
+ );
137
+ } else {
138
+ supportInfo.documentation.url = documentationUrl;
139
+ }
130
140
  },
131
141
  );
132
142
 
133
143
  export const supportInfo_setWebsite = action(
134
144
  (supportInfo: SupportInfo, website: string) => {
135
- supportInfo.website = observer_DataProductLink(
136
- new DataProductLink(website),
137
- );
145
+ if (!supportInfo.website) {
146
+ supportInfo.website = observer_DataProductLink(
147
+ new DataProductLink(website),
148
+ );
149
+ } else {
150
+ supportInfo.website.url = website;
151
+ }
138
152
  },
139
153
  );
140
154
 
141
155
  export const supportInfo_setFaqUrl = action(
142
156
  (supportInfo: SupportInfo, faqUrl: string) => {
143
- supportInfo.faqUrl = observer_DataProductLink(new DataProductLink(faqUrl));
157
+ if (!supportInfo.faqUrl) {
158
+ supportInfo.faqUrl = observer_DataProductLink(
159
+ new DataProductLink(faqUrl),
160
+ );
161
+ } else {
162
+ supportInfo.faqUrl.url = faqUrl;
163
+ }
144
164
  },
145
165
  );
146
166
 
147
167
  export const supportInfo_setSupportUrl = action(
148
168
  (supportInfo: SupportInfo, supportUrl: string) => {
149
- supportInfo.supportUrl = observer_DataProductLink(
150
- new DataProductLink(supportUrl),
151
- );
169
+ if (!supportInfo.supportUrl) {
170
+ supportInfo.supportUrl = observer_DataProductLink(
171
+ new DataProductLink(supportUrl),
172
+ );
173
+ } else {
174
+ supportInfo.supportUrl.url = supportUrl;
175
+ }
152
176
  },
153
177
  );
154
178