mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
feat: add grid display for NLU values based on types of NLU entity
This commit is contained in:
parent
e0a77302cc
commit
d17b920fcf
@ -81,6 +81,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const [selectedNlpValues, setSelectedNlpValues] = useState<string[]>([]);
|
const [selectedNlpValues, setSelectedNlpValues] = useState<string[]>([]);
|
||||||
|
const shouldIncludeSynonyms = nlpEntity?.lookups.includes("keywords");
|
||||||
const actionColumns = useActionColumns<INlpValue>(
|
const actionColumns = useActionColumns<INlpValue>(
|
||||||
EntityType.NLP_VALUE,
|
EntityType.NLP_VALUE,
|
||||||
[
|
[
|
||||||
@ -102,6 +103,19 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
|
|||||||
],
|
],
|
||||||
t("label.operations"),
|
t("label.operations"),
|
||||||
);
|
);
|
||||||
|
const synonymsColumn = {
|
||||||
|
flex: 3,
|
||||||
|
field: "synonyms",
|
||||||
|
headerName: t("label.synonyms"),
|
||||||
|
sortable: true,
|
||||||
|
renderCell: (params) => {
|
||||||
|
return params.row?.expressions?.map((exp, index) => (
|
||||||
|
<Chip sx={{ margin: 0.8 }} label={exp} variant="inbox" key={index} />
|
||||||
|
));
|
||||||
|
},
|
||||||
|
disableColumnMenu: true,
|
||||||
|
renderHeader,
|
||||||
|
};
|
||||||
const columns: GridColDef<INlpValue>[] = [
|
const columns: GridColDef<INlpValue>[] = [
|
||||||
{
|
{
|
||||||
flex: 3,
|
flex: 3,
|
||||||
@ -111,20 +125,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
|
|||||||
disableColumnMenu: true,
|
disableColumnMenu: true,
|
||||||
renderHeader,
|
renderHeader,
|
||||||
},
|
},
|
||||||
{
|
...(shouldIncludeSynonyms ? [synonymsColumn] : []),
|
||||||
flex: 3,
|
|
||||||
field: "synonyms",
|
|
||||||
headerName: t("label.synonyms"),
|
|
||||||
sortable: true,
|
|
||||||
renderCell: (params) => {
|
|
||||||
return params.row?.expressions?.map((exp, index) => (
|
|
||||||
<Chip sx={{ margin: 0.8 }} label={exp} variant="inbox" key={index} />
|
|
||||||
));
|
|
||||||
},
|
|
||||||
disableColumnMenu: true,
|
|
||||||
renderHeader,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
maxWidth: 140,
|
maxWidth: 140,
|
||||||
field: "createdAt",
|
field: "createdAt",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user