Skip to content

Commit 75b797d

Browse files
committed
some small fixes
1 parent 400de05 commit 75b797d

File tree

3 files changed

+11
-80
lines changed

3 files changed

+11
-80
lines changed

src/app/dfSlice.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,6 @@ export const dataFormulatorSlice = createSlice({
675675

676676
console.log("load model complete");
677677
console.log("state.models", state.models);
678-
console.log("state.selectedModelId", state.selectedModelId);
679-
console.log("state.testedModels", state.testedModels);
680678
})
681679
.addCase(fetchCodeExpl.fulfilled, (state, action) => {
682680
let codeExpl = action.payload;

src/views/ConceptCard.tsx

Lines changed: 9 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,15 @@ export const ConceptCard: FC<ConceptCardProps> = function ConceptCard({ field })
116116
}),
117117
}));
118118

119-
let notInAnyTable = tables.some(t => t.names.includes(field.name));
120-
121119
let notInFocusedTable : boolean;
122120
if (field.source == "derived") {
123121
let parentConceptNames = (field.transform as ConceptTransformation)
124122
.parentIDs.map((parentID) => conceptShelfItems.find(c => c.id == parentID) as FieldItem).map(f => f.name);
125-
console.log(parentConceptNames)
126123
notInFocusedTable = parentConceptNames.some(name => !focusedChartRefTable?.names.includes(name));
127124
} else {
128125
notInFocusedTable = !focusedChartRefTable?.names.includes(field.name);
129126
}
130127

131-
132-
133128
let opacity = isDragging ? 0.3 :(notInFocusedTable ? 0.65 : 1);
134129
let fontStyle = "inherit";
135130
let border = "hidden";
@@ -177,21 +172,6 @@ export const ConceptCard: FC<ConceptCardProps> = function ConceptCard({ field })
177172
//deleteOption
178173
]
179174

180-
let exampleToComponent = (values: any[], exampleSize: number, label?: string) => {
181-
let examples = values.slice(0, values.length > exampleSize ? exampleSize : values.length);
182-
let incomplete = examples.length < values.length;
183-
184-
return (
185-
values.length == 0 ? "" : (<Typography className="draggable-card-example-values" key={examples.toString()}
186-
sx={{ fontSize: "inherit", textOverflow: "ellipsis", overflow: "hidden", whiteSpace: "nowrap" }}>
187-
{label ? <Typography variant="body2" sx={{ fontSize: 14 }}>
188-
{label}:
189-
</Typography> : ""}
190-
{examples.map((v: any) => String(v)).join(", ")} {incomplete ? "..." : ""}
191-
</Typography>)
192-
);
193-
}
194-
195175
const editModeCard = (
196176
<CardContent className="draggable-card-body-edit-mode">
197177
{field.source == "derived" ? <DerivedConceptForm concept={field} handleUpdateConcept={handleUpdateConcept}
@@ -398,7 +378,6 @@ export const CustomConceptForm: FC<ConceptFormProps> = function CustomConceptFor
398378
)
399379

400380
let cardTopComponents = undefined;
401-
let cardBottomComponents = undefined;
402381

403382
let childrenConceptIDs = [concept.id];
404383
while (true) {
@@ -415,43 +394,6 @@ export const CustomConceptForm: FC<ConceptFormProps> = function CustomConceptFor
415394
cardTopComponents = [
416395
nameField,
417396
typeField,
418-
// <Tooltip key="prompt-expand" title="Provide additional prompt to explain the concept">
419-
// <IconButton
420-
// key="prompt-expand"
421-
// color="primary" sx={{
422-
// margin: "auto"
423-
// }}
424-
// size="small" onClick={() => { setDescOptOpen(!descOptOpen); }}>
425-
// <ExpandCircleDownIcon sx={{
426-
// transform: descOptOpen ? "rotate(180deg)" : "rotate(0)",
427-
// transitionProperty: "transform",
428-
// fontSize: 16,
429-
// transitionTimingFunction: "ease-in-out",
430-
// transitionDuration: "0.1s"
431-
// }} />
432-
// </IconButton>
433-
// </Tooltip>
434-
]
435-
436-
cardBottomComponents = [
437-
<Box key="codearea-container" width="100%">
438-
{/*descOptOpen ? <TextField fullWidth value={description} key={`input-description`} onChange={(event: any) => { setDescription(event.target.value) }}
439-
multiline variant="standard" label={"Additional prompt to explain the concept (optional)"} /> : ""*/}
440-
{/* <Autocomplete
441-
id="free-solo-demo"
442-
freeSolo
443-
size="small"
444-
color="primary"
445-
value={description}
446-
onChange={(event: any, newValue: any | null) => { setDescription(newValue || ""); }}
447-
sx={{ flex: 1, "& .MuiAutocomplete-option": { fontSize: '12px' } }}
448-
options={[]}
449-
renderOption={(params, option) => <Typography {...params} style={{ fontSize: "12px" }}>{option}</Typography>}
450-
renderInput={(params) => {
451-
return
452-
}}
453-
/> */}
454-
</Box>
455397
]
456398

457399
const checkCustomConceptDiff = () => {
@@ -473,7 +415,6 @@ export const CustomConceptForm: FC<ConceptFormProps> = function CustomConceptFor
473415
<Box sx={{ overflowX: "clip", display: "flex", flexDirection: "row", justifyContent: "flex-start", alignItems: "baseline" }}>
474416
{cardTopComponents}
475417
</Box>
476-
{cardBottomComponents}
477418
<ButtonGroup size="small" sx={{ "& button": { textTransform: "none", padding: "2px 4px", marginLeft: "4px" }, flexGrow: 1, justifyContent: "right" }}>
478419
<IconButton size="small"
479420
color="primary" aria-label="Delete" component="span"
@@ -603,6 +544,11 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
603544
childrenConceptIDs = [...childrenConceptIDs, ...newChildrens];
604545
}
605546

547+
// this might be a hack, but it works
548+
// the first parent is the concept that the user initially clicks to create the derived concept, thus its tableRef is the affiliated table
549+
// since this locks out other tables to be used as parents, the affiliated table is an invariant for tables created here
550+
let affiliatedTableId = conceptShelfItems.find(f => f.id == conceptTransform.parentIDs[0])?.tableRef;
551+
606552
cardTopComponents = [
607553
nameField,
608554
<FormControl fullWidth key="derived-card-control" sx={{ minWidth: 120 }} size="small">
@@ -618,8 +564,6 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
618564
renderValue={(selected) =>
619565
<Typography key={selected[0]} sx={{ whiteSpace: "normal", fontSize: "inherit" }}>
620566
{selected.map(conceptID => {
621-
console.log(conceptID)
622-
console.log(conceptShelfItems.find(f => f.id == conceptID)?.source)
623567
let chipColor = conceptShelfItems.find(f => f.id == conceptID)?.source == "original" ? theme.palette.primary.light : theme.palette.custom.main;
624568
return <Chip
625569
key={conceptID}
@@ -640,10 +584,8 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
640584
typeof value === "string" ? setTransformParentIDs([value]) : setTransformParentIDs(value);
641585
}}
642586
>
643-
{conceptShelfItems.filter((t) => t.name != "").map((t, i) => (
587+
{conceptShelfItems.filter((t) => t.name != "" && t.tableRef == affiliatedTableId).map((t, i) => (
644588
<MenuItem value={t.id} key={`${concept.id}-${t.id}`} sx={{ fontSize: 12, marginLeft: "0px" }} disabled={childrenConceptIDs.includes(t.id)}>
645-
{/* <Checkbox size="small" checked={transformParentIDs.indexOf(t.id) > -1} />
646-
<ListItemText sx={{fontSize: 12}} primary={t.name} /> */}
647589
{<Checkbox sx={{padding: 0.5}} size="small" checked={transformParentIDs.indexOf(t.id) > -1} />}
648590
{t.name}
649591
</MenuItem>
@@ -662,16 +604,6 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
662604
let colNames: [string[], string] = [parentConcepts.map(f => f.name), name];
663605

664606
viewExamples = (<Box key="viewexample--box" width="100%" sx={{ position: "relative", }}>
665-
{/* <Tooltip title={collapseCode ? "view / edit transformation code" : "hide transformation code"}>
666-
<IconButton color="primary" sx={{
667-
position: "absolute", right: "4px", top: "4px", zIndex: 3,
668-
backgroundColor: collapseCode ? "" : "rgba(2, 136, 209, 0.3)",
669-
"&:hover": { backgroundColor: collapseCode ? "default" : "rgba(2, 136, 209, 0.3)" }
670-
}}
671-
size="small" onClick={() => { setCollapseCode(!collapseCode); setCollapseVisInspector(true); }}>
672-
<TerminalIcon fontSize="small" />
673-
</IconButton>
674-
</Tooltip> */}
675607
<InputLabel shrink>illustration of the generated function</InputLabel>
676608
<GroupItems sx={{ padding: "0px 0px 6px 0px", margin: 0 }}>
677609
{simpleTableView(transformResult, colNames, conceptShelfItems, 5)}
@@ -703,10 +635,9 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
703635
let candidates = processCodeCandidates(rawCodeList, transformParentIDs, conceptShelfItems, tables)
704636
let candidate = candidates[0];
705637

706-
setCodeCandidates(candidates); // setCodeCandidates(codeList)
638+
setCodeCandidates(candidates);
707639
setTransformCode(candidate);
708640

709-
710641
if (candidates.length > 0) {
711642
dispatch(dfActions.addMessages({
712643
"timestamp": Date.now(),
@@ -940,11 +871,12 @@ export const CodexDialogBox: FC<CodexDialogBoxProps> = function ({
940871
let textBox = <Box key="interaction-comp" width='100%' sx={{ display: 'flex' }}>
941872
<TextField
942873
size="small"
874+
sx={{fontSize: 12}}
943875
color="primary"
944876
fullWidth
945877
disabled={outputName == ""}
946878
InputProps={{
947-
endAdornment: formulateButton
879+
endAdornment: formulateButton,
948880
}}
949881
InputLabelProps={{ shrink: true }}
950882
multiline

src/views/DataThread.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ export const DataThread: FC<{}> = function ({ }) {
453453
}
454454
for (let i = 0; i < leafTables.length; i++) {
455455
let aAncestors = getAncestorOrders(leafTables[i]);
456-
console.log(leafTables[i].id, aAncestors);
456+
// this is for debugging ancestor orders
457+
//console.log(leafTables[i].id, aAncestors);
457458
}
458459
leafTables.sort((a, b) => {
459460
let aAncestors = getAncestorOrders(a);

0 commit comments

Comments
 (0)