Our pure JavaScript Scheduler component

Post by rcon »

As much as I noticed there isnt any specific instruction to follow Firestore implementation.

I just finished a VUE3 Firestore project, and had no issues at all with conections, permissions, what so ever.

For this project with Bryntum Scheduler Pro I would like to have a resourceStore and eventStore connected to a Firestore where things will be changing automaticly probably 30/40 times a minute.

Also every change made on the timeline needs to stay reactive to the Firestore.

What would be the best aproach to implement such a solution with Bryntum Scheduler Pro?

Post by saki »

Bryntum components are designed to be server-side agnostic and they work with any server implementation that is able to deliver json in a consumable format.

...things will be changing automaticly probably 30/40 times a minute.

You would probably want use Web Socket for this rate of change, polling wouldn't probably do. CrudManager does not use web socket so you would probably want to write your own layer to make the data available for scheduler. You can use https://bryntum.com/examples/scheduler/websockets/ demo as a starting point in this case.

There is a rich variety of events that could be listened to to keep the changes in sync with the server namely https://bryntum.com/docs/scheduler-pro/api/SchedulerPro/view/SchedulerPro#event-dataChange event that is fired on each UI-induced change of data.

I think the offline caching of data would also be possible. It is simple to set data (events, resources, etc.) on the Scheduler, regardless of source from which the data may come. In that case you can use https://bryntum.com/docs/scheduler-pro/api/Scheduler/model/mixin/ProjectModelMixin#function-loadInlineData function. There is also https://bryntum.com/docs/scheduler-pro/api/Core/data/mixin/StoreSync#config-syncDataOnLoad option that turns on data updates instead of remove/re-create cycle on setting new data on the store. Setting it to true can improve performance significantly.

Post by rcon »

Thank you very much... that helped quite alot

Post by thtpark »

CrudManager is incredibly difficult to work with Firestore at the moment. It actually has nothing to do with WebSocket if CrudManager is flexible enough to support models on the client-side.

I've been always waiting for this issue to be resolved for the same reason, I'm really sad to see it's been pushed back to v5.

Any chance it'll be implemented earlier?

Post by alex.l »

Hi thtpark,

I will ask if we can move it, but I don't think there is any chance to have it before v5.

All the best,

Post by thtpark »

alex.l wrote:
Wed Dec 15, 2021 7:16 am

Hi thtpark,

I will ask if we can move it, but I don't think there is any chance to have it before v5.

Now it seems to be removed from v5. We are not getting this feature any time soon?

Writing our own Transport for Firestore is quite tricky (especially in react). If we should not expect this feature anytime soon, can any of you help us to write one?

Post by mats »

You should not need to use CrudManager if you only want to work with local data. Have you read the instructions above at viewtopic.php?p=96955#p96955

You can set new data / get data using this property on the Project: https://bryntum.com/docs/scheduler/api/Scheduler/model/mixin/ProjectModelMixin#property-inlineData

Post by thtpark »

Thanks for the reply but the problem isn't just dealing with local data.
inlineData doesn't help at all as we want full CRUD operations as well as synchronizing with any server-side updates.

There are two ways to do this as suggested by one of the Bryntum developers; one is to override AjaxHelper, and the other is to write a custom Transport that replaces AjaxTransport. As you might know, this is quite tricky (especially, in react) due to the way CrudManager is currently designed.

Or am I missing something with inlineData? Can we achieve all CRUD operations as well as real-time updates from Firestore? Two users must be able to see the same data on their schedulers at all times. We've done some workarounds by not using CrudManager at all (hence losing undo/redo) and adding data to eventStore directly. It gets quite tedious when you're trying to add new data from Firestore, not from the UI, as it doesn't know the source of the update, so we are double-checking whether the data exists already before sending it to Firestore all the time.

Post by saki »

My original ideas were based on the following:

  1. You wouldn't use CrudManager at all
  2. You would write a (websocket based?) bidirectional data transfer layer.
  3. On read from server, the Scheduler stores would be updated (loadInlineData can be used)
  4. On user update (D&D, etc), you would listen to dataChange event. The listener would send the modified data to the server

Note: I don't think you would necessarily lose Undo/Redo as https://bryntum.com/docs/scheduler/api/Core/data/stm/StateTrackingManager does not depend on CM but you can call https://bryntum.com/docs/scheduler/api/Core/data/stm/StateTrackingManager#function-addStore yourself

Post Reply