Skip to content

Application Settings API - Move JS to CE

Zack Cuddy requested to merge cuddyz-move-js-endpoint-to-ce into master

What does this MR do and why?

Discovered as part of !131090 (merged)

The Application Settings API is available for all tiers per the documentation. Originally there was some confusion since this doc is located in the ee/ directory of the docs. However, this is actually a misrepresentation per this issue: gitlab-docs#1081 (closed)

Additionally when looking at the implementation of the API in rails you will find it in the ce/ directory.


Now prior to the effort where this was discovered linked above all implementations in the code base for this endpoint were in ee/ features and thus the API implementation in JS lived in ee/api without any issues. Now that a ce/ feature will be using it we need to refactor it into a ce/ domain. As well as to the rest_api.js file per the API refactor.

Impacted Usages/Changes

  1. Geo Settings
    • JS code refactored to use new import
    • Jest code mocks axios directly so no updates needed
  2. Maintenance Mode
    • JS code refactored to use new import
    • Jest code mocks axios directly so no updates needed
  3. Git Abuse Settings
    • JS code refactored to use new import
    • Jest code refactored to use new import

Screenshots or screen recordings

Videos of all features continuing to work

Geo Settings Maintenance Mode Git Abuse Settings
Geo MM Abuse

How to set up and validate locally

Testing CE endpoints

  1. Setup a GDK with no license
  2. Hit the GET path api/v4/application/settings
  3. Ensure data is returned
  4. Hit the PUT path (w/ postman/curl/etc.) to update a setting api/v4/application/settings
  5. Ensure data is updated

Geo Settings

  1. Setup Geo by following the 1-line installation in the Easy Installation section (How to setup Geo)
  2. Navigate to Geo Settings (/admin/geo/settings)
  3. Ensure you can update settings in the UI and it retains changes after refresh

Maintenance Mode

  1. Setup Premium/Ultimate license
  2. Navigate to Admin > Settings > General
  3. Find the the maintenance mode panel
  4. Enable and add message, click save changes
  5. Refresh a few times, it takes the instance a second to enable
  6. Ensure the alert shows up and your settings are retained

Git Abuse Settings

  1. Setup Ultimate license
  2. Navigate to Admin > Settings > Reporting
  3. Find the Git Abuse panel
  4. Ensure you can update settings in the UI and it retains changes after refresh

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports