mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 12:06:47 +00:00
fix: ui schema storage (#188)
* fix: test * chore: root schema x-index * fix: getJsonSchema & getProperties empty response
This commit is contained in:
parent
2e2b5cd938
commit
8a791f37aa
@ -86,6 +86,22 @@ describe('action test', () => {
|
|||||||
expect(data.properties.b.properties.c['x-uid']).toEqual('n3');
|
expect(data.properties.b.properties.c['x-uid']).toEqual('n3');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('getJsonSchema when uid not exists', async () => {
|
||||||
|
const response = await app.agent().resource('ui_schemas').getJsonSchema({
|
||||||
|
resourceIndex: 'not-exists',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(response.statusCode).toEqual(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get properties when uid not exists', async () => {
|
||||||
|
const response = await app.agent().resource('ui_schemas').getProperties({
|
||||||
|
resourceIndex: 'not-exists',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(response.statusCode).toEqual(200);
|
||||||
|
});
|
||||||
|
|
||||||
test('remove', async () => {
|
test('remove', async () => {
|
||||||
await app
|
await app
|
||||||
.agent()
|
.agent()
|
||||||
|
@ -89,6 +89,10 @@ export class UiSchemaRepository extends Repository {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (nodes[0].length == 0) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
const schema = this.nodesToSchema(nodes[0], uid);
|
const schema = this.nodesToSchema(nodes[0], uid);
|
||||||
return lodash.pick(schema, ['type', 'properties']);
|
return lodash.pick(schema, ['type', 'properties']);
|
||||||
}
|
}
|
||||||
@ -117,6 +121,10 @@ export class UiSchemaRepository extends Repository {
|
|||||||
transaction: options?.transaction,
|
transaction: options?.transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (nodes[0].length == 0) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
const schema = this.nodesToSchema(nodes[0], uid);
|
const schema = this.nodesToSchema(nodes[0], uid);
|
||||||
return schema;
|
return schema;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user