Chatwoot/app/dashboards/installation_config_dashboard.rb
Sony Mathew 18d3c40fb3
feat: installation config in super admin console (#1641)
* feat: installation config in super admin console

* Added the ability for super admins to view, edit and update
installation config values. Also they can add new isntallation config
values. The impact of editing and adding depends on which all
installation config values are being used in the code.
* Known limitation now: Ability to edit hash values (for eg: feature
flags) are disabled. This requires more work and will be taken up in
a secondary set of changes.
* Minor UX improvement. Clicking on the Sidekiq option in the super
admin siebar will now open the sidekiq dashboard in a new tab rather
than in the same tab that you were using super admin.

* fix: method name fix in custom adminsitrate field

* feat: added locked attribute to global config
* Added the locked attribute to instalaltion config table. Added
necessary migrations. Added changes in config loader.
* Added the changes on the installation config yml
* Locked the account feature defaults in code

* feat: show only editable configs in admin console
* Added a new scope in installation config model
* Added scope in adminstrate controller for installation_config

* fix: new installation config create error
* Fixed the error in new installation config create

* fix: specs coverage
* Added specs for installation config super admin controller

* chore: update git ignore with encrypted config ext
2021-01-15 13:21:53 +05:30

66 lines
1.8 KiB
Ruby

require 'administrate/base_dashboard'
class InstallationConfigDashboard < Administrate::BaseDashboard
# ATTRIBUTE_TYPES
# a hash that describes the type of each of the model's fields.
#
# Each different type represents an Administrate::Field object,
# which determines how the attribute is displayed
# on pages throughout the dashboard.
ATTRIBUTE_TYPES = {
id: Field::Number,
name: Field::String,
value: SerializedField,
created_at: Field::DateTime,
updated_at: Field::DateTime
}.freeze
# COLLECTION_ATTRIBUTES
# an array of attributes that will be displayed on the model's index page.
#
# By default, it's limited to four items to reduce clutter on index pages.
# Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = %i[
id
name
value
created_at
].freeze
# SHOW_PAGE_ATTRIBUTES
# an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = %i[
id
name
value
created_at
updated_at
].freeze
# FORM_ATTRIBUTES
# an array of attributes that will be displayed
# on the model's form (`new` and `edit`) pages.
FORM_ATTRIBUTES = %i[
name
value
].freeze
# COLLECTION_FILTERS
# a hash that defines filters that can be used while searching via the search
# field of the dashboard.
#
# For example to add an option to search for open resources by typing "open:"
# in the search field:
#
# COLLECTION_FILTERS = {
# open: ->(resources) { resources.where(open: true) }
# }.freeze
COLLECTION_FILTERS = {}.freeze
# Overwrite this method to customize how installation configs are displayed
# across all pages of the admin dashboard.
#
# def display_resource(installation_config)
# "InstallationConfig ##{installation_config.id}"
# end
end