@finos/legend-extension-dsl-data-space-studio
Version:
Legend extension for Data Space DSL - Studio
60 lines • 2.61 kB
JavaScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NewElementDriver, } from '@finos/legend-application-studio';
import { DataSpace, DataSpaceExecutionContext, DataSpaceSupportCombinedInfo, } from '@finos/legend-extension-dsl-data-space/graph';
import { PackageableElementExplicitReference, stub_Mapping, stub_PackageableRuntime, } from '@finos/legend-graph';
import { action, makeObservable, observable } from 'mobx';
import { dataSpace_setDescription, dataSpace_setSupportInfo, dataSpace_setTitle, } from '../stores/studio/DSL_DataSpace_GraphModifierHelper.js';
export class NewDataProductDriver extends NewElementDriver {
title;
description;
constructor(editorStore) {
super(editorStore);
makeObservable(this, {
title: observable,
description: observable,
setTitle: action,
setDescription: action,
});
this.title = '';
this.description = '';
}
setTitle(value) {
this.title = value;
}
setDescription(value) {
this.description = value;
}
get isValid() {
return Boolean(this.title && this.description);
}
createElement(name) {
const dataSpace = new DataSpace(name);
const dataSpaceExecutionContext = new DataSpaceExecutionContext();
dataSpaceExecutionContext.name = 'defaultContext';
dataSpaceExecutionContext.mapping =
PackageableElementExplicitReference.create(stub_Mapping());
dataSpaceExecutionContext.defaultRuntime =
PackageableElementExplicitReference.create(stub_PackageableRuntime());
dataSpace.executionContexts = [dataSpaceExecutionContext];
dataSpace.defaultExecutionContext = dataSpaceExecutionContext;
dataSpace_setTitle(dataSpace, this.title);
dataSpace_setDescription(dataSpace, this.description);
dataSpace_setSupportInfo(dataSpace, new DataSpaceSupportCombinedInfo());
return dataSpace;
}
}
//# sourceMappingURL=DSL_DataProduct_ElementDriver.js.map