Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-10-03 09:49:44 +06:00 committed by GitHub
parent b2435326fd
commit 56ecd9cfc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 336 additions and 82 deletions

View File

@ -47,7 +47,7 @@
"@hcengineering/client": "^0.6.13",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/model": "^0.6.6",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"faker": "~5.5.3",
"@hcengineering/model-recruit": "^0.6.0",
"@hcengineering/chunter": "^0.6.10",

View File

@ -67,8 +67,8 @@
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/chunter-assets": "^0.6.8",
"@hcengineering/chunter-resources": "^0.6.0",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit-assets": "^0.6.12",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/recruit-assets": "^0.6.13",
"@hcengineering/recruit-resources": "^0.6.0",
"@hcengineering/setting": "^0.6.9",
"@hcengineering/setting-assets": "^0.6.7",
@ -134,8 +134,8 @@
"@hcengineering/server-tags-resources": "^0.6.0",
"@hcengineering/server-task": "^0.6.0",
"@hcengineering/server-task-resources": "^0.6.0",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar-assets": "^0.6.12",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/calendar-assets": "^0.6.13",
"@hcengineering/calendar-resources": "^0.6.0",
"@hcengineering/server-calendar": "^0.6.0",
"@hcengineering/server-calendar-resources": "^0.6.0",
@ -158,7 +158,7 @@
"@hcengineering/hr-resources": "^0.6.0",
"@hcengineering/server-hr": "^0.6.0",
"@hcengineering/server-hr-resources": "^0.6.0",
"@hcengineering/bitrix": "^0.6.41",
"@hcengineering/bitrix": "^0.6.42",
"@hcengineering/bitrix-assets": "^0.6.0",
"@hcengineering/bitrix-resources": "^0.6.0",
"@hcengineering/support": "^0.6.0",

View File

@ -69,7 +69,7 @@
"@hcengineering/server-attachment-resources": "^0.6.0",
"xml2js": "~0.4.23",
"@hcengineering/model-recruit": "^0.6.0",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/task": "^0.6.11",
"@hcengineering/chunter": "^0.6.10",
"mime-types": "~2.1.34",

View File

@ -35,7 +35,7 @@
"@hcengineering/view": "^0.6.8",
"@hcengineering/model-view": "^0.6.0",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/bitrix": "^0.6.41",
"@hcengineering/bitrix": "^0.6.42",
"@hcengineering/bitrix-resources": "^0.6.0",
"@hcengineering/preference": "^0.6.8",
"@hcengineering/model-preference": "^0.6.0",

View File

@ -98,6 +98,7 @@ export function createModel (builder: Builder): void {
label: bitrix.string.Bitrix,
description: bitrix.string.BitrixDesc,
icon: bitrix.component.BitrixIcon,
allowMultiple: false,
createComponent: bitrix.component.BitrixConnect,
configureComponent: bitrix.component.BitrixConfigure
},

View File

@ -32,12 +32,13 @@
"@hcengineering/model-attachment": "^0.6.0",
"@hcengineering/setting": "^0.6.9",
"@hcengineering/model-task": "^0.6.0",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/calendar-resources": "^0.6.0",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/notification": "^0.6.14",
"@hcengineering/model-core": "^0.6.0",
"@hcengineering/model-view": "^0.6.0",
"@hcengineering/model-setting": "^0.6.0",
"@hcengineering/model-workbench": "^0.6.1",
"@hcengineering/activity": "^0.6.0",
"@hcengineering/workbench": "^0.6.8",

View File

@ -18,6 +18,7 @@ import {
Calendar,
CalendarEventPresenter,
Event,
ExternalCalendar,
ReccuringEvent,
ReccuringInstance,
RecurringRule,
@ -62,8 +63,14 @@ export const DOMAIN_CALENDAR = 'calendar' as Domain
@UX(calendar.string.Calendar, calendar.icon.Calendar)
export class TCalendar extends TSpaceWithStates implements Calendar {
visibility!: Visibility
}
sync?: boolean
@Model(calendar.class.ExternalCalendar, calendar.class.Calendar)
@UX(calendar.string.Calendar, calendar.icon.Calendar)
export class TExternalCalendar extends TCalendar implements ExternalCalendar {
default!: boolean
externalId!: string
externalUser!: string
}
@Model(calendar.class.Event, core.class.AttachedDoc, DOMAIN_CALENDAR)
@ -136,7 +143,14 @@ export class TCalendarEventPresenter extends TClass implements CalendarEventPres
}
export function createModel (builder: Builder): void {
builder.createModel(TCalendar, TReccuringEvent, TReccuringInstance, TEvent, TCalendarEventPresenter)
builder.createModel(
TCalendar,
TExternalCalendar,
TReccuringEvent,
TReccuringInstance,
TEvent,
TCalendarEventPresenter
)
builder.mixin(calendar.class.Event, core.class.Class, calendar.mixin.CalendarEventPresenter, {
presenter: calendar.component.CalendarEventPresenter
@ -164,6 +178,7 @@ export function createModel (builder: Builder): void {
label: calendar.string.Calendar,
description: calendar.string.IntegrationDescr,
icon: calendar.component.CalendarIntegrationIcon,
allowMultiple: true,
createComponent: calendar.component.IntegrationConnect,
onDisconnect: calendar.handler.DisconnectHandler,
reconnectComponent: calendar.component.IntegrationConnect,

View File

@ -14,11 +14,14 @@
//
import { Calendar, Event, ReccuringEvent } from '@hcengineering/calendar'
import contact from '@hcengineering/contact'
import core, { Ref, TxOperations } from '@hcengineering/core'
import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model'
import calendar from './plugin'
import { DOMAIN_SPACE } from '@hcengineering/model-core'
import { DOMAIN_SETTING } from '@hcengineering/model-setting'
import { Integration } from '@hcengineering/setting'
import { DOMAIN_CALENDAR } from '.'
import contact from '@hcengineering/contact'
import calendar from './plugin'
async function migrateCalendars (tx: TxOperations): Promise<void> {
const existCalendars = new Set((await tx.findAll(calendar.class.Calendar, {})).map((p) => p._id))
@ -57,6 +60,29 @@ async function migrateCalendars (tx: TxOperations): Promise<void> {
}
}
async function migrateExternalCalendars (client: MigrationClient): Promise<void> {
const calendars = await client.find<Calendar>(DOMAIN_SPACE, { _class: calendar.class.Calendar })
const integrations = await client.find<Integration>(DOMAIN_SETTING, {
type: calendar.integrationType.Calendar,
disabled: false,
value: { $ne: '' }
})
for (const val of calendars) {
if (val._id.endsWith('_calendar')) continue
const integration = integrations.find((i) => i.createdBy === val.createdBy)
await client.update(
DOMAIN_SPACE,
{ _id: val._id },
{
_class: calendar.class.ExternalCalendar,
externalId: val._id,
externalUser: integration?.value ?? '',
default: val._id === integration?.value
}
)
}
}
async function fixEventDueDate (client: MigrationClient): Promise<void> {
const events = await client.find<Event>(DOMAIN_CALENDAR, {
_class: calendar.class.Event,
@ -86,11 +112,22 @@ async function fillOriginalStartTime (client: MigrationClient): Promise<void> {
}
}
async function migrateSync (client: MigrationClient): Promise<void> {
await client.update(DOMAIN_SPACE, { _class: calendar.class.Calendar, sync: false }, { archived: true })
await client.update(
DOMAIN_SPACE,
{ _class: calendar.class.Calendar, sync: { $exists: true } },
{ $unset: { sync: true } }
)
}
export const calendarOperation: MigrateOperation = {
async migrate (client: MigrationClient): Promise<void> {
await fixEventDueDate(client)
await migrateReminders(client)
await fillOriginalStartTime(client)
await migrateSync(client)
await migrateExternalCalendars(client)
},
async upgrade (client: MigrationUpgradeClient): Promise<void> {
const tx = new TxOperations(client, core.account.System)

View File

@ -151,6 +151,7 @@ export function createModel (builder: Builder): void {
label: gmail.string.IntegrationLabel,
description: gmail.string.IntegrationDescription,
icon: gmail.component.IconGmail,
allowMultiple: false, // enable in future
createComponent: gmail.component.Connect,
onDisconnect: gmail.handler.DisconnectHandler,
reconnectComponent: gmail.component.Connect,

View File

@ -34,7 +34,7 @@
"@hcengineering/model-view": "^0.6.0",
"@hcengineering/model-workbench": "^0.6.1",
"@hcengineering/model-contact": "^0.6.1",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/recruit-resources": "^0.6.0",
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/notification": "^0.6.14",

View File

@ -28,7 +28,7 @@
"@hcengineering/core": "^0.6.27",
"@hcengineering/model": "^0.6.6",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/server-notification": "^0.6.1",
"@hcengineering/server-calendar": "^0.6.0",
"@hcengineering/contact": "^0.6.19",

View File

@ -74,6 +74,7 @@ export class TIntegrationType extends TDoc implements IntegrationType {
label!: IntlString
description!: IntlString
icon!: AnyComponent
allowMultiple!: boolean
createComponent!: AnyComponent
reconnectComponent?: AnyComponent
onDisconnect!: Handler

View File

@ -153,6 +153,7 @@ export function createModel (builder: Builder): void {
label: telegram.string.Telegram,
description: telegram.string.TelegramIntegrationDesc,
icon: telegram.component.IconTelegram,
allowMultiple: false,
createComponent: telegram.component.Connect,
reconnectComponent: telegram.component.Reconnect,
onDisconnect: telegram.handler.DisconnectHandler

View File

@ -1,6 +1,6 @@
{
"name": "@hcengineering/panel",
"version": "0.6.12",
"version": "0.6.13",
"main": "src/index.ts",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",
@ -40,7 +40,7 @@
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/activity": "^0.6.0",
"@hcengineering/calendar": "^0.6.14"
"@hcengineering/calendar": "^0.6.15"
},
"repository": "https://github.com/hcenginneing/anticrm",
"publishConfig": {

View File

@ -48,7 +48,7 @@
<div bind:this={container} class="min-w-0">
<Button
{focusIndex}
icon={selected?.icon ?? icon}
icon={icon !== undefined ? selected?.icon ?? icon : undefined}
iconProps={selected?.iconProps}
width={width ?? 'min-content'}
{size}

View File

@ -41,7 +41,7 @@
"@hcengineering/core": "^0.6.27",
"@hcengineering/view": "^0.6.8",
"@hcengineering/view-resources": "^0.6.0",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/text-editor": "^0.6.0",
"@hcengineering/login": "^0.6.7",
"filesize": "^8.0.3",

View File

@ -30,6 +30,6 @@
},
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"@hcengineering/bitrix": "^0.6.41"
"@hcengineering/bitrix": "^0.6.42"
}
}

View File

@ -34,7 +34,7 @@
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"svelte": "3.55.1",
"@hcengineering/bitrix": "^0.6.41",
"@hcengineering/bitrix": "^0.6.42",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/text-editor": "^0.6.0",
@ -54,7 +54,7 @@
"@hcengineering/tags": "^0.6.11",
"@hcengineering/tags-resources": "^0.6.0",
"fast-equals": "^2.0.3",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/task": "^0.6.11"
},
"repository": "https://github.com/hcengineering/anticrm",

View File

@ -1,6 +1,6 @@
{
"name": "@hcengineering/bitrix",
"version": "0.6.41",
"version": "0.6.42",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",
@ -37,7 +37,7 @@
"fast-equals": "^2.0.3",
"qs": "~6.11.0",
"@hcengineering/gmail": "^0.6.13",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/task": "^0.6.11"
},
"repository": "https://github.com/hcengineering/anticrm",

View File

@ -35,7 +35,7 @@
"@hcengineering/attachment": "^0.6.8",
"@hcengineering/attachment-resources": "^0.6.0",
"@hcengineering/board": "^0.6.10",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/chunter-resources": "^0.6.0",
"@hcengineering/contact": "^0.6.19",
@ -44,7 +44,7 @@
"@hcengineering/core": "^0.6.27",
"@hcengineering/notification": "^0.6.14",
"@hcengineering/notification-resources": "^0.6.0",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/task": "^0.6.11",

View File

@ -44,4 +44,9 @@
<path d="M15.4698 7.83C14.8817 6.30882 13.8608 4.99331 12.5332 4.04604C11.2056 3.09878 9.62953 2.56129 7.99979 2.5C6.37005 2.56129 4.79398 3.09878 3.46639 4.04604C2.1388 4.99331 1.11787 6.30882 0.529787 7.83C0.490071 7.93985 0.490071 8.06015 0.529787 8.17C1.11787 9.69118 2.1388 11.0067 3.46639 11.954C4.79398 12.9012 6.37005 13.4387 7.99979 13.5C9.62953 13.4387 11.2056 12.9012 12.5332 11.954C13.8608 11.0067 14.8817 9.69118 15.4698 8.17C15.5095 8.06015 15.5095 7.93985 15.4698 7.83ZM7.99979 12.5C5.34979 12.5 2.54979 10.535 1.53479 8C2.54979 5.465 5.34979 3.5 7.99979 3.5C10.6498 3.5 13.4498 5.465 14.4648 8C13.4498 10.535 10.6498 12.5 7.99979 12.5Z" fill="currentColor"/>
<path d="M7.99979 5C7.40644 5 6.82642 5.17595 6.33308 5.50559C5.83973 5.83524 5.45521 6.30377 5.22815 6.85195C5.00109 7.40013 4.94168 8.00333 5.05743 8.58527C5.17319 9.16721 5.45891 9.70176 5.87847 10.1213C6.29802 10.5409 6.83257 10.8266 7.41452 10.9424C7.99646 11.0581 8.59966 10.9987 9.14784 10.7716C9.69602 10.5446 10.1646 10.1601 10.4942 9.66671C10.8238 9.17336 10.9998 8.59334 10.9998 8C10.9998 7.20435 10.6837 6.44129 10.1211 5.87868C9.5585 5.31607 8.79544 5 7.99979 5ZM7.99979 10C7.60422 10 7.21755 9.8827 6.88865 9.66294C6.55975 9.44318 6.3034 9.13082 6.15203 8.76537C6.00065 8.39991 5.96105 7.99778 6.03822 7.60982C6.11539 7.22186 6.30587 6.86549 6.58557 6.58579C6.86528 6.30608 7.22164 6.1156 7.60961 6.03843C7.99757 5.96126 8.3997 6.00087 8.76515 6.15224C9.13061 6.30362 9.44296 6.55996 9.66273 6.88886C9.88249 7.21776 9.99979 7.60444 9.99979 8C9.99979 8.53043 9.78907 9.03914 9.414 9.41421C9.03893 9.78929 8.53022 10 7.99979 10Z" fill="currentColor"/>
</symbol>
<symbol id="eyeCrossed" viewBox="0 0 16 16" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.1462 1.14645C14.3415 0.951184 14.658 0.951184 14.8533 1.14645C15.0486 1.34171 15.0486 1.65829 14.8533 1.85355L12.5998 4.10999C13.8988 5.0435 14.8965 6.33659 15.4698 7.82999C15.5095 7.93984 15.5095 8.06013 15.4698 8.16999C14.8817 9.69116 13.8608 11.0067 12.5332 11.9539C11.2056 12.9012 9.62953 13.4387 7.99979 13.5C6.68181 13.4787 5.39173 13.117 4.25479 12.45L1.85338 14.8535C1.65812 15.0488 1.34153 15.0488 1.14627 14.8535C0.951009 14.6583 0.951009 14.3417 1.14627 14.1464L14.1462 1.14645ZM9.99979 7.99999C9.99768 8.35004 9.90374 8.6934 9.72734 8.99577C9.55094 9.29813 9.29828 9.5489 8.99459 9.72302C8.69091 9.89713 8.34684 9.98849 7.99678 9.98795C7.64673 9.98742 7.30294 9.89502 6.99979 9.71999L9.71979 6.99999C9.89954 7.30285 9.99613 7.64781 9.99979 7.99999ZM7.99979 12.5C6.95082 12.4817 5.92173 12.2107 4.99979 11.71L6.26979 10.44C6.84746 10.8408 7.54756 11.026 8.24785 10.9632C8.94815 10.9004 9.60415 10.5937 10.1013 10.0965C10.5985 9.59935 10.9052 8.94335 10.968 8.24305C11.0308 7.54275 10.8456 6.84265 10.4448 6.26499L11.8798 4.82999C13.0271 5.61748 13.9243 6.7177 14.4648 7.99999C13.4498 10.535 10.6498 12.5 7.99979 12.5Z" fill="currentColor"/>
<path d="M3.33479 10.545L2.61979 11.255C1.69 10.4055 0.973911 9.34849 0.529787 8.16999C0.490071 8.06013 0.490071 7.93984 0.529787 7.82999C1.11787 6.30881 2.1388 4.99329 3.46639 4.04603C4.79398 3.09876 6.37005 2.56127 7.99979 2.49999C8.95363 2.51166 9.89611 2.70865 10.7748 3.07999L9.99979 3.85999C9.3575 3.63063 8.68173 3.50899 7.99979 3.49999C5.34979 3.49999 2.54979 5.46499 1.53479 7.99999C1.93677 8.97233 2.5519 9.84204 3.33479 10.545Z" fill="currentColor"/>
<path d="M6.58033 6.59553C6.24063 6.93522 6.03456 7.38584 5.99979 7.86499L5.08979 8.76999C4.95626 8.26287 4.95799 7.7296 5.09482 7.22336C5.23164 6.71712 5.49878 6.25559 5.86958 5.88478C6.24039 5.51397 6.70193 5.24684 7.20817 5.11002C7.71441 4.97319 8.24767 4.97146 8.75479 5.10499L7.84979 6.01499C7.37064 6.04976 6.92003 6.25583 6.58033 6.59553Z" fill="currentColor"/>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -82,6 +82,7 @@
"Visibility": "Visibility",
"Private": "Only visible to you",
"Public": "Visible to everyone",
"FreeBusy": "FreeBusy"
"FreeBusy": "FreeBusy",
"DefaultVisibility": "Default visibility"
}
}

View File

@ -82,6 +82,7 @@
"Visibility": "Видимость",
"Private": "Видно только Вам",
"Public": "Видно всем",
"FreeBusy": "Скрыть детали"
"FreeBusy": "Скрыть детали",
"DefaultVisibility": "Видимость по умолчанию"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@hcengineering/calendar-assets",
"version": "0.6.12",
"version": "0.6.13",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"template": "@hcengineering/assets-package",
@ -30,7 +30,7 @@
},
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"@hcengineering/calendar": "^0.6.14"
"@hcengineering/calendar": "^0.6.15"
},
"repository": "https://github.com/hcenginneing/anticrm",
"publishConfig": {

View File

@ -28,7 +28,8 @@ loadMetadata(calendar.icon, {
Repeat: `${icons}#repeat`,
Globe: `${icons}#globe`,
Private: `${icons}#private`,
Public: `${icons}#public`
Public: `${icons}#public`,
Hidden: `${icons}#eyeCrossed`
})
addStringsLoader(calendarId, async (lang: string) => await import(`../lang/${lang}.json`))

View File

@ -36,13 +36,13 @@
"@hcengineering/platform": "^0.6.9",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/setting": "^0.6.9",
"@hcengineering/theme": "^0.6.3",
"svelte": "3.55.1",
"@hcengineering/text-editor": "^0.6.0",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/contact-resources": "^0.6.0",
"@hcengineering/view-resources": "^0.6.0",
"@hcengineering/view": "^0.6.8",

View File

@ -0,0 +1,51 @@
<script lang="ts">
import { Calendar, ExternalCalendar } from '@hcengineering/calendar'
import { Ref, getCurrentAccount } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation'
import calendarPlugin from '../plugin'
import { createEventDispatcher } from 'svelte'
import { Dropdown, Icon } from '@hcengineering/ui'
import calendar from '../plugin'
export let value: Ref<Calendar> | undefined
const dispatch = createEventDispatcher()
let calendars: ExternalCalendar[] = []
const me = getCurrentAccount()
const q = createQuery()
q.query(calendarPlugin.class.ExternalCalendar, { members: me._id, archived: false }, (res) => {
calendars = res
})
$: items = calendars.map((p) => {
return {
_id: p._id,
label: p.name
}
})
$: selected = value !== undefined ? items.find((p) => p._id === value) : undefined
function change (id: Ref<ExternalCalendar>) {
if (value !== id) {
dispatch('change', { _id: id })
value = id
}
}
</script>
{#if calendars.length > 0}
<div class="flex-row-center flex-gap-1">
<Icon icon={calendar.icon.Calendar} size={'small'} />
<Dropdown
kind={'ghost'}
size={'medium'}
placeholder={calendar.string.Calendar}
{items}
withSearch={false}
{selected}
on:selected={(e) => change(e.detail._id)}
/>
</div>
{/if}

View File

@ -13,10 +13,10 @@
// limitations under the License.
-->
<script lang="ts">
import { Calendar, RecurringRule, generateEventId } from '@hcengineering/calendar'
import { Calendar, RecurringRule, Visibility, generateEventId } from '@hcengineering/calendar'
import { Person, PersonAccount } from '@hcengineering/contact'
import { Class, Doc, Ref, getCurrentAccount } from '@hcengineering/core'
import presentation, { getClient } from '@hcengineering/presentation'
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
import { StyledTextBox } from '@hcengineering/text-editor'
import { Button, EditBox, Icon, IconClose, IconMoreH, showPopup } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
@ -27,6 +27,8 @@
import EventTimeEditor from './EventTimeEditor.svelte'
import EventTimeExtraButton from './EventTimeExtraButton.svelte'
import ReccurancePopup from './ReccurancePopup.svelte'
import VisibilityEditor from './VisibilityEditor.svelte'
import CalendarSelector from './CalendarSelector.svelte'
export let attachedTo: Ref<Doc> = calendar.ids.NoAttached
export let attachedToClass: Ref<Class<Doc>> = calendar.class.Event
@ -48,6 +50,16 @@
let reminders = [30 * 60 * 1000]
let description: string = ''
let visibility: Visibility = 'private'
const me = getCurrentAccount()
let space: Ref<Calendar> = `${me._id}_calendar` as Ref<Calendar>
const q = createQuery()
q.query(calendar.class.ExternalCalendar, { default: true, members: me._id, archived: false }, (res) => {
if (res.length > 0) {
space = res[0]._id
}
})
let rules: RecurringRule[] = []
@ -67,7 +79,6 @@
if (startDate != null) date = startDate
if (date === undefined) return
if (title === '') return
const space = `${getCurrentAccount()._id}_calendar` as Ref<Calendar>
if (rules.length > 0) {
await client.addCollection(calendar.class.ReccuringEvent, space, attachedTo, attachedToClass, 'events', {
eventId: generateEventId(),
@ -80,6 +91,7 @@
reminders,
description,
participants,
visibility,
title,
allDay,
access: 'owner',
@ -92,6 +104,7 @@
dueDate: allDay ? saveUTC(dueDate) : dueDate,
externalParticipants,
description,
visibility,
participants,
reminders,
title,
@ -168,6 +181,11 @@
</div>
</div>
<div class="block rightCropPadding">
<CalendarSelector bind:value={space} />
<div class="flex-row-center flex-gap-1">
<Icon icon={calendar.icon.Hidden} size={'small'} />
<VisibilityEditor bind:value={visibility} kind={'ghost'} withoutIcon />
</div>
<EventReminders bind:reminders />
</div>
<div class="flex-between p-5 flex-no-shrink">

View File

@ -28,6 +28,8 @@
import EventTimeEditor from './EventTimeEditor.svelte'
import EventTimeExtraButton from './EventTimeExtraButton.svelte'
import ReccurancePopup from './ReccurancePopup.svelte'
import VisibilityEditor from './VisibilityEditor.svelte'
import CalendarSelector from './CalendarSelector.svelte'
export let object: Event
$: readOnly = isReadOnly(object)
@ -41,7 +43,9 @@
const duration = object.dueDate - object.date
let dueDate = startDate + duration
let allDay = object.allDay
let visibility = object.visibility ?? 'public'
let reminders = [...(object.reminders ?? [])]
let space = object.space
let description = object.description
@ -68,6 +72,12 @@
if (object.description !== description) {
update.description = description.trim()
}
if (object.visibility !== visibility) {
update.visibility = visibility
}
if (object.space !== space) {
update.space = space
}
if (allDay !== object.allDay) {
update.date = allDay ? saveUTC(startDate) : startDate
update.dueDate = allDay ? saveUTC(dueDate) : dueDate
@ -171,6 +181,11 @@
</div>
<div class="divider" />
<div class="block rightCropPadding">
<CalendarSelector bind:value={space} />
<div class="flex-row-center flex-gap-1">
<Icon icon={calendar.icon.Hidden} size={'small'} />
<VisibilityEditor bind:value={visibility} kind={'ghost'} withoutIcon />
</div>
<EventReminders bind:reminders />
</div>
<div class="divider" />

View File

@ -47,7 +47,6 @@
<Button
label={reminders.length ? calendar.string.AddReminder : calendar.string.Reminders}
kind={'ghost'}
padding={'0 .5rem'}
shape={'round-sm'}
on:click={(e) => addReminder(e)}
/>

View File

@ -34,7 +34,7 @@
async function update (calendar: Calendar, value: boolean) {
await client.update(calendar, {
sync: value
archived: !value
})
}
@ -63,7 +63,7 @@
{#each calendars as calendar}
<div>{calendar.name}</div>
<div>
<Toggle bind:on={calendar.sync} on:change={(res) => update(calendar, res.detail)} />
<Toggle on={calendar.archived === false} on:change={(res) => update(calendar, res.detail)} />
</div>
{/each}
</Grid>

View File

@ -41,7 +41,7 @@
}
})
const redirectTo = await res.text()
window.open(redirectTo)
window.open(redirectTo, '_blank', 'location=yes,height=870,width=720,scrollbars=yes,status=yes')
dispatch('close')
}
</script>

View File

@ -0,0 +1,73 @@
<!--
// Copyright © 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { Visibility } from '@hcengineering/calendar'
import { translate } from '@hcengineering/platform'
import { ButtonKind, Dropdown, ListItem, themeStore } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import calendar from '../plugin'
export let value: Visibility | undefined
export let disabled: boolean = false
export let kind: ButtonKind = 'regular'
export let withoutIcon: boolean = false
let items: ListItem[] = []
$: fill($themeStore.language)
async function fill (lang: string) {
items = [
{
_id: 'public',
label: await translate(calendar.string.Public, {}, lang),
icon: calendar.icon.Public
},
{
_id: 'freeBusy',
label: await translate(calendar.string.FreeBusy, {}, lang),
icon: calendar.icon.Private
},
{
_id: 'private',
label: await translate(calendar.string.Private, {}, lang),
icon: calendar.icon.Hidden
}
]
}
$: selected = value !== undefined ? items.find((item) => item._id === value) : undefined
const dispatch = createEventDispatcher()
function change (val: Visibility) {
if (value !== val) {
dispatch('change', val)
value = val
}
}
</script>
<Dropdown
{disabled}
icon={withoutIcon ? undefined : calendar.icon.Hidden}
{kind}
size={'medium'}
placeholder={calendar.string.DefaultVisibility}
{items}
withSearch={false}
{selected}
on:selected={(e) => change(e.detail._id)}
/>

View File

@ -39,6 +39,8 @@ import EventTimeEditor from './components/EventTimeEditor.svelte'
import EventTimeExtraButton from './components/EventTimeExtraButton.svelte'
import IntegrationConfigure from './components/IntegrationConfigure.svelte'
import EventReminders from './components/EventReminders.svelte'
import VisibilityEditor from './components/VisibilityEditor.svelte'
import CalendarSelector from './components/CalendarSelector.svelte'
import calendar from './plugin'
import contact from '@hcengineering/contact'
import { deleteObjects } from '@hcengineering/view-resources'
@ -50,7 +52,9 @@ export {
EventParticipants,
EventTimeEditor,
EventTimeExtraButton,
EventReminders
EventReminders,
VisibilityEditor,
CalendarSelector
}
export type {
@ -189,11 +193,11 @@ export default async (): Promise<Resources> => ({
DeleteRecEvent: deleteRecEvent
},
handler: {
DisconnectHandler: async () => {
DisconnectHandler: async (value: string) => {
const url = getMetadata(calendar.metadata.CalendarServiceURL)
const token = getMetadata(presentation.metadata.Token)
if (url === undefined || token === undefined) return
await fetch(concatLink(url, '/signout'), {
await fetch(concatLink(url, `/signout?value=${value}`), {
method: 'GET',
headers: {
Authorization: 'Bearer ' + token,

View File

@ -76,6 +76,7 @@ export default mergeIds(calendarId, calendar, {
Busy: '' as IntlString,
AddReminder: '' as IntlString,
SeeAllNumberParticipants: '' as IntlString,
SeeAllNumberReminders: '' as IntlString
SeeAllNumberReminders: '' as IntlString,
DefaultVisibility: '' as IntlString
}
})

View File

@ -1,6 +1,6 @@
{
"name": "@hcengineering/calendar",
"version": "0.6.14",
"version": "0.6.15",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",

View File

@ -29,9 +29,15 @@ export type Visibility = 'public' | 'freeBusy' | 'private'
*/
export interface Calendar extends Space {
visibility: Visibility
sync?: boolean
externalId?: string
externalUser?: string
}
/**
* @public
*/
export interface ExternalCalendar extends Calendar {
default: boolean
externalId: string
externalUser: string
}
/**
@ -126,6 +132,7 @@ export const calendarId = 'calendar' as Plugin
const calendarPlugin = plugin(calendarId, {
class: {
Calendar: '' as Ref<Class<Calendar>>,
ExternalCalendar: '' as Ref<Class<ExternalCalendar>>,
Event: '' as Ref<Class<Event>>,
ReccuringEvent: '' as Ref<Class<ReccuringEvent>>,
ReccuringInstance: '' as Ref<Class<ReccuringInstance>>
@ -144,6 +151,7 @@ const calendarPlugin = plugin(calendarId, {
Repeat: '' as Asset,
Globe: '' as Asset,
Public: '' as Asset,
Hidden: '' as Asset,
Private: '' as Asset
},
space: {

View File

@ -44,7 +44,7 @@
"@hcengineering/core": "^0.6.27",
"@hcengineering/view": "^0.6.8",
"@hcengineering/attachment-resources": "^0.6.0",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/view-resources": "^0.6.0",
"@hcengineering/attachment": "^0.6.8",
"@hcengineering/login": "^0.6.7",

View File

@ -48,7 +48,7 @@
"@hcengineering/attachment-resources": "^0.6.0",
"@hcengineering/login": "^0.6.7",
"@hcengineering/core": "^0.6.27",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/templates": "^0.6.6"
}
}

View File

@ -33,13 +33,13 @@
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"svelte": "3.55.1",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/calendar-resources": "^0.6.0",
"@hcengineering/hr": "^0.6.10",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/core": "^0.6.27",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/view": "^0.6.8",
"@hcengineering/view-resources": "^0.6.0",

View File

@ -36,7 +36,7 @@
"svelte": "3.55.1",
"@hcengineering/inventory": "^0.6.6",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/view": "^0.6.8",
"@hcengineering/view-resources": "^0.6.0",

View File

@ -37,7 +37,7 @@
"@hcengineering/ui": "^0.6.10",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/core": "^0.6.27",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/view": "^0.6.8",
"@hcengineering/task": "^0.6.11",

View File

@ -1,6 +1,6 @@
{
"name": "@hcengineering/recruit-assets",
"version": "0.6.12",
"version": "0.6.13",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"template": "@hcengineering/assets-package",
@ -30,7 +30,7 @@
},
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"@hcengineering/recruit": "^0.6.18"
"@hcengineering/recruit": "^0.6.19"
},
"repository": "https://github.com/hcenginneing/anticrm",
"publishConfig": {

View File

@ -34,7 +34,7 @@
"@hcengineering/platform": "^0.6.9",
"@hcengineering/core": "^0.6.27",
"svelte": "3.55.1",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/text-editor": "^0.6.0",
@ -42,7 +42,7 @@
"@hcengineering/contact": "^0.6.19",
"@hcengineering/login": "^0.6.7",
"@hcengineering/workbench": "^0.6.8",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/activity": "^0.6.0",
"@hcengineering/attachment": "^0.6.8",
"@hcengineering/attachment-resources": "^0.6.0",
@ -55,7 +55,7 @@
"@hcengineering/rekoni": "^0.6.0",
"@hcengineering/notification": "^0.6.14",
"@hcengineering/tags": "^0.6.11",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/tracker": "^0.6.11"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@hcengineering/recruit",
"version": "0.6.18",
"version": "0.6.19",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",
@ -31,7 +31,7 @@
"@hcengineering/contact": "^0.6.19",
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/task": "^0.6.11",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/tags": "^0.6.11"
},

View File

@ -40,7 +40,7 @@
"@hcengineering/attachment": "^0.6.8",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/view": "^0.6.8",
"@hcengineering/view-resources": "^0.6.0",
"@hcengineering/task": "^0.6.11",

View File

@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { getCurrentAccount } from '@hcengineering/core'
import { Ref, getCurrentAccount } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation'
import type { Integration, IntegrationType } from '@hcengineering/setting'
import setting from '@hcengineering/setting'
@ -28,7 +28,15 @@
let integrationTypes: IntegrationType[] = []
typeQuery.query(setting.class.IntegrationType, {}, (res) => (integrationTypes = res))
integrationQuery.query(setting.class.Integration, { createdBy: accountId }, (res) => (integrations = res))
integrationQuery.query(
setting.class.Integration,
{ createdBy: accountId },
(res) => (integrations = res.filter((p) => p.value !== ''))
)
function getIntegrations (type: Ref<IntegrationType>, integrations: Integration[]): Integration[] {
return integrations.filter((p) => p.type === type)
}
</script>
<div class="antiComponent">
@ -38,7 +46,14 @@
</div>
<div class="ac-body__cards-container">
{#each integrationTypes as integrationType (integrationType._id)}
<PluginCard integration={integrations.find((p) => p.type === integrationType._id)} {integrationType} />
{#if integrationType.allowMultiple}
{#each getIntegrations(integrationType._id, integrations) as integration (integration._id)}
<PluginCard {integration} {integrationType} />
{/each}
<PluginCard integration={undefined} {integrationType} />
{:else}
<PluginCard integration={integrations.find((p) => p.type === integrationType._id)} {integrationType} />
{/if}
{/each}
</div>
</div>

View File

@ -59,7 +59,7 @@
async function disconnect (): Promise<void> {
if (integration !== undefined && integrationType.onDisconnect !== undefined) {
const disconnect = await getResource(integrationType.onDisconnect)
await disconnect()
await disconnect(integration.value)
}
}
const handleConfigure = async (e: any, component?: AnyComponent, pos?: PopupPosAlignment): Promise<void> => {
@ -91,7 +91,11 @@
</div>
</div>
<div class="content">
<Label label={integrationType.description} />
{#if integration}
{integration.value}
{:else}
<Label label={integrationType.description} />
{/if}
</div>
<div class="footer">
{#if (integration?.value ?? '') === ''}

View File

@ -22,7 +22,7 @@ import { TemplateFieldCategory, TemplateField } from '@hcengineering/templates'
/**
* @public
*/
export type Handler = Resource<() => Promise<void>>
export type Handler = Resource<(value: string) => Promise<void>>
/**
* @public
@ -31,6 +31,7 @@ export interface IntegrationType extends Doc {
label: IntlString
description: IntlString
icon: AnyComponent
allowMultiple: boolean
createComponent?: AnyComponent
onDisconnect?: Handler

View File

@ -41,7 +41,7 @@
"@hcengineering/core": "^0.6.27",
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/attachment": "^0.6.8",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/view": "^0.6.8",
"@hcengineering/view-resources": "^0.6.0",
"@hcengineering/login": "^0.6.7",

View File

@ -46,7 +46,7 @@
"@hcengineering/notification-resources": "^0.6.0",
"@hcengineering/attachment": "^0.6.8",
"@hcengineering/attachment-resources": "^0.6.0",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/templates": "^0.6.6"
}
}

View File

@ -43,7 +43,7 @@
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/login": "^0.6.7",
"@hcengineering/setting": "^0.6.9",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/tags": "^0.6.11",
"@hcengineering/task": "^0.6.11",
"@hcengineering/chunter": "^0.6.10",
@ -52,7 +52,7 @@
"@hcengineering/contact-resources": "^0.6.0",
"@hcengineering/view-resources": "^0.6.0",
"@hcengineering/text-editor": "^0.6.0",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/kanban": "^0.6.0",
"@hcengineering/attachment-resources": "^0.6.0",
"@hcengineering/workbench": "^0.6.8",

View File

@ -36,7 +36,7 @@
"@hcengineering/platform": "^0.6.9",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/model": "^0.6.6",
"@hcengineering/panel": "^0.6.12",
"@hcengineering/panel": "^0.6.13",
"@hcengineering/core": "^0.6.27",
"@hcengineering/view": "^0.6.8",
"@hcengineering/ui": "^0.6.10",

View File

@ -41,7 +41,7 @@
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/login": "^0.6.7",
"@hcengineering/setting": "^0.6.9",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/request": "^0.6.4",
"@hcengineering/notification": "^0.6.14",
"@hcengineering/notification-resources": "^0.6.0",

View File

@ -90,7 +90,7 @@
"@hcengineering/view-assets": "^0.6.6",
"@hcengineering/task-assets": "^0.6.10",
"@hcengineering/chunter-assets": "^0.6.8",
"@hcengineering/recruit-assets": "^0.6.12",
"@hcengineering/recruit-assets": "^0.6.13",
"@hcengineering/setting-assets": "^0.6.7",
"@hcengineering/support-assets": "^0.6.0",
"@hcengineering/contact-assets": "^0.6.8",
@ -106,7 +106,7 @@
"@hcengineering/notification-assets": "^0.6.8",
"@hcengineering/preference-assets": "^0.6.0",
"@hcengineering/tags-assets": "^0.6.0",
"@hcengineering/calendar-assets": "^0.6.12",
"@hcengineering/calendar-assets": "^0.6.13",
"@hcengineering/tracker-assets": "^0.6.0",
"@hcengineering/board-assets": "^0.6.10",
"@hcengineering/hr-assets": "^0.6.10",
@ -116,7 +116,7 @@
"@hcengineering/view": "^0.6.8",
"@hcengineering/task": "^0.6.11",
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/setting": "^0.6.9",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/activity": "^0.6.0",
@ -131,11 +131,11 @@
"@hcengineering/notification": "^0.6.14",
"@hcengineering/preference": "^0.6.8",
"@hcengineering/tags": "^0.6.11",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/tracker": "^0.6.11",
"@hcengineering/board": "^0.6.10",
"@hcengineering/hr": "^0.6.10",
"@hcengineering/bitrix": "^0.6.41",
"@hcengineering/bitrix": "^0.6.42",
"@hcengineering/request": "^0.6.4",
"@hcengineering/support": "^0.6.0"
}

View File

@ -28,7 +28,7 @@
"dependencies": {
"@hcengineering/core": "^0.6.27",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/calendar": "^0.6.14",
"@hcengineering/calendar": "^0.6.15",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/server-core": "^0.6.1",
"@hcengineering/server-notification-resources": "^0.6.0"

View File

@ -33,7 +33,7 @@
"@hcengineering/server-core": "^0.6.1",
"@hcengineering/server": "^0.6.4",
"@hcengineering/chunter": "^0.6.10",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"got": "^11.8.3",
"fast-equals": "^2.0.3",
"html-to-text": "^9.0.3"

View File

@ -29,7 +29,7 @@
"@hcengineering/core": "^0.6.27",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/server-core": "^0.6.1",
"@hcengineering/recruit": "^0.6.18",
"@hcengineering/recruit": "^0.6.19",
"@hcengineering/view": "^0.6.8",
"@hcengineering/login": "^0.6.7",
"@hcengineering/workbench": "^0.6.8",