Skip to content

WIP | Enable / Disable Settings in UI#847

Closed
jtdub wants to merge 52 commits intodevelopfrom
gc-app-settings
Closed

WIP | Enable / Disable Settings in UI#847
jtdub wants to merge 52 commits intodevelopfrom
gc-app-settings

Conversation

@jtdub
Copy link
Copy Markdown
Contributor

@jtdub jtdub commented Dec 11, 2024

Closes #842.

  1. Removes conditional based UI views
  2. Allows configurations to be updated in the Golden Config Settings UI.

Navigation views display all options regardless of what is enabled or disabled:

Screenshot 2024-12-19 at 6 28 06 PM

Golden Config Settings displays whether backups and intended are enabled:

Screenshot 2024-12-19 at 6 29 54 PM

Creating and Updating Golden Config Settings in the UI:

Screenshot 2024-12-19 at 3 28 39 PM Screenshot 2024-12-19 at 3 28 50 PM

Reading the Golden Config Settings in the UI.

Screenshot 2024-12-19 at 3 30 02 PM

@jtdub jtdub self-assigned this Dec 11, 2024
@jtdub jtdub marked this pull request as draft December 11, 2024 18:44
@jtdub jtdub force-pushed the gc-app-settings branch 2 times, most recently from 47e4b89 to 3113bf9 Compare December 13, 2024 15:32
@jtdub jtdub marked this pull request as ready for review December 16, 2024 19:00
@jtdub jtdub changed the title WIP | Remove conditional views in Golden Config Remove conditional views in Golden Config Dec 16, 2024
@jeffkala
Copy link
Copy Markdown
Contributor

jeffkala commented Dec 18, 2024

  • content_template.html - Does have some conditional views logic as well. But perhaps its one that makes some since since its on the device detail side. Just notating here for review purposes for now, no action right now.
  • goldenconfig_list.html - Has some conditional view logic that needs to figure out if we should remove as well.

@jeffkala
Copy link
Copy Markdown
Contributor

AS far as this concern: "UI-based configuration settings would apply to each device individually within a dynamic group, rather than checking the configuration globally once."

I don't expect this to cause much performance issue as we already have function get_device_to_settings_map that does most of this work. I think its still one call to that function to create the map and then its a call to the map.

@jtdub jtdub marked this pull request as draft December 19, 2024 21:30
@jeffkala
Copy link
Copy Markdown
Contributor

jeffkala commented Dec 19, 2024

List view for GC settings has two different types of checkbox.
Screenshot 2024-12-19 at 3 02 11 PM

Also not sure we really need all these in the table view.

Comment thread tasks.py Outdated
@jtdub jtdub marked this pull request as ready for review December 27, 2024 22:02
@jtdub jtdub requested a review from jeffkala December 27, 2024 22:02
jtdub

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@jeffkala jeffkala left a comment

Choose a reason for hiding this comment

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

Also looks like you're missing the EXXX.md files in the mkdocs.yml file to be rendered on the actual docs. site.

Comment thread nautobot_golden_config/nornir_plays/config_backup.py Outdated
Comment thread nautobot_golden_config/nornir_plays/config_compliance.py Outdated
Comment thread nautobot_golden_config/nornir_plays/config_deployment.py Outdated
@jtdub jtdub requested a review from jeffkala February 27, 2025 21:42
@jeffkala
Copy link
Copy Markdown
Contributor

jeffkala commented Feb 27, 2025

@jtdub I still feel like the error messages are a bit off. Maybe its related to the actual git-repo side of it.

Backup on a device in a GC setting where backups are disabled I get

BACKUP CONFIG failed: 'NoneType' object has no attribute 'filesystem_path'

Its because we do some determination on what repos must be synced at the beginning of each job. I'm testing now and will report back any other things I'd like fixed but getting closer!!

Seems like the get setting is the problem

db_instance = models.GoldenConfigSetting.objects.first()

Really isn't good enough as inscope devices can be apart of different GC settings. This works fine if you really have a single config setting, but breaks when there is multiple.

@jeffkala
Copy link
Copy Markdown
Contributor

feel like in general to make all the different conditional checks we do throughout we need

  1. Take in a device filterset QS based on job form devicefilterset ValueError
  2. Get the unique in-scope golden config settings
  3. Get the backup enabled devices
  4. Get the backup repos
  5. Get the intended enabled devices
  6. Get the intended repos
    etc.

Maybe something like

from nautobot_golden_config.utilities.helper import get_golden_config_settings

class CustomFilterSettings:
    def __init__(self, queryset):
        self.queryset = queryset
    
    def get_unique_inscope_gcs(self, device_qs):
        return set(get_device_to_settings_map(device_qs).values())
    def get_backup_enabled(self):
        return {"true": [device for device in self.queryset if device.backup_enabled],
                "false": [device for device in self.queryset if not device.backup_enabled]}
    def get_backup_repos(self):
        return [GitRepsitory.object.filter(....)]
    def get_intended_enabled(self):
        return {"true": [device for device in self.queryset if device.intended_enabled],
                "false": [device for device in self.queryset if not device.intended_enabled]}
    def get_intended_repos(self):
        return return [GitRepsitory.object.filter(....)]

@jtdub jtdub marked this pull request as draft March 26, 2025 18:47
@jtdub jtdub changed the title Remove conditional views in Golden Config WIP | Enable / Disable Settings in UI Mar 27, 2025
@jeffkala
Copy link
Copy Markdown
Contributor

closing as its being covered in: #984

@jeffkala jeffkala closed this Sep 26, 2025
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.

Make Global App config options available on a per golden config setting level

2 participants