diff --git a/dev/tool/src/configuration.ts b/dev/tool/src/configuration.ts index c560b8d2f49..d0d213d94f1 100644 --- a/dev/tool/src/configuration.ts +++ b/dev/tool/src/configuration.ts @@ -34,9 +34,7 @@ export async function changeConfiguration ( const config = await connection.findAll(core.class.PluginConfiguration, {}) if (cmd.list === true) { for (const c of config) { - if (c.label !== undefined) { - console.log(toLen(c.pluginId, '-', 20), c.enabled) - } + console.log(toLen(c.pluginId, '-', 20), c.enabled, c.hidden === true ? '(hidden)' : '') } } const enable = (cmd.enable ?? '').trim().split(',') diff --git a/models/all/src/index.ts b/models/all/src/index.ts index b056719d9fe..9db37578627 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -190,6 +190,7 @@ export default function buildModel (): Builder { label: contact.string.ConfigLabel, description: contact.string.ConfigDescription, enabled: true, + system: true, beta: false, icon: contact.icon.ContactApplication, classFilter: defaultFilter @@ -354,10 +355,11 @@ export default function buildModel (): Builder { requestModel, requestId, { - // label: request.string.ConfigLabel, + label: setting.string.Configure, // description: request.string.ConfigDescription, enabled: false, beta: false, + hidden: true, classFilter: defaultFilter } ], @@ -421,8 +423,10 @@ export default function buildModel (): Builder { questionsModel, questionsId, { + label: setting.string.Configure, enabled: false, beta: false, + hidden: true, classFilter: defaultFilter } ], @@ -480,7 +484,16 @@ export default function buildModel (): Builder { [emojiModel, emojiId], [communicationModel, communicationId], [mailModel, mailId], - [billingModel, billingId, { beta: false, hidden: true, enabled: true }], + [ + billingModel, + billingId, + { + label: setting.string.Configure, + beta: false, + hidden: true, + enabled: true + } + ], [hulyMailModel, hulyMailId], [ aiAssistantModel, @@ -543,7 +556,9 @@ export default function buildModel (): Builder { pluginId: id, transactions: txes.map((it) => it._id), ...config, - enabled: config?.label === undefined || ((config?.enabled ?? true) && !(config.hidden ?? false)), + label: config?.label ?? setting.string.Configure, + hidden: config !== undefined ? config.hidden : true, + enabled: (config?.enabled ?? true) && !(config?.hidden ?? false), beta: config?.beta ?? false }, ('plugin-configuration-' + id) as Ref diff --git a/packages/core/src/__tests__/client.test.ts b/packages/core/src/__tests__/client.test.ts index e4770b566b2..ae01a115457 100644 --- a/packages/core/src/__tests__/client.test.ts +++ b/packages/core/src/__tests__/client.test.ts @@ -178,6 +178,7 @@ describe('client', () => { const pluginData1: Data = { pluginId: 'testPlugin1' as Plugin, + label: 'Test Plugin 1' as IntlString, transactions: [], beta: true, enabled: true @@ -198,6 +199,7 @@ describe('client', () => { const pluginData2 = { pluginId: 'testPlugin2' as Plugin, + label: 'Test Plugin 2' as IntlString, transactions: [], beta: true, enabled: true @@ -219,6 +221,7 @@ describe('client', () => { const pluginData3 = { pluginId: 'testPlugin3' as Plugin, + label: 'Test Plugin 3' as IntlString, transactions: [txCreateDoc1._id], beta: true, enabled: true diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index 12aa10bacf9..55c570ee9cf 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -275,11 +275,14 @@ export interface PluginConfiguration extends Doc { pluginId: Plugin transactions: Ref[] - label?: IntlString + label: IntlString icon?: Asset description?: IntlString enabled: boolean + // If set will not allow to disable this configuration + system?: true + // If set will not be shown in configuration UI or enabled hidden?: boolean diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 3314a14f124..6706e449e6e 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -819,7 +819,9 @@ export function fillConfiguration (systemTx: Tx[], configs: Map) if (c !== undefined) { - TxProcessor.updateDoc2Doc(c, ut) + if (c.system !== true || ut.modifiedBy === core.account.ConfigUser) { + TxProcessor.updateDoc2Doc(c, ut) + } } } } diff --git a/packages/presentation/src/configuration.ts b/packages/presentation/src/configuration.ts index 41bdafe1274..5f74edcda21 100644 --- a/packages/presentation/src/configuration.ts +++ b/packages/presentation/src/configuration.ts @@ -36,7 +36,8 @@ export class ConfigurationManager { ) {} has (plugin: Plugin): boolean { - return this.configuration.get(plugin)?.enabled !== false + const configuration = this.configuration.get(plugin) + return configuration !== undefined && configuration.enabled } hasResource(resource?: Resource | null): boolean | undefined { diff --git a/plugins/setting-resources/src/components/Configure.svelte b/plugins/setting-resources/src/components/Configure.svelte index 70688d59657..394f73dac01 100644 --- a/plugins/setting-resources/src/components/Configure.svelte +++ b/plugins/setting-resources/src/components/Configure.svelte @@ -38,7 +38,7 @@
{#each $pluginConfigurationStore.list as config} - {#if config.label && !(config.hidden ?? false)} + {#if config.hidden !== true && config.system !== true}