diff --git a/.vscode/launch.json b/.vscode/launch.json index ff8799e72d..50f38d9ca4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -27,7 +27,7 @@ "ts-node/register" ], "sourceMaps": true, - "cwd": "${workspaceRoot}/server/server", + "cwd": "${workspaceRoot}/pods/server", "protocol": "inspector" }, { diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index 45f20e26aa..083ff02299 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -266,9 +266,9 @@ export function devTool ( program .command('backup-restore [date]') .description('dump workspace transactions and minio resources') - .action(async (dirName, workspace, date, cmd) => { + .action(async (dirName: string, workspace: string, date, cmd) => { const storage = await createFileBackupStorage(dirName) - return await restore(transactorUrl, workspace, storage, parseInt(date ?? '-1')) + return await restore(transactorUrl, getWorkspaceId(workspace, productId), storage, parseInt(date ?? '-1')) }) program diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 9997dc2dc9..b8839c49a8 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -113,7 +113,7 @@ export class TChannel extends TAttachedDoc implements Channel { @Model(contact.class.Person, contact.class.Contact) @UX(contact.string.Person, contact.icon.Person, undefined, 'name') export class TPerson extends TContact implements Person { - @Prop(TypeDate(), contact.string.Birthday) + @Prop(TypeDate(false, false), contact.string.Birthday) birthday?: Timestamp } diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index c82c26b5b0..606f6b56d0 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -305,6 +305,9 @@ export function createModel (builder: Builder): void { builder.mixin(core.class.Class, core.class.Class, view.mixin.IgnoreActions, { actions: [view.action.Delete] }) + builder.mixin(core.class.Attribute, core.class.Class, view.mixin.IgnoreActions, { + actions: [view.action.Delete] + }) createAction(builder, { action: view.actionImpl.ShowPopup, @@ -341,6 +344,46 @@ export function createModel (builder: Builder): void { ) // builder.mixin(core.class.Space, core.class.Class, setting.mixin.Editable, {}) + + createAction(builder, { + action: view.actionImpl.UpdateDocument, + actionProps: { + key: 'hidden', + value: true + }, + query: { + hidden: { $in: [false, undefined, null] } + }, + label: setting.string.HideAttribute, + input: 'any', + icon: view.icon.Setting, + category: setting.category.Settings, + target: core.class.Attribute, + context: { + mode: ['context', 'browser'], + group: 'edit' + } + }) + + createAction(builder, { + action: view.actionImpl.UpdateDocument, + actionProps: { + key: 'hidden', + value: false + }, + query: { + hidden: true + }, + label: setting.string.ShowAttribute, + input: 'any', + icon: view.icon.Setting, + category: setting.category.Settings, + target: core.class.Attribute, + context: { + mode: ['context', 'browser'], + group: 'edit' + } + }) } export { settingOperation } from './migration' diff --git a/packages/presentation/src/components/SpaceSelect.svelte b/packages/presentation/src/components/SpaceSelect.svelte index 085808e74e..d6046ea552 100644 --- a/packages/presentation/src/components/SpaceSelect.svelte +++ b/packages/presentation/src/components/SpaceSelect.svelte @@ -51,6 +51,7 @@ export let allowDeselect = false export let component: AnySvelteComponent | undefined = undefined export let componentProps: any | undefined = undefined + export let autoSelect = true let selected: Space | undefined @@ -61,10 +62,10 @@ async function updateSelected (value: Ref | undefined) { selected = value !== undefined ? await client.findOne(_class, { ...(spaceQuery ?? {}), _id: value }) : undefined - if (selected === undefined) { + if (selected === undefined && autoSelect) { selected = await client.findOne(_class, { ...(spaceQuery ?? {}) }) if (selected !== undefined) { - value = selected._id + value = selected._id ?? undefined dispatch('change', value) dispatch('space', selected) } @@ -89,8 +90,8 @@ }, !$$slots.content ? eventToHTMLElement(ev) : getEventPositionElement(ev), (result) => { - if (result) { - value = result._id + if (result !== undefined) { + value = result?._id ?? undefined dispatch('change', value) mgr?.setFocusPos(focusIndex) } @@ -100,6 +101,7 @@ {#if $$slots.content} +
@@ -116,7 +118,7 @@ showTooltip={{ label, direction: labelDirection }} on:click={showSpacesPopup} > - + {#if selected}{selected.name}{:else} diff --git a/packages/presentation/src/components/SpaceSelector.svelte b/packages/presentation/src/components/SpaceSelector.svelte index 7beb6160b6..2ea3b699c8 100644 --- a/packages/presentation/src/components/SpaceSelector.svelte +++ b/packages/presentation/src/components/SpaceSelector.svelte @@ -32,6 +32,7 @@ export let focus = true export let component: AnySvelteComponent | undefined = undefined export let componentProps: any | undefined = undefined + export let autoSelect = true export let create: ObjectCreate | undefined = undefined @@ -51,6 +52,7 @@ {width} {component} {componentProps} + {autoSelect} bind:value={space} on:change={(evt) => { space = evt.detail diff --git a/packages/presentation/src/components/UserBox.svelte b/packages/presentation/src/components/UserBox.svelte index fa2cd36374..58097ff832 100644 --- a/packages/presentation/src/components/UserBox.svelte +++ b/packages/presentation/src/components/UserBox.svelte @@ -118,6 +118,7 @@ $: hideIcon = size === 'x-large' || (size === 'large' && kind !== 'link') +
{#if $$slots.content}
{:else} diff --git a/packages/ui/src/components/calendar/DateRangePresenter.svelte b/packages/ui/src/components/calendar/DateRangePresenter.svelte index fdf5275186..1e835ff6c6 100644 --- a/packages/ui/src/components/calendar/DateRangePresenter.svelte +++ b/packages/ui/src/components/calendar/DateRangePresenter.svelte @@ -272,6 +272,7 @@ adaptValue() + @@ -502,8 +506,8 @@ padding: 0 0.875rem; width: 100%; height: 2rem; + color: var(--caption-color); &:hover { - color: var(--caption-color); background-color: var(--body-color); border-color: var(--divider-color); .btn-icon { diff --git a/plugins/hr-resources/src/components/DepartmentEditor.svelte b/plugins/hr-resources/src/components/DepartmentEditor.svelte index d7ea73d0d5..9aef479319 100644 --- a/plugins/hr-resources/src/components/DepartmentEditor.svelte +++ b/plugins/hr-resources/src/components/DepartmentEditor.svelte @@ -37,6 +37,7 @@ {justify} allowDeselect {width} + autoSelect={false} focus={false} bind:space={value} on:change={(e) => onChange(e.detail)} diff --git a/plugins/setting-assets/lang/en.json b/plugins/setting-assets/lang/en.json index 6470cd01a0..f80e06a53c 100644 --- a/plugins/setting-assets/lang/en.json +++ b/plugins/setting-assets/lang/en.json @@ -62,6 +62,10 @@ "ImportEnumCopy": "Copy enum values from clipboard", "CreateMixin": "Create Mixin", "OldNames": "Old values", - "NewClassName": "Type new class name or select from previous values..." + "NewClassName": "Type new class name or select from previous values...", + "ShowAttribute": "Show attribute", + "HideAttribute": "Hide attribute", + "Visibility": "Visibility", + "Hidden": "Hidden" } } \ No newline at end of file diff --git a/plugins/setting-assets/lang/ru.json b/plugins/setting-assets/lang/ru.json index 793325d417..d8fd1311ea 100644 --- a/plugins/setting-assets/lang/ru.json +++ b/plugins/setting-assets/lang/ru.json @@ -62,6 +62,11 @@ "ImportEnumCopy": "Загрузить значения справочника из буфера обмена", "CreateMixin": "Создать Миксин", "OldNames": "Предыдушие значения", - "NewClassName": "Введите новое имя класса или выберете прошлое значение..." + "NewClassName": "Введите новое имя класса или выберете прошлое значение...", + + "ShowAttribute": "Hide", + "HideAttribute": "Show", + "Visibility": "Видимость", + "Hidden": "Спрятанный" } } \ No newline at end of file diff --git a/plugins/setting-resources/src/components/ClassAttributes.svelte b/plugins/setting-resources/src/components/ClassAttributes.svelte index 44f92e86bb..4b2da069cb 100644 --- a/plugins/setting-resources/src/components/ClassAttributes.svelte +++ b/plugins/setting-resources/src/components/ClassAttributes.svelte @@ -26,7 +26,7 @@ RefTo, Type } from '@hcengineering/core' - import { IntlString } from '@hcengineering/platform' + import { getResource, IntlString } from '@hcengineering/platform' import presentation, { createQuery, getClient, MessageBox } from '@hcengineering/presentation' import { Action, @@ -44,10 +44,12 @@ showPopup } from '@hcengineering/ui' import view from '@hcengineering/view' + import { getContextActions } from '@hcengineering/view-resources/src/actions' import settings from '../plugin' import CreateAttribute from './CreateAttribute.svelte' import EditAttribute from './EditAttribute.svelte' import EditClassLabel from './EditClassLabel.svelte' + export let _class: Ref> const client = getClient() @@ -65,10 +67,16 @@ function getCustomAttributes (_class: Ref>): AnyAttribute[] { const cl = hierarchy.getClass(_class) const attributes = Array.from(hierarchy.getAllAttributes(_class, cl.extends).values()) - const filtred = attributes.filter((p) => !p.hidden) - return filtred + // const filtred = attributes.filter((p) => !p.hidden) + return attributes } + const attrQuery = createQuery() + + $: attrQuery.query(core.class.Attribute, { attributeOf: _class }, () => { + attributes = getCustomAttributes(_class) + }) + function update () { attributes = getCustomAttributes(_class) } @@ -108,15 +116,28 @@ action: async () => { editAttribute(attribute, exist) } - }, - { + } + ] + if (attribute.isCustom) { + actions.push({ label: presentation.string.Remove, icon: IconDelete, action: async () => { removeAttribute(attribute, exist) } - } - ] + }) + } + const extra = await getContextActions(client, attribute, { mode: 'context' }) + actions.push( + ...extra.map((it) => ({ + label: it.label, + icon: it.icon, + action: async (_: any, evt: Event) => { + const r = await getResource(it.action) + r(attribute, evt, it.actionProps) + } + })) + ) showPopup(Menu, { actions }, getEventPositionElement(ev), () => {}) } @@ -179,6 +200,11 @@
+ +
+
+