Equipment use logs

A Farmier subscriber that upgraded to farmOS v2 recently asked me about viewing “Equipment use logs” - which were easy to see on each Equipment asset page in farmOS v1. There are ways to get this information in v2, but not directly from the Equipment asset, so I’m considering adding this feature. There are some considerations, though, so I’m curious to get thoughts from others…

A little more background: all asset records in farmOS have a “Logs” tab, which shows all logs that reference them from the asset field of the log. However, this does NOT show logs that reference the equipment in the equipment (aka “Equipment used”) field of the log. So when you go to the equipment asset record, you can’t easily find logs that reference it as the “Equipment used” to perform the log.

The current workaround is you can go to any list of logs by type (eg: “Records > Logs > Activity”) and then use the exposed filter options to filter by “Equipment used”. This gives you the information you want, but a) intuitively you would expect to be able to find this information on the Equipment asset record itself, and b) you have to know what log type you’re looking for, you can’t see a list of all equipment use logs regardless of type.

The difference between the asset field of the log and the equipment field is: the asset field means “the action happened TO the asset”, whereas the equipment field means “this equipment was used to perform the action”. It’s a subtle but important distinction.

Consider this example: “I plowed Field A with Big Tractor” - this log would reference “Field A” in the asset field and “Big Tractor” in the equipment field. However, if you then go to the “Big Tractor > Logs” tab, you don’t see this log, because it didn’t happen TO the “Big Tractor” asset. On the other hand, if I created an “Oil change” maintenance log, I would reference “Big Tractor” in the asset field, and that would show up in the “Big Tractor > Logs” tab.

So, this is a bit more than a question of what’s technically possible. It’s also a question of where would you intuitively look for this information? I would intuitively want to click on the “Big Tractor > Logs” tab… but should that be a mix of both logs that happened TO the tractor and WITH the tractor? Or should they be separate pages? My inclination is to make them separate pages, because that’s more explicit, but then it’s challenging to decide where to put that so that it’s intuitive.

One idea might be to put an additional “Equipment Use Logs” tab next to the existing “Logs” tab. That would be an easy solution, but it feels redundant, and could lead to confusion about what the difference is between the two. One advantage to this approach is we could have sub-tabs that break out the logs by type, which include type-specific columns+filters like the “Logs” tab does.

Another idea might be to add it as a sub-tab of “Logs”. For example: “Big Tractor > Logs > Equipment use logs”. That’s also easy technically, BUT it would be mixed in with the existing sub-tabs that filter by log type. So you would end up with tabs like “All logs”, “Harvest”, “Activity”, …, and “Equipment use logs”. The disadvantage is we couldn’t have sub-sub-tabs that break out equipment use logs by log type.

So… it sort of feels like an “Equipment Use Logs” tab is the “least bad” option. But maybe someone has a brilliant idea that elegantly considers all of the above? :slight_smile:

One more layer of complexity: logs also have a location field, for specifying “this log happened IN this location” (another subtle difference from “happened TO this asset”).

The “Logs” tab of asset records actually takes this location field into account already as well. So technically, the “Logs” tab is actually a list of logs that reference the asset in either the asset or location field.

It might be possible to ALSO include the equipment field in this filter. There are some technical challenges to this, but they might be solvable (one specifically: the equipment module may not be enabled, but the farm_ui_views module always is, so it would have to add this filter only IF the equipment module is enabled).

But: does that confuse things? It feels like it would be intuitive to go to the “Logs” tab for any kind of log that references the Equipment (in either asset or equipment fields). But would it muddle things? What if you want to exclude/filter out logs that referenced the asset in the equipment field?

A similar but separate question exists for “Group membership” logs. When the farm_group module is enabled, it adds a “Group” asset type, and a group reference field to all logs, so that you can use a log to assign assets to a group. Similar to “Equipment use logs”, we don’t currently have a “Group membership logs” tab/list on Group assets, to see all the membership changes that have occurred throughout its history. A similar workaround exists as described in my first post above, but it suffers from the same limitations.

So, I’m also curious if there’s a generalized solution to all of these things…

Maybe

@paul121 maybe we could look at how this Views argument handler works, and provide some mechanisms for other modules (like farm_equipment and farm_group) to hook into it and add additional fields to consider in the filtering process. :thinking:

That would essentially make the “Logs” tab on assets a combination of logs that reference the asset in potentially 4 different fields (asset, location, equipment, group).

The question is:

Here is the Views argument handler: https://github.com/farmOS/farmOS/blob/0093d48b84a88aa5402404331051807ed12e3cc2/modules/core/ui/views/src/Plugin/views/argument/AssetOrLocationArgument.php

It is made available to Views here: https://github.com/farmOS/farmOS/blob/0093d48b84a88aa5402404331051807ed12e3cc2/modules/core/ui/views/farm_ui_views.views.inc#L13

And it is used in the farm_log View here: https://github.com/farmOS/farmOS/blob/0093d48b84a88aa5402404331051807ed12e3cc2/modules/core/ui/views/config/install/views.view.farm_log.yml#L2428

Would it be viable to add an exposed filter radio/select control to choose which kinds of log relationships are being shown (with the default being show logs based on all 4)?

It might also be helpful to have a visual indication in the table that shows how a given log came to appear in the list…

2 Likes

This would be great. I’m not sure how to accomplish that with Views plugins, but it might be possible. It could be a good solution though, and would tie everything described above together… basically generalize our current AssetOrLocationArgument plugin so that other modules can add their own fields to filter on, and include some UI in the “Filters” box to expose some controls.

Open to ideas on this as well! As it stands, we would basically be relying on the existing columns showing the asset.

So for example, “Big Tractor” would show in the “Equipment” column rather than the “Assets” column. However, this isn’t perfect either, because the “Equipment” column only gets added to the sub-tabs for specific log types currently, since it’s a bundle field not a base field.

1 Like

Regarding equipment I generally like to have a uncluttered service-book of the equipments.
But that can be filtered on maintenance when viewing all logs.

My thought too. (without overthinking this)

Maybe this approach could be useful useful other places too.
So, how many radio buttons before a dropdown would be better?

Curious to see how it would look.

3 Likes

Could resist the curiosity, so I experimented a bit, and it looks like it is possible (in theory) for a Views argument handler to add to the exposed form. Here’s a quick proof-of-concept screenshot I whipped up:

This is far from actually functional, and there would be a good bit of development involved to make it all work, but it does seem possible!

Open to ideas on how it should look in the form too… I just sketched up the example with some checkboxes, but that might not be the best. The field label/description will be important too.

3 Likes

Would it be totally mad to have 2 log view tabs?
One for Logs pertaining to the equipment “maintenance/ upkeep” and a seperate one for “usage” logs?

2 Likes

@Farmer-Ed Yea that was one of the options I was thinking about too (described above):

I think having both “Logs” and “Equipment use logs” could be a bit confusing.

There’s also similar question about “Group membership logs”, which makes me want to find a common solution.

But that’s why I wanted to ask everyone… to get a sense of what “feels” right. The question is: where would you intuitively look for these logs? I think for many, at least right now, clicking on the “Logs” tab is where they look first.

1 Like

All that said: this exposed “Asset reference fields” option in the “Filter” box is NOT intuitive at all! I’ll be the first to acknowledge that. It works elegantly from a code/functionality perspective though… so is there a way we can bridge the user experience? Can we add help text or some other UI to help?

1 Like

FYI I pushed the PoC work I did to this branch for future reference: GitHub - mstenta/farmOS at 2.x-views-log-asset-references

1 Like

oh… missed that bit
Don’t think it would be that confusing for the Equipment case, the difference is distinct and arguably useful to keep them separated.

But the Groups case does need a better solution and understand that a common solution could make sense.

1 Like

Another idea I had: make an “Equipment Use Report” available from a top-level “Reports” menu item. It could just be a View with a dropdown of Equipment assets to filter, perhaps.

This would be separate from the Equipment asset record itself, though, so I didn’t mention it here because it seems like we need something on the record for users who want to find it there.

But maybe both would be useful? Heck maybe we add these checkboxes to the existing filter options AND add a new “Reports” tab to Equipment assets with an “Equipment use” tab under that?

2 Likes

I tend to click on the asset category in the dashboard, and get the asset from there.
If I want to see tractor logs, “tractor” is my natural focus. (Not "logs and then tractor)

For another discussion: (but maybe relevant regarding what feels natural)
I’d like some favorite assets exposed directly on the dashboard for quick access.

2 Likes

Agreed. And currently it isn’t possible to get “Equipment use” logs that way.

The screenshot above is the “Logs” tab on the Tractor asset itself. I got to it by clicking on the Tractor asset, then clicking on the Logs tab for that tractor.

I like that idea! Favorite assets or something. But yes let’s start a separate topic for that… :wink:

1 Like

I never experimented with reports from v1 so curious how they look…

2 Likes

There never worry any, really… and they could look however we want them to look. I’m thinking of them as basically just custom pages/forms/Views that are focused on a particular topic. But for this one they could just be a list of logs like all the others.

3 Likes

Same here, although for equipment I’d be more interested in the maintenance logs anyway, which do work this way.

Definitely think the dashboard would be nice to be a little more user customizable, or a selection of widget plugins/addons.Think there was some discussion not too long ago, you really should join one of the dev calls.

3 Likes