Skip to content

Commit

Permalink
MAT-7795 use CqlFunction to line up with madie-measure
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-cecilialiu committed Dec 18, 2024
1 parent f0e0a13 commit fac2c90
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/AceEditor/madie-ace-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Definition } from "../CqlBuilderPanel/definitionsSection/definitionBuil
import { SelectedLibrary } from "../CqlBuilderPanel/Includes/CqlLibraryDetailsDialog";
import { Funct } from "../CqlBuilderPanel/functionsSection/functionBuilder/FunctionBuilder";
import CqlVersion from "@madie/cql-antlr-parser/dist/src/dto/CqlVersion";
import { FunctionLookup } from "../model/CqlBuilderLookup";
import { CQLFunction } from "../model/CqlFunction";

export interface EditorPropsType {
value: string;
Expand All @@ -48,7 +48,7 @@ export interface EditorPropsType {
) => void;
handleDeleteLibrary?: (lib: SelectedLibrary) => void;
handleApplyFunction?: (funct: Funct) => void;
handleFunctionDelete?: (funct: FunctionLookup) => void;
handleFunctionDelete?: (funct: CQLFunction) => void;
parseDebounceTime?: number;
inboundAnnotations?: Ace.Annotation[];
inboundErrorMarkers?: Ace.MarkerLike[];
Expand Down
13 changes: 8 additions & 5 deletions src/CqlBuilderPanel/functionsSection/functions/Functions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
MadieConfirmDialog,
} from "@madie/madie-design-system/dist/react";
import Tooltip from "@mui/material/Tooltip";
import { CQLFunction } from "../../../model/CqlFunction";

const TH = tw.th`p-3 text-left text-sm font-bold capitalize`;
const TD = tw.td`p-3 text-left text-sm break-all`;
Expand Down Expand Up @@ -51,7 +52,7 @@ const Functions = ({
const [visibleFunctions, setVisibleFunctions] = useState<FunctionLookup[]>(
[]
);
const [selectedFunction, setSelectedFunction] = useState<FunctionLookup>();
const [selectedFunction, setSelectedFunction] = useState<CQLFunction>();
const [deleteDialogOpen, setDeleteDialogOpen] = useState<boolean>(false);
const [discardDialog, setDiscardDialog] = useState({
open: false,
Expand Down Expand Up @@ -147,14 +148,16 @@ const Functions = ({
size: "small",
onClick: (e) => {
const tableData = table.getRow(row.cell.row.id).original;
const functionToDelete = {
const functionToDelete: CQLFunction = {
functionName: tableData.name,
comment: tableData.comment,
functionsArguments: tableData.arguments,
fluentFunction: tableData.isFluent,
functionsArguments: row.cell.row.original.argumentNames,
fluentFunction:
tableData.isFluent === "Yes" ? true : false,
expressionValue: tableData.logic,
expression: tableData.logic,
};
setSelectedFunction(tableData);
setSelectedFunction(functionToDelete);
if (!isCQLUnchanged) {
setDiscardDialog({ open: true, operation: "delete" });
} else {
Expand Down
13 changes: 13 additions & 0 deletions src/model/CqlFunction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export interface CQLFunctionArgument {
argumentName?: string;
dataType?: string;
}

export interface CQLFunction {
functionName?: string;
expression?: string;
comment?: string;
fluentFunction?: boolean;
expressionValue?: string;
functionsArguments?: CQLFunctionArgument[];
}

0 comments on commit fac2c90

Please sign in to comment.