diff --git a/src/components/FormField/index.tsx b/src/components/FormField/index.tsx
index 27fcb2e7..6da596b8 100644
--- a/src/components/FormField/index.tsx
+++ b/src/components/FormField/index.tsx
@@ -78,7 +78,12 @@ const FormField = ({
iterable,
format,
} = model;
- const linkedClass = schemaDefn.get(linkedClassName, false);
+ let linkedClass;
+ if (typeof linkedClassName === 'string') {
+ linkedClass = schemaDefn.get(linkedClassName);
+ } else {
+ linkedClass = linkedClassName;
+ }
const inputValue = formContent[name];
const generated = Boolean(model.generated && formVariant !== FORM_VARIANT.SEARCH);
@@ -103,7 +108,6 @@ const FormField = ({
}
let value = inputValue;
-
if (formVariant !== FORM_VARIANT.SEARCH) {
if (value === undefined || (!nullable && value === null)) {
if (defaultValue !== undefined) {
@@ -119,7 +123,6 @@ const FormField = ({
}
let propComponent;
-
if (type === 'boolean') {
propComponent = (
);
} else if (type.includes('embedded') && linkedClass) {
+
if (iterable && linkedClass.name === 'StatementReview') {
+
propComponent = (
);
} else if (linkedClass.name === 'Permissions') {
+
// permissions table of checkboxes
propComponent = (
);
} else if (POSITION_CLASSES.includes(linkedClass.name)) {
+
propComponent = (
{
}}
label={label}
placeholder={
- (disabled || selectedValues.length)
- ? ''
- : placeholder
- }
+ (disabled || selectedValues.length)
+ ? ''
+ : placeholder
+ }
required={required}
/>
)}
@@ -301,7 +301,7 @@ RecordAutocomplete.defaultProps = {
isMulti: false,
label: '',
minSearchLength: 1,
- onChange: () => {},
+ onChange: () => { },
placeholder: 'Search Records by Name or ID',
required: false,
singleLoad: false,
diff --git a/src/components/RecordForm/index.tsx b/src/components/RecordForm/index.tsx
index 9ac8878d..5fb6fd6e 100644
--- a/src/components/RecordForm/index.tsx
+++ b/src/components/RecordForm/index.tsx
@@ -228,11 +228,11 @@ const RecordForm = ({
variant={variant}
/>
- {variant === FORM_VARIANT.VIEW && schemaDefn.get(modelName).inherits.includes('V') && (
+ {variant === FORM_VARIANT.VIEW && schemaDefn.children(modelName).includes('V') && (
<>
- {schemaDefn.get(modelName).inherits.includes('Ontology') && (
+ {schemaDefn.children(modelName).includes('Ontology') && (
)}
>
@@ -253,7 +253,7 @@ const RecordForm = ({
// for spacing issues only
: ()}
{actionInProgress && (
-
+
)}
{variant === FORM_VARIANT.NEW || (variant === FORM_VARIANT.EDIT && !isEdge)
? (
@@ -281,8 +281,8 @@ const RecordForm = ({
RecordForm.defaultProps = {
modelName: null,
- onError: () => {},
- onSubmit: () => {},
+ onError: () => { },
+ onSubmit: () => { },
onToggleState: undefined,
rid: null,
variant: FORM_VARIANT.VIEW,
diff --git a/src/components/VariantForm/BreakpointForm/index.tsx b/src/components/VariantForm/BreakpointForm/index.tsx
index eab4227b..c2b585f4 100644
--- a/src/components/VariantForm/BreakpointForm/index.tsx
+++ b/src/components/VariantForm/BreakpointForm/index.tsx
@@ -8,7 +8,7 @@ import React, { useCallback, useContext, useState } from 'react';
import FormContext from '@/components/FormContext';
import FormField from '@/components/FormField';
-interface BreakpointFormProps{
+interface BreakpointFormProps {
/** the Position class */
coordinateType: string;
/**
@@ -85,7 +85,7 @@ const BreakpointForm = ({
clearable={false}
label={`end (${coordinateType})`}
model={{
- ...model.properties.break1Start,
+ ...model.properties.break1End,
name: end,
mandatory: required,
linkedClass: schemaDefn.get(coordinateType),
diff --git a/src/services/api/index.tsx b/src/services/api/index.tsx
index 52b17bdf..3932fb92 100644
--- a/src/services/api/index.tsx
+++ b/src/services/api/index.tsx
@@ -1,7 +1,7 @@
/**
* Wrapper for api, handles all requests and special functions.
*/
-import { util } from '@bcgsc-pori/graphkb-schema';
+import { util, schema as schemaDefn } from '@bcgsc-pori/graphkb-schema';
import * as jc from 'json-cycle';
import qs from 'qs';
import { QueryClient } from 'react-query';
@@ -124,10 +124,10 @@ const getDefaultSuggestionQueryBody = (model) => (textInput) => {
limit: MAX_SUGGESTIONS,
neighbors: 1,
};
-
- if (model.inherits.includes('Ontology') || model.name === 'Ontology') {
+ if (model && model.name && schemaDefn.children(model.name) && schemaDefn.children(model.name).includes('Ontology') || model.name === 'Ontology') {
body.orderBy = ['source.sort', 'name', 'sourceId'];
}
+
return body;
};
diff --git a/src/services/schema.tsx b/src/services/schema.tsx
index 8f1667ba..e9610c1c 100644
--- a/src/services/schema.tsx
+++ b/src/services/schema.tsx
@@ -98,7 +98,7 @@ function getEdges(node: GeneralRecordType !!(schemaDefn.get(cls)
- && schemaDefn.get(cls).inherits.some((inherited) => inherited === 'E'));
+ && schemaDefn.children(cls).some((inherited) => inherited === 'E'));
/**
* Validates a value against some property model and returns the new property tracking object