Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions dev/tool/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(',')
Expand Down
21 changes: 18 additions & 3 deletions models/all/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
],
Expand Down Expand Up @@ -421,8 +423,10 @@ export default function buildModel (): Builder {
questionsModel,
questionsId,
{
label: setting.string.Configure,
enabled: false,
beta: false,
hidden: true,
classFilter: defaultFilter
}
],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<PluginConfiguration>
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/__tests__/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ describe('client', () => {

const pluginData1: Data<PluginConfiguration> = {
pluginId: 'testPlugin1' as Plugin,
label: 'Test Plugin 1' as IntlString,
transactions: [],
beta: true,
enabled: true
Expand All @@ -198,6 +199,7 @@ describe('client', () => {

const pluginData2 = {
pluginId: 'testPlugin2' as Plugin,
label: 'Test Plugin 2' as IntlString,
transactions: [],
beta: true,
enabled: true
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,14 @@ export interface PluginConfiguration extends Doc {
pluginId: Plugin
transactions: Ref<Doc>[]

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

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,9 @@ export function fillConfiguration (systemTx: Tx[], configs: Map<Ref<PluginConfig
if (ut.objectClass === core.class.PluginConfiguration) {
const c = configs.get(ut.objectId as Ref<PluginConfiguration>)
if (c !== undefined) {
TxProcessor.updateDoc2Doc(c, ut)
if (c.system !== true || ut.modifiedBy === core.account.ConfigUser) {
TxProcessor.updateDoc2Doc(c, ut)
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/presentation/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(resource?: Resource<T> | null): boolean | undefined {
Expand Down
2 changes: 1 addition & 1 deletion plugins/setting-resources/src/components/Configure.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<Scroller align={'center'} padding={'var(--spacing-3)'} bottomPadding={'var(--spacing-3)'}>
<div class="flex-row-center flex-wrap gap-around-4">
{#each $pluginConfigurationStore.list as config}
{#if config.label && !(config.hidden ?? false)}
{#if config.hidden !== true && config.system !== true}
<div class="cardBox flex-col clear-mins" class:enabled={config.enabled ?? true}>
<div class="flex-row-center">
<span class="mr-2">
Expand Down
Loading