@finos/legend-application-studio 28.13.3 → 28.13.5

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 (33) hide show
  1. package/lib/components/editor/ActivityBar.js +1 -1
  2. package/lib/components/editor/ActivityBar.js.map +1 -1
  3. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +15 -15
  4. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  5. package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +10 -10
  7. package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
  8. package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js +1 -1
  9. package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js.map +1 -1
  10. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.d.ts.map +1 -1
  11. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js +52 -16
  12. package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js.map +1 -1
  13. package/lib/index.css +1 -1
  14. package/lib/package.json +1 -1
  15. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts +8 -2
  16. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts.map +1 -1
  17. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js +140 -4
  18. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js.map +1 -1
  19. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
  20. package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
  21. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts +1 -0
  22. package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts.map +1 -1
  23. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js +4 -1
  24. package/lib/stores/graph-modifier/DomainGraphModifierHelper.js.map +1 -1
  25. package/package.json +6 -6
  26. package/src/components/editor/ActivityBar.tsx +1 -1
  27. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +36 -36
  28. package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +86 -78
  29. package/src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx +1 -1
  30. package/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx +156 -25
  31. package/src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts +237 -5
  32. package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +0 -1
  33. package/src/stores/graph-modifier/DomainGraphModifierHelper.ts +11 -0
@@ -1313,91 +1313,99 @@ export const FunctionEditor = observer(() => {
1313
1313
  ))}
1314
1314
  </div>
1315
1315
  <div className="panel__header__actions">
1316
- <div className="btn__dropdown-combo btn__dropdown-combo--primary">
1317
- <button
1318
- className="btn__dropdown-combo__label"
1319
- onClick={editWithQueryBuilder()}
1320
- title="Edit Query"
1321
- tabIndex={-1}
1322
- >
1323
- <PencilIcon className="btn__dropdown-combo__label__icon" />
1324
- <div className="btn__dropdown-combo__label__title">Edit</div>
1325
- </button>
1326
- </div>
1327
- <div className="btn__dropdown-combo btn__dropdown-combo--primary">
1328
- {functionEditorState.isRunningFunc ? (
1329
- <button
1330
- className="btn__dropdown-combo__canceler"
1331
- onClick={cancelQuery}
1332
- tabIndex={-1}
1333
- >
1334
- <div className="btn--dark btn--caution btn__dropdown-combo__canceler__label">
1335
- <PauseCircleIcon className="btn__dropdown-combo__canceler__label__icon" />
1336
- <div className="btn__dropdown-combo__canceler__label__title">
1337
- Stop
1338
- </div>
1339
- </div>
1340
- </button>
1341
- ) : (
1342
- <>
1316
+ {selectedTab === FUNCTION_EDITOR_TAB.DEFINITION && (
1317
+ <>
1318
+ <div className="btn__dropdown-combo btn__dropdown-combo--primary">
1343
1319
  <button
1344
1320
  className="btn__dropdown-combo__label"
1345
- onClick={runFunc}
1346
- title="Run Function"
1347
- disabled={executionIsRunning}
1321
+ onClick={editWithQueryBuilder()}
1322
+ title="Edit Query"
1348
1323
  tabIndex={-1}
1349
1324
  >
1350
- <PlayIcon className="btn__dropdown-combo__label__icon" />
1351
- <div className="btn__dropdown-combo__label__title">Run</div>
1325
+ <PencilIcon className="btn__dropdown-combo__label__icon" />
1326
+ <div className="btn__dropdown-combo__label__title">
1327
+ Edit
1328
+ </div>
1352
1329
  </button>
1353
- <DropdownMenu
1354
- className="btn__dropdown-combo__dropdown-btn"
1355
- disabled={executionIsRunning}
1356
- content={
1357
- <MenuContent>
1358
- <MenuContentItem
1359
- className="btn__dropdown-combo__option"
1360
- onClick={generatePlan}
1361
- >
1362
- Generate Plan
1363
- </MenuContentItem>
1364
- <MenuContentItem
1365
- className="btn__dropdown-combo__option"
1366
- onClick={debugPlanGeneration}
1367
- >
1368
- Debug
1369
- </MenuContentItem>
1370
- </MenuContent>
1371
- }
1372
- menuProps={{
1373
- anchorOrigin: {
1374
- vertical: 'bottom',
1375
- horizontal: 'right',
1376
- },
1377
- transformOrigin: {
1378
- vertical: 'top',
1379
- horizontal: 'right',
1380
- },
1381
- }}
1330
+ </div>
1331
+ <div className="btn__dropdown-combo btn__dropdown-combo--primary">
1332
+ {functionEditorState.isRunningFunc ? (
1333
+ <button
1334
+ className="btn__dropdown-combo__canceler"
1335
+ onClick={cancelQuery}
1336
+ tabIndex={-1}
1337
+ >
1338
+ <div className="btn--dark btn--caution btn__dropdown-combo__canceler__label">
1339
+ <PauseCircleIcon className="btn__dropdown-combo__canceler__label__icon" />
1340
+ <div className="btn__dropdown-combo__canceler__label__title">
1341
+ Stop
1342
+ </div>
1343
+ </div>
1344
+ </button>
1345
+ ) : (
1346
+ <>
1347
+ <button
1348
+ className="btn__dropdown-combo__label"
1349
+ onClick={runFunc}
1350
+ title="Run Function"
1351
+ disabled={executionIsRunning}
1352
+ tabIndex={-1}
1353
+ >
1354
+ <PlayIcon className="btn__dropdown-combo__label__icon" />
1355
+ <div className="btn__dropdown-combo__label__title">
1356
+ Run
1357
+ </div>
1358
+ </button>
1359
+ <DropdownMenu
1360
+ className="btn__dropdown-combo__dropdown-btn"
1361
+ disabled={executionIsRunning}
1362
+ content={
1363
+ <MenuContent>
1364
+ <MenuContentItem
1365
+ className="btn__dropdown-combo__option"
1366
+ onClick={generatePlan}
1367
+ >
1368
+ Generate Plan
1369
+ </MenuContentItem>
1370
+ <MenuContentItem
1371
+ className="btn__dropdown-combo__option"
1372
+ onClick={debugPlanGeneration}
1373
+ >
1374
+ Debug
1375
+ </MenuContentItem>
1376
+ </MenuContent>
1377
+ }
1378
+ menuProps={{
1379
+ anchorOrigin: {
1380
+ vertical: 'bottom',
1381
+ horizontal: 'right',
1382
+ },
1383
+ transformOrigin: {
1384
+ vertical: 'top',
1385
+ horizontal: 'right',
1386
+ },
1387
+ }}
1388
+ >
1389
+ <CaretDownIcon />
1390
+ </DropdownMenu>
1391
+ </>
1392
+ )}
1393
+ </div>
1394
+ <div className="btn__dropdown-combo btn__dropdown-combo--primary">
1395
+ <button
1396
+ className="btn__dropdown-combo__label"
1397
+ onClick={openFunctionActivateModal}
1398
+ title="Activate function"
1399
+ tabIndex={-1}
1382
1400
  >
1383
- <CaretDownIcon />
1384
- </DropdownMenu>
1385
- </>
1386
- )}
1387
- </div>
1388
- <div className="btn__dropdown-combo btn__dropdown-combo--primary">
1389
- <button
1390
- className="btn__dropdown-combo__label"
1391
- onClick={openFunctionActivateModal}
1392
- title="Activate function"
1393
- tabIndex={-1}
1394
- >
1395
- <RocketIcon className="btn__dropdown-combo__label__icon" />
1396
- <div className="btn__dropdown-combo__label__title">
1397
- Activate
1401
+ <RocketIcon className="btn__dropdown-combo__label__icon" />
1402
+ <div className="btn__dropdown-combo__label__title">
1403
+ Activate
1404
+ </div>
1405
+ </button>
1398
1406
  </div>
1399
- </button>
1400
- </div>
1407
+ </>
1408
+ )}
1401
1409
  <button
1402
1410
  className="panel__header__action"
1403
1411
  disabled={
@@ -166,7 +166,7 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
166
166
  title="Deploy to sandbox"
167
167
  tabIndex={-1}
168
168
  >
169
- Deploy
169
+ Deploy to Sandbox
170
170
  </button>
171
171
  </div>
172
172
  </div>
@@ -18,9 +18,17 @@ import { observer } from 'mobx-react-lite';
18
18
  import {
19
19
  BlankPanelPlaceholder,
20
20
  ContextMenu,
21
+ Dialog,
21
22
  MenuContent,
22
23
  MenuContentItem,
24
+ Modal,
25
+ ModalBody,
26
+ ModalFooter,
27
+ ModalFooterButton,
28
+ ModalHeader,
29
+ ModalTitle,
23
30
  PanelContent,
31
+ PanelFormTextField,
24
32
  PlayIcon,
25
33
  PlusIcon,
26
34
  ResizablePanel,
@@ -31,7 +39,7 @@ import {
31
39
  RunErrorsIcon,
32
40
  clsx,
33
41
  } from '@finos/legend-art';
34
- import { forwardRef, useEffect, useState } from 'react';
42
+ import { forwardRef, useEffect, useRef, useState } from 'react';
35
43
  import {
36
44
  type FunctionTestSuite,
37
45
  type DataElement,
@@ -331,7 +339,7 @@ const FunctionTestDataStateEditor = observer(
331
339
  const FunctionTestEditor = observer(
332
340
  (props: { functionTestState: FunctionTestState }) => {
333
341
  const { functionTestState } = props;
334
- const mappingTest = functionTestState.test;
342
+ const functionTest = functionTestState.test;
335
343
  return (
336
344
  <div className="service-test-editor panel">
337
345
  <div className="panel mapping-testable-editor">
@@ -347,10 +355,10 @@ const FunctionTestEditor = observer(
347
355
  <textarea
348
356
  className="panel__content__form__section__textarea mapping-testable-editor__doc__textarea"
349
357
  spellCheck={false}
350
- value={mappingTest.doc ?? ''}
358
+ value={functionTest.doc ?? ''}
351
359
  onChange={(event) => {
352
360
  atomicTest_setDoc(
353
- mappingTest,
361
+ functionTest,
354
362
  event.target.value ? event.target.value : undefined,
355
363
  );
356
364
  }}
@@ -383,18 +391,17 @@ const FunctionTestItem = observer(
383
391
  functionTestState: FunctionTestState;
384
392
  }) => {
385
393
  const { functionTestState, suiteState } = props;
386
- const mappingTest = functionTestState.test;
394
+ const functionTest = functionTestState.test;
387
395
  const isRunning = functionTestState.runningTestAction.isInProgress;
388
396
  const [isSelectedFromContextMenu, setIsSelectedFromContextMenu] =
389
397
  useState(false);
390
398
  const isReadOnly =
391
399
  suiteState.functionTestableState.functionEditorState.isReadOnly;
392
- const openTest = (): void => suiteState.changeTest(mappingTest);
393
- const isActive = suiteState.selectTestState?.test === mappingTest;
400
+ const openTest = (): void => suiteState.changeTest(functionTest);
401
+ const isActive = suiteState.selectTestState?.test === functionTest;
394
402
  const _testableResult = getTestableResultFromTestResult(
395
403
  functionTestState.testResultState.result,
396
404
  );
397
-
398
405
  const testableResult = isRunning
399
406
  ? TESTABLE_RESULT.IN_PROGRESS
400
407
  : _testableResult;
@@ -405,11 +412,11 @@ const FunctionTestItem = observer(
405
412
  // TODO
406
413
  };
407
414
  const _delete = (): void => {
408
- suiteState.deleteTest(mappingTest);
415
+ suiteState.deleteTest(functionTest);
409
416
  };
410
417
 
411
418
  const rename = (): void => {
412
- // suiteState.mappingTestableState.setRenameComponent(mappingTest);
419
+ suiteState.functionTestableState.setRenameComponent(functionTest);
413
420
  };
414
421
  const runTest = (): void => {
415
422
  flowResult(functionTestState.runTest()).catch(
@@ -448,7 +455,7 @@ const FunctionTestItem = observer(
448
455
  {resultIcon}
449
456
  </div>
450
457
  <div className="testable-test-explorer__item__label__text">
451
- {mappingTest.id}
458
+ {functionTest.id}
452
459
  </div>
453
460
  <div className="mapping-test-explorer__item__actions">
454
461
  <button
@@ -467,6 +474,59 @@ const FunctionTestItem = observer(
467
474
  },
468
475
  );
469
476
 
477
+ const CreateTestModal = observer(
478
+ (props: { functionSuiteState: FunctionTestSuiteState }) => {
479
+ const { functionSuiteState } = props;
480
+ const suite = functionSuiteState.suite;
481
+ // test name
482
+ const [id, setId] = useState<string | undefined>(undefined);
483
+ const isValid = id && !id.includes(' ');
484
+ const errorMessage = validateTestableId(
485
+ id,
486
+ suite.tests.map((t) => t.id),
487
+ );
488
+ const close = (): void => functionSuiteState.setShowModal(false);
489
+ const create = (): void => {
490
+ if (id) {
491
+ functionSuiteState.addNewTest(id);
492
+ close();
493
+ }
494
+ };
495
+
496
+ return (
497
+ <Dialog
498
+ open={functionSuiteState.showCreateModal}
499
+ onClose={close}
500
+ classes={{ container: 'search-modal__container' }}
501
+ PaperProps={{ classes: { root: 'search-modal__inner-container' } }}
502
+ >
503
+ <Modal darkMode={true}>
504
+ <ModalHeader>
505
+ <ModalTitle title="Create Mapping Test" />
506
+ </ModalHeader>
507
+ <ModalBody>
508
+ <PanelFormTextField
509
+ name="Name"
510
+ prompt=""
511
+ value={id}
512
+ update={(value: string | undefined): void => setId(value ?? '')}
513
+ errorMessage={errorMessage}
514
+ />
515
+ </ModalBody>
516
+ <ModalFooter>
517
+ <ModalFooterButton
518
+ disabled={!isValid}
519
+ onClick={create}
520
+ text="Create"
521
+ />
522
+ <ModalFooterButton onClick={close} text="Close" />
523
+ </ModalFooter>
524
+ </Modal>
525
+ </Dialog>
526
+ );
527
+ },
528
+ );
529
+
470
530
  const FunctionTestSuiteEditor = observer(
471
531
  (props: { functionTestSuiteState: FunctionTestSuiteState }) => {
472
532
  const { functionTestSuiteState } = props;
@@ -474,7 +534,7 @@ const FunctionTestSuiteEditor = observer(
474
534
  const editorStore = functionTestSuiteState.editorStore;
475
535
  const selectedTestState = functionTestSuiteState.selectTestState;
476
536
  const addTest = (): void => {
477
- // TODO
537
+ functionTestSuiteState.setShowModal(true);
478
538
  };
479
539
  const runTests = (): void => {
480
540
  flowResult(functionTestSuiteState.runSuite()).catch(
@@ -488,7 +548,7 @@ const FunctionTestSuiteEditor = observer(
488
548
  };
489
549
 
490
550
  const addStoreTestData = (): void => {
491
- // mappingTestableDataState.setShowModal(true);
551
+ // TODO
492
552
  };
493
553
 
494
554
  const renderMappingTestEditor = (): React.ReactNode => {
@@ -527,9 +587,6 @@ const FunctionTestSuiteEditor = observer(
527
587
  tooltipText="Click to add store test data"
528
588
  />
529
589
  )}
530
- {/* {mappingTestableDataState.showNewModal && (
531
- <CreateStoreTestDataModal mappingTestState={mappingTestState} />
532
- )} */}
533
590
  </div>
534
591
  </ResizablePanel>
535
592
  <ResizablePanelSplitter>
@@ -563,7 +620,7 @@ const FunctionTestSuiteEditor = observer(
563
620
  className="panel__header__action"
564
621
  tabIndex={-1}
565
622
  onClick={addTest}
566
- title="Add Mapping Test"
623
+ title="Add Function Test"
567
624
  >
568
625
  <PlusIcon />
569
626
  </button>
@@ -577,9 +634,11 @@ const FunctionTestSuiteEditor = observer(
577
634
  suiteState={functionTestSuiteState}
578
635
  />
579
636
  ))}
580
- {/* {mappingTestSuiteState.showCreateModal && (
581
- <CreateTestModal mappingSuiteState={mappingTestSuiteState} />
582
- )} */}
637
+ {functionTestSuiteState.showCreateModal && (
638
+ <CreateTestModal
639
+ functionSuiteState={functionTestSuiteState}
640
+ />
641
+ )}
583
642
  </PanelContent>
584
643
  </ResizablePanel>
585
644
  <ResizablePanelSplitter>
@@ -595,6 +654,78 @@ const FunctionTestSuiteEditor = observer(
595
654
  },
596
655
  );
597
656
 
657
+ const CreateFucntionTestSuiteModal = observer(
658
+ (props: { functiontestableEditorState: FunctionTestableState }) => {
659
+ const { functiontestableEditorState } = props;
660
+ const inputRef = useRef<HTMLInputElement>(null);
661
+ const handleEnter = (): void => inputRef.current?.focus();
662
+ const [suiteName, setSuiteName] = useState<string | undefined>(undefined);
663
+ const [testName, setTestName] = useState<string | undefined>(undefined);
664
+ const isValid = suiteName && testName;
665
+
666
+ // model
667
+ const close = (): void => functiontestableEditorState.setCreateSuite(false);
668
+ const create = (): void => {
669
+ if (suiteName && testName) {
670
+ functiontestableEditorState.createSuite(suiteName, testName);
671
+ }
672
+ };
673
+ return (
674
+ <Dialog
675
+ open={true}
676
+ onClose={close}
677
+ TransitionProps={{
678
+ onEnter: handleEnter,
679
+ }}
680
+ classes={{ container: 'search-modal__container' }}
681
+ PaperProps={{ classes: { root: 'search-modal__inner-container' } }}
682
+ >
683
+ <Modal darkMode={true}>
684
+ <ModalHeader>
685
+ <ModalTitle title="Create Mapping Test Suite" />
686
+ </ModalHeader>
687
+ <ModalBody>
688
+ <PanelFormTextField
689
+ ref={inputRef}
690
+ name="Test Suite Name"
691
+ prompt="Unique Identifier for Test suite i.e Person_suite"
692
+ value={suiteName}
693
+ placeholder="Suite Name"
694
+ update={(value: string | undefined): void =>
695
+ setSuiteName(value ?? '')
696
+ }
697
+ errorMessage={validateTestableId(suiteName, undefined)}
698
+ />
699
+ <PanelFormTextField
700
+ name="Test Name"
701
+ prompt="Unique Identifier for first test in suite"
702
+ placeholder="Test Name"
703
+ value={testName}
704
+ update={(value: string | undefined): void =>
705
+ setTestName(value ?? '')
706
+ }
707
+ errorMessage={validateTestableId(testName, undefined)}
708
+ />
709
+ </ModalBody>
710
+ <ModalFooter>
711
+ <ModalFooterButton
712
+ disabled={!isValid}
713
+ title={
714
+ !isValid
715
+ ? 'Suite Name and Test Name Required'
716
+ : 'Create Test Suite'
717
+ }
718
+ onClick={create}
719
+ text="Create"
720
+ />
721
+ <ModalFooterButton onClick={close} text="Close" />
722
+ </ModalFooter>
723
+ </Modal>
724
+ </Dialog>
725
+ );
726
+ },
727
+ );
728
+
598
729
  export const FunctionTestableEditor = observer(
599
730
  (props: { functionTestableState: FunctionTestableState }) => {
600
731
  const { functionTestableState } = props;
@@ -615,7 +746,7 @@ export const FunctionTestableEditor = observer(
615
746
  functionTestableState.runAllFailingSuites();
616
747
  };
617
748
  const addSuite = (): void => {
618
- // TODO
749
+ functionTestableState.setCreateSuite(true);
619
750
  };
620
751
 
621
752
  const renderSuiteState = (): React.ReactNode => {
@@ -722,11 +853,11 @@ export const FunctionTestableEditor = observer(
722
853
  </div>
723
854
  </ResizablePanel>
724
855
  </ResizablePanelGroup>
725
- {/* {mappingTestableState.createSuiteState && (
726
- <CreateTestSuiteModal
727
- creatorState={mappingTestableState.createSuiteState}
856
+ {functionTestableState.createSuiteModal && (
857
+ <CreateFucntionTestSuiteModal
858
+ functiontestableEditorState={functionTestableState}
728
859
  />
729
- )} */}
860
+ )}
730
861
  {functionTestableState.testableComponentToRename && (
731
862
  <RenameModal
732
863
  val={functionTestableState.testableComponentToRename.id}