Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: LEAP-859: Fix data manager breaking on displaying specific data #5692

Merged
merged 8 commits into from
Apr 11, 2024
Merged
8 changes: 4 additions & 4 deletions web/dist/apps/labelstudio/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"message": "Merge branch 'develop' into 'fb-HUMSIG-37-visuals'",
"commit": "309851f803a1995c36b11f416f80cff709b6be2f",
"date": "2024-04-04T16:34:09.000Z",
"branch": "fb-HUMSIG-37-visuals"
"message": "fix: LEAP-859: Fix data manager breaking on displaying specific data",
"commit": "0585e0651dbece8896d51078bfced6a39e8336f1",
"date": "2024-04-08T12:48:22.000Z",
"branch": "fb-leap-859/colimn-special-characters"
}
2 changes: 1 addition & 1 deletion web/dist/libs/datamanager/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/datamanager/main.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions web/dist/libs/datamanager/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"message": "Merge branch 'develop' into 'fb-HUMSIG-37-visuals'",
"commit": "309851f803a1995c36b11f416f80cff709b6be2f",
"date": "2024-04-04T16:34:09.000Z",
"branch": "fb-HUMSIG-37-visuals"
"message": "fix: LEAP-859: Fix data manager breaking on displaying specific data",
"commit": "0585e0651dbece8896d51078bfced6a39e8336f1",
"date": "2024-04-08T12:48:22.000Z",
"branch": "fb-leap-859/colimn-special-characters"
}
8 changes: 4 additions & 4 deletions web/dist/libs/editor/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"message": "Merge branch 'develop' into 'fb-HUMSIG-37-visuals'",
"commit": "309851f803a1995c36b11f416f80cff709b6be2f",
"date": "2024-04-04T16:34:09.000Z",
"branch": "fb-HUMSIG-37-visuals"
"message": "fix: LEAP-859: Fix data manager breaking on displaying specific data",
"commit": "0585e0651dbece8896d51078bfced6a39e8336f1",
"date": "2024-04-08T12:48:22.000Z",
"branch": "fb-leap-859/colimn-special-characters"
}
8 changes: 8 additions & 0 deletions web/libs/datamanager/src/components/CellViews/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {toStudlyCaps} from "strman";
Gondragos marked this conversation as resolved.
Show resolved Hide resolved

export { Agreement } from './Agreement/Agreement';
export {
Annotators,
Expand All @@ -15,3 +17,9 @@ export { StringCell as Text } from "./StringCell";
export { VideoCell as Video } from "./VideoCell";
export { ProjectCell as Project } from './ProjectCell';

export function normalizeCellAlias(alias) {
const safeAlias = alias
Gondragos marked this conversation as resolved.
Show resolved Hide resolved
// remove trailing separators to make `toStudlyCaps` safe
.replace(/[-_\s]+$/g, '');
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
return toStudlyCaps(safeAlias);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { observer } from "mobx-react";
import React from "react";
import { toStudlyCaps } from 'strman';
import { Block } from "../../../../utils/bem";
import { FF_LOPS_E_3, isFF } from "../../../../utils/feature-flags";
import { normalizeCellAlias } from "../../../CellViews";
import { SkeletonLoader } from "../../SkeletonLoader";
import { TableContext, TableElem } from "../TableContext";
import { getProperty, getStyle } from "../utils";
import "./TableRow.styl";
import { SkeletonLoader } from "../../SkeletonLoader";
import { FF_LOPS_E_3, isFF } from "../../../../utils/feature-flags";

const CellRenderer = observer(
({ col: colInput, data, decoration, cellViews }) => {
Expand All @@ -24,7 +24,7 @@ const CellRenderer = observer(


const valuePath = id.split(":")[1] ?? id;
const altType = toStudlyCaps(valuePath);
const altType = normalizeCellAlias(valuePath);
const value = getProperty(data, valuePath);

const Renderer = cellViews[altType] ?? cellViews[col.original.currentType] ?? cellViews.String;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { observer } from "mobx-react";
import React from "react";
import { toStudlyCaps } from 'strman';
import { Block } from "../../../../utils/bem";
import { TableContext, TableElem } from "../TableContext";
import { getProperty, getStyle } from "../utils";
import { FF_LOPS_E_3, isFF } from "../../../../utils/feature-flags";
import { normalizeCellAlias } from "../../../CellViews";
import { SkeletonLoader } from "../../SkeletonLoader";
import "./TableRow.styl";
import { FF_LOPS_E_3, isFF } from "../../../../utils/feature-flags";
import { TableContext, TableElem } from "../TableContext";
import { getProperty, getStyle } from "../utils";

const CellRenderer = observer(
({ col: colInput, data, decoration, cellViews }) => {
Expand All @@ -24,7 +24,7 @@ const CellRenderer = observer(


const valuePath = id.split(":")[1] ?? id;
const altType = toStudlyCaps(valuePath);
const altType = normalizeCellAlias(valuePath);
const value = getProperty(data, valuePath);

const Renderer = cellViews[altType] ?? cellViews[col.original.currentType] ?? cellViews.String;
Expand Down
15 changes: 12 additions & 3 deletions web/libs/datamanager/src/stores/Tabs/tab_column.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { getRoot, getSnapshot, types } from "mobx-state-tree";
import React from "react";
import { toStudlyCaps } from "strman";
import { CommentCheck, CommentRed, LsAnnotation, LsBanSquare, LsSparkSquare, LsStarSquare, LsThumbsDown, LsThumbsUp } from "../../assets/icons";
import {
CommentCheck,
CommentRed,
LsAnnotation,
LsBanSquare,
LsSparkSquare,
LsStarSquare,
LsThumbsDown,
LsThumbsUp
} from "../../assets/icons";
import * as CellViews from "../../components/CellViews";
import { normalizeCellAlias } from "../../components/CellViews";
import { all } from "../../utils/utils";
import { StringOrNumberID } from "../types";

Expand Down Expand Up @@ -214,7 +223,7 @@ export const TabColumn = types
},

get filterable() {
return ((CellViews[self.type] ?? CellViews[toStudlyCaps(self.alias)])?.filterable) !== false;
return ((CellViews[self.type] ?? CellViews[normalizeCellAlias(self.alias)])?.filterable) !== false;
Gondragos marked this conversation as resolved.
Show resolved Hide resolved
},
}))
.actions((self) => ({
Expand Down
12 changes: 4 additions & 8 deletions web/libs/datamanager/src/stores/Tabs/tab_filter.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { flow, getParent, getRoot, types } from "mobx-state-tree";
import { toStudlyCaps } from "strman";
import * as Filters from "../../components/Filters/types";
import * as CellViews from "../../components/CellViews";
import { normalizeCellAlias } from "../../components/CellViews";
import * as Filters from "../../components/Filters/types";
import { allowedFilterOperations } from "../../components/Filters/types/Utility";
import { debounce } from "../../utils/debounce";
import { isBlank, isDefined } from "../../utils/utils";
import {
FilterValueRange,
FilterValueType,
TabFilterType
} from "./tab_filter_type";
import { FilterValueRange, FilterValueType, TabFilterType } from "./tab_filter_type";

const operatorNames = Array.from(
new Set(
Expand Down Expand Up @@ -99,7 +95,7 @@ export const TabFilter = types
get cellView() {
const col = self.filter.field;

return CellViews[col.type] ?? CellViews[toStudlyCaps(col.alias)];
return CellViews[col.type] ?? CellViews[normalizeCellAlias(col.alias)];
},
}))
.volatile(() => ({
Expand Down