< 032021-05-04⋎05 >

farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Feature requests and bug reports: github.com/farmOS/farmOS/issuesSet by ChanServ on 2018-08-16 at 14:32
03:32symbioquine[m]<mstenta[m] "But for contrib modules: yea bes"> I think I've figured out a decent pattern for this: github.com/symbioquine/farmOS_vue_page_d
13:19*cpm has joined
15:33symbioquine[m]Building on that to start sketching out a land drawing tool for 2.x; github.com/symbioquine/farmOS_land_drawi
15:34*uploaded an image: (124KiB) < matrix.org/_matrix/media/r0/download/mat >
15:34paul121[m]okay COOL! curious how/if (??) Vue can play with the map :-)
15:35symbioquine[m]The OpenLayers vector source is just an object so there's nothing stopping it from being reactive in Vue.js
15:36symbioquine[m]github.com/symbioquine/farmOS_land_drawi
15:36symbioquine[m]github.com/symbioquine/farmOS_land_drawi
15:36symbioquine[m]github.com/symbioquine/farmOS_land_drawi
15:40paul121[m]ah cool.. was curious how it was interacting with the map instance... but it looks like you create it within the vue app, makes sense: github.com/symbioquine/farmOS_land_drawi
15:40symbioquine[m]Yeah, that way the component can own the lifecycle of the map
15:41symbioquine[m]More critical in apps with routing where the map might need to get created/destroyed multiple times within a single "page instance"
15:41symbioquine[m]But still a good pattern
15:41paul121[m]bonus points if you can make it work with the map that Drupal creates :-)
15:43symbioquine[m]I considered that, but it would have been pretty hard to untangle that Drupal event subscriber stuff and get only the bits of behavior I need for this tool.
15:43paul121[m](main thinking is so that other custom layers/behaviors could be included in this as well - certainly not critical)
15:43symbioquine[m]farmOS-map has a cleaner interface
15:43paul121[m]yeah
15:44symbioquine[m]<paul121[m] "(main thinking is so that other "> Yeah that makes sense, it's just hard to make stuff both globally automatic and modular/configurable... :)
15:45paul121[m]yea.. Drupal wasn't made for JS modularity!
15:46paul121[m]one idea tho, if you make a `map-type` config entity & render a map on a page via a Drupal controller, it should get a unique ID on the page. Could the Vue app "attach" to that?
15:47symbioquine[m]<paul121[m] "one idea tho, if you make a `map"> That would probably work, but at least there'd be some complicated state associated with hot reloading for development.
15:48symbioquine[m]With Vue managing the instance it's pretty much a live editing experience without even needing page reloads.
15:49symbioquine[m]github.com/symbioquine/farmOS_vue_page_d
15:50paul121[m]ooohhh yeah that would complicate hot reloading
15:52*uploaded an image: (397KiB) < matrix.org/_matrix/media/r0/download/mat >
15:55symbioquine[m]That said, it would be nice if there were a way for certain farmOS-map behaviors from relevant farmOS contrib modules to get automatically registered with tools like this.
15:56symbioquine[m]It's almost like we need some sort of tagging/scoping system so that the behaviors can control when they apply and map instances or pages can supply more metadata about themselves for that determination.
15:58symbioquine[m]That seems to be roughly the goal of that Drupal MapEvent system, but as-is you can't use it without pulling in a bunch of stuff that is (appears anyway) hard-coded for the scenario where Drupal is rendering the map component.
16:01paul121[m]> It's almost like we need some sort of tagging/scoping system so that the behaviors can control when they apply and map instances or pages can supply more metadata about themselves for that determination.
16:01paul121[m]yesss... had a few ideas on that here - it's necessary for supporting "multiple maps", but "multiple maps" can also mean maps being created/destroyed over the lifetime of a single page which is probably more common: github.com/farmOS/farmOS-map/issues/94#m
16:03paul121[m]the "global behavior" registry might actually work well for this Vue app use case tho.. I *think* it would still add those behaviors to the map instance it's handling itself?
16:03paul121[m]but the issue with the global behaviors is they're always there, and always added
16:04symbioquine[m]See github.com/farmOS/farmOS-map/issues/110#
16:04paul121[m]if you enable `farm_mapbox` does it get added to this Vue app?
16:05symbioquine[m]no
16:05symbioquine[m]At least I'm pretty sure it wouldn't
16:05symbioquine[m]I can check
16:05paul121[m]ah right... because the map render event is when it's added to the page
16:08paul121[m]cool yea `namedBehaviors` is inline with what I was thinking :D
16:09paul121[m]a pattern I'm seeing though is that with the `attachBehavior(behavior, options = {})`, the `options` are different from what I've been referring to as "settings"
16:10paul121[m]`options` could certainly be used for "settings", but that hasn't been our practice haha
16:10paul121[m]I hadn't realized that before
16:12paul121[m]so the "farmOS-map API is complete", yes, but our Drupal implementation could be improved
16:45symbioquine[m]<paul121[m] "`options` could certainly be use"> The nice thing about this is that most of the settings don't need to change over the life of a map instance so a "constructor-based" model is much simpler.
16:46symbioquine[m]That said some mutable/observable state could be really nice too...
16:47symbioquine[m]Might make sense for them to be largely separate mechanisms though.
16:47paul121[m]true and true
16:48paul121[m]right... and theres nothing stopping a behavior from using `instance.map.set('myvalue', ..)` right now...
16:48symbioquine[m]Gotta go play outside now, but super excited to be talking through this stuff!
16:48paul121[m]guess its just a matter of how & if we should standardize something. hmm
16:48symbioquine[m]yeah
16:57mstenta[m]Haven't had a chance to respond but I've been enjoying reading all this! Great stuff!!

< 032021-05-04⋏05 >