TSK-1406: Correct Configuration defaults (#3107)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-04-28 15:22:25 +07:00 committed by GitHub
parent 59d1e2eb37
commit 082bc85ff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 44 deletions

View File

@ -38,7 +38,7 @@ export class TTxViewlet extends TDoc implements TxViewlet {
hideOnRemove!: boolean
}
@Model(activity.class.ActivityFilter, core.class.Class, DOMAIN_MODEL)
@Model(activity.class.ActivityFilter, core.class.Doc, DOMAIN_MODEL)
export class TActivityFilter extends TDoc implements ActivityFilter {
label!: IntlString
filter!: Resource<(tx: DisplayTx, _class?: Ref<Doc>) => boolean>

View File

@ -98,7 +98,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
label: contact.string.ConfigLabel,
description: contact.string.ConfigDescription,
enabled: true,
configurable: false,
beta: false,
icon: contact.icon.ContactApplication,
classFilter: [workbench.class.Application]
}
@ -110,7 +110,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
label: chunter.string.ConfigLabel,
description: chunter.string.ConfigDescription,
enabled: false,
configurable: false,
beta: true,
icon: chunter.icon.Chunter,
classFilter: [workbench.class.Application]
}
@ -123,9 +123,9 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
label: recruit.string.ConfigLabel,
description: recruit.string.ConfigDescription,
enabled: true,
beta: false,
icon: recruit.icon.RecruitApplication,
classFilter: [workbench.class.Application, view.class.Action],
configurable: true
classFilter: [workbench.class.Application, view.class.Action]
}
],
[settingModel, settingId],
@ -136,13 +136,13 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
label: telegram.string.ConfigLabel,
description: telegram.string.ConfigDescription,
enabled: true,
beta: false,
classFilter: [
workbench.class.Application,
view.class.Action,
contact.class.ChannelProvider,
setting.class.IntegrationType
],
configurable: true
]
}
],
[
@ -151,9 +151,9 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
{
label: lead.string.ConfigLabel,
description: lead.string.ConfigDescription,
enabled: true,
icon: lead.icon.LeadApplication,
configurable: false
enabled: false,
beta: true,
icon: lead.icon.LeadApplication
}
],
[
@ -163,13 +163,13 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
label: gmail.string.ConfigLabel,
description: gmail.string.ConfigDescription,
enabled: true,
beta: false,
classFilter: [
workbench.class.Application,
view.class.Action,
contact.class.ChannelProvider,
setting.class.IntegrationType
],
configurable: true
]
}
],
[
@ -178,10 +178,10 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
{
label: inventory.string.ConfigLabel,
description: inventory.string.ConfigDescription,
enabled: true,
enabled: false,
beta: true,
icon: inventory.icon.InventoryApplication,
classFilter: [workbench.class.Application, view.class.Action],
configurable: false
classFilter: [workbench.class.Application, view.class.Action]
}
],
[presentationModel, presentationId],
@ -195,10 +195,10 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
{
label: hr.string.ConfigLabel,
description: hr.string.ConfigDescription,
enabled: true,
enabled: false,
beta: true,
icon: hr.icon.Structure,
classFilter: [workbench.class.Application, view.class.Action],
configurable: true
classFilter: [workbench.class.Application, view.class.Action]
}
],
[
@ -207,9 +207,9 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
{
label: document.string.ConfigLabel,
description: document.string.ConfigDescription,
enabled: true,
icon: document.icon.DocumentApplication,
configurable: false
enabled: false,
beta: true,
icon: document.icon.DocumentApplication
}
],
[
@ -219,9 +219,9 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
label: tracker.string.ConfigLabel,
description: tracker.string.ConfigDescription,
enabled: true,
beta: false,
icon: tracker.icon.TrackerApplication,
classFilter: [workbench.class.Application, view.class.Action],
configurable: true
classFilter: [workbench.class.Application, view.class.Action]
}
],
[
@ -230,10 +230,10 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
{
label: board.string.ConfigLabel,
description: board.string.ConfigDescription,
enabled: true,
enabled: false,
beta: true,
icon: board.icon.Board,
classFilter: [workbench.class.Application, view.class.Action],
configurable: false
classFilter: [workbench.class.Application, view.class.Action]
}
],
[
@ -242,10 +242,10 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
{
label: calendar.string.ConfigLabel,
description: calendar.string.ConfigDescription,
enabled: true,
enabled: false,
beta: true,
icon: calendar.icon.Calendar,
classFilter: [workbench.class.Application],
configurable: false
classFilter: [workbench.class.Application]
}
],
[
@ -255,8 +255,8 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
label: bitrix.string.ConfigLabel,
description: bitrix.string.ConfigDescription,
enabled: false,
icon: bitrix.icon.Bitrix,
configurable: false
beta: true,
icon: bitrix.icon.Bitrix
}
],
[
@ -266,7 +266,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
// label: request.string.ConfigLabel,
// description: request.string.ConfigDescription,
enabled: false,
configurable: false,
beta: true,
classFilter: [workbench.class.Application, view.class.Action]
}
],
@ -311,7 +311,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
enabled:
config?.label === undefined ||
((config?.enabled ?? true) && (enabled.includes(id) || enabled.includes('*')) && !disabled.includes(id)),
configurable: config?.configurable ?? false
beta: config?.beta ?? false
},
('plugin-configuration-' + id) as Ref<PluginConfiguration>
)

View File

@ -242,7 +242,7 @@ export class TPluginConfiguration extends TDoc implements PluginConfiguration {
label!: IntlString
enabled!: boolean
configurable!: boolean
beta!: boolean
}
@Model(core.class.BlobData, core.class.Doc, DOMAIN_BLOB)

View File

@ -121,7 +121,7 @@ describe('client', () => {
const pluginData1: Data<PluginConfiguration> = {
pluginId: 'testPlugin1' as Plugin,
transactions: [],
configurable: true,
beta: true,
enabled: true
}
const txCreateDoc1 = txFactory.createTxCreateDoc(core.class.PluginConfiguration, core.space.Model, pluginData1)
@ -138,7 +138,7 @@ describe('client', () => {
const pluginData2 = {
pluginId: 'testPlugin2' as Plugin,
transactions: [],
configurable: true,
beta: true,
enabled: true
}
const txCreateDoc2 = txFactory.createTxCreateDoc(core.class.PluginConfiguration, core.space.Model, pluginData2)
@ -156,7 +156,7 @@ describe('client', () => {
const pluginData3 = {
pluginId: 'testPlugin3' as Plugin,
transactions: [txCreateDoc1._id],
configurable: true,
beta: true,
enabled: true
}
const txUpdateDoc = txFactory.createTxUpdateDoc(

View File

@ -180,8 +180,8 @@ export interface PluginConfiguration extends Doc {
description?: IntlString
enabled: boolean
// If specified, will allow user to enable/disable item.
configurable: boolean
// If specified, will show beta/testing label in UI.
beta: boolean
// If defined, will only remove classes in list.
classFilter?: Ref<Class<Obj>>[]

View File

@ -79,6 +79,7 @@
"ConfigurationEnabled": "Enabled",
"ConfigurationDisabled": "Disabled",
"ConfigDisable": "Disable",
"ConfigEnable": "Enable"
"ConfigEnable": "Enable",
"ConfigBeta": "Beta version"
}
}

View File

@ -80,6 +80,7 @@
"ConfigurationEnabled": "Включено",
"ConfigurationDisabled": "Выключено",
"ConfigDisable": "Выключить",
"ConfigEnable": "Включить"
"ConfigEnable": "Включить",
"ConfigBeta": "Ознакомительная версия"
}
}

View File

@ -50,7 +50,10 @@
<Label label={config.description} />
</div>
{/if}
{#if config.configurable}
<div class="flex-between flex-row-center">
{#if config.beta}
<Label label={setting.string.ConfigBeta} />
{/if}
<div class="flex-row-center flex-reverse flex-grow max-h-9">
<Button
label={config.enabled ?? true ? setting.string.ConfigDisable : setting.string.ConfigEnable}
@ -58,7 +61,7 @@
on:click={() => change(config, !(config.enabled ?? true))}
/>
</div>
{/if}
</div>
</div>
{/if}
{/each}

View File

@ -72,6 +72,7 @@ export default mergeIds(settingId, setting, {
ConfigurationEnabled: '' as IntlString,
ConfigurationDisabled: '' as IntlString,
ConfigDisable: '' as IntlString,
ConfigEnable: '' as IntlString
ConfigEnable: '' as IntlString,
ConfigBeta: '' as IntlString
}
})