All files / src/form/cells RelateObjects.tsx

100% Statements 8/8
100% Branches 4/4
100% Functions 1/1
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35          66x 9x 8x   8x 8x 1x 1x         7x                                  
import React, { ReactElement } from "react";
import { ListComponent } from "../../form";
import { Empty } from "antd";
import { DetailPanelProps } from "@props/RecordProps";
 
const RelateObjects = (props: DetailPanelProps): ReactElement => {
  const { ownerClass, record, column, zIndex, isCurrentActiveTab } = props;
  const { fieldType, elementType, key, extInfo } = column;
 
  const elementDomain = column.elementDomain ?? elementType;
  if (!elementDomain) {
    const description = `Error to get ${JSON.stringify(column)}`;
    return (<Empty
      image={Empty.PRESENTED_IMAGE_SIMPLE}
      description={description}
    />);
  } else {
    return (
      <ListComponent
        isCurrentActiveTab={isCurrentActiveTab}
        domainName={elementDomain}
        columnNameInOwnerClass={key}
        ownerClass={ownerClass}
        ownerId={record?.id}
        tableMode="detail"
        inline={false}
        zIndex={zIndex + 1}
        fieldType={fieldType}
        displayForm={extInfo?.displayForm}
      />);
  }
};
 
export default RelateObjects;