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

Add new transition form #1384

Merged
merged 11 commits into from
Sep 11, 2023
Merged

Add new transition form #1384

merged 11 commits into from
Sep 11, 2023

Commits on Sep 8, 2023

  1. Add constants for global and special redirect types

    We want to add a new site form. In order to do this we will need an easy way to
    access these values.
    
    We might want to consider refining these further into enums, as this would
    allow us to remove some of the methods in the site model.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    2376ba3 View commit details
    Browse the repository at this point in the history
  2. Add routes for site creation

    We want to add sites per organisation.
    
    This add nested routes for site creation.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    98a59f2 View commit details
    Browse the repository at this point in the history
  3. Only validate presence of canonical host or aka if hostname is present

    If hostname is not provided for the host, this validation will raise an error.
    
    Add a condition that this validation only runs when hostname is present.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    0250f54 View commit details
    Browse the repository at this point in the history
  4. Add site form object

    We are aiming to archive Transition Config which is currently used to create
    sites in Transition.
    
    This adds a form object for the creation of a site. 
    
    It's worth noting that the process currently moves existing hosts and aka hosts
    to the new site if they already exist (see
    `lib/transition/import/site_yaml_file.rb`). We aren't yet sure whether we want
    to create a new UI for that functionality, or to use this form. For now, this
    form does not have that functionality.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    da2db05 View commit details
    Browse the repository at this point in the history
  5. Add site creation actions and views

    We are aiming to archive Transition Config which is currently used to create
    sites in Transition.
    
    This adds the actions and views necessary for a user to add a new transition.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    6e38101 View commit details
    Browse the repository at this point in the history
  6. Validate that host hostname is lowercase

    Currently the site importer (`lib/transition/import/site_yaml_file.rb`)
    downcases any hostnames.
    
    This adds validation to the host model which will be surfaced on the new site
    form.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    e249f33 View commit details
    Browse the repository at this point in the history
  7. Only allow Site managers to create new sites

    This adds authorization that only people with the `Site manager` role in GOV.UK
    Signon can create new sites.
    
    This is so that we can safely test new features before we officially archive
    Transition Config.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    cb051c7 View commit details
    Browse the repository at this point in the history
  8. Validate that global new URL is absent if the global type is "archive"

    Currently, there is validation in place to prevent the creation of sites which
    have a global type of "redirect" without a global new URL, but the opposite
    validation is missing.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    7e1e35e View commit details
    Browse the repository at this point in the history
  9. Improve appearance of radio buttons

    In order to style these using Bootstrap, we need to provide a block to `collection_radio_buttons`.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    ab5026c View commit details
    Browse the repository at this point in the history
  10. Nilify blanks on the Site model

    The optional fields of the site form come through as empty strings when left
    blank. These are then saved in the database, when ideally these would be saved
    as `nil` in order to preserve the previous behaviour of adding them through
    Transition Config for consistency.
    
    We already have a module that handles the nilification of blanks, however we
    need to make a couple of changes:
    - We add an "except list" of attributes that we don't want to nilify, such as
      Booleans that should be false and not nil (false.blank? == true).
    - We allow blank for `special_redirect_strategy` as this will now be nilified
      before save.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    e68936d View commit details
    Browse the repository at this point in the history
  11. Add hints to new site form inputs

    This copies the guidance fro Transition Config over to the new site form.
    
    This will need later refinement.
    jkempster34 committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    1f8f4ef View commit details
    Browse the repository at this point in the history