Open isglass opened 2 years ago
To get an idea how it is solved in Odoo
https://github.com/bryntum/odoo-app/blob/dev/advanced/src/lib/ProjectModel.js
I need to load the data to the project using 3rd party framework which I don't have control over. I need to load/sync changes automatically.
Project (crud manager) API assume we always have a URL which can serve/receive data according to a specific protocol. There is a way to override a transport layer, but it is not very convenient: you need to override 4 methods, rebuild project model class and instantiate it (which is tricky if you're working with react).
Another part of the problem is that we only can auto sync crud changes with project: { autoSync: true }
, there is no way to do same by listening events on the project. E.g. when you're editing task in task editor you get hasChanges
event on every change, and those changes can be reverted. TaskEditor feature suspends auto sync on the project only.
Use dependency injection to avoid all the unnesessary step assumed for ajax transport. All crud manager should do it output a change set package using current protocol and pass it to some entity which would handle everything else.
// was
// keep active request details
me.activeRequests.sync = {
type : 'sync',
pack,
resolve,
reject,
id : pack.requestId,
desc : me.sendRequest({
id : pack.requestId,
data : me.encode(pack),
type : 'sync',
success : me.onCrudRequestSuccess,
failure : me.onCrudRequestFailure,
thisObj : me
})
};
// should be
await me.proxy.sync(pack)
We need a recommended and well documented way of how to use an external data source (as in not using CrudManager) with Project.
Should work as users of each framework would expect it to.
Related https://github.com/bryntum/support/issues/2092