@finos/legend-application-studio 28.15.5 → 28.15.6
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +5 -0
- package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts +1 -1
- 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 -4
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.d.ts +19 -0
- package/lib/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.js +175 -0
- package/lib/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.js.map +1 -0
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js +18 -5
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +4 -1
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.js +5 -1
- package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js +17 -2
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.d.ts +53 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js +150 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js.map +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
- package/lib/stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.d.ts +28 -0
- package/lib/stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.d.ts.map +1 -0
- package/lib/stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.js +55 -0
- package/lib/stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.js.map +1 -0
- package/package.json +4 -4
- package/src/components/editor/editor-group/EditorGroup.tsx +10 -0
- package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +10 -6
- package/src/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.tsx +631 -0
- package/src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx +51 -3
- package/src/stores/editor/EditorGraphState.ts +3 -0
- package/src/stores/editor/EditorTabManagerState.ts +7 -0
- package/src/stores/editor/editor-state/element-editor-state/FunctionActivatorState.ts +17 -1
- package/src/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.ts +212 -0
- package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
- package/src/stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.ts +96 -0
- package/tsconfig.json +3 -0
@@ -33,17 +33,19 @@ import {
|
|
33
33
|
generateFunctionPrettyName,
|
34
34
|
RelationalDatabaseConnection,
|
35
35
|
DatabaseType,
|
36
|
+
DeploymentOwner,
|
36
37
|
} from '@finos/legend-graph';
|
37
38
|
import { observer } from 'mobx-react-lite';
|
38
39
|
import { useApplicationStore } from '@finos/legend-application';
|
39
40
|
import { useEditorStore } from '../../EditorStoreProvider.js';
|
40
41
|
import { SnowflakeAppFunctionActivatorEdtiorState } from '../../../../stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
|
41
42
|
import { flowResult } from 'mobx';
|
42
|
-
import { useRef } from 'react';
|
43
|
+
import { useRef, useState } from 'react';
|
43
44
|
import {
|
44
45
|
buildRelationalDatabaseConnectionOption,
|
45
46
|
type RelationalDatabaseConnectionOption,
|
46
47
|
} from '../connection-editor/RelationalDatabaseConnectionEditor.js';
|
48
|
+
import { activator_setDeploymentOwner } from '../../../../stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.js';
|
47
49
|
|
48
50
|
export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
49
51
|
const editorStore = useEditorStore();
|
@@ -51,7 +53,9 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
51
53
|
const editorState = editorStore.tabManagerState.getCurrentEditorState(
|
52
54
|
SnowflakeAppFunctionActivatorEdtiorState,
|
53
55
|
);
|
56
|
+
const isReadOnly = editorState.isReadOnly;
|
54
57
|
const activator = editorState.activator;
|
58
|
+
const ownership = activator.ownership;
|
55
59
|
const connectionSelectorRef = useRef<SelectComponent>(null);
|
56
60
|
const connectionFilterOption = createFilter({
|
57
61
|
ignoreCase: true,
|
@@ -86,7 +90,7 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
86
90
|
: initializeActivationConnection(connectionOptions.at(0)?.value);
|
87
91
|
|
88
92
|
const changeConnection = (val: RelationalDatabaseConnectionOption): void => {
|
89
|
-
if (val.value === activationConnection) {
|
93
|
+
if (!isReadOnly && val.value === activationConnection) {
|
90
94
|
return;
|
91
95
|
}
|
92
96
|
editorState.updateConnection(val.value);
|
@@ -94,7 +98,9 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
94
98
|
const changeDescription: React.ChangeEventHandler<HTMLTextAreaElement> = (
|
95
99
|
event,
|
96
100
|
) => {
|
97
|
-
|
101
|
+
if (!isReadOnly) {
|
102
|
+
editorState.updateAppDescription(event.target.value);
|
103
|
+
}
|
98
104
|
};
|
99
105
|
const visitFunction = (): void =>
|
100
106
|
editorState.editorStore.graphEditorMode.openElement(
|
@@ -116,6 +122,17 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
116
122
|
);
|
117
123
|
};
|
118
124
|
|
125
|
+
//Ownership
|
126
|
+
const [ownerInputValue, setOwner] = useState<string>('');
|
127
|
+
const updateDeploymentIdentifier: React.ChangeEventHandler<
|
128
|
+
HTMLInputElement
|
129
|
+
> = (event) => {
|
130
|
+
if (!isReadOnly) {
|
131
|
+
setOwner(event.target.value);
|
132
|
+
activator_setDeploymentOwner(ownership, event.target.value);
|
133
|
+
}
|
134
|
+
};
|
135
|
+
|
119
136
|
return (
|
120
137
|
<div className="snowflake-app-function-activator-editor">
|
121
138
|
<Panel>
|
@@ -225,6 +242,7 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
225
242
|
<PanelForm>
|
226
243
|
<PanelFormTextField
|
227
244
|
value={activator.applicationName}
|
245
|
+
isReadOnly={isReadOnly}
|
228
246
|
name="Activator Identifer"
|
229
247
|
placeholder="Specify the name of the UDTF for this activator..."
|
230
248
|
update={(value: string | undefined): void =>
|
@@ -241,11 +259,41 @@ export const SnowflakeAppFunctionActivatorEditor = observer(() => {
|
|
241
259
|
<textarea
|
242
260
|
className="panel__content__form__section__textarea service-editor__documentation__input"
|
243
261
|
spellCheck={false}
|
262
|
+
disabled={isReadOnly}
|
244
263
|
value={activator.description}
|
245
264
|
onChange={changeDescription}
|
246
265
|
/>
|
247
266
|
</div>
|
248
267
|
</PanelForm>
|
268
|
+
<PanelForm>
|
269
|
+
<div>
|
270
|
+
<div className="panel__content__form__section">
|
271
|
+
<div className="panel__content__form__section__header__label">
|
272
|
+
Ownership
|
273
|
+
</div>
|
274
|
+
<div className="panel__content__form__section__header__prompt">
|
275
|
+
The ownership model you want to use to control your snowflake
|
276
|
+
app.
|
277
|
+
</div>
|
278
|
+
</div>
|
279
|
+
{ownership instanceof DeploymentOwner && (
|
280
|
+
<div className="panel__content__form__section">
|
281
|
+
<div>
|
282
|
+
<div className="panel__content__form__section__header__label">
|
283
|
+
Deployment Identifier :
|
284
|
+
</div>
|
285
|
+
<input
|
286
|
+
className="panel__content__form__section__input"
|
287
|
+
spellCheck={false}
|
288
|
+
disabled={isReadOnly}
|
289
|
+
value={ownerInputValue}
|
290
|
+
onChange={updateDeploymentIdentifier}
|
291
|
+
/>
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
)}
|
295
|
+
</div>
|
296
|
+
</PanelForm>
|
249
297
|
</PanelContent>
|
250
298
|
</Panel>
|
251
299
|
</div>
|
@@ -89,6 +89,7 @@ import {
|
|
89
89
|
ExecutionEnvironmentInstance,
|
90
90
|
SnowflakeApp,
|
91
91
|
GraphEntities,
|
92
|
+
HostedService,
|
92
93
|
} from '@finos/legend-graph';
|
93
94
|
import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
|
94
95
|
import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
|
@@ -872,6 +873,8 @@ export class EditorGraphState {
|
|
872
873
|
return PACKAGEABLE_ELEMENT_TYPE.EXECUTION_ENVIRONMENT;
|
873
874
|
} else if (element instanceof SnowflakeApp) {
|
874
875
|
return PACKAGEABLE_ELEMENT_TYPE.SNOWFLAKE_APP;
|
876
|
+
} else if (element instanceof HostedService) {
|
877
|
+
return PACKAGEABLE_ELEMENT_TYPE.HOSTED_SERVICE;
|
875
878
|
}
|
876
879
|
const extraElementTypeLabelGetters = this.editorStore.pluginManager
|
877
880
|
.getApplicationPlugins()
|
@@ -34,6 +34,7 @@ import {
|
|
34
34
|
Service,
|
35
35
|
INTERNAL__UnknownFunctionActivator,
|
36
36
|
SnowflakeApp,
|
37
|
+
HostedService,
|
37
38
|
} from '@finos/legend-graph';
|
38
39
|
import {
|
39
40
|
type Clazz,
|
@@ -61,6 +62,7 @@ import type { DSL_LegendStudioApplicationPlugin_Extension } from '../LegendStudi
|
|
61
62
|
import { TabManagerState } from '@finos/legend-lego/application';
|
62
63
|
import { INTERNAL__UnknownFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js';
|
63
64
|
import { SnowflakeAppFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
|
65
|
+
import { HostedServiceFunctionActivatorEditorState } from './editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js';
|
64
66
|
|
65
67
|
export class EditorTabManagerState extends TabManagerState {
|
66
68
|
readonly editorStore: EditorStore;
|
@@ -133,6 +135,11 @@ export class EditorTabManagerState extends TabManagerState {
|
|
133
135
|
this.editorStore,
|
134
136
|
element,
|
135
137
|
);
|
138
|
+
} else if (element instanceof HostedService) {
|
139
|
+
return new HostedServiceFunctionActivatorEditorState(
|
140
|
+
this.editorStore,
|
141
|
+
element,
|
142
|
+
);
|
136
143
|
} else if (element instanceof INTERNAL__UnknownFunctionActivator) {
|
137
144
|
return new INTERNAL__UnknownFunctionActivatorEdtiorState(
|
138
145
|
this.editorStore,
|
@@ -25,8 +25,9 @@ import {
|
|
25
25
|
extractPackagePathFromPath,
|
26
26
|
SnowflakeAppDeploymentConfiguration,
|
27
27
|
DeploymentOwner,
|
28
|
+
HostedService,
|
28
29
|
} from '@finos/legend-graph';
|
29
|
-
import { type GeneratorFn } from '@finos/legend-shared';
|
30
|
+
import { uuid, type GeneratorFn } from '@finos/legend-shared';
|
30
31
|
import { FUNCTION_ACTIVATE_TYPE } from '../../../../components/editor/editor-group/function-activator/FunctionEditor.js';
|
31
32
|
|
32
33
|
const BASE_ACTIVATOR_NAME = 'NewActivator';
|
@@ -100,6 +101,21 @@ export class FunctionActivatorState {
|
|
100
101
|
new SnowflakeAppDeploymentConfiguration();
|
101
102
|
return snowflakeApp;
|
102
103
|
}
|
104
|
+
case FUNCTION_ACTIVATE_TYPE.HOSTED_SERVICE: {
|
105
|
+
const activatorName = this.activatorPath.includes('::')
|
106
|
+
? extractElementNameFromPath(this.activatorPath)
|
107
|
+
: this.activatorPath;
|
108
|
+
const hostedService = new HostedService(activatorName);
|
109
|
+
hostedService.documentation = '';
|
110
|
+
hostedService.ownership = new DeploymentOwner('', hostedService);
|
111
|
+
hostedService.pattern = `/${uuid()}`;
|
112
|
+
hostedService.autoActivateUpdates = true;
|
113
|
+
hostedService.storeModel = false;
|
114
|
+
hostedService.generateLineage = false;
|
115
|
+
hostedService.function =
|
116
|
+
PackageableElementExplicitReference.create(functionElement);
|
117
|
+
return hostedService;
|
118
|
+
}
|
103
119
|
default:
|
104
120
|
return undefined;
|
105
121
|
}
|
@@ -0,0 +1,212 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import {
|
18
|
+
InMemoryGraphData,
|
19
|
+
HostedService,
|
20
|
+
observe_HostedService,
|
21
|
+
DeploymentOwner,
|
22
|
+
UserList,
|
23
|
+
} from '@finos/legend-graph';
|
24
|
+
import {
|
25
|
+
type GeneratorFn,
|
26
|
+
ActionState,
|
27
|
+
assertErrorThrown,
|
28
|
+
guaranteeType,
|
29
|
+
type PlainObject,
|
30
|
+
} from '@finos/legend-shared';
|
31
|
+
import { makeObservable, action, flow, computed } from 'mobx';
|
32
|
+
import type { EditorStore } from '../../../EditorStore.js';
|
33
|
+
import { ElementEditorState } from '../ElementEditorState.js';
|
34
|
+
import { activator_setOwnership } from '../../../../graph-modifier/DSL_FunctionActivator_GraphModifierHelper.js';
|
35
|
+
import { User } from '@finos/legend-server-sdlc';
|
36
|
+
|
37
|
+
//Ownership
|
38
|
+
enum HostedServiceOwnershipType {
|
39
|
+
DEPLOYMENT_OWNERSHIP = 'deploymentOwnership',
|
40
|
+
USERLIST_OWNERSHIP = 'userListOwnership',
|
41
|
+
}
|
42
|
+
export const MINIMUM_HOSTED_SERVICE_OWNERS = 2;
|
43
|
+
export const DeploymentOwnershipLabel = 'Deployment';
|
44
|
+
export const UserlistOwnershipLabel = 'User List';
|
45
|
+
|
46
|
+
export const OWNERSHIP_OPTIONS = [
|
47
|
+
{
|
48
|
+
label: DeploymentOwnershipLabel,
|
49
|
+
value: HostedServiceOwnershipType.DEPLOYMENT_OWNERSHIP,
|
50
|
+
},
|
51
|
+
{
|
52
|
+
label: UserlistOwnershipLabel,
|
53
|
+
value: HostedServiceOwnershipType.USERLIST_OWNERSHIP,
|
54
|
+
},
|
55
|
+
];
|
56
|
+
|
57
|
+
export type HostedServiceOwnerOption = {
|
58
|
+
label: string;
|
59
|
+
value: string;
|
60
|
+
};
|
61
|
+
|
62
|
+
export class HostedServiceFunctionActivatorEditorState extends ElementEditorState {
|
63
|
+
readonly validateState = ActionState.create();
|
64
|
+
readonly deployState = ActionState.create();
|
65
|
+
|
66
|
+
constructor(editorStore: EditorStore, element: HostedService) {
|
67
|
+
super(editorStore, element);
|
68
|
+
|
69
|
+
makeObservable(this, {
|
70
|
+
activator: computed,
|
71
|
+
reprocess: action,
|
72
|
+
updateDocumentation: action,
|
73
|
+
updatePattern: action,
|
74
|
+
setSelectedOwnership: action,
|
75
|
+
selectedOwnership: computed,
|
76
|
+
storeModel: action,
|
77
|
+
generateLineage: action,
|
78
|
+
validate: flow,
|
79
|
+
deployToSandbox: flow,
|
80
|
+
searchUsers: flow,
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
get activator(): HostedService {
|
85
|
+
return observe_HostedService(
|
86
|
+
guaranteeType(
|
87
|
+
this.element,
|
88
|
+
HostedService,
|
89
|
+
'Element inside hosted service state must be a HostedService',
|
90
|
+
),
|
91
|
+
);
|
92
|
+
}
|
93
|
+
|
94
|
+
updateDocumentation(val: string): void {
|
95
|
+
this.activator.documentation = val;
|
96
|
+
}
|
97
|
+
|
98
|
+
updatePattern(val: string): void {
|
99
|
+
this.activator.pattern = val;
|
100
|
+
}
|
101
|
+
|
102
|
+
storeModel(val: boolean): void {
|
103
|
+
this.activator.storeModel = val;
|
104
|
+
}
|
105
|
+
|
106
|
+
generateLineage(val: boolean): void {
|
107
|
+
this.activator.generateLineage = val;
|
108
|
+
}
|
109
|
+
|
110
|
+
get selectedOwnership(): HostedServiceOwnerOption | undefined {
|
111
|
+
const ownership = this.activator.ownership;
|
112
|
+
if (ownership instanceof DeploymentOwner) {
|
113
|
+
return {
|
114
|
+
label: DeploymentOwnershipLabel,
|
115
|
+
value: HostedServiceOwnershipType.DEPLOYMENT_OWNERSHIP,
|
116
|
+
};
|
117
|
+
} else if (ownership instanceof UserList) {
|
118
|
+
return {
|
119
|
+
label: UserlistOwnershipLabel,
|
120
|
+
value: HostedServiceOwnershipType.USERLIST_OWNERSHIP,
|
121
|
+
};
|
122
|
+
}
|
123
|
+
return undefined;
|
124
|
+
}
|
125
|
+
|
126
|
+
setSelectedOwnership(o: HostedServiceOwnerOption): void {
|
127
|
+
switch (o.value) {
|
128
|
+
case HostedServiceOwnershipType.DEPLOYMENT_OWNERSHIP: {
|
129
|
+
activator_setOwnership(
|
130
|
+
this.activator,
|
131
|
+
new DeploymentOwner('', this.activator),
|
132
|
+
);
|
133
|
+
break;
|
134
|
+
}
|
135
|
+
case HostedServiceOwnershipType.USERLIST_OWNERSHIP: {
|
136
|
+
const currentUserId =
|
137
|
+
this.editorStore.graphManagerState.graphManager.TEMPORARY__getEngineConfig()
|
138
|
+
.currentUserId;
|
139
|
+
activator_setOwnership(
|
140
|
+
this.activator,
|
141
|
+
new UserList(currentUserId ? [currentUserId] : [], this.activator),
|
142
|
+
);
|
143
|
+
break;
|
144
|
+
}
|
145
|
+
default: {
|
146
|
+
this.editorStore.applicationStore.notificationService.notifyError(
|
147
|
+
'Unsupported ownership type',
|
148
|
+
);
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
*validate(): GeneratorFn<void> {
|
154
|
+
this.validateState.inProgress();
|
155
|
+
try {
|
156
|
+
yield this.editorStore.graphManagerState.graphManager.validateFunctionActivator(
|
157
|
+
this.activator,
|
158
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
159
|
+
);
|
160
|
+
this.editorStore.applicationStore.notificationService.notifySuccess(
|
161
|
+
`Hosted Service is valid`,
|
162
|
+
);
|
163
|
+
} catch (error) {
|
164
|
+
assertErrorThrown(error);
|
165
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
166
|
+
} finally {
|
167
|
+
this.validateState.complete();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
*deployToSandbox(): GeneratorFn<void> {
|
172
|
+
this.deployState.inProgress();
|
173
|
+
try {
|
174
|
+
yield this.editorStore.graphManagerState.graphManager.publishFunctionActivatorToSandbox(
|
175
|
+
this.activator,
|
176
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
177
|
+
);
|
178
|
+
this.editorStore.applicationStore.notificationService.notifySuccess(
|
179
|
+
'Hosted Service Function Activator has been deployed successfully',
|
180
|
+
);
|
181
|
+
} catch (error) {
|
182
|
+
assertErrorThrown(error);
|
183
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
184
|
+
} finally {
|
185
|
+
this.deployState.complete();
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
*searchUsers(name: string): GeneratorFn<User[]> {
|
190
|
+
try {
|
191
|
+
return (
|
192
|
+
(yield this.editorStore.sdlcServerClient.getUsers(
|
193
|
+
name,
|
194
|
+
)) as PlainObject<User>[]
|
195
|
+
).map((p) => User.serialization.fromJson(p));
|
196
|
+
} catch (error) {
|
197
|
+
assertErrorThrown(error);
|
198
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
199
|
+
return [];
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
reprocess(
|
204
|
+
newElement: HostedService,
|
205
|
+
editorStore: EditorStore,
|
206
|
+
): HostedServiceFunctionActivatorEditorState {
|
207
|
+
return new HostedServiceFunctionActivatorEditorState(
|
208
|
+
editorStore,
|
209
|
+
newElement,
|
210
|
+
);
|
211
|
+
}
|
212
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import {
|
18
|
+
type HostedService,
|
19
|
+
DEFAULT_HOSTED_SERVICE_PATTERN,
|
20
|
+
type FunctionActivator,
|
21
|
+
type Ownership,
|
22
|
+
observe_FunctionActivatorOwnership,
|
23
|
+
type DeploymentOwner,
|
24
|
+
type UserList,
|
25
|
+
} from '@finos/legend-graph';
|
26
|
+
import { action } from 'mobx';
|
27
|
+
|
28
|
+
export const hostedService_setDocumentation = action(
|
29
|
+
(hostedService: HostedService, val: string): void => {
|
30
|
+
hostedService.documentation = val;
|
31
|
+
},
|
32
|
+
);
|
33
|
+
|
34
|
+
export const hostedService_setAutoActivateUpdates = action(
|
35
|
+
(hostedService: HostedService, val: boolean): void => {
|
36
|
+
hostedService.autoActivateUpdates = val;
|
37
|
+
},
|
38
|
+
);
|
39
|
+
|
40
|
+
export const hostedService_setPattern = action(
|
41
|
+
(hostedService: HostedService, val: string): void => {
|
42
|
+
hostedService.pattern = val;
|
43
|
+
},
|
44
|
+
);
|
45
|
+
|
46
|
+
export const hostedService_removePatternParameter = action(
|
47
|
+
(hostedService: HostedService, value: string): void => {
|
48
|
+
const newPattern = hostedService.pattern
|
49
|
+
.replace(new RegExp(`\\/\\{${value}\\}`, 'ug'), '')
|
50
|
+
.replace(/\/{2,}/gu, '/');
|
51
|
+
hostedService.pattern =
|
52
|
+
newPattern !== '' ? newPattern : DEFAULT_HOSTED_SERVICE_PATTERN;
|
53
|
+
},
|
54
|
+
);
|
55
|
+
|
56
|
+
export const hostedService_setStoreModel = action(
|
57
|
+
(hostedService: HostedService, val: boolean): void => {
|
58
|
+
hostedService.storeModel = val;
|
59
|
+
},
|
60
|
+
);
|
61
|
+
|
62
|
+
export const hostedService_setGenerateLineage = action(
|
63
|
+
(hostedService: HostedService, val: boolean): void => {
|
64
|
+
hostedService.generateLineage = val;
|
65
|
+
},
|
66
|
+
);
|
67
|
+
|
68
|
+
export const activator_setOwnership = action(
|
69
|
+
(activator: FunctionActivator, value: Ownership): void => {
|
70
|
+
activator.ownership = observe_FunctionActivatorOwnership(value);
|
71
|
+
},
|
72
|
+
);
|
73
|
+
|
74
|
+
export const activator_setDeploymentOwner = action(
|
75
|
+
(deploymentOwner: DeploymentOwner, value: string): void => {
|
76
|
+
deploymentOwner.id = value;
|
77
|
+
},
|
78
|
+
);
|
79
|
+
|
80
|
+
export const activator_addUserOwner = action(
|
81
|
+
(userList: UserList, value: string): void => {
|
82
|
+
userList.users.push(value);
|
83
|
+
},
|
84
|
+
);
|
85
|
+
|
86
|
+
export const activator_updateUserOwnership = action(
|
87
|
+
(userList: UserList, value: string, index: number): void => {
|
88
|
+
userList.users[index] = value;
|
89
|
+
},
|
90
|
+
);
|
91
|
+
|
92
|
+
export const activator_deleteValueFromUserOwnership = action(
|
93
|
+
(userList: UserList, index: number): void => {
|
94
|
+
userList.users.splice(index, 1);
|
95
|
+
},
|
96
|
+
);
|
package/tsconfig.json
CHANGED
@@ -107,6 +107,7 @@
|
|
107
107
|
"./src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts",
|
108
108
|
"./src/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_BindingEditorState.ts",
|
109
109
|
"./src/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.ts",
|
110
|
+
"./src/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.ts",
|
110
111
|
"./src/stores/editor/editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.ts",
|
111
112
|
"./src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts",
|
112
113
|
"./src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts",
|
@@ -167,6 +168,7 @@
|
|
167
168
|
"./src/stores/extensions/STO_Relational_LegendStudioApplicationPlugin_Extension.ts",
|
168
169
|
"./src/stores/graph-modifier/DSL_Data_GraphModifierHelper.ts",
|
169
170
|
"./src/stores/graph-modifier/DSL_ExternalFormat_GraphModifierHelper.ts",
|
171
|
+
"./src/stores/graph-modifier/DSL_FunctionActivator_GraphModifierHelper.ts",
|
170
172
|
"./src/stores/graph-modifier/DSL_Generation_GraphModifierHelper.ts",
|
171
173
|
"./src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts",
|
172
174
|
"./src/stores/graph-modifier/DSL_Service_GraphModifierHelper.ts",
|
@@ -234,6 +236,7 @@
|
|
234
236
|
"./src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.tsx",
|
235
237
|
"./src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.tsx",
|
236
238
|
"./src/components/editor/editor-group/function-activator/FunctionEditor.tsx",
|
239
|
+
"./src/components/editor/editor-group/function-activator/HostedServiceFunctionActivatorEditor.tsx",
|
237
240
|
"./src/components/editor/editor-group/function-activator/INTERNAL__UnknownFunctionActivatorEdtior.tsx",
|
238
241
|
"./src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx",
|
239
242
|
"./src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx",
|