Skip to content

Feature/restructure farm#648

Merged
vincent-olivert-riera merged 4 commits intoline:masterfrom
hoangpn:feature/restructure_farm
Sep 19, 2025
Merged

Feature/restructure farm#648
vincent-olivert-riera merged 4 commits intoline:masterfrom
hoangpn:feature/restructure_farm

Conversation

@hoangpn
Copy link
Contributor

@hoangpn hoangpn commented Sep 12, 2025

Convert the relationship between the Project and the Farm from N-1 to 1-1 by reusing the farm_id field in the table promgen_project and cloning data in the table promgen_farm.

This PR includes the following changes:

  • Migration script for cloning farms.
  • Remove the Farm Link feature for Local Farm.
  • Remove the Farm's permission management feature.
  • Remove the owner field of the Farm.
  • Updates on UI due to BE's changes.

UI changes:

Project's Hosts : Buttons and Confirn message (only changes for Local Farm)
AS-IS:
image
image
image
TO-BE:
image
image
image

Farm Register: Remove owner field
AS-IS:
image
TO-BE:
image

Farm Detail: Remove panels and change the breadcrumb
AS-IS:
image
TO-BE:
image

Host Detail: Change UI and the Silence button
AS-IS:
image
TO-BE:
image

Farm List: Remove ul tag due to only one project per farm
AS-IS:
image
TO-BE:
image

Host List: Remove ul tag due to only one project per farm
AS-IS:
image
TO-BE:
image

Search: Change UI and the Silence button
AS-IS:
image
TO-BE:
image

We added a migration script to link projects to a newly cloned farm if they are using
a shared farm with other projects. Due to the presence of these cloned farms, we also
removed the constraint that required farm names and farm sources to be unique.
@hoangpn hoangpn force-pushed the feature/restructure_farm branch 7 times, most recently from 6bdfbcd to 18ae98e Compare September 16, 2025 07:49
We have added some changes to both UI and View classes to make Farm become child object of Project. Each Project will have its own Farm.
- Not support linking Project to an existed local Farm.
- Always delete Farm after unlinking it from its Project.
- Always create new Farm in the database when linking a remote Farm.
Since the Farm has become a child object of the Project, we have removed all
permissions and the permission management feature related to the Farm model.
Now, a user's permissions on a Farm will be inherited from the user's permissions
on the parent Project of that Farm.
Since the Farm has become a child object of the Project and the permission management
for the Farm has inherited from its parent Project, the field 'owner' of the Farm model
become unnecessary. We have removed this field.
@hoangpn hoangpn force-pushed the feature/restructure_farm branch from 18ae98e to 9504934 Compare September 16, 2025 09:39
Copy link
Contributor

@vincent-olivert-riera vincent-olivert-riera left a comment

Choose a reason for hiding this comment

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

LGTM

@vincent-olivert-riera vincent-olivert-riera merged commit 1eecf01 into line:master Sep 19, 2025
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.

2 participants