chore: Reorganize the installation config settings (#8794)

- Reorganizing installation config settings to move more configurations into UI from environment variables
- Changes to installation config to support premium plans in the enterprise edition
- Fixes the broken premium indicator in account/show and accounts/edit page
This commit is contained in:
Sojan Jose
2024-01-31 16:48:42 +04:00
committed by GitHub
parent ee3f734b7b
commit 390cd756e8
20 changed files with 398 additions and 62 deletions

View File

@@ -4,11 +4,15 @@
<div class="field-unit__field feature-container">
<% field.data.each do |key,val| %>
<div class='feature-cell'>
<% if ['audit_logs', 'response_bot'].include? key %>
<span class='icon-container'><i class="ion ion-asterisk"></i></span>
<% is_premium = SuperAdmin::AccountFeaturesHelper.account_premium_features.include? key %>
<% if is_premium %>
<span class='icon-container'>
<svg class="inline" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"><path d="M480 224l-186.828 7.487L401.688 64l-59.247-32L256 208 169.824 32l-59.496 32 108.5 167.487L32 224v64l185.537-10.066L113.65 448l55.969 32L256 304l86.381 176 55.949-32-103.867-170.066L480 288z" fill="currentColor"/></svg>
</span>
<% end %>
<span><%= key %></span>
<span class='value-container'><%= check_box "enabled_features", "feature_#{key}", { checked: val }, true, false %> </span>
<% should_disable = is_premium && ChatwootHub.pricing_plan == 'community' %>
<span class='value-container'><%= check_box "enabled_features", "feature_#{key}", { checked: val, disabled: should_disable }, true, false %> </span>
</div>
<% end %>
</div>

View File

@@ -1,8 +1,10 @@
<div class='feature-container'>
<% field.data.each do |key,val| %>
<div class='feature-cell'>
<% if ['audit_logs', 'response_bot'].include? key %>
<span class='icon-container'><i class="ion ion-asterisk"></i></span>
<% if SuperAdmin::AccountFeaturesHelper.account_premium_features.include? key %>
<span class='icon-container'>
<svg class="inline" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"><path d="M480 224l-186.828 7.487L401.688 64l-59.247-32L256 208 169.824 32l-59.496 32 108.5 167.487L32 224v64l185.537-10.066L113.65 448l55.969 32L256 304l86.381 176 55.949-32-103.867-170.066L480 288z" fill="currentColor"/></svg>
</span>
<% end %>
<span><%= key %></span>
<span class='value-container'><%= val.present? ? '✅' : '❌' %> </span>

View File

@@ -1,5 +1,5 @@
<% content_for(:title) do %>
Configure Settings
Configure Settings - <%= @config.titleize %>
<% end %>
<header class="main-content__header" role="banner">
<h1 class="main-content__page-title" id="page-title">

View File

@@ -13,6 +13,15 @@
</div>
</header>
<section class="main-content__body">
<% if Redis::Alfred.get(Redis::Alfred::CHATWOOT_INSTALLATION_CONFIG_RESET_WARNING) %>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-5" role="alert">
<strong class="font-bold">Alert!</strong>
<span class="block sm:inline">Unauthorized premium changes detected in Chatwoot. To keep using them, please upgrade your plan.
Contact for help :</span><span class="inline rounded-full bg-red-200 px-2 text-white ml-2">sales@chatwoot.com</span>
</div>
<% end %>
<div class="bg-white py-2 px-3">
<div class="mb-4">
<div class="flex items-center gap-2">
@@ -44,7 +53,7 @@
<% if ChatwootHub.pricing_plan != 'community' && User.count > ChatwootHub.pricing_plan_quantity %>
<div role="alert">
<div class="border border-t-0 border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700">
<p>You have <%= User.count %> agents. Please add more licenses.</p>
<p>You have <%= User.count %> agents. Please add more licenses to add more users.</p>
</div>
</div>
<% end %>