60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
import { difference } from 'oak-domain/lib/utils/lodash';
|
|
export default OakComponent({
|
|
entity: 'path',
|
|
actions: ['remove', 'create', 'update'],
|
|
projection: {
|
|
id: 1,
|
|
destEntity: 1,
|
|
value: 1,
|
|
recursive: 1,
|
|
sourceEntity: 1,
|
|
desc: 1,
|
|
},
|
|
isList: true,
|
|
filters: [{
|
|
filter() {
|
|
const { entity } = this.props;
|
|
return {
|
|
destEntity: entity,
|
|
};
|
|
},
|
|
'#name': 'destEntity'
|
|
}],
|
|
data: {
|
|
actions: [],
|
|
relations: [],
|
|
},
|
|
lifetimes: {
|
|
async ready() {
|
|
const { entity } = this.props;
|
|
if (entity) {
|
|
const schema = this.features.cache.getSchema();
|
|
const { actions } = schema[entity];
|
|
// const { data: relationList } = await this.features.cache.refresh('relation', {
|
|
// data: {
|
|
// id: 1,
|
|
// name: 1,
|
|
// },
|
|
// filter: {
|
|
// entity: entity as any,
|
|
// },
|
|
// count: 1000,
|
|
// });
|
|
// const relations = relationList.map((ele) => ele.name);
|
|
this.setState({
|
|
actions: difference(actions, ['aggregate', 'download', 'stat', 'count']),
|
|
// relations: relations as string[],
|
|
});
|
|
}
|
|
}
|
|
},
|
|
formData({ data }) {
|
|
return {
|
|
paths: data.filter(ele => ele.$$createAt$$ > 1),
|
|
};
|
|
},
|
|
properties: {
|
|
entity: '',
|
|
}
|
|
});
|