@finos/legend-application-studio 28.18.43 → 28.18.45
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/lib/components/editor/editor-group/function-activator/ActivatorFormComponents.d.ts +23 -0
- package/lib/components/editor/editor-group/function-activator/ActivatorFormComponents.d.ts.map +1 -0
- package/lib/components/editor/editor-group/function-activator/ActivatorFormComponents.js +34 -0
- package/lib/components/editor/editor-group/function-activator/ActivatorFormComponents.js.map +1 -0
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +6 -3
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.js +8 -102
- package/lib/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js +4 -13
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +4 -2
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +5 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.d.ts +1 -2
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js +29 -7
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js.map +1 -1
- package/package.json +8 -8
- package/src/components/editor/editor-group/function-activator/ActivatorFormComponents.tsx +97 -0
- package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +38 -1
- package/src/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.tsx +5 -349
- package/src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx +7 -42
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +11 -0
- package/src/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.ts +39 -12
- package/tsconfig.json +1 -0
|
@@ -25,19 +25,14 @@ import {
|
|
|
25
25
|
PanelFormBooleanField,
|
|
26
26
|
PanelFormValidatedTextField,
|
|
27
27
|
TimesIcon,
|
|
28
|
-
CustomSelectorInput,
|
|
29
|
-
PencilIcon,
|
|
30
|
-
ErrorIcon,
|
|
31
28
|
clsx,
|
|
32
29
|
PlusIcon,
|
|
33
30
|
} from '@finos/legend-art';
|
|
34
31
|
import {
|
|
35
|
-
DeploymentOwner,
|
|
36
32
|
Profile,
|
|
37
33
|
StereotypeExplicitReference,
|
|
38
34
|
type StereotypeReference,
|
|
39
35
|
type TaggedValue,
|
|
40
|
-
UserList,
|
|
41
36
|
generateFunctionPrettyName,
|
|
42
37
|
stub_Profile,
|
|
43
38
|
stub_Stereotype,
|
|
@@ -50,9 +45,6 @@ import { useApplicationStore } from '@finos/legend-application';
|
|
|
50
45
|
import { useEditorStore } from '../../EditorStoreProvider.js';
|
|
51
46
|
import {
|
|
52
47
|
HostedServiceFunctionActivatorEditorState,
|
|
53
|
-
OWNERSHIP_OPTIONS,
|
|
54
|
-
type HostedServiceOwnerOption,
|
|
55
|
-
MINIMUM_HOSTED_SERVICE_OWNERS,
|
|
56
48
|
ACTIVATOR_EDITOR_TAB,
|
|
57
49
|
} from '../../../../stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js';
|
|
58
50
|
import {
|
|
@@ -61,16 +53,11 @@ import {
|
|
|
61
53
|
hostedService_setPattern,
|
|
62
54
|
hostedService_removePatternParameter,
|
|
63
55
|
hostedService_setStoreModel,
|
|
64
|
-
hostedService_setGenerateLineage,
|
|
65
|
-
activator_setDeploymentOwner,
|
|
66
|
-
activator_updateUserOwnership,
|
|
67
|
-
activator_deleteValueFromUserOwnership,
|
|
68
|
-
activator_addUserOwner,
|
|
69
56
|
} from '../../../../stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.js';
|
|
70
|
-
import { useCallback, useEffect,
|
|
71
|
-
import {
|
|
72
|
-
import { debounce, prettyCONSTName } from '@finos/legend-shared';
|
|
57
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
58
|
+
import { prettyCONSTName } from '@finos/legend-shared';
|
|
73
59
|
import { flowResult } from 'mobx';
|
|
60
|
+
import { ActivatorOwnershipForm } from './ActivatorFormComponents.js';
|
|
74
61
|
import {
|
|
75
62
|
annotatedElement_addStereotype,
|
|
76
63
|
annotatedElement_addTaggedValue,
|
|
@@ -92,8 +79,6 @@ import {
|
|
|
92
79
|
StereotypeSelector,
|
|
93
80
|
} from '../uml-editor/StereotypeSelector.js';
|
|
94
81
|
|
|
95
|
-
type UserOption = { label: string; value: string };
|
|
96
|
-
|
|
97
82
|
export const HostedServiceFunctionActivatorEditor = observer(() => {
|
|
98
83
|
const editorStore = useEditorStore();
|
|
99
84
|
const applicationStore = useApplicationStore();
|
|
@@ -197,7 +182,6 @@ export const HostedServiceFunctionActivatorEditor = observer(() => {
|
|
|
197
182
|
editorState.setSelectedTab(tab);
|
|
198
183
|
|
|
199
184
|
const activator = editorState.activator;
|
|
200
|
-
const ownership = activator.ownership;
|
|
201
185
|
const visitFunction = (): void =>
|
|
202
186
|
editorState.editorStore.graphEditorMode.openElement(
|
|
203
187
|
activator.function.value,
|
|
@@ -225,10 +209,6 @@ export const HostedServiceFunctionActivatorEditor = observer(() => {
|
|
|
225
209
|
hostedService_setStoreModel(activator, !activator.storeModel);
|
|
226
210
|
};
|
|
227
211
|
|
|
228
|
-
const toggleGenerateLineage = (): void => {
|
|
229
|
-
hostedService_setGenerateLineage(activator, !activator.generateLineage);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
212
|
const toggleAutoActivateUpdates = (): void => {
|
|
233
213
|
hostedService_setAutoActivateUpdates(
|
|
234
214
|
activator,
|
|
@@ -243,127 +223,6 @@ export const HostedServiceFunctionActivatorEditor = observer(() => {
|
|
|
243
223
|
: undefined;
|
|
244
224
|
};
|
|
245
225
|
|
|
246
|
-
//Ownership
|
|
247
|
-
const [showOwnerEditInput, setShowOwnerEditInput] = useState<
|
|
248
|
-
boolean | number
|
|
249
|
-
>(false);
|
|
250
|
-
const [ownerInputValue, setOwnerInputValue] = useState<string>('');
|
|
251
|
-
const [searchText, setSearchText] = useState('');
|
|
252
|
-
const [userOptions, setUserOptions] = useState<UserOption[]>([]);
|
|
253
|
-
const [isLoadingUsers, setIsLoadingUsers] = useState<boolean>(false);
|
|
254
|
-
const [ownerInputs, setOwnerInputs] = useState<string[]>([]);
|
|
255
|
-
const showAddOwnerInput = (): void => setShowOwnerEditInput(true);
|
|
256
|
-
|
|
257
|
-
const onOwnershipChange = (
|
|
258
|
-
val: HostedServiceOwnerOption | undefined,
|
|
259
|
-
): void => {
|
|
260
|
-
if (val) {
|
|
261
|
-
editorState.setSelectedOwnership(val);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
const updateDeploymentIdentifier: React.ChangeEventHandler<
|
|
266
|
-
HTMLInputElement
|
|
267
|
-
> = (event) => {
|
|
268
|
-
if (!isReadOnly && ownership instanceof DeploymentOwner) {
|
|
269
|
-
activator_setDeploymentOwner(ownership, event.target.value);
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const changeUserOwnerInputValue: React.ChangeEventHandler<
|
|
274
|
-
HTMLInputElement
|
|
275
|
-
> = (event) => setOwnerInputValue(event.target.value);
|
|
276
|
-
|
|
277
|
-
const updateUser =
|
|
278
|
-
(idx: number): (() => void) =>
|
|
279
|
-
(): void => {
|
|
280
|
-
if (
|
|
281
|
-
ownerInputValue &&
|
|
282
|
-
ownership instanceof UserList &&
|
|
283
|
-
!ownership.users.includes(ownerInputValue)
|
|
284
|
-
) {
|
|
285
|
-
activator_updateUserOwnership(ownership, ownerInputValue, idx);
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const showEditOwnerInput =
|
|
290
|
-
(value: string, idx: number): (() => void) =>
|
|
291
|
-
(): void => {
|
|
292
|
-
setOwnerInputValue(value);
|
|
293
|
-
setShowOwnerEditInput(idx);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
const hideAddOrEditOwnerInput = (): void => {
|
|
297
|
-
setShowOwnerEditInput(false);
|
|
298
|
-
setOwnerInputValue('');
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
const deleteUser =
|
|
302
|
-
(idx: number): (() => void) =>
|
|
303
|
-
(): void => {
|
|
304
|
-
if (!isReadOnly && ownership instanceof UserList) {
|
|
305
|
-
activator_deleteValueFromUserOwnership(ownership, idx);
|
|
306
|
-
if (
|
|
307
|
-
typeof showOwnerEditInput === 'number' &&
|
|
308
|
-
showOwnerEditInput > idx
|
|
309
|
-
) {
|
|
310
|
-
setShowOwnerEditInput(showOwnerEditInput - 1);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
const debouncedSearchUsers = useMemo(
|
|
316
|
-
() =>
|
|
317
|
-
debounce((input: string): void => {
|
|
318
|
-
setIsLoadingUsers(true);
|
|
319
|
-
flowResult(editorState.searchUsers(input))
|
|
320
|
-
.then((users) =>
|
|
321
|
-
setUserOptions(
|
|
322
|
-
users.map((u) => ({
|
|
323
|
-
value: u.userId,
|
|
324
|
-
label: u.userId,
|
|
325
|
-
})),
|
|
326
|
-
),
|
|
327
|
-
)
|
|
328
|
-
.then(() => setIsLoadingUsers(false))
|
|
329
|
-
.catch(editorState.editorStore.applicationStore.alertUnhandledError);
|
|
330
|
-
}, 500),
|
|
331
|
-
[editorState],
|
|
332
|
-
);
|
|
333
|
-
|
|
334
|
-
const onSearchTextChange = (value: string): void => {
|
|
335
|
-
if (value !== searchText) {
|
|
336
|
-
setSearchText(value);
|
|
337
|
-
debouncedSearchUsers.cancel();
|
|
338
|
-
if (value.length >= 3) {
|
|
339
|
-
debouncedSearchUsers(value);
|
|
340
|
-
} else if (value.length === 0) {
|
|
341
|
-
setUserOptions([]);
|
|
342
|
-
setIsLoadingUsers(false);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
const onUserOptionChange = (options: UserOption[]): void => {
|
|
348
|
-
setOwnerInputs(options.map((op) => op.label));
|
|
349
|
-
setUserOptions([]);
|
|
350
|
-
debouncedSearchUsers.cancel();
|
|
351
|
-
setIsLoadingUsers(false);
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
const addUser = (): void => {
|
|
355
|
-
ownerInputs.forEach((value) => {
|
|
356
|
-
if (
|
|
357
|
-
value &&
|
|
358
|
-
ownership instanceof UserList &&
|
|
359
|
-
!ownership.users.includes(value)
|
|
360
|
-
) {
|
|
361
|
-
activator_addUserOwner(ownership, value);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
hideAddOrEditOwnerInput();
|
|
365
|
-
};
|
|
366
|
-
|
|
367
226
|
//Pattern
|
|
368
227
|
const patternRef = useRef<HTMLInputElement>(null);
|
|
369
228
|
const [pattern, setPattern] = useState(activator.pattern);
|
|
@@ -583,214 +442,11 @@ export const HostedServiceFunctionActivatorEditor = observer(() => {
|
|
|
583
442
|
/>
|
|
584
443
|
</PanelForm>
|
|
585
444
|
<PanelForm>
|
|
586
|
-
<
|
|
445
|
+
<ActivatorOwnershipForm
|
|
446
|
+
activator={activator}
|
|
587
447
|
isReadOnly={isReadOnly}
|
|
588
|
-
value={activator.generateLineage}
|
|
589
|
-
name="Generate Lineage"
|
|
590
|
-
prompt="Generate Lineage (slower)"
|
|
591
|
-
update={toggleGenerateLineage}
|
|
592
448
|
/>
|
|
593
449
|
</PanelForm>
|
|
594
|
-
<PanelForm>
|
|
595
|
-
{
|
|
596
|
-
<div>
|
|
597
|
-
<div className="panel__content__form__section">
|
|
598
|
-
<div className="panel__content__form__section__header__label">
|
|
599
|
-
Ownership
|
|
600
|
-
</div>
|
|
601
|
-
<div className="panel__content__form__section__header__prompt">
|
|
602
|
-
The ownership model you want to use to control your
|
|
603
|
-
service.
|
|
604
|
-
</div>
|
|
605
|
-
<CustomSelectorInput
|
|
606
|
-
options={OWNERSHIP_OPTIONS}
|
|
607
|
-
onChange={onOwnershipChange}
|
|
608
|
-
value={editorState.selectedOwnership}
|
|
609
|
-
darkMode={
|
|
610
|
-
!applicationStore.layoutService
|
|
611
|
-
.TEMPORARY__isLightColorThemeEnabled
|
|
612
|
-
}
|
|
613
|
-
/>
|
|
614
|
-
</div>
|
|
615
|
-
{ownership instanceof DeploymentOwner && (
|
|
616
|
-
<div className="panel__content__form__section">
|
|
617
|
-
<div>
|
|
618
|
-
<div className="panel__content__form__section__header__label">
|
|
619
|
-
Deployment Identifier :
|
|
620
|
-
</div>
|
|
621
|
-
<input
|
|
622
|
-
className="panel__content__form__section__input"
|
|
623
|
-
spellCheck={false}
|
|
624
|
-
disabled={isReadOnly}
|
|
625
|
-
value={ownership.id}
|
|
626
|
-
onChange={updateDeploymentIdentifier}
|
|
627
|
-
/>
|
|
628
|
-
</div>
|
|
629
|
-
</div>
|
|
630
|
-
)}
|
|
631
|
-
{ownership instanceof UserList && (
|
|
632
|
-
<div className="panel__content__form__section">
|
|
633
|
-
<div>
|
|
634
|
-
<div className="panel__content__form__section__header__label">
|
|
635
|
-
Users :
|
|
636
|
-
</div>
|
|
637
|
-
<div className="panel__content__form__section__list">
|
|
638
|
-
<div
|
|
639
|
-
className="panel__content__form__section__list__items"
|
|
640
|
-
data-testid={
|
|
641
|
-
LEGEND_STUDIO_TEST_ID.PANEL_CONTENT_FORM_SECTION_LIST_ITEMS
|
|
642
|
-
}
|
|
643
|
-
>
|
|
644
|
-
{ownership.users.map((value, idx) => (
|
|
645
|
-
<div
|
|
646
|
-
key={value}
|
|
647
|
-
className={
|
|
648
|
-
showOwnerEditInput === idx
|
|
649
|
-
? 'panel__content__form__section__list__new-item'
|
|
650
|
-
: 'panel__content__form__section__list__item'
|
|
651
|
-
}
|
|
652
|
-
>
|
|
653
|
-
{showOwnerEditInput === idx ? (
|
|
654
|
-
<>
|
|
655
|
-
<input
|
|
656
|
-
className="panel__content__form__section__input panel__content__form__section__list__new-item__input"
|
|
657
|
-
spellCheck={false}
|
|
658
|
-
disabled={isReadOnly}
|
|
659
|
-
value={ownerInputValue}
|
|
660
|
-
onChange={changeUserOwnerInputValue}
|
|
661
|
-
/>
|
|
662
|
-
<div className="panel__content__form__section__list__new-item__actions">
|
|
663
|
-
<button
|
|
664
|
-
className="panel__content__form__section__list__new-item__add-btn btn btn--dark"
|
|
665
|
-
disabled={
|
|
666
|
-
isReadOnly ||
|
|
667
|
-
ownership.users.includes(
|
|
668
|
-
ownerInputValue,
|
|
669
|
-
)
|
|
670
|
-
}
|
|
671
|
-
onClick={updateUser(idx)}
|
|
672
|
-
tabIndex={-1}
|
|
673
|
-
>
|
|
674
|
-
Save
|
|
675
|
-
</button>
|
|
676
|
-
<button
|
|
677
|
-
className="panel__content__form__section__list__new-item__cancel-btn btn btn--dark"
|
|
678
|
-
disabled={isReadOnly}
|
|
679
|
-
onClick={hideAddOrEditOwnerInput}
|
|
680
|
-
tabIndex={-1}
|
|
681
|
-
>
|
|
682
|
-
Cancel
|
|
683
|
-
</button>
|
|
684
|
-
</div>
|
|
685
|
-
</>
|
|
686
|
-
) : (
|
|
687
|
-
<>
|
|
688
|
-
<div className="panel__content__form__section__list__item__value">
|
|
689
|
-
{value}
|
|
690
|
-
</div>
|
|
691
|
-
<div className="panel__content__form__section__list__item__actions">
|
|
692
|
-
<button
|
|
693
|
-
className="panel__content__form__section__list__item__edit-btn"
|
|
694
|
-
disabled={isReadOnly}
|
|
695
|
-
onClick={showEditOwnerInput(
|
|
696
|
-
value,
|
|
697
|
-
idx,
|
|
698
|
-
)}
|
|
699
|
-
tabIndex={-1}
|
|
700
|
-
>
|
|
701
|
-
<PencilIcon />
|
|
702
|
-
</button>
|
|
703
|
-
<button
|
|
704
|
-
className="panel__content__form__section__list__item__remove-btn"
|
|
705
|
-
disabled={isReadOnly}
|
|
706
|
-
onClick={deleteUser(idx)}
|
|
707
|
-
tabIndex={-1}
|
|
708
|
-
>
|
|
709
|
-
<TimesIcon />
|
|
710
|
-
</button>
|
|
711
|
-
</div>
|
|
712
|
-
</>
|
|
713
|
-
)}
|
|
714
|
-
</div>
|
|
715
|
-
))}
|
|
716
|
-
{showOwnerEditInput === true && (
|
|
717
|
-
<div className="panel__content__form__section__list__new-item">
|
|
718
|
-
<CustomSelectorInput
|
|
719
|
-
className="service-editor__owner__selector"
|
|
720
|
-
placeholder="Enter an owner..."
|
|
721
|
-
inputValue={searchText}
|
|
722
|
-
options={userOptions}
|
|
723
|
-
allowCreating={true}
|
|
724
|
-
isLoading={isLoadingUsers}
|
|
725
|
-
disabled={isReadOnly}
|
|
726
|
-
darkMode={
|
|
727
|
-
!applicationStore.layoutService
|
|
728
|
-
.TEMPORARY__isLightColorThemeEnabled
|
|
729
|
-
}
|
|
730
|
-
onInputChange={onSearchTextChange}
|
|
731
|
-
onChange={onUserOptionChange}
|
|
732
|
-
isMulti={true}
|
|
733
|
-
/>
|
|
734
|
-
<div className="panel__content__form__section__list__new-item__actions">
|
|
735
|
-
<button
|
|
736
|
-
className="panel__content__form__section__list__new-item__add-btn btn btn--dark service-editor__owner__action"
|
|
737
|
-
disabled={
|
|
738
|
-
isReadOnly ||
|
|
739
|
-
ownerInputs.some((i) =>
|
|
740
|
-
ownership.users.includes(i),
|
|
741
|
-
)
|
|
742
|
-
}
|
|
743
|
-
onClick={addUser}
|
|
744
|
-
tabIndex={-1}
|
|
745
|
-
>
|
|
746
|
-
Save
|
|
747
|
-
</button>
|
|
748
|
-
<button
|
|
749
|
-
className="panel__content__form__section__list__new-item__cancel-btn btn btn--dark service-editor__owner__action"
|
|
750
|
-
disabled={isReadOnly}
|
|
751
|
-
onClick={hideAddOrEditOwnerInput}
|
|
752
|
-
tabIndex={-1}
|
|
753
|
-
>
|
|
754
|
-
Cancel
|
|
755
|
-
</button>
|
|
756
|
-
</div>
|
|
757
|
-
</div>
|
|
758
|
-
)}
|
|
759
|
-
</div>
|
|
760
|
-
{ownership.users.length <
|
|
761
|
-
MINIMUM_HOSTED_SERVICE_OWNERS &&
|
|
762
|
-
showOwnerEditInput !== true && (
|
|
763
|
-
<div
|
|
764
|
-
className="service-editor__owner__validation"
|
|
765
|
-
title={`${MINIMUM_HOSTED_SERVICE_OWNERS} owners required`}
|
|
766
|
-
>
|
|
767
|
-
<ErrorIcon />
|
|
768
|
-
<div className="service-editor__owner__validation-label">
|
|
769
|
-
Service requires at least{' '}
|
|
770
|
-
{MINIMUM_HOSTED_SERVICE_OWNERS} owners
|
|
771
|
-
</div>
|
|
772
|
-
</div>
|
|
773
|
-
)}
|
|
774
|
-
{showOwnerEditInput !== true && (
|
|
775
|
-
<div className="panel__content__form__section__list__new-item__add">
|
|
776
|
-
<button
|
|
777
|
-
className="panel__content__form__section__list__new-item__add-btn btn btn--dark"
|
|
778
|
-
disabled={isReadOnly}
|
|
779
|
-
onClick={showAddOwnerInput}
|
|
780
|
-
tabIndex={-1}
|
|
781
|
-
title="Add owner"
|
|
782
|
-
>
|
|
783
|
-
Add Value
|
|
784
|
-
</button>
|
|
785
|
-
</div>
|
|
786
|
-
)}
|
|
787
|
-
</div>
|
|
788
|
-
</div>
|
|
789
|
-
</div>
|
|
790
|
-
)}
|
|
791
|
-
</div>
|
|
792
|
-
}
|
|
793
|
-
</PanelForm>
|
|
794
450
|
</div>
|
|
795
451
|
)}
|
|
796
452
|
{selectedTab === ACTIVATOR_EDITOR_TAB.TAGGED_VALUES && (
|
|
@@ -34,7 +34,6 @@ import {
|
|
|
34
34
|
generateFunctionPrettyName,
|
|
35
35
|
RelationalDatabaseConnection,
|
|
36
36
|
DatabaseType,
|
|
37
|
-
DeploymentOwner,
|
|
38
37
|
SnowflakePermissionScheme,
|
|
39
38
|
} from '@finos/legend-graph';
|
|
40
39
|
import { observer } from 'mobx-react-lite';
|
|
@@ -42,12 +41,12 @@ import { useApplicationStore } from '@finos/legend-application';
|
|
|
42
41
|
import { useEditorStore } from '../../EditorStoreProvider.js';
|
|
43
42
|
import { SnowflakeAppFunctionActivatorEdtiorState } from '../../../../stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
|
|
44
43
|
import { flowResult } from 'mobx';
|
|
45
|
-
import { useRef
|
|
44
|
+
import { useRef } from 'react';
|
|
46
45
|
import {
|
|
47
46
|
type RelationalDatabaseConnectionOption,
|
|
48
47
|
buildRelationalDatabaseConnectionOption,
|
|
49
48
|
} from '../connection-editor/RelationalDatabaseConnectionEditor.js';
|
|
50
|
-
import {
|
|
49
|
+
import { ActivatorOwnershipForm } from './ActivatorFormComponents.js';
|
|
51
50
|
|
|
52
51
|
export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
53
52
|
const editorStore = useEditorStore();
|
|
@@ -57,7 +56,7 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
|
57
56
|
);
|
|
58
57
|
const isReadOnly = editorState.isReadOnly;
|
|
59
58
|
const activator = editorState.activator;
|
|
60
|
-
|
|
59
|
+
|
|
61
60
|
const connectionSelectorRef = useRef<SelectComponent>(null);
|
|
62
61
|
const connectionFilterOption = createFilter({
|
|
63
62
|
ignoreCase: true,
|
|
@@ -140,17 +139,6 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
|
140
139
|
);
|
|
141
140
|
};
|
|
142
141
|
|
|
143
|
-
//Ownership
|
|
144
|
-
const [ownerInputValue, setOwner] = useState<string>(activator.ownership.id);
|
|
145
|
-
const updateDeploymentIdentifier: React.ChangeEventHandler<
|
|
146
|
-
HTMLInputElement
|
|
147
|
-
> = (event) => {
|
|
148
|
-
if (!isReadOnly) {
|
|
149
|
-
setOwner(event.target.value);
|
|
150
|
-
activator_setDeploymentOwner(ownership, event.target.value);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
142
|
return (
|
|
155
143
|
<div className="snowflake-app-function-activator-editor">
|
|
156
144
|
<Panel>
|
|
@@ -330,33 +318,10 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
|
330
318
|
</div>
|
|
331
319
|
</PanelForm>
|
|
332
320
|
<PanelForm>
|
|
333
|
-
<
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
</div>
|
|
338
|
-
<div className="panel__content__form__section__header__prompt">
|
|
339
|
-
The ownership model you want to use to control your snowflake
|
|
340
|
-
app.
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
{ownership instanceof DeploymentOwner && (
|
|
344
|
-
<div className="panel__content__form__section">
|
|
345
|
-
<div>
|
|
346
|
-
<div className="panel__content__form__section__header__label">
|
|
347
|
-
Deployment Identifier :
|
|
348
|
-
</div>
|
|
349
|
-
<input
|
|
350
|
-
className="panel__content__form__section__input"
|
|
351
|
-
spellCheck={false}
|
|
352
|
-
disabled={isReadOnly}
|
|
353
|
-
value={ownerInputValue}
|
|
354
|
-
onChange={updateDeploymentIdentifier}
|
|
355
|
-
/>
|
|
356
|
-
</div>
|
|
357
|
-
</div>
|
|
358
|
-
)}
|
|
359
|
-
</div>
|
|
321
|
+
<ActivatorOwnershipForm
|
|
322
|
+
activator={activator}
|
|
323
|
+
isReadOnly={isReadOnly}
|
|
324
|
+
/>
|
|
360
325
|
</PanelForm>
|
|
361
326
|
</PanelContent>
|
|
362
327
|
</Panel>
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
observe_ValueSpecification,
|
|
55
55
|
generateFunctionPrettyName,
|
|
56
56
|
RawVariableExpression,
|
|
57
|
+
type FunctionActivator,
|
|
57
58
|
} from '@finos/legend-graph';
|
|
58
59
|
import {
|
|
59
60
|
ExecutionPlanState,
|
|
@@ -74,6 +75,7 @@ export enum FUNCTION_EDITOR_TAB {
|
|
|
74
75
|
TAGGED_VALUES = 'TAGGED_VALUES',
|
|
75
76
|
STEREOTYPES = 'STEREOTYPES',
|
|
76
77
|
TEST_SUITES = 'TEST_SUITES',
|
|
78
|
+
LAMBDAS = 'LAMBDAS',
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
export class FunctionDefinitionEditorState extends LambdaEditorState {
|
|
@@ -314,6 +316,15 @@ export class FunctionEditorState extends ElementEditorState {
|
|
|
314
316
|
);
|
|
315
317
|
}
|
|
316
318
|
|
|
319
|
+
get activators(): FunctionActivator[] {
|
|
320
|
+
const allActivators =
|
|
321
|
+
this.editorStore.graphManagerState.graph.functionActivators;
|
|
322
|
+
return allActivators.filter(
|
|
323
|
+
(activator: FunctionActivator) =>
|
|
324
|
+
activator.function.value === this.element,
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
317
328
|
setSelectedTab(tab: FUNCTION_EDITOR_TAB): void {
|
|
318
329
|
this.selectedTab = tab;
|
|
319
330
|
}
|
|
@@ -33,9 +33,13 @@ import type { EditorStore } from '../../../EditorStore.js';
|
|
|
33
33
|
import { ElementEditorState } from '../ElementEditorState.js';
|
|
34
34
|
import { activator_setOwnership } from '../../../../graph-modifier/DSL_FunctionActivator_GraphModifierHelper.js';
|
|
35
35
|
import { User } from '@finos/legend-server-sdlc';
|
|
36
|
+
import {
|
|
37
|
+
ActionAlertActionType,
|
|
38
|
+
ActionAlertType,
|
|
39
|
+
} from '@finos/legend-application';
|
|
36
40
|
|
|
37
41
|
//Ownership
|
|
38
|
-
enum HostedServiceOwnershipType {
|
|
42
|
+
export enum HostedServiceOwnershipType {
|
|
39
43
|
DEPLOYMENT_OWNERSHIP = 'deploymentOwnership',
|
|
40
44
|
USERLIST_OWNERSHIP = 'userListOwnership',
|
|
41
45
|
}
|
|
@@ -48,10 +52,6 @@ export const OWNERSHIP_OPTIONS = [
|
|
|
48
52
|
label: DeploymentOwnershipLabel,
|
|
49
53
|
value: HostedServiceOwnershipType.DEPLOYMENT_OWNERSHIP,
|
|
50
54
|
},
|
|
51
|
-
{
|
|
52
|
-
label: UserlistOwnershipLabel,
|
|
53
|
-
value: HostedServiceOwnershipType.USERLIST_OWNERSHIP,
|
|
54
|
-
},
|
|
55
55
|
];
|
|
56
56
|
|
|
57
57
|
export enum ACTIVATOR_EDITOR_TAB {
|
|
@@ -182,13 +182,40 @@ export class HostedServiceFunctionActivatorEditorState extends ElementEditorStat
|
|
|
182
182
|
*deployToSandbox(): GeneratorFn<void> {
|
|
183
183
|
this.deployState.inProgress();
|
|
184
184
|
try {
|
|
185
|
-
yield this.editorStore.graphManagerState.graphManager
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
185
|
+
yield this.editorStore.graphManagerState.graphManager
|
|
186
|
+
.publishFunctionActivatorToSandbox(
|
|
187
|
+
this.activator,
|
|
188
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
|
189
|
+
)
|
|
190
|
+
.then((response) =>
|
|
191
|
+
this.editorStore.applicationStore.alertService.setActionAlertInfo({
|
|
192
|
+
message: `Hosted Service Function Activator has been deployed successfully`,
|
|
193
|
+
prompt: response.deploymentLocation
|
|
194
|
+
? 'You can now launch and monitor the operation of your function activator'
|
|
195
|
+
: undefined,
|
|
196
|
+
type: ActionAlertType.STANDARD,
|
|
197
|
+
actions: [
|
|
198
|
+
...(response.deploymentLocation !== undefined
|
|
199
|
+
? [
|
|
200
|
+
{
|
|
201
|
+
label: 'Launch Service',
|
|
202
|
+
type: ActionAlertActionType.PROCEED,
|
|
203
|
+
handler: (): void => {
|
|
204
|
+
this.editorStore.applicationStore.navigationService.navigator.visitAddress(
|
|
205
|
+
response.deploymentLocation ?? '',
|
|
206
|
+
);
|
|
207
|
+
},
|
|
208
|
+
default: true,
|
|
209
|
+
},
|
|
210
|
+
]
|
|
211
|
+
: []),
|
|
212
|
+
{
|
|
213
|
+
label: 'Close',
|
|
214
|
+
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
}),
|
|
218
|
+
);
|
|
192
219
|
} catch (error) {
|
|
193
220
|
assertErrorThrown(error);
|
|
194
221
|
this.editorStore.applicationStore.notificationService.notifyError(error);
|
package/tsconfig.json
CHANGED
|
@@ -254,6 +254,7 @@
|
|
|
254
254
|
"./src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_NewSchemaSetDriver.tsx",
|
|
255
255
|
"./src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.tsx",
|
|
256
256
|
"./src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.tsx",
|
|
257
|
+
"./src/components/editor/editor-group/function-activator/ActivatorFormComponents.tsx",
|
|
257
258
|
"./src/components/editor/editor-group/function-activator/FunctionEditor.tsx",
|
|
258
259
|
"./src/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.tsx",
|
|
259
260
|
"./src/components/editor/editor-group/function-activator/INTERNAL__UnknownFunctionActivatorEdtior.tsx",
|