Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LF-4562 remove unused animal sections #3539

Merged
merged 16 commits into from
Dec 5, 2024

Conversation

antsgar
Copy link
Collaborator

@antsgar antsgar commented Nov 20, 2024

Description

  • Removed Locations and Groups sections in Animals module. Animals now doesn't have subsections in the main menu.
  • Removed group relations from animal and batch models, and removed code related to animals from animal/batch controllers and tests.
  • Removed group routes from API.
  • Removed group column and group filters from inventory UI, group name text field from animal creation flow, and all other group related code from the UI.
  • Removed "Clone" and "Add to group" actions from action menu.

Jira link:
https://lite-farm.atlassian.net/browse/LF-4562

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@antsgar antsgar requested review from a team as code owners November 20, 2024 00:49
@antsgar antsgar requested review from Duncan-Brain and SayakaOno and removed request for a team November 20, 2024 00:49
@Duncan-Brain
Copy link
Collaborator

Wondering if we can comment out backend stuff too? It might be nice to prevent insertions on group table on all api accessible routes. Just so when we return to it we have a guaranteed clean db.

@antsgar
Copy link
Collaborator Author

antsgar commented Nov 20, 2024

@Duncan-Brain yeah for sure, are you referring to the group related routes? I can comment out those.

@Duncan-Brain
Copy link
Collaborator

Those yes, but it is also possible to add groups on add/edit animals/batches. I am not sure whether the noInsert option or removing model relations, or removing controller logic would be best.

@antsgar antsgar marked this pull request as draft November 20, 2024 17:18
@antsgar antsgar changed the title remove unused animal sections LF-4562 remove unused animal sections Dec 3, 2024
@Duncan-Brain
Copy link
Collaborator

Duncan-Brain commented Dec 4, 2024

@antsgar so far seeing 'groups' in the withGraphFetched() expression in taskController. That is the main error I see in the log. Will test and see if thats it.

Heres the fix for merg into this: #3563

@antsgar antsgar marked this pull request as ready for review December 4, 2024 21:14
@@ -422,9 +403,7 @@ export default function AnimalInventory({
};

const iconActions: iconAction[] = [
{ label: t(`common:ADD_TO_GROUP`), iconName: 'ADD_ANIMAL', onClick: () => ({}) },
{ label: t(`common:CREATE_A_TASK`), iconName: 'TASK_CREATION', onClick: () => ({}) },
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Kept this one because I added the feature on #3564

kathyavini
kathyavini previously approved these changes Dec 5, 2024
Copy link
Collaborator

@kathyavini kathyavini left a comment

Choose a reason for hiding this comment

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

Has a merge conflict but it looks good to me!

Is there a difference between the tests that were skipped vs the ones deleted?

@antsgar
Copy link
Collaborator Author

antsgar commented Dec 5, 2024

@kathyavini I deleted all the logic related to groups from the animal/batch controllers and models (I was initially going to comment it out but thought it might end up being too confusing for future readers), and so since that functionality no longer exists in the code I removed the associated tests as well. For groups, I kept the routes, controller and model and so I kept the tests. Not sure if this makes total sense though, I wasn't sure! I could also just skip the test that was entirely removed on the animal test file

kathyavini
kathyavini previously approved these changes Dec 5, 2024
Copy link
Collaborator

@kathyavini kathyavini left a comment

Choose a reason for hiding this comment

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

so since that functionality no longer exists in the code I removed the associated tests as well

That distinction makes sense to me!

Copy link
Collaborator

@SayakaOno SayakaOno left a comment

Choose a reason for hiding this comment

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

Just one thing to revert!
Could we keep the translations? I would feel bad for the translators if they had to translate the same strings again...


function App() {
const [isCompactSideMenu, setIsCompactSideMenu] = useState(false);
const [isFeedbackSurveyOpen, setFeedbackSurveyOpen] = useState(false);
const FULL_WIDTH_ROUTES = ['/map', ANIMALS_INVENTORY_URL, ANIMALS_URL];
const FULL_WIDTH_ROUTES = ['/map', ANIMALS_INVENTORY_URL];
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need ANIMALS_URL to make the animal details view full width ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call!!

Duncan-Brain
Duncan-Brain previously approved these changes Dec 5, 2024
Copy link
Collaborator

@Duncan-Brain Duncan-Brain left a comment

Choose a reason for hiding this comment

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

Awesome thanks for doing this!

Edit: saw Sayaka is also reviewing haha ... undo my approval!

Question: should we immediately make a "revert" PR for future us?

@@ -43,17 +41,15 @@ import { useSelector } from 'react-redux';
import { locationsSelector } from '../../locationSlice';
import { Location } from '../../../types';

export type AnimalInventory = {
export type AnimalInventoryItem = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for improving this!

@Duncan-Brain Duncan-Brain self-requested a review December 5, 2024 18:27
@kathyavini
Copy link
Collaborator

Question: should we immediately make a "revert" PR for future us?

@Duncan-Brain Aren't we doing a sensors release before we add anything to animals, though?

@antsgar you have another conflict, sorry. At this point it feels like every merge is a conflict in three other PRs 😅

@Duncan-Brain
Copy link
Collaborator

@kathyavini yeah, just asking if we should make a PR -- not merge it. Probably answer is no haha

@antsgar antsgar dismissed stale reviews from Duncan-Brain and kathyavini via e18b86c December 5, 2024 22:05
@antsgar
Copy link
Collaborator Author

antsgar commented Dec 5, 2024

@Duncan-Brain it'd be pretty easy to create one with a revert commit from the merge commit once this is merged, so I think we could do that when the time comes!

@SayakaOno I readded the translation strings, good call ☺️ this is ready for re-reviews I think

@kathyavini kathyavini added this pull request to the merge queue Dec 5, 2024
Merged via the queue into integration with commit f1db435 Dec 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants