这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
boolColumnOperators,
} from './utils';

import { getTableName } from '../../utils';

import QueryBuilderJson from '../../../../QueryBuilderJson/QueryBuilderJson';

const styles = require('./Styles.scss');
Expand Down Expand Up @@ -406,7 +408,8 @@ class PermissionBuilder extends React.Component {
let tableColumns = [];
let tableRelationships = [];
if (table) {
const tableSchema = tableSchemas[table];
// In case of a manual relationship the right table is an object for a different schema
const tableSchema = tableSchemas[getTableName(table)];
tableColumns = getTableColumnNames(tableSchema);
tableRelationships = getTableRelationshipNames(tableSchema);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const generateRelationshipsQuery = (
} else {
const columnReducer = (accumulator, val) => ({
...accumulator,
[val.rcol]: val.lcol,
[val.lcol]: val.rcol,
});
upQuery.args.using = {
manual_configuration: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
const getTableName = t => {
const typ = typeof t;
if (typ === 'string') {
return t;
} else if (typ === 'object') {
return 'name' in t ? t.name : '';
}
return '';
};
import { getTableName } from '../utils';

const suggestedRelationshipsRaw = (tableName, allSchemas) => {
const objRels = [];
Expand Down
11 changes: 11 additions & 0 deletions console/src/components/Services/Data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,22 @@ const escapeRegExp = string => {
return string.replace(/([.*+?^${}()|[\]\\])/g, '\\$1');
};

const getTableName = t => {
const typ = typeof t;
if (typ === 'string') {
return t;
} else if (typ === 'object') {
return 'name' in t ? t.name : '';
}
return '';
};

export {
ordinalColSort,
findTableFromRel,
findAllFromRel,
getEdForm,
getIngForm,
escapeRegExp,
getTableName,
};