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
This commit is contained in:
Sony Mathew
2021-01-15 13:21:53 +05:30
committed by GitHub
parent 2e19de5d01
commit 18d3c40fb3
16 changed files with 296 additions and 30 deletions

View File

@@ -0,0 +1,26 @@
class AddLockedAttributeToInstallationConfig < ActiveRecord::Migration[6.0]
def up
add_column :installation_configs, :locked, :boolean, default: true, null: false
purge_duplicates
add_index :installation_configs, :name, unique: true
end
def down
remove_column :installation_configs, :locked
remove_index :installation_configs, :name
end
def purge_duplicates
config_names = InstallationConfig.all.map(&:name).uniq
config_names.each do |name|
ids = InstallationConfig.where(name: name).pluck(&:id)
next if ids.size <= 1
# preserve the last config and destroy rest
ids.sort!
ids.pop
InstallationConfig.where(id: ids).destroy_all
end
end
end

View File

@@ -10,8 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_01_09_211805) do
ActiveRecord::Schema.define(version: 2021_01_13_045116) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@@ -293,7 +292,9 @@ ActiveRecord::Schema.define(version: 2021_01_09_211805) do
t.jsonb "serialized_value", default: {}, null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.boolean "locked", default: true, null: false
t.index ["name", "created_at"], name: "index_installation_configs_on_name_and_created_at", unique: true
t.index ["name"], name: "index_installation_configs_on_name", unique: true
end
create_table "integrations_hooks", force: :cascade do |t|