Skip to content

Commit

Permalink
CB-5060 add beta features config param (#2599)
Browse files Browse the repository at this point in the history
* CB-5109 add beta features config param

* CB-5109 rename param

* CB-5060 feat: disable beta features

* CB-5109 add param to config file

---------

Co-authored-by: Alexey <[email protected]>
Co-authored-by: kseniaguzeeva <[email protected]>
  • Loading branch information
3 people authored May 14, 2024
1 parent 12bc212 commit 833dae5
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/sample-databases/DefaultConfiguration/cloudbeaver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
"h2:h2_embedded",
"h2:h2_embedded_v2",
"clickhouse:yandex_clickhouse"
],
disabledBetaFeatures: [

]

}
Expand Down
3 changes: 3 additions & 0 deletions config/sample-databases/SQLiteConfiguration/cloudbeaver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
"h2:h2_embedded",
"h2:h2_embedded_v2",
"clickhouse:yandex_clickhouse"
],
disabledBetaFeatures: [

]

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ public abstract class BaseWebAppConfiguration implements WebAppConfiguration {
protected boolean resourceManagerEnabled;
protected boolean showReadOnlyConnectionInfo;
protected String[] enabledFeatures;
protected String[] disabledBetaFeatures;


public BaseWebAppConfiguration() {
this.plugins = new LinkedHashMap<>();
this.resourceManagerEnabled = true;
this.enabledFeatures = null;
this.disabledBetaFeatures = new String[0];
this.showReadOnlyConnectionInfo = false;
}

Expand All @@ -46,6 +49,7 @@ public BaseWebAppConfiguration(BaseWebAppConfiguration src) {
this.defaultUserTeam = src.defaultUserTeam;
this.resourceManagerEnabled = src.resourceManagerEnabled;
this.enabledFeatures = src.enabledFeatures;
this.disabledBetaFeatures = src.disabledBetaFeatures;
this.showReadOnlyConnectionInfo = src.showReadOnlyConnectionInfo;
}

Expand Down Expand Up @@ -104,4 +108,8 @@ public void setEnabledFeatures(String[] enabledFeatures) {
public boolean isShowReadOnlyConnectionInfo() {
return showReadOnlyConnectionInfo;
}

public String[] getDisabledBetaFeatures() {
return disabledBetaFeatures;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ type ServerConfig {
distributed: Boolean!

enabledFeatures: [ID!]!
disabledBetaFeatures: [ID!] @since(version: "24.0.5")
enabledAuthProviders: [ID!]!
supportedLanguages: [ ServerLanguage! ]!
services: [ WebServiceConfig ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.service.security.PasswordPolicyConfiguration;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.navigator.DBNBrowseSettings;
import org.jkiss.dbeaver.registry.language.PlatformLanguageDescriptor;
Expand Down Expand Up @@ -155,6 +156,12 @@ public String[] getEnabledFeatures() {
return application.getAppConfiguration().getEnabledFeatures();
}

@Property
@Nullable
public String[] getDisabledBetaFeatures() {
return application.getAppConfiguration().getDisabledBetaFeatures();
}

@Property
public String[] getEnabledAuthProviders() {
return application.getAppConfiguration().getEnabledAuthProviders();
Expand Down
4 changes: 4 additions & 0 deletions webapp/packages/core-root/src/ServerConfigResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export class ServerConfigResource extends CachedDataResource<ServerConfig | null
return this.update.resourceManagerEnabled ?? this.data?.resourceManagerEnabled ?? false;
}

isBetaFeatureDisabled(feature: string): boolean {
return this.data?.disabledBetaFeatures?.includes(feature) || false;
}

isFeatureEnabled(feature: string, serverSide = false): boolean {
if (serverSide) {
return this.data?.enabledFeatures.includes(feature) || false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ query serverConfig {
distributed

enabledFeatures
disabledBetaFeatures
enabledAuthProviders
supportedLanguages {
isoCode
Expand Down

0 comments on commit 833dae5

Please sign in to comment.