Skip to content

Remove asset status + refactor how assets and plans are archived#986

Merged
mstenta merged 25 commits intofarmOS:4.xfrom
mstenta:4.x-refactor-archived-status
Aug 14, 2025
Merged

Remove asset status + refactor how assets and plans are archived#986
mstenta merged 25 commits intofarmOS:4.xfrom
mstenta:4.x-refactor-archived-status

Conversation

@mstenta
Copy link
Copy Markdown
Member

@mstenta mstenta commented Aug 2, 2025

This is a followup to #978, as described in https://farmos.discourse.group/t/proposal-remove-status-field-from-assets-and-plans/2319

This is a breaking change to the farmOS data model's asset and plan entity types. Here is a quick overview of what this does:

  • Repurposes the archived field on asset and plan entities to indicate whether or not the entity is "archived" (not shown in the UI by default).
  • Removes the archived status option from the plan entity status field's default state machine workflow.
  • Adds additional planning, done, and abandoned status options to the plan entity status field's default state machine workflow. This accomplishes two goals:
    • It avoids the awkward situation left by removing the archived status, leaving on the active status remaining.
    • It adds 3 new useful status options!
  • Removes the status field from asset entities.

See the forum topic linked above for the full context and discussion.

@mstenta mstenta changed the title Remove asset status field + refactor how assets and plans are archived Remove asset status + refactor how assets and plans are archived Aug 2, 2025
mstenta added a commit to mstenta/farmOS that referenced this pull request Aug 2, 2025
@mstenta mstenta force-pushed the 4.x-refactor-archived-status branch from 86b71fa to a846b56 Compare August 2, 2025 21:05
mstenta added a commit to mstenta/farmOS that referenced this pull request Aug 2, 2025
@mstenta mstenta force-pushed the 4.x-refactor-archived-status branch from a846b56 to 7576146 Compare August 2, 2025 21:33
@mstenta mstenta marked this pull request as ready for review August 2, 2025 22:42
@mstenta mstenta added this to the v4.0.0 milestone Aug 5, 2025
@mstenta
Copy link
Copy Markdown
Member Author

mstenta commented Aug 7, 2025

Notes from dev call:

  • Make sure active is the default initial state for plans.

@paul121
Copy link
Copy Markdown
Member

paul121 commented Aug 14, 2025

Adds additional planning, done, and abandoned status options to the plan entity status field

Re: the status options for plan entities, just wanted to mention we had added custom states for the Rothamsted Experiment plan (requested, planning, active, completed, cancelled and archived). These new plan states align well. But one I think I have always wondered is the naming of "planning" vs "planned". It seems the "planned" would be more consistent, but not sure what is best. I'm curious if this was considered?

@mstenta
Copy link
Copy Markdown
Member Author

mstenta commented Aug 14, 2025

But one I think I have always wondered is the naming of "planning" vs "planned". It seems the "planned" would be more consistent, but not sure what is best. I'm curious if this was considered?

In my mind, a status of "planning" means that the plan is in the process of being built.

A status of "planned" would imply that the planning process is done, so it would be different from "planning". I could see that being useful, perhaps, in some situations, but probably isn't necessary in the default set of statuses we provide out of the box. If a custom planning module needs that level of granularity for its workflow then it can provide that.

Copy link
Copy Markdown
Member

@paul121 paul121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not test locally, but this all LGTM. Great changes, hope this simplifies things going forward

assert($entity->get('status')->first() instanceof StateItemInterface);
// Load new and original archived state to see if it is changed.
$archived = $entity->get('archived')->value;
$original_archived = $entity->original->get('archived')->value;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use the new $entity->getOriginal() method we will start using after #980 is merged

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I'll merge this and then rebase #980 on top and make sure this is updated with it.

mstenta added 19 commits August 14, 2025 17:51
It only represents log columns in one of the three places it
is implemented. The other two are asset columns and term columns.
This simply generalizes it to $columns in all three.
Performs the following steps:

- Install the new last_archived field.
- Populate last_archived field values from the old archived field.
- Delete the old archived field.
- Install the new boolean archived field.
- Archive assets with a status of archived.
- Rename asset_activate_action action configuration entity to asset_unarchive_action.
- Delete the status field.
@mstenta
Copy link
Copy Markdown
Member Author

mstenta commented Aug 14, 2025

Make sure active is the default initial state for plans.

I tested this, and the default status is planning. But I think that's OK. It makes sense to start it off in that status, to encourage users to go through the logical steps (planning -> active -> done).

@mstenta mstenta force-pushed the 4.x-refactor-archived-status branch from 7576146 to 46a1734 Compare August 14, 2025 22:06
@mstenta mstenta merged commit ad19317 into farmOS:4.x Aug 14, 2025
1 of 4 checks passed
@mstenta mstenta deleted the 4.x-refactor-archived-status branch August 14, 2025 22:07
mstenta added a commit to mstenta/farmOS that referenced this pull request Aug 16, 2025
@see PR: Remove asset status + refactor how assets and
plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Aug 16, 2025
This matches the changes made in PR: Remove asset status + refactor
how assets and plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Sep 16, 2025
@see PR: Remove asset status + refactor how assets and
plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Sep 16, 2025
This matches the changes made in PR: Remove asset status + refactor
how assets and plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Oct 16, 2025
@see PR: Remove asset status + refactor how assets and
plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Oct 16, 2025
This matches the changes made in PR: Remove asset status + refactor
how assets and plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Oct 16, 2025
@see PR: Remove asset status + refactor how assets and
plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Oct 16, 2025
This matches the changes made in PR: Remove asset status + refactor
how assets and plans are archived farmOS#986
mstenta added a commit to mstenta/farmOS that referenced this pull request Oct 31, 2025
See farmOS#986

This is necessary because farm_update will no longer revert
these automatically.
mstenta added a commit to mstenta/farmOS that referenced this pull request Oct 31, 2025
See farmOS#986

This is necessary because farm_update will no longer revert
these automatically.
mstenta added a commit to mstenta/farmOS that referenced this pull request Oct 31, 2025
See farmOS#986

This is necessary because farm_update will no longer revert
these automatically.
mstenta added a commit to mstenta/farmOS that referenced this pull request Nov 2, 2025
See farmOS#986

This is necessary because farm_update will no longer revert
these automatically.
mstenta added a commit that referenced this pull request Nov 23, 2025
… hook_views_data_alter().

Organization entities do not have a status field. They did in the
early implementation of the branch that added organization
entities, but that was removed when the status field was
removed from asset entities. So this is just cleaning up
lines that should have been removed at that point.

@see #986
mstenta added a commit to mstenta/farmOS that referenced this pull request Nov 23, 2025
This dependency is no longer necessary since the status field
was removed from assets.

See farmOS#986
mstenta added a commit that referenced this pull request Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants