这是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
1 change: 0 additions & 1 deletion console/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
webpack/*
src/utils.js
3 changes: 2 additions & 1 deletion console/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@
"jsx-a11y/interactive-supports-focus": "off",
"no-restricted-properties": "off",
"react/no-danger": "off",
"react/no-array-index-key": "off"
"react/no-array-index-key": "off",
"no-case-declarations": 0
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,50 @@ export const permissionTypes = [
'delete_permission',
];

export const getTableNameFromDef = def => {
if (def.constructor.name === 'Object') {
return def.name;
export type MetadataObject = {
name: string;
function_name: string;
type:
| 'table'
| 'array_relation'
| 'object_relation'
| 'function'
| 'event_trigger'
| 'remote_schema'
| 'action';
definition: {
name: string;
role: string;
table: {
name: string;
};
configuration: {
name: string;
};
};
table_name: string;
relationships: Array<{ rel_name: string }>;
permissions: Array<{ role_name: string }>;
};

export const getTableNameFromDef = (
def:
| {
name: string;
}
| string
) => {
if (typeof def === 'string') {
return def;
}
return def;
return def.name;
};

const filterInconsistentMetadataObject = (
objects,
inconsistentObject,
type
) => {
objects: MetadataObject[],
inconsistentObject: MetadataObject,
type: string
): MetadataObject[] => {
switch (type) {
case 'tables':
const schemas = objects;
Expand Down Expand Up @@ -108,10 +140,10 @@ const filterInconsistentMetadataObject = (
};

export const filterInconsistentMetadataObjects = (
metadataObjects,
inconsistentObjects,
type
) => {
metadataObjects: MetadataObject[],
inconsistentObjects: MetadataObject[],
type: string
): MetadataObject[] => {
let filteredMetadataObjects = JSON.parse(JSON.stringify(metadataObjects));

inconsistentObjects.forEach(object => {
Expand Down