mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
* handle non-existent column names * handle invalid _exist operator expression keys * handle non-array values for _and/_or operators
This commit is contained in:
parent
3a07228525
commit
4b78884d36
@ -42,6 +42,7 @@ import {
|
||||
isJsonString,
|
||||
getAllJsonPaths,
|
||||
isObject,
|
||||
isArray,
|
||||
} from '../../../../Common/utils/jsUtils';
|
||||
|
||||
class PermissionBuilder extends React.Component {
|
||||
@ -101,9 +102,13 @@ class PermissionBuilder extends React.Component {
|
||||
_missingSchemas = findMissingSchemas(newPath, currTable);
|
||||
} else if (isExistOperator(operator)) {
|
||||
const existTableDef = getQualifiedTableDef(value[TABLE_KEY]);
|
||||
const existTableSchema = existTableDef.schema;
|
||||
|
||||
const existWhere = value[WHERE_KEY];
|
||||
let existTableSchema;
|
||||
if (existTableDef) {
|
||||
existTableSchema = existTableDef.schema;
|
||||
}
|
||||
|
||||
const existWhere = value[WHERE_KEY] || '';
|
||||
|
||||
if (existTableSchema) {
|
||||
const { allTableSchemas } = this.props;
|
||||
@ -443,12 +448,12 @@ class PermissionBuilder extends React.Component {
|
||||
);
|
||||
});
|
||||
|
||||
const selectedValue = addToPrefix(prefix, value);
|
||||
const selectedValue = addToPrefix(prefix, value || '--');
|
||||
|
||||
return (
|
||||
<select
|
||||
value={selectedValue}
|
||||
name={value}
|
||||
name={prefix}
|
||||
onChange={dispatchSelect}
|
||||
className={styles.qb_select}
|
||||
data-test="qb-select"
|
||||
@ -720,7 +725,9 @@ class PermissionBuilder extends React.Component {
|
||||
let columnType = '';
|
||||
if (tableSchema && columnName) {
|
||||
const column = getTableColumn(tableSchema, columnName);
|
||||
columnType = getColumnType(column);
|
||||
if (column) {
|
||||
columnType = getColumnType(column);
|
||||
}
|
||||
}
|
||||
|
||||
_columnExp = renderOperatorExp(
|
||||
@ -818,7 +825,7 @@ class PermissionBuilder extends React.Component {
|
||||
};
|
||||
|
||||
const unselectedElements = [];
|
||||
if (!existsOpTable.name) {
|
||||
if (!existsOpTable || !existsOpTable.name) {
|
||||
unselectedElements.push(WHERE_KEY);
|
||||
}
|
||||
|
||||
@ -840,6 +847,8 @@ class PermissionBuilder extends React.Component {
|
||||
) => {
|
||||
const _boolExpArray = [];
|
||||
|
||||
expressions = isArray(expressions) ? expressions : [];
|
||||
|
||||
expressions.concat([{}]).forEach((expression, i) => {
|
||||
const _boolExp = renderBoolExp(
|
||||
dispatchFunc,
|
||||
|
Loading…
Reference in New Issue
Block a user