Add min attribute to elasticsearch form
What does this MR do and why?
Related Issue: #245219 (closed)
The elasticsearch settings form allows users to select negative values. The corresponding model IndexSetting has the necessary validations for number_of_replicas
and number_of_shard
attributes.
class IndexSetting < ApplicationRecord
self.table_name = 'elastic_index_settings'
validates :alias_name, uniqueness: true, length: { maximum: 255 }
validates :number_of_replicas, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :number_of_shards, presence: true, numericality: { only_integer: true, greater_than: 0 }
In the _elasticsearch_form.html.haml file, the number_field
helper doesn't have the min attribute.
This MR adds a minor change to the _elasticsearch_form.html.haml file to set the min attribute for number_of_replicas
and number_of_shard
settings.
Screenshots or screen recordings
Before:
After:
How to set up and validate locally
- Switch to
sshaik-elasticreplicas
branch - Once the app is up and running, navigate to https://gitlab.example.com/admin/application_settings/advanced_search (Please not that it's a paid feature)
- Expand the
Advanced Search
section and change/test the values underNumber of Elasticsearch shards and replicas per index
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by sameer shaik