IRC logs for #farmOS, 2022-08-30 (GMT)

2022-08-29
2022-08-31
TimeNickMessage
[20:02:44]<symbioquine[m]>I have been using `git add -p` to stage parts of changes for years now, but never bothered to learn the (e)dit function until today. It is awesome! 10/10 wish I'd taken the time sooner! https://drewdeponte.com/blog/git-add-patch-wont-split/
[08:55:17]* jonasbits has quit (Ping timeout: 244 seconds)
[08:56:35]* jonasbits has joined #farmos
[09:50:28]<symbioquine[m]><FarmerEd[m]> "Did you release the version with..." <- Just released [Asset Link 0.6.0](https://farmos.discourse.group/t/asset-link-dev-log/1175/21) that includes the editor (and lots of other stuff)
[10:42:49]<FarmerEd[m]>Noticeably better performance with no caching issues
[10:43:42]<symbioquine[m]>FarmerEd[m]: Probably [this commit](https://github.com/symbioquine/farmOS_asset_link/commit/6716235314c27a5c...) in action :)
[10:48:06]<FarmerEd[m]>That release could have saved me some messing this morning 🫠
[10:48:06]<FarmerEd[m]>Kept confusing myself between images tagged 2.x and images without the quantities fix 😆
[10:48:06]<FarmerEd[m]>But 0.6.0 runs fine on the latest image.
[10:48:46]<FarmerEd[m]>or rather not tagged 2.x
[10:49:46]<FarmerEd[m]>But looks great
[10:49:59]<symbioquine[m]>Thanks!
[11:15:10]<symbioquine[m]>mstenta / paul121 What's the best way to include static data files in a Drupal module so they can be loaded by front-end code?
[11:15:12]<symbioquine[m]>* A custom controller works fine (and it's what I've been doing), but seems a bit heavy-weight for a module that only needs a single static file served without any database checks or complex pre/post processing.
[11:15:12]<symbioquine[m]>* It seems like `*.libraries.yml` is only intended for resources that get "attached" to pages - like JS/CSS - not arbitrary vue/json file types.
[11:15:12]<symbioquine[m]>* The module could copy the files to `public://`/`private://`, but without references it seems like some sites might clean up the files automatically. Also this seems like an abuse of storage meant for user content, not module data files.
[11:15:43]<symbioquine[m]>s/*/1./, s/*/2./, s/*/3./
[11:17:25]<symbioquine[m]>I expected to see a controller class in Drupal core named something like `StaticFileController` so I could do it with just `*.services.yml` and `*.routing.yml` config.
[11:17:40]<symbioquine[m]>Even that seems a bit heavy-weight
[11:20:16]<mstenta[m]>I think the tricky thing is: a module may be installed in different locations, so you need some way to know where the files will be.
[11:20:31]<mstenta[m]>By serving them from a controller you can have better control over that.
[11:21:26]<mstenta[m]>I'm not familiar with anything like a `StaticFileController` although that's an interesting idea
[11:21:33]<mstenta[m]>IIRC the fieldkit module uses a controller
[11:22:09]<paul121[m]>you can also configure caching from the controller's response. That might help?
[11:22:43]<paul121[m]>heavyweight DX or UX/performance is the question I guess :-)
[11:23:08]<symbioquine[m]>Yeah, I guess a controller is probably the way to go...
[11:23:20]<mstenta[m]>The controller is the only way to have a fixed/predictable path AFAIK
[11:23:36]<symbioquine[m]>paul121[m]: I was thinking from a DX/maintenance perspective
[11:24:11]<mstenta[m]>symbioquine: are you familiar with the way the `farm_fieldkit` module works?
[11:25:08]<mstenta[m]>It adds it's own config entity type so that other modules can declare their field modules via config yml files
[11:25:16]<mstenta[m]>for example: https://github.com/farmOS/farmOS/blob/2.x/modules/core/fieldkit/modules/...
[11:25:59]<mstenta[m]>and they declare their JS via `*.libraries.yml`, eg: https://github.com/farmOS/farmOS/blob/2.x/modules/core/fieldkit/modules/...
[11:26:33]<mstenta[m]>The Field Kit module itself serves them via this controller: https://github.com/farmOS/farmOS/blob/2.x/modules/core/fieldkit/src/Cont...
[11:26:59]<mstenta[m]>At the path: `fieldkit/js/{field_module}/index.js`
[11:27:07]<mstenta[m]>(Defined here: https://github.com/farmOS/farmOS/blob/2.x/modules/core/fieldkit/farm_fie...)
[11:49:35]<paul121[m]>all, would a bulk action for assigning the asset's parent be useful? similar to the "move asset" and "group asset" actions
[11:50:17]<paul121[m]>Rothamsted has a use-case where they would like to set the parent for their Experiment plot assets in bulk. It seems like it could be easy to abstract this out but curious if it would be useful
[11:50:19]<mstenta[m]>I think it could be yea!
[11:50:46]<paul121[m]>Maybe we need a way to configure which bulk actions are shown in the UI... :-)
[11:51:44]<mstenta[m]>I wonder if that could/should be achieved with permissions
[11:56:33]<paul121[m]>interesting
[11:59:06]<symbioquine[m]><mstenta[m]> "symbioquine: are you familiar..." <- Yeah, I'll probably end up providing a similar mechanism
[13:15:20]<mstenta[m]>One thing I'd like to add to this weeks dev call agenda is https://www.drupal.org/project/farm/issues/3306892
[13:16:11]<mstenta[m]>Which (maybe?) is a prerequisite for https://github.com/farmOS/farmOS/issues/561 (but maybe is actually separate... this is part of what I want some help thinking through)
[13:16:22]<mstenta[m]>Feel free to read my notes/comments in those, but I can also walk through it on the call
[13:17:20]<mstenta[m]>The other thing I'd like to add is https://github.com/farmOS/farmOS/pull/537 - would love to do a final review of that and see if it's ready to merge!
[15:55:09]* cosine has quit (*.net *.split)
[15:55:09]* RafatKhashan[m] has quit (*.net *.split)
[15:55:09]* evered[m] has quit (*.net *.split)
[15:55:11]* sandg100[m]1 has quit (*.net *.split)
[15:55:11]* courtneylking[m] has quit (*.net *.split)
[15:55:12]* jonasbits has quit (*.net *.split)
[15:55:14]* KarsonWynne[m] has quit (*.net *.split)
[15:55:14]* botlfarm[m]1 has quit (*.net *.split)
[15:55:14]* leogaggl[m] has quit (*.net *.split)
[15:55:14]* Mo[m] has quit (*.net *.split)
[15:55:14]* symbioquine[m] has quit (*.net *.split)
[15:55:14]* jgaehring[m] has quit (*.net *.split)
[15:55:14]* FarmerEd[m] has quit (*.net *.split)
[15:55:15]* scrdcow[m] has quit (*.net *.split)
[15:55:15]* GudjonEinarMagnu has quit (*.net *.split)
[15:55:15]* paul121[m] has quit (*.net *.split)
[15:55:15]* thattechguy99[m] has quit (*.net *.split)
[15:55:15]* gbathree[m] has quit (*.net *.split)
[15:55:15]* mstenta[m] has quit (*.net *.split)
[15:55:15]* perfectinfoseeke has quit (*.net *.split)
[15:56:41]* jonasbits has joined #farmos
[15:56:41]* RafatKhashan[m] has joined #farmos
[15:56:41]* GudjonEinarMagnu has joined #farmos
[15:56:41]* cosine has joined #farmos
[15:56:41]* symbioquine[m] has joined #farmos
[15:56:41]* mstenta[m] has joined #farmos
[15:56:41]* evered[m] has joined #farmos
[15:56:41]* perfectinfoseeke has joined #farmos
[15:56:41]* jgaehring[m] has joined #farmos
[15:56:41]* paul121[m] has joined #farmos
[15:56:41]* FarmerEd[m] has joined #farmos
[15:56:41]* KarsonWynne[m] has joined #farmos
[15:56:41]* sandg100[m]1 has joined #farmos
[15:56:41]* botlfarm[m]1 has joined #farmos
[15:56:41]* leogaggl[m] has joined #farmos
[15:56:41]* Mo[m] has joined #farmos
[15:56:41]* courtneylking[m] has joined #farmos
[15:56:41]* thattechguy99[m] has joined #farmos
[15:56:41]* gbathree[m] has joined #farmos
[15:56:41]* scrdcow[m] has joined #farmos
[15:59:26]* dazinism[m] has quit (Ping timeout: 255 seconds)
[15:59:53]* GerardoLisboa[m] has quit (Ping timeout: 255 seconds)
[16:00:11]* sandg100[m]1 has quit (Ping timeout: 268 seconds)
[16:02:38]* symbioquine[m] has quit (Ping timeout: 240 seconds)
[16:02:38]* jgaehring[m] has quit (Ping timeout: 240 seconds)
[16:02:38]* FarmerEd[m] has quit (Ping timeout: 240 seconds)
[16:02:38]* scrdcow[m] has quit (Ping timeout: 240 seconds)
[16:02:38]* KarsonWynne[m] has quit (Ping timeout: 255 seconds)
[16:02:38]* Mo[m] has quit (Ping timeout: 255 seconds)
[16:02:43]* RafatKhashan[m] has quit (Ping timeout: 248 seconds)
[16:03:05]* botlfarm[m]1 has quit (Ping timeout: 255 seconds)
[16:03:05]* leogaggl[m] has quit (Ping timeout: 255 seconds)
[16:03:06]* GudjonEinarMagnu has quit (Ping timeout: 264 seconds)
[16:03:06]* paul121[m] has quit (Ping timeout: 264 seconds)
[16:03:06]* thattechguy99[m] has quit (Ping timeout: 264 seconds)
[16:03:06]* gbathree[m] has quit (Ping timeout: 264 seconds)
[16:03:10]* mstenta[m] has quit (Ping timeout: 268 seconds)
[16:03:10]* perfectinfoseeke has quit (Ping timeout: 268 seconds)
[16:03:15]* evered[m] has quit (Ping timeout: 248 seconds)
[16:03:16]* courtneylking[m] has quit (Ping timeout: 268 seconds)
[16:21:46]* KarsonWynne[m] has joined #farmos
[16:22:12]* Mo[m] has joined #farmos
[16:24:45]* thattechguy99[m] has joined #farmos
[16:25:16]* mstenta[m] has joined #farmos
[16:25:17]* perfectinfoseeke has joined #farmos
[16:25:45]* symbioquine[m] has joined #farmos
[16:25:45]* jgaehring[m] has joined #farmos
[16:25:53]* FarmerEd[m] has joined #farmos
[16:25:53]* scrdcow[m] has joined #farmos
[16:28:16]* paul121[m] has joined #farmos
[16:28:27]* GudjonEinarMagnu has joined #farmos
[16:29:56]* RafatKhashan[m] has joined #farmos
[16:30:17]* evered[m] has joined #farmos
[16:30:27]<symbioquine[m]><symbioquine[m]> "Yeah, I'll probably end up..." <- Got it working! https://github.com/symbioquine/farmOS_asset_link/commit/34b387c9eece52a7...
[16:31:04]* courtneylking[m] has joined #farmos
[16:31:05]* gbathree[m] has joined #farmos
[16:31:54]<symbioquine[m]>ACTION sent a yml code block: https://libera.ems.host/_matrix/media/r0/download/libera.chat/0eb314956d...
[16:32:57]<symbioquine[m]>And the Asset Link controller resolves the config entity from the "NameBobAssetActionProvider" part of the url (which is required to match the name of the plugin)
[16:33:01]* leogaggl[m] has joined #farmos
[16:33:36]<symbioquine[m]>Then uses the required dependency of the config entity to get the module path to load the file
[16:36:09]* botlfarm[m]1 has joined #farmos
[16:37:04]<symbioquine[m]>TL;DR; Asset Link plugins in contrib modules can be defined with just 4 files - including the `info.yml` and `composer.json` (or 3 files if not composer installable)
[16:40:17]<paul121[m]><symbioquine[m]> "Then uses the required dependenc..." <- ah clever solution!
[16:43:46]<symbioquine[m]>Yeah, I'm a bit on the fence about that part... Might change it to encode the module name into the URL pattern
[16:44:33]<paul121[m]>are those yml files plugins?
[16:44:59]<paul121[m]>oh I see it is a config entity
[16:45:23]<symbioquine[m]>No, the plugin (in this case) is a `.a link.js` file
[16:46:36]<symbioquine[m]>The config entity just installs it as a default plugin
[16:49:12]<paul121[m]>gotcha
[17:06:57]* GerardoLisboa[m] has joined #farmos
[17:08:24]<mstenta[m]>> Then uses the required dependency of the config entity to get the module path to load the file
[17:08:24]<mstenta[m]>oh interesting!
[17:10:33]<mstenta[m]>i guess `farm_fieldkit` wires that up by using the library
[17:10:43]<mstenta[m]>https://github.com/farmOS/farmOS/blob/b495cdb840bd0bc662c1c57205ebcec8f1...
[17:10:59]<mstenta[m]>but then you also need a `*.libraries.yml` file in the module
[17:12:20]* sandg100[m]1 has joined #farmos
[17:12:43]<symbioquine[m]>And I'm not sure it's meant for use with non js/CSS assets
[17:13:00]<symbioquine[m]>E.g. vue plugins
[17:14:24]<mstenta[m]>oh good question
[17:15:04]<paul121[m]>yeah I think a big reason I chose libraries is because it was a definite link to the module
[17:15:54]<paul121[m]>but the enforced dependency is an interesting option. one challenge there is if these config entities are created via the UI.. (not sure if that is a requirement)
[17:18:23]<mstenta[m]>Yea the enforced dependency feels a bit "loose"... but in practice it should work, as long as plugin authors know to include it... and if it doesn't work without that then it's actually not "loose" haha
[17:19:45]<mstenta[m]>> And I'm not sure it's meant for use with non js/CSS assets
[17:19:45]<mstenta[m]>Now I'm curious about this... I wonder if it would work 🤔
[17:21:54]<mstenta[m]>I was trying to think earlier... does using libraries have any other benefits? like would it useful to "attach" them to the page that asset link itself is served from?
[17:22:29]<mstenta[m]>(maybe not... i'm not thinking very hard about how all this works haha)
[17:23:40]<symbioquine[m]><symbioquine[m]> "Yeah, I'm a bit on the fence..." <- ^ I'm considering this since it might be nice to be able to use the required dependency feature so a plugin could model a dependency on another drupal module
[17:25:01]<symbioquine[m]>mstenta[m]: Wouldn't work since Asset Link doesn't use the Drupal render API to serve itself
[17:35:00]<symbioquine[m]><paul121[m]> "but the enforced dependency is..." <- The config entities can be created through the UI , but they aren't expected to use this feature in that case. Instead they would use a fully qualified URL or one relative to the Drupal installation.
[18:18:25]* dazinism[m] has joined #farmos