Skip to content

Commit d996af7

Browse files
committed
logging
1 parent 369b64a commit d996af7

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

packages/core/src/reducers/core.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,23 @@ export const errorsAt = (
337337
schema: JsonSchema,
338338
matchPath: (path: string[]) => boolean
339339
) => (errors: ErrorObject[]): ErrorObject[] => {
340+
console.log("errors: ",errors);
340341
// Get data paths of oneOf and anyOf errors to later determine whether an error occurred inside a subschema of oneOf or anyOf.
341342
const combinatorPaths = filter(
342343
errors,
343344
error => error.keyword === 'oneOf' || error.keyword === 'anyOf'
344345
).map(error => getControlPath(error));
345346

346347
return filter(errors, error => {
348+
347349
// Filter errors that match any keyword that we don't want to show in the UI
348350
if (filteredErrorKeywords.indexOf(error.keyword) !== -1) {
349351
return false;
350352
}
351353
const controlPath = getControlPath(error);
354+
console.log("controllpath: ", controlPath);
352355
let result = matchPath(controlPath);
356+
console.log("result: ",result);
353357
// In anyOf and oneOf blocks with "primitive" (i.e. string, number etc.) or array subschemas,
354358
// we want to make sure that errors are only shown for the correct subschema.
355359
// Therefore, we compare the error's parent schema with the property's schema.
@@ -363,6 +367,7 @@ export const errorsAt = (
363367
&& combinatorPaths.findIndex(p => contains(instancePath,p)) !== -1) {
364368
result = result && isEqual(parentSchema, schema);
365369
}
370+
console.log(result);
366371
return result;
367372
});
368373
};

packages/core/src/util/path.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export const toId = (path: string[]): string=>{
9090
}
9191

9292
export const contains = (path1: string[], path2: string[]):boolean =>{
93+
console.log("contains");
9394
if(path1.length<path2.length){
9495
return false;
9596
}
@@ -98,5 +99,6 @@ export const contains = (path1: string[], path2: string[]):boolean =>{
9899
return false;
99100
}
100101
})
102+
console.log("true");
101103
return true;
102104
}

packages/material/src/complex/MaterialTableControl.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const ctxToNonEmptyCellProps = (
170170
if(ownProps.schema.type === 'object'){
171171
path.push(ownProps.propName);
172172
}
173-
173+
console.log(ctx.core.errors);
174174
const errors = formatErrorMessage(
175175
union(
176176
errorsAt(
@@ -180,6 +180,7 @@ const ctxToNonEmptyCellProps = (
180180
)(ctx.core.errors).map((error: ErrorObject) => error.message)
181181
)
182182
);
183+
console.log("errores: ",errors);
183184
return {
184185
rowPath: ownProps.rowPath,
185186
propName: ownProps.propName,
@@ -212,6 +213,7 @@ const NonEmptyCell = (ownProps: OwnPropsOfNonEmptyCell) => {
212213
cells
213214
} = ctxToNonEmptyCellProps(ctx, ownProps);
214215

216+
console.log("errors: ",errors);
215217
const isValid = isEmpty(errors);
216218
return (
217219
<NoBorderTableCell>
@@ -405,6 +407,7 @@ export class MaterialTableControl extends React.Component<
405407
? generateCells(TableHeaderCell, schema, path, enabled, cells)
406408
: undefined;
407409
console.log("here");
410+
console.log("errors: ",errors);
408411

409412
return (
410413
<Hidden xsUp={!visible}>

0 commit comments

Comments
 (0)