UNPKG

@finos/legend-studio

Version:
57 lines 3.1 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /** * 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 { observer } from 'mobx-react-lite'; import { ExternalFormatConnection, PackageableElementExplicitReference, UrlStream, } from '@finos/legend-graph'; import { computed, makeObservable } from 'mobx'; import { ConnectionValueState } from '../../../../stores/editor-state/element-editor-state/connection/ConnectionEditorState.js'; import { NewConnectionValueDriver } from '../../../../stores/editor/NewElementState.js'; import { externalFormat_urlStream_setUrl } from '../../../../stores/graphModifier/DSLExternalFormat_GraphModifierHelper.js'; export class ExternalFormatConnectionValueState extends ConnectionValueState { connection; constructor(editorStore, connection) { super(editorStore, connection); this.connection = connection; } label() { return 'external format connection'; } } export const ExternalFormatConnectionEditor = observer((props) => { const { connectionValueState, isReadOnly } = props; const connection = connectionValueState.connection; const changeUrl = (event) => externalFormat_urlStream_setUrl(connection.externalSource, event.target.value); return (_jsx("div", { className: "external-format-connection-editor", children: _jsxs("div", { className: "external-format-connection-editor__section", children: [_jsx("div", { className: "external-format-connection-editor__section__header__label", children: "URL" }), _jsx("div", { className: "external-format-connection-editor__section__header__prompt", children: "Specifies the connection URL" }), _jsx("textarea", { className: "external-format-connection-editor__section__textarea", spellCheck: false, value: connection.externalSource.url, onChange: changeUrl, disabled: isReadOnly })] }) })); }); export class NewExternalFormatConnectionDriver extends NewConnectionValueDriver { constructor(editorStore) { super(editorStore); makeObservable(this, { isValid: computed, }); } get isValid() { return true; } createConnection(store) { const externalFormatConnection = new ExternalFormatConnection(PackageableElementExplicitReference.create(store)); const urlStream = new UrlStream(); externalFormat_urlStream_setUrl(urlStream, ''); externalFormatConnection.externalSource = urlStream; return externalFormatConnection; } } //# sourceMappingURL=ExternalFormatConnectionEditor.js.map