@finos/legend-extension-dsl-data-quality
Version:
Legend extension for Data Quality
33 lines • 4.25 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
* Copyright (c) 2026-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 { Badge, Checkbox, clsx, PlusIcon, Switch } from '@finos/legend-art';
import { PrimitiveType } from '@finos/legend-graph';
import { InlineLambdaEditor } from '@finos/legend-query-builder';
import { DataQualityRelationLambdaGUIValidationEditor } from './DataQualityRelationLambdaGUIValidationEditor.js';
import { SuggestionType } from './states/DataQualityRelationValidationSuggestedValidationState.js';
export const DataQualityRelationValidationSuggestionItem = observer((props) => {
const { validationState, configurationState } = props;
const validation = validationState.relationValidation;
const suggestionType = configurationState.suggestedValidationsState.getSuggestionType(validationState);
return (_jsx("div", { className: "relation-validation__container", children: _jsxs("div", { className: clsx('relation-validation', {
backdrop__element: validationState.parserError,
}), children: [_jsxs("div", { className: "relation-validation__content", children: [suggestionType === SuggestionType.EDIT && (_jsx(Badge, { className: "rule-suggestion-panel__badge rule-suggestion-panel__badge--modification", title: 'MODIFICATION' })), suggestionType === SuggestionType.NEW && (_jsx(Badge, { className: "rule-suggestion-panel__badge rule-suggestion-panel__badge--new", title: 'NEW' })), _jsx("input", { className: "relation-validation__content__name", spellCheck: false, disabled: true, value: validation.name, placeholder: "Validation name" }), validationState.canEditInGUI && (_jsxs("div", { className: "data-quality-uml-element-editor__editor-switch-container", children: [_jsx(Switch, { checked: validationState.isTextEditor, size: "small", id: `suggestion-switch-${validation._UUID}`, onChange: () => validationState.toggleEditorMode(), disabled: false }), _jsx("label", { className: "data-quality-uml-element-editor__lambda__label", htmlFor: `suggestion-switch-${validation._UUID}`, children: '</> Code' })] })), _jsx("button", { className: "uml-element-editor__remove-btn btn--success", onClick: () => configurationState.applyOrModifySuggestion(validationState), tabIndex: -1, title: "Add this validation", children: _jsx(PlusIcon, {}) }), _jsx(Checkbox, { checked: validationState.isSelected, className: "ml-2 p-0", size: "large", onChange: (_, checked) => {
validationState.setIsSelected(checked);
} })] }), _jsxs("div", { className: "data-quality-uml-element-editor__lambda", children: [_jsx("div", { className: "data-quality-uml-element-editor__lambda__label", children: "Assertion" }), _jsxs("div", { className: "data-quality-uml-element-editor__lambda__value", children: [validationState.isTextEditor && (_jsx(InlineLambdaEditor, { disabled: true, lambdaEditorState: validationState, forceBackdrop: false, expectedType: PrimitiveType.BOOLEAN, disablePopUp: true, className: "relation-validation__lambda" })), validationState.isGUIEditor && (_jsx(DataQualityRelationLambdaGUIValidationEditor, { disabled: true, validationState: validationState }))] })] }), _jsxs("div", { className: "relation-validation-editor__content", children: [_jsx("div", { className: "data-quality-uml-element-editor__lambda__label", children: "Description" }), _jsx("input", { className: "relation-validation-editor__content__name", spellCheck: false, disabled: true, value: validation.description ?? '', placeholder: "Enter the description" })] })] }) }));
});
//# sourceMappingURL=DataQualityReltionValidationSuggestionItem.js.map