MM-52818 - create config setting to enable/disable playbooks product (#23508)
* create config setting to enable/disable playbooks product * fix to config name * fix typo * revert changes to package-lock.json * update name of test --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3705d7af4d
Коммит
22275fa0f5
@@ -607,6 +607,7 @@ const defaultServerConfig: AdminConfig = {
|
|||||||
},
|
},
|
||||||
ProductSettings: {
|
ProductSettings: {
|
||||||
EnablePublicSharedBoards: false,
|
EnablePublicSharedBoards: false,
|
||||||
|
EnablePlaybooks: true,
|
||||||
},
|
},
|
||||||
PluginSettings: {
|
PluginSettings: {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ func (s *Server) shouldStart(product string) bool {
|
|||||||
s.Log().Warn("Skipping Playbooks start: disabled via env var")
|
s.Log().Warn("Skipping Playbooks start: disabled via env var")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if !*s.Config().ProductSettings.EnablePlaybooks {
|
||||||
|
s.Log().Warn("Skipping Playbooks start: disabled via configuration")
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
|||||||
props["AllowSyncedDrafts"] = strconv.FormatBool(*c.ServiceSettings.AllowSyncedDrafts)
|
props["AllowSyncedDrafts"] = strconv.FormatBool(*c.ServiceSettings.AllowSyncedDrafts)
|
||||||
props["DelayChannelAutocomplete"] = strconv.FormatBool(*c.ExperimentalSettings.DelayChannelAutocomplete)
|
props["DelayChannelAutocomplete"] = strconv.FormatBool(*c.ExperimentalSettings.DelayChannelAutocomplete)
|
||||||
|
|
||||||
|
props["EnablePlaybooks"] = strconv.FormatBool(*c.ProductSettings.EnablePlaybooks)
|
||||||
|
|
||||||
if license != nil {
|
if license != nil {
|
||||||
props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer)
|
props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer)
|
||||||
|
|
||||||
|
|||||||
@@ -326,6 +326,20 @@ func TestGetClientConfig(t *testing.T) {
|
|||||||
"ExperimentalSharedChannels": "true",
|
"ExperimentalSharedChannels": "true",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Default Playbooks Enabled",
|
||||||
|
&model.Config{
|
||||||
|
ProductSettings: model.ProductSettings{},
|
||||||
|
},
|
||||||
|
"",
|
||||||
|
&model.License{
|
||||||
|
Features: &model.Features{},
|
||||||
|
SkuShortName: "other",
|
||||||
|
},
|
||||||
|
map[string]string{
|
||||||
|
"EnablePlaybooks": "true",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, testCase := range testCases {
|
for _, testCase := range testCases {
|
||||||
|
|||||||
@@ -2879,6 +2879,7 @@ func (s *CloudSettings) SetDefaults() {
|
|||||||
|
|
||||||
type ProductSettings struct {
|
type ProductSettings struct {
|
||||||
EnablePublicSharedBoards *bool
|
EnablePublicSharedBoards *bool
|
||||||
|
EnablePlaybooks *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ProductSettings) SetDefaults(plugins map[string]map[string]any) {
|
func (s *ProductSettings) SetDefaults(plugins map[string]map[string]any) {
|
||||||
@@ -2889,6 +2890,9 @@ func (s *ProductSettings) SetDefaults(plugins map[string]map[string]any) {
|
|||||||
s.EnablePublicSharedBoards = NewBool(false)
|
s.EnablePublicSharedBoards = NewBool(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if s.EnablePlaybooks == nil {
|
||||||
|
s.EnablePlaybooks = NewBool(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type PluginState struct {
|
type PluginState struct {
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ function configureClient() {
|
|||||||
|
|
||||||
function loadRemoteModules() {
|
function loadRemoteModules() {
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
return async (/*dispatch: DispatchFunc, getState: GetStateFunc*/) => {
|
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||||
// const config = getConfig(getState());
|
const config = getConfig(getState());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* products contains a map of product IDs to a function that will load all of their parts. Calling that
|
* products contains a map of product IDs to a function that will load all of their parts. Calling that
|
||||||
@@ -47,7 +47,7 @@ function loadRemoteModules() {
|
|||||||
* Note that these import paths must be statically defined or else they won't be found at runtime. They
|
* Note that these import paths must be statically defined or else they won't be found at runtime. They
|
||||||
* can't be constructed based on the name of a product at runtime.
|
* can't be constructed based on the name of a product at runtime.
|
||||||
*/
|
*/
|
||||||
const products = [
|
let products = [
|
||||||
{
|
{
|
||||||
id: 'boards',
|
id: 'boards',
|
||||||
load: () => ({
|
load: () => ({
|
||||||
@@ -65,6 +65,9 @@ function loadRemoteModules() {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
if (config.EnablePlaybooks !== 'true') {
|
||||||
|
products = products.filter((p) => p.id !== 'playbooks');
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.all(products.map(async (product) => {
|
await Promise.all(products.map(async (product) => {
|
||||||
if (!REMOTE_CONTAINERS[product.id]) {
|
if (!REMOTE_CONTAINERS[product.id]) {
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export type ClientConfig = {
|
|||||||
EnableOAuthServiceProvider: string;
|
EnableOAuthServiceProvider: string;
|
||||||
EnableOpenServer: string;
|
EnableOpenServer: string;
|
||||||
EnableOutgoingWebhooks: string;
|
EnableOutgoingWebhooks: string;
|
||||||
|
EnablePlaybooks: string;
|
||||||
EnablePostIconOverride: string;
|
EnablePostIconOverride: string;
|
||||||
EnablePostUsernameOverride: string;
|
EnablePostUsernameOverride: string;
|
||||||
EnablePreviewFeatures: string;
|
EnablePreviewFeatures: string;
|
||||||
@@ -818,6 +819,7 @@ export type JobSettings = {
|
|||||||
|
|
||||||
export type ProductSettings = {
|
export type ProductSettings = {
|
||||||
EnablePublicSharedBoards: boolean;
|
EnablePublicSharedBoards: boolean;
|
||||||
|
EnablePlaybooks: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PluginSettings = {
|
export type PluginSettings = {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user