mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 02:51:54 +03:00
remove extra spaces (#5930)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
f9aabe98c3
commit
2fb4763f3f
@ -56,7 +56,7 @@ async function createDefaults (tx: TxOperations): Promise<void> {
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: tags.icon.Tags,
|
||||
label: 'Other',
|
||||
|
@ -243,7 +243,7 @@ async function createTagCategories (tx: TxOperations): Promise<void> {
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: tags.icon.Tags,
|
||||
label: 'Labels',
|
||||
@ -257,7 +257,7 @@ async function createTagCategories (tx: TxOperations): Promise<void> {
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: tags.icon.Tags,
|
||||
label: 'Labels',
|
||||
|
@ -13,29 +13,27 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import core, { type Ref, type Space } from '@hcengineering/core'
|
||||
import { gmailId } from '@hcengineering/gmail'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
tryUpgrade,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
} from '@hcengineering/model'
|
||||
import gmail from './plugin'
|
||||
import { DOMAIN_GMAIL } from '.'
|
||||
|
||||
export const gmailOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, gmailId, [
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await tryMigrate(client, gmailId, [
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, gmail.space.Gmail, {
|
||||
name: 'Gmail',
|
||||
description: 'Space for all gmail messages'
|
||||
})
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'gmail:space:Gmail' as Ref<Space>, core.space.Workspace, [DOMAIN_GMAIL])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import core, { TDoc } from '@hcengineering/model-core'
|
||||
import { type Location } from '@hcengineering/ui'
|
||||
import guest from './plugin'
|
||||
|
||||
const GUEST_DOMAIN = 'guest' as Domain
|
||||
export const GUEST_DOMAIN = 'guest' as Domain
|
||||
|
||||
@Model(guest.class.PublicLink, core.class.Doc, GUEST_DOMAIN)
|
||||
export class TPublicLink extends TDoc implements PublicLink {
|
||||
|
@ -1,16 +1,23 @@
|
||||
import { AccountRole, DOMAIN_TX, type Account, type TxCreateDoc, type TxUpdateDoc } from '@hcengineering/core'
|
||||
import {
|
||||
AccountRole,
|
||||
DOMAIN_TX,
|
||||
type Ref,
|
||||
type Space,
|
||||
type Account,
|
||||
type TxCreateDoc,
|
||||
type TxUpdateDoc
|
||||
} from '@hcengineering/core'
|
||||
import { guestId } from '@hcengineering/guest'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
tryUpgrade,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient,
|
||||
type ModelLogger
|
||||
} from '@hcengineering/model'
|
||||
import core from '@hcengineering/model-core'
|
||||
import guest from './plugin'
|
||||
import { GUEST_DOMAIN } from '.'
|
||||
|
||||
export const guestOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient, logger: ModelLogger): Promise<void> {
|
||||
@ -58,20 +65,14 @@ export const guestOperation: MigrateOperation = {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, guestId, [
|
||||
},
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, guest.space.Links, {
|
||||
name: 'Links',
|
||||
description: 'Space for all guest links'
|
||||
})
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'guest:space:Links' as Ref<Space>, core.space.Workspace, [GUEST_DOMAIN])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -13,9 +13,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { type Ref, TxOperations } from '@hcengineering/core'
|
||||
import { type Space, TxOperations, type Ref } from '@hcengineering/core'
|
||||
import { type Department } from '@hcengineering/hr'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
tryUpgrade,
|
||||
type MigrateOperation,
|
||||
@ -24,7 +25,6 @@ import {
|
||||
} from '@hcengineering/model'
|
||||
import core, { DOMAIN_SPACE } from '@hcengineering/model-core'
|
||||
import hr, { DOMAIN_HR, hrId } from './index'
|
||||
import { type Department } from '@hcengineering/hr'
|
||||
|
||||
async function createDepartment (tx: TxOperations): Promise<void> {
|
||||
const current = await tx.findOne(hr.class.Department, {
|
||||
@ -33,7 +33,7 @@ async function createDepartment (tx: TxOperations): Promise<void> {
|
||||
if (current === undefined) {
|
||||
await tx.createDoc(
|
||||
hr.class.Department,
|
||||
hr.space.HR,
|
||||
core.space.Workspace,
|
||||
{
|
||||
name: 'Organization',
|
||||
description: '',
|
||||
@ -49,21 +49,21 @@ async function createDepartment (tx: TxOperations): Promise<void> {
|
||||
async function migrateDepartments (client: MigrationClient): Promise<void> {
|
||||
await client.update(
|
||||
DOMAIN_HR,
|
||||
{ _class: hr.class.PublicHoliday, space: { $ne: hr.space.HR } },
|
||||
{ space: hr.space.HR }
|
||||
{ _class: hr.class.PublicHoliday, space: { $ne: core.space.Workspace } },
|
||||
{ space: core.space.Workspace }
|
||||
)
|
||||
const objects = await client.find(DOMAIN_HR, { space: { $ne: hr.space.HR }, _class: hr.class.Request })
|
||||
const objects = await client.find(DOMAIN_HR, { space: { $ne: core.space.Workspace }, _class: hr.class.Request })
|
||||
for (const obj of objects) {
|
||||
await client.update(DOMAIN_HR, { _id: obj._id }, { space: hr.space.HR, department: obj.space })
|
||||
await client.update(DOMAIN_HR, { _id: obj._id }, { space: core.space.Workspace, department: obj.space })
|
||||
}
|
||||
await client.move(DOMAIN_SPACE, { _class: hr.class.Department }, DOMAIN_HR)
|
||||
const departments = await client.find<Department>(DOMAIN_HR, {
|
||||
_class: hr.class.Department,
|
||||
space: { $ne: hr.space.HR }
|
||||
space: { $ne: core.space.Workspace }
|
||||
})
|
||||
for (const department of departments) {
|
||||
const upd: Partial<Department> = {
|
||||
space: hr.space.HR
|
||||
space: core.space.Workspace
|
||||
}
|
||||
if (department._id !== hr.ids.Head) {
|
||||
upd.parent = department.space as unknown as Ref<Department>
|
||||
@ -83,6 +83,12 @@ export const hrOperation: MigrateOperation = {
|
||||
{
|
||||
state: 'migrateDepartments',
|
||||
func: migrateDepartments
|
||||
},
|
||||
{
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'hr:space:HR' as Ref<Space>, core.space.Workspace, [DOMAIN_HR])
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
@ -91,7 +97,6 @@ export const hrOperation: MigrateOperation = {
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, hr.space.HR, { name: 'HR', description: 'Human Resources' })
|
||||
const tx = new TxOperations(client, core.account.System)
|
||||
await createDepartment(tx)
|
||||
}
|
||||
|
@ -13,33 +13,28 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import core, { type Ref, type Space } from '@hcengineering/core'
|
||||
import { inventoryId } from '@hcengineering/inventory'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
tryUpgrade,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
} from '@hcengineering/model'
|
||||
import inventory from './plugin'
|
||||
import { DOMAIN_INVENTORY } from '.'
|
||||
|
||||
export const inventoryOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, inventoryId, [
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await tryMigrate(client, inventoryId, [
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, inventory.space.Category, {
|
||||
name: 'Categories',
|
||||
description: 'Space for all inventory categories'
|
||||
})
|
||||
await createDefaultSpace(client, inventory.space.Products, {
|
||||
name: 'Products',
|
||||
description: 'Space for all inventory products'
|
||||
})
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'inventory:space:Category' as Ref<Space>, core.space.Workspace, [DOMAIN_INVENTORY])
|
||||
await migrateSpace(client, 'inventory:space:Products' as Ref<Space>, core.space.Workspace, [DOMAIN_INVENTORY])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -14,11 +14,13 @@
|
||||
//
|
||||
|
||||
import contact from '@hcengineering/contact'
|
||||
import { TxOperations, type Ref } from '@hcengineering/core'
|
||||
import { type Space, TxOperations, type Ref } from '@hcengineering/core'
|
||||
import drive from '@hcengineering/drive'
|
||||
import { RoomAccess, RoomType, createDefaultRooms, isOffice, loveId, type Floor } from '@hcengineering/love'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
tryUpgrade,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
@ -26,6 +28,7 @@ import {
|
||||
} from '@hcengineering/model'
|
||||
import core from '@hcengineering/model-core'
|
||||
import love from './plugin'
|
||||
import { DOMAIN_LOVE } from '.'
|
||||
|
||||
async function createDefaultFloor (tx: TxOperations): Promise<void> {
|
||||
const current = await tx.findOne(love.class.Floor, {
|
||||
@ -34,7 +37,7 @@ async function createDefaultFloor (tx: TxOperations): Promise<void> {
|
||||
if (current === undefined) {
|
||||
await tx.createDoc(
|
||||
love.class.Floor,
|
||||
love.space.Rooms,
|
||||
core.space.Workspace,
|
||||
{
|
||||
name: 'Main'
|
||||
},
|
||||
@ -53,7 +56,7 @@ async function createRooms (client: MigrationUpgradeClient): Promise<void> {
|
||||
const data = createDefaultRooms(employees.map((p) => p._id))
|
||||
for (const room of data) {
|
||||
const _class = isOffice(room) ? love.class.Office : love.class.Room
|
||||
await tx.createDoc(_class, love.space.Rooms, room)
|
||||
await tx.createDoc(_class, core.space.Workspace, room)
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +68,7 @@ async function createReception (client: MigrationUpgradeClient): Promise<void> {
|
||||
if (current !== undefined) return
|
||||
await tx.createDoc(
|
||||
love.class.Room,
|
||||
love.space.Rooms,
|
||||
core.space.Workspace,
|
||||
{
|
||||
name: 'Reception',
|
||||
type: RoomType.Reception,
|
||||
@ -81,15 +84,18 @@ async function createReception (client: MigrationUpgradeClient): Promise<void> {
|
||||
}
|
||||
|
||||
export const loveOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {},
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await tryMigrate(client, loveId, [
|
||||
{
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'love:space:Rooms' as Ref<Space>, core.space.Workspace, [DOMAIN_LOVE])
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, loveId, [
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, love.space.Rooms, { name: 'Rooms', description: 'Space for all rooms' })
|
||||
}
|
||||
},
|
||||
{
|
||||
state: 'initial-defaults',
|
||||
func: async (client) => {
|
||||
|
@ -13,11 +13,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { type Doc, type Ref, type Class, type DocumentQuery, DOMAIN_TX } from '@hcengineering/core'
|
||||
import core, { DOMAIN_TX, type Class, type Doc, type DocumentQuery, type Ref, type Space } from '@hcengineering/core'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
tryUpgrade,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
@ -76,37 +75,29 @@ export const notificationOperation: MigrateOperation = {
|
||||
func: async (client) => {
|
||||
await removeNotifications(client, { hidden: true })
|
||||
}
|
||||
}
|
||||
])
|
||||
await tryMigrate(client, notificationId, [
|
||||
},
|
||||
{
|
||||
state: 'delete-invalid-notifications',
|
||||
func: async (client) => {
|
||||
await removeNotifications(client, { attachedToClass: 'chunter:class:Comment' as Ref<Class<Doc>> })
|
||||
}
|
||||
}
|
||||
])
|
||||
await tryMigrate(client, notificationId, [
|
||||
},
|
||||
{
|
||||
state: 'remove-old-classes',
|
||||
func: async (client) => {
|
||||
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:DocUpdates' as Ref<Class<Doc>> })
|
||||
await client.deleteMany(DOMAIN_TX, { objectClass: 'notification:class:DocUpdates' as Ref<Class<Doc>> })
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, notificationId, [
|
||||
},
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, notification.space.Notifications, {
|
||||
name: 'Notifications',
|
||||
description: 'Space for all notifications'
|
||||
})
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'notification:space:Notifications' as Ref<Space>, core.space.Workspace, [
|
||||
DOMAIN_NOTIFICATION
|
||||
])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -13,25 +13,28 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import core, { type Ref, type Space } from '@hcengineering/core'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
tryUpgrade,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
} from '@hcengineering/model'
|
||||
import preference, { preferenceId } from '@hcengineering/preference'
|
||||
import { DOMAIN_PREFERENCE, preferenceId } from '@hcengineering/preference'
|
||||
|
||||
export const preferenceOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, preferenceId, [
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await tryMigrate(client, preferenceId, [
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, preference.space.Preference, { name: 'Preference' })
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'preference:space:Preference' as Ref<Space>, core.space.Workspace, [
|
||||
DOMAIN_PREFERENCE
|
||||
])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@
|
||||
//
|
||||
|
||||
import { getCategories } from '@anticrm/skillset'
|
||||
import core, { DOMAIN_TX, TxOperations, type Ref, type Status } from '@hcengineering/core'
|
||||
import core, { DOMAIN_TX, TxOperations, type Ref, type Space, type Status } from '@hcengineering/core'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
createOrUpdate,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
tryUpgrade,
|
||||
type MigrateOperation,
|
||||
@ -29,6 +29,7 @@ import tags, { type TagCategory } from '@hcengineering/model-tags'
|
||||
import task, { DOMAIN_TASK, createSequence, migrateDefaultStatusesBase } from '@hcengineering/model-task'
|
||||
import { recruitId, type Applicant } from '@hcengineering/recruit'
|
||||
|
||||
import { DOMAIN_CALENDAR } from '@hcengineering/model-calendar'
|
||||
import { DOMAIN_SPACE } from '@hcengineering/model-core'
|
||||
import recruit from './plugin'
|
||||
import { defaultApplicantStatuses } from './spaceType'
|
||||
@ -53,6 +54,12 @@ export const recruitOperation: MigrateOperation = {
|
||||
func: async (client) => {
|
||||
await migrateDefaultTypeMixins(client)
|
||||
}
|
||||
},
|
||||
{
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'recruit:space:Reviews' as Ref<Space>, core.space.Workspace, [DOMAIN_CALENDAR])
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
@ -164,12 +171,10 @@ async function migrateDefaultTypeMixins (client: MigrationClient): Promise<void>
|
||||
}
|
||||
|
||||
async function createDefaults (client: MigrationUpgradeClient, tx: TxOperations): Promise<void> {
|
||||
await createDefaultSpace(client, recruit.space.Reviews, { name: 'Reviews' })
|
||||
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: recruit.icon.Skills,
|
||||
label: 'Other',
|
||||
@ -184,7 +189,7 @@ async function createDefaults (client: MigrationUpgradeClient, tx: TxOperations)
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: recruit.icon.Skills,
|
||||
label: c.label,
|
||||
|
@ -13,26 +13,27 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import core, { type Ref, type Space } from '@hcengineering/core'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
tryUpgrade,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
} from '@hcengineering/model'
|
||||
import { settingId } from '@hcengineering/setting'
|
||||
import setting from './plugin'
|
||||
import { DOMAIN_SETTING } from '.'
|
||||
|
||||
export const settingOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, settingId, [
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await tryMigrate(client, settingId, [
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, setting.space.Setting, { name: 'Setting' })
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'setting:space:Setting' as Ref<Space>, core.space.Workspace, [DOMAIN_SETTING])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -1,23 +1,24 @@
|
||||
import core, { type Ref, type Space } from '@hcengineering/core'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
tryUpgrade,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
} from '@hcengineering/model'
|
||||
import { tagsId } from '@hcengineering/tags'
|
||||
import tags from './plugin'
|
||||
import { DOMAIN_TAGS } from '.'
|
||||
|
||||
export const tagsOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, tagsId, [
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await tryMigrate(client, tagsId, [
|
||||
{
|
||||
state: 'create-defaults-v2',
|
||||
func: async (client) => {
|
||||
await createDefaultSpace(client, tags.space.Tags, { name: 'Tags', description: 'Space for all tags' })
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'tags:space:Tags' as Ref<Space>, core.space.Workspace, [DOMAIN_TAGS])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ import {
|
||||
type TxUpdateDoc
|
||||
} from '@hcengineering/core'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
createOrUpdate,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
tryUpgrade,
|
||||
type MigrateOperation,
|
||||
@ -51,7 +51,7 @@ import {
|
||||
type TaskType
|
||||
} from '@hcengineering/task'
|
||||
|
||||
import { DOMAIN_TASK } from '.'
|
||||
import { DOMAIN_KANBAN, DOMAIN_TASK } from '.'
|
||||
import task from './plugin'
|
||||
|
||||
/**
|
||||
@ -59,18 +59,13 @@ import task from './plugin'
|
||||
*/
|
||||
export async function createSequence (tx: TxOperations, _class: Ref<Class<Doc>>): Promise<void> {
|
||||
if ((await tx.findOne(task.class.Sequence, { attachedTo: _class })) === undefined) {
|
||||
await tx.createDoc(task.class.Sequence, task.space.Sequence, {
|
||||
await tx.createDoc(task.class.Sequence, core.space.Workspace, {
|
||||
attachedTo: _class,
|
||||
sequence: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function createDefaults (client: MigrationUpgradeClient): Promise<void> {
|
||||
await createDefaultSpace(client, task.space.Sequence, { name: 'Sequences' })
|
||||
await createDefaultSpace(client, task.space.Statuses, { name: 'Statuses' })
|
||||
}
|
||||
|
||||
export async function migrateDefaultStatusesBase<T extends Task> (
|
||||
client: MigrationClient,
|
||||
logger: ModelLogger,
|
||||
@ -583,15 +578,17 @@ export const taskOperation: MigrateOperation = {
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, task.space.Sequence, core.space.Workspace, [DOMAIN_KANBAN])
|
||||
}
|
||||
}
|
||||
])
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, taskId, [
|
||||
{
|
||||
state: 'defaults-v2',
|
||||
func: createDefaults
|
||||
},
|
||||
{
|
||||
state: 'u-task-001',
|
||||
func: async (client) => {
|
||||
@ -600,7 +597,7 @@ export const taskOperation: MigrateOperation = {
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: tags.icon.Tags,
|
||||
label: 'Text Label',
|
||||
|
@ -13,31 +13,27 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import core, { type Ref, type Space } from '@hcengineering/core'
|
||||
import {
|
||||
createDefaultSpace,
|
||||
tryUpgrade,
|
||||
migrateSpace,
|
||||
tryMigrate,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
} from '@hcengineering/model'
|
||||
import { telegramId } from '@hcengineering/telegram'
|
||||
import telegram from './plugin'
|
||||
|
||||
export async function createSpace (client: MigrationUpgradeClient): Promise<void> {
|
||||
await createDefaultSpace(client, telegram.space.Telegram, {
|
||||
name: 'Telegram',
|
||||
description: 'Space for all telegram messages'
|
||||
})
|
||||
}
|
||||
import { DOMAIN_TELEGRAM } from '.'
|
||||
|
||||
export const telegramOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, telegramId, [
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await tryMigrate(client, telegramId, [
|
||||
{
|
||||
state: 'defaults-v2',
|
||||
func: createSpace
|
||||
state: 'removeDeprecatedSpace',
|
||||
func: async (client: MigrationClient) => {
|
||||
await migrateSpace(client, 'telegram:space:Telegram' as Ref<Space>, core.space.Workspace, [DOMAIN_TELEGRAM])
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
},
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||
}
|
||||
|
@ -193,7 +193,6 @@ export function createModel (builder: Builder): void {
|
||||
icon: calendarPlugin.icon.Calendar,
|
||||
alias: timeId,
|
||||
hidden: false,
|
||||
position: 'top',
|
||||
modern: true,
|
||||
component: time.component.Me
|
||||
},
|
||||
|
@ -190,7 +190,7 @@ export const timeOperation: MigrateOperation = {
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: tags.icon.Tags,
|
||||
label: 'Other',
|
||||
|
@ -126,7 +126,7 @@ async function createDefaults (tx: TxOperations): Promise<void> {
|
||||
await createOrUpdate(
|
||||
tx,
|
||||
tags.class.TagCategory,
|
||||
tags.space.Tags,
|
||||
core.space.Workspace,
|
||||
{
|
||||
icon: tags.icon.Tags,
|
||||
label: 'Other',
|
||||
|
@ -159,7 +159,8 @@ export default plugin(coreId, {
|
||||
DerivedTx: '' as Ref<Space>,
|
||||
Model: '' as Ref<Space>,
|
||||
Space: '' as Ref<TypedSpace>,
|
||||
Configuration: '' as Ref<Space>
|
||||
Configuration: '' as Ref<Space>,
|
||||
Workspace: '' as Ref<Space>
|
||||
},
|
||||
account: {
|
||||
System: '' as Ref<Account>,
|
||||
|
@ -2,6 +2,7 @@ import core, {
|
||||
Class,
|
||||
Client,
|
||||
DOMAIN_MIGRATION,
|
||||
DOMAIN_TX,
|
||||
Data,
|
||||
Doc,
|
||||
DocumentQuery,
|
||||
@ -223,3 +224,18 @@ export async function createDefaultSpace<T extends Space> (
|
||||
await tx.createDoc(_class, core.space.Space, data, _id)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function migrateSpace (
|
||||
client: MigrationClient,
|
||||
from: Ref<Space>,
|
||||
to: Ref<Space>,
|
||||
domains: Domain[]
|
||||
): Promise<void> {
|
||||
for (const domain of domains) {
|
||||
await client.update(domain, { space: from }, { space: to })
|
||||
}
|
||||
await client.update(DOMAIN_TX, { objectSpace: from }, { objectSpace: to })
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
import { get } from 'svelte/store'
|
||||
import type { ActivityMessage, Reaction } from '@hcengineering/activity'
|
||||
import core, { type Doc, type Ref, type TxOperations, getCurrentAccount, isOtherHour } from '@hcengineering/core'
|
||||
import core, { getCurrentAccount, isOtherHour, type Doc, type Ref, type TxOperations } from '@hcengineering/core'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import {
|
||||
type Location,
|
||||
getEventPositionElement,
|
||||
closePopup,
|
||||
showPopup,
|
||||
EmojiPopup,
|
||||
getCurrentResolvedLocation
|
||||
closePopup,
|
||||
getCurrentResolvedLocation,
|
||||
getEventPositionElement,
|
||||
showPopup,
|
||||
type Location
|
||||
} from '@hcengineering/ui'
|
||||
import { type AttributeModel } from '@hcengineering/view'
|
||||
import preference from '@hcengineering/preference'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
import { savedMessagesStore } from './activity'
|
||||
import activity from './plugin'
|
||||
@ -77,7 +76,7 @@ export async function saveForLater (message?: ActivityMessage): Promise<void> {
|
||||
closePopup()
|
||||
const client = getClient()
|
||||
|
||||
await client.createDoc(activity.class.SavedMessage, preference.space.Preference, {
|
||||
await client.createDoc(activity.class.SavedMessage, core.space.Workspace, {
|
||||
attachedTo: message._id
|
||||
})
|
||||
}
|
||||
|
@ -13,57 +13,56 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import attachment, { type Attachment } from '@hcengineering/attachment'
|
||||
import { type ObjQueryType, SortingOrder, type SortingQuery, type Markup } from '@hcengineering/core'
|
||||
import { type IntlString, type Resources } from '@hcengineering/platform'
|
||||
import preference from '@hcengineering/preference'
|
||||
import { PDFViewer, deleteFile, getClient, uploadFile } from '@hcengineering/presentation'
|
||||
import activity, { type ActivityMessage, type DocUpdateMessage } from '@hcengineering/activity'
|
||||
import attachment, { type Attachment } from '@hcengineering/attachment'
|
||||
import core, { SortingOrder, type Markup, type ObjQueryType, type SortingQuery } from '@hcengineering/core'
|
||||
import { type IntlString, type Resources } from '@hcengineering/platform'
|
||||
import { PDFViewer, deleteFile, getClient, uploadFile } from '@hcengineering/presentation'
|
||||
|
||||
import AccordionEditor from './components/AccordionEditor.svelte'
|
||||
import AddAttachment from './components/AddAttachment.svelte'
|
||||
import AttachmentDocList from './components/AttachmentDocList.svelte'
|
||||
import AttachmentDroppable from './components/AttachmentDroppable.svelte'
|
||||
import AttachmentGalleryPresenter from './components/AttachmentGalleryPresenter.svelte'
|
||||
import AttachmentList from './components/AttachmentList.svelte'
|
||||
import AttachmentPresenter from './components/AttachmentPresenter.svelte'
|
||||
import AttachmentPreview from './components/AttachmentPreview.svelte'
|
||||
import AttachmentRefInput from './components/AttachmentRefInput.svelte'
|
||||
import AttachmentStyleBoxCollabEditor from './components/AttachmentStyleBoxCollabEditor.svelte'
|
||||
import AttachmentStyleBoxEditor from './components/AttachmentStyleBoxEditor.svelte'
|
||||
import AttachmentStyledBox from './components/AttachmentStyledBox.svelte'
|
||||
import Attachments from './components/Attachments.svelte'
|
||||
import AttachmentsPresenter from './components/AttachmentsPresenter.svelte'
|
||||
import FileBrowser from './components/FileBrowser.svelte'
|
||||
import FileDownload from './components/icons/FileDownload.svelte'
|
||||
import Photos from './components/Photos.svelte'
|
||||
import AttachmentStyledBox from './components/AttachmentStyledBox.svelte'
|
||||
import AttachmentStyleBoxEditor from './components/AttachmentStyleBoxEditor.svelte'
|
||||
import AttachmentStyleBoxCollabEditor from './components/AttachmentStyleBoxCollabEditor.svelte'
|
||||
import AccordionEditor from './components/AccordionEditor.svelte'
|
||||
import IconUploadDuo from './components/icons/UploadDuo.svelte'
|
||||
import IconAttachment from './components/icons/Attachment.svelte'
|
||||
import AttachmentPreview from './components/AttachmentPreview.svelte'
|
||||
import AttachmentsUpdatedMessage from './components/activity/AttachmentsUpdatedMessage.svelte'
|
||||
import AttachmentsTooltip from './components/AttachmentsTooltip.svelte'
|
||||
import FileBrowser from './components/FileBrowser.svelte'
|
||||
import Photos from './components/Photos.svelte'
|
||||
import AttachmentsUpdatedMessage from './components/activity/AttachmentsUpdatedMessage.svelte'
|
||||
import IconAttachment from './components/icons/Attachment.svelte'
|
||||
import FileDownload from './components/icons/FileDownload.svelte'
|
||||
import IconUploadDuo from './components/icons/UploadDuo.svelte'
|
||||
|
||||
export * from './types'
|
||||
|
||||
export {
|
||||
AccordionEditor,
|
||||
AddAttachment,
|
||||
AttachmentDocList,
|
||||
AttachmentDroppable,
|
||||
AttachmentGalleryPresenter,
|
||||
AttachmentList,
|
||||
AttachmentPresenter,
|
||||
AttachmentPreview,
|
||||
AttachmentRefInput,
|
||||
AttachmentStyleBoxCollabEditor,
|
||||
AttachmentStyleBoxEditor,
|
||||
AttachmentStyledBox,
|
||||
Attachments,
|
||||
AttachmentsPresenter,
|
||||
AttachmentPresenter,
|
||||
AttachmentGalleryPresenter,
|
||||
AttachmentRefInput,
|
||||
AttachmentList,
|
||||
AttachmentDocList,
|
||||
FileDownload,
|
||||
AttachmentsTooltip,
|
||||
FileBrowser,
|
||||
AttachmentStyledBox,
|
||||
AttachmentStyleBoxEditor,
|
||||
AttachmentStyleBoxCollabEditor,
|
||||
AccordionEditor,
|
||||
IconUploadDuo,
|
||||
FileDownload,
|
||||
IconAttachment,
|
||||
AttachmentPreview,
|
||||
AttachmentsTooltip
|
||||
IconUploadDuo
|
||||
}
|
||||
|
||||
export enum FileBrowserSortMode {
|
||||
@ -211,7 +210,7 @@ export const fileTypeFileBrowserFilters: TypeFilter[] = [
|
||||
export async function AddAttachmentToSaved (attach: Attachment): Promise<void> {
|
||||
const client = getClient()
|
||||
|
||||
await client.createDoc(attachment.class.SavedAttachments, preference.space.Preference, {
|
||||
await client.createDoc(attachment.class.SavedAttachments, core.space.Workspace, {
|
||||
attachedTo: attach._id
|
||||
})
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ export async function convert (
|
||||
description: '',
|
||||
title: vv,
|
||||
targetClass: attr.attributeOf,
|
||||
space: tags.space.Tags,
|
||||
space: core.space.Workspace,
|
||||
modifiedBy: document.modifiedBy,
|
||||
modifiedOn: document.modifiedOn
|
||||
}
|
||||
@ -379,7 +379,7 @@ export async function convert (
|
||||
weight: o.weight,
|
||||
modifiedBy: document.modifiedBy,
|
||||
modifiedOn: document.modifiedOn,
|
||||
space: tags.space.Tags,
|
||||
space: core.space.Workspace,
|
||||
bitrixId: vv
|
||||
}
|
||||
newExtraSyncDocs.push(ref)
|
||||
|
@ -1,6 +1,5 @@
|
||||
import board, { type Board, type CommonBoardPreference } from '@hcengineering/board'
|
||||
import core, { getCurrentAccount, type Ref, type TxOperations } from '@hcengineering/core'
|
||||
import preference from '@hcengineering/preference'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import type { ProjectType } from '@hcengineering/task'
|
||||
import {
|
||||
@ -55,7 +54,7 @@ export const commonBoardPreference = readable<CommonBoardPreference>(undefined,
|
||||
set(result[0])
|
||||
return
|
||||
}
|
||||
void getClient().createDoc(board.class.CommonBoardPreference, preference.space.Preference, {
|
||||
void getClient().createDoc(board.class.CommonBoardPreference, core.space.Workspace, {
|
||||
attachedTo: board.app.Board
|
||||
})
|
||||
})
|
||||
|
@ -30,7 +30,7 @@ import {
|
||||
import type { Asset, Metadata, Plugin, Resource } from '@hcengineering/platform'
|
||||
import { IntlString, plugin } from '@hcengineering/platform'
|
||||
import { TemplateField, TemplateFieldCategory } from '@hcengineering/templates'
|
||||
import type { AnyComponent, ColorDefinition, ResolvedLocation } from '@hcengineering/ui'
|
||||
import type { AnyComponent, ColorDefinition, ResolvedLocation, Location } from '@hcengineering/ui'
|
||||
import { Action, FilterMode, Viewlet } from '@hcengineering/view'
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
} from '@hcengineering/core'
|
||||
import type { Asset, Plugin, Resource } from '@hcengineering/platform'
|
||||
import { IntlString, plugin } from '@hcengineering/platform'
|
||||
import type { AnyComponent, ResolvedLocation } from '@hcengineering/ui'
|
||||
import type { AnyComponent, ResolvedLocation, Location } from '@hcengineering/ui'
|
||||
import { Action } from '@hcengineering/view'
|
||||
|
||||
import type {
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import {
|
||||
import core, {
|
||||
generateId,
|
||||
getCurrentAccount,
|
||||
type Class,
|
||||
@ -25,7 +25,6 @@ import {
|
||||
} from '@hcengineering/core'
|
||||
import { type Document, type Teamspace } from '@hcengineering/document'
|
||||
import { type Resources } from '@hcengineering/platform'
|
||||
import preference from '@hcengineering/preference'
|
||||
import { getClient, type ObjectSearchResult } from '@hcengineering/presentation'
|
||||
import { showPopup } from '@hcengineering/ui'
|
||||
import { openDoc } from '@hcengineering/view-resources'
|
||||
@ -117,7 +116,7 @@ async function editTeamspace (teamspace: Teamspace | undefined): Promise<void> {
|
||||
export async function starDocument (doc: Document): Promise<void> {
|
||||
const client = getClient()
|
||||
|
||||
await client.createDoc(document.class.SavedDocument, preference.space.Preference, {
|
||||
await client.createDoc(document.class.SavedDocument, core.space.Workspace, {
|
||||
attachedTo: doc._id
|
||||
})
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
import attachmentP, { Attachment } from '@hcengineering/attachment'
|
||||
import { AttachmentPresenter } from '@hcengineering/attachment-resources'
|
||||
import contact, { Channel, Contact, getName } from '@hcengineering/contact'
|
||||
import { Data, Markup, generateId } from '@hcengineering/core'
|
||||
import core, { Data, Markup, generateId } from '@hcengineering/core'
|
||||
import { NewMessage, SharedMessage } from '@hcengineering/gmail'
|
||||
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
||||
import { getResource, setPlatformStatus, unknownError } from '@hcengineering/platform'
|
||||
@ -68,7 +68,7 @@
|
||||
async function sendMsg (): Promise<void> {
|
||||
await client.createDoc(
|
||||
plugin.class.NewMessage,
|
||||
plugin.space.Gmail,
|
||||
core.space.Workspace,
|
||||
{
|
||||
...obj,
|
||||
content: markupToHTML(content),
|
||||
@ -120,7 +120,7 @@
|
||||
const uuid = await uploadFile(file)
|
||||
await client.addCollection(
|
||||
attachmentP.class.Attachment,
|
||||
plugin.space.Gmail,
|
||||
core.space.Workspace,
|
||||
objectId,
|
||||
plugin.class.NewMessage,
|
||||
'attachments',
|
||||
|
@ -17,7 +17,7 @@
|
||||
import attachmentP, { Attachment } from '@hcengineering/attachment'
|
||||
import { AttachmentPresenter } from '@hcengineering/attachment-resources'
|
||||
import contact, { Channel, Contact, getName as getContactName } from '@hcengineering/contact'
|
||||
import { generateId, getCurrentAccount, Markup, Ref, toIdMap } from '@hcengineering/core'
|
||||
import core, { generateId, getCurrentAccount, Markup, Ref, toIdMap } from '@hcengineering/core'
|
||||
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
||||
import { getResource, setPlatformStatus, unknownError } from '@hcengineering/platform'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
@ -83,7 +83,7 @@
|
||||
templateProvider.set(contact.class.Contact, target)
|
||||
const htmlContent = markupToHTML(content)
|
||||
const message = await templateProvider.fillTemplate(htmlContent)
|
||||
const id = await client.createDoc(plugin.class.NewMessage, plugin.space.Gmail, {
|
||||
const id = await client.createDoc(plugin.class.NewMessage, core.space.Workspace, {
|
||||
subject,
|
||||
content: message,
|
||||
to: channel.value,
|
||||
@ -98,7 +98,7 @@
|
||||
for (const attachment of attachments) {
|
||||
await client.addCollection(
|
||||
attachmentP.class.Attachment,
|
||||
plugin.space.Gmail,
|
||||
core.space.Workspace,
|
||||
id,
|
||||
plugin.class.NewMessage,
|
||||
'attachments',
|
||||
@ -145,7 +145,7 @@
|
||||
const uuid = await uploadFile(file)
|
||||
await client.addCollection(
|
||||
attachmentP.class.Attachment,
|
||||
plugin.space.Gmail,
|
||||
core.space.Workspace,
|
||||
attachmentParentId,
|
||||
plugin.class.NewMessage,
|
||||
'attachments',
|
||||
|
@ -14,10 +14,10 @@
|
||||
//
|
||||
|
||||
import { ChannelItem } from '@hcengineering/contact'
|
||||
import type { Account, AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
|
||||
import type { Account, AttachedDoc, Class, Doc, Ref, Timestamp } from '@hcengineering/core'
|
||||
import { NotificationType } from '@hcengineering/notification'
|
||||
import type { IntlString, Plugin } from '@hcengineering/platform'
|
||||
import { Metadata, plugin } from '@hcengineering/platform'
|
||||
import { NotificationType } from '@hcengineering/notification'
|
||||
import type { Handler, IntegrationType } from '@hcengineering/setting'
|
||||
import type { AnyComponent } from '@hcengineering/ui'
|
||||
|
||||
@ -106,10 +106,6 @@ export default plugin(gmailId, {
|
||||
ids: {
|
||||
EmailNotification: '' as Ref<NotificationType>
|
||||
},
|
||||
space: {
|
||||
// todo remove, should be in contact
|
||||
Gmail: '' as Ref<Space>
|
||||
},
|
||||
metadata: {
|
||||
GmailURL: '' as Metadata<string>
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Class, Doc, Ref, Space } from '@hcengineering/core'
|
||||
import { Class, Doc, Ref } from '@hcengineering/core'
|
||||
import type { Asset, Plugin } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import { AnyComponent, Location } from '@hcengineering/ui'
|
||||
@ -30,9 +30,6 @@ export default plugin(guestId, {
|
||||
icon: {
|
||||
Link: '' as Asset
|
||||
},
|
||||
space: {
|
||||
Links: '' as Ref<Space>
|
||||
},
|
||||
component: {
|
||||
GuestApp: '' as AnyComponent
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright © 2024 Hardcore Engineering Inc.
|
||||
//
|
||||
|
||||
import { Doc, TxOperations } from '@hcengineering/core'
|
||||
import core, { Doc, TxOperations } from '@hcengineering/core'
|
||||
import { type Location } from '@hcengineering/ui'
|
||||
|
||||
import guest from './index'
|
||||
@ -13,7 +13,7 @@ export async function createPublicLink (
|
||||
location: Location,
|
||||
revokable: boolean = true
|
||||
): Promise<void> {
|
||||
await client.createDoc(guest.class.PublicLink, guest.space.Links, {
|
||||
await client.createDoc(guest.class.PublicLink, core.space.Workspace, {
|
||||
attachedTo: object._id,
|
||||
location,
|
||||
revokable,
|
||||
|
@ -15,7 +15,7 @@
|
||||
<script lang="ts">
|
||||
import { Employee } from '@hcengineering/contact'
|
||||
import { EmployeeBox } from '@hcengineering/contact-resources'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import core, { Ref } from '@hcengineering/core'
|
||||
import { Card, getClient } from '@hcengineering/presentation'
|
||||
import { Button, EditBox, FocusHandler, createFocusManager } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
@ -36,7 +36,7 @@
|
||||
const client = getClient()
|
||||
|
||||
async function createDepartment () {
|
||||
const id = await client.createDoc(hr.class.Department, hr.space.HR, {
|
||||
const id = await client.createDoc(hr.class.Department, core.space.Workspace, {
|
||||
name,
|
||||
description: '',
|
||||
parent,
|
||||
|
@ -75,7 +75,7 @@
|
||||
if (date === undefined) return
|
||||
if (type === undefined) return
|
||||
if (employee === null) return
|
||||
await client.addCollection(hr.class.Request, hr.space.HR, employee, staff._class, 'requests', {
|
||||
await client.addCollection(hr.class.Request, core.space.Workspace, employee, staff._class, 'requests', {
|
||||
type: type._id,
|
||||
tzDate: timeToTzDate(date),
|
||||
tzDueDate: timeToTzDate(dueDate),
|
||||
@ -146,7 +146,7 @@
|
||||
bind:this={descriptionBox}
|
||||
{objectId}
|
||||
_class={hr.class.Request}
|
||||
space={hr.space.HR}
|
||||
space={core.space.Workspace}
|
||||
alwaysEdit
|
||||
showButtons={false}
|
||||
maxHeight={'card'}
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Data, Ref, Timestamp } from '@hcengineering/core'
|
||||
import core, { Data, Ref, Timestamp } from '@hcengineering/core'
|
||||
import { Department, PublicHoliday, timeToTzDate } from '@hcengineering/hr'
|
||||
import presentation, { Card, getClient } from '@hcengineering/presentation'
|
||||
import { Button, DateRangePresenter, EditBox, Label } from '@hcengineering/ui'
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
async function saveHoliday () {
|
||||
if (existingHoliday !== undefined) {
|
||||
await client.updateDoc(hr.class.PublicHoliday, hr.space.HR, existingHoliday._id, {
|
||||
await client.updateDoc(hr.class.PublicHoliday, core.space.Workspace, existingHoliday._id, {
|
||||
title,
|
||||
description
|
||||
})
|
||||
@ -51,7 +51,7 @@
|
||||
date: timeToTzDate(date),
|
||||
department
|
||||
}
|
||||
await client.createDoc(hr.class.PublicHoliday, hr.space.HR, holiday)
|
||||
await client.createDoc(hr.class.PublicHoliday, core.space.Workspace, holiday)
|
||||
}
|
||||
}
|
||||
findHoliday()
|
||||
|
@ -14,7 +14,7 @@
|
||||
//
|
||||
|
||||
import type { Contact, Employee, PersonAccount } from '@hcengineering/contact'
|
||||
import type { Arr, AttachedDoc, Class, Doc, Markup, Mixin, Ref, Space, Type } from '@hcengineering/core'
|
||||
import type { Arr, AttachedDoc, Class, Doc, Markup, Mixin, Ref, Type } from '@hcengineering/core'
|
||||
import { NotificationType } from '@hcengineering/notification'
|
||||
import type { Asset, IntlString, Plugin } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
@ -123,9 +123,6 @@ const hr = plugin(hrId, {
|
||||
mixin: {
|
||||
Staff: '' as Ref<Mixin<Staff>>
|
||||
},
|
||||
space: {
|
||||
HR: '' as Ref<Space>
|
||||
},
|
||||
icon: {
|
||||
HR: '' as Asset,
|
||||
Department: '' as Asset,
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { DocumentQuery } from '@hcengineering/core'
|
||||
import core, { DocumentQuery } from '@hcengineering/core'
|
||||
import { Button, Label, Scroller, SearchEdit, showPopup, IconAdd } from '@hcengineering/ui'
|
||||
import type { Category } from '@hcengineering/inventory'
|
||||
import inventory from '../plugin'
|
||||
@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
function showCreateDialog () {
|
||||
showPopup(CreateCategory, { space: inventory.space.Category }, 'top')
|
||||
showPopup(CreateCategory, { space: core.space.Workspace }, 'top')
|
||||
}
|
||||
|
||||
// $: twoRows = $deviceInfo.twoRows
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { AttachedData, AttachedDoc, Doc, Ref, generateId } from '@hcengineering/core'
|
||||
import core, { AttachedData, AttachedDoc, Doc, Ref, generateId } from '@hcengineering/core'
|
||||
import { OK, Status } from '@hcengineering/platform'
|
||||
import { Card, getClient } from '@hcengineering/presentation'
|
||||
import type { Category } from '@hcengineering/inventory'
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
await client.addCollection(
|
||||
inventory.class.Category,
|
||||
inventory.space.Category,
|
||||
core.space.Workspace,
|
||||
attachedTo,
|
||||
inventory.class.Category,
|
||||
'categories',
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Account, Doc, generateId, Ref } from '@hcengineering/core'
|
||||
import core, { Account, Doc, generateId, Ref } from '@hcengineering/core'
|
||||
import { Category, Product } from '@hcengineering/inventory'
|
||||
import { Card, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Button, DropdownLabels, DropdownTextItem, EditBox } from '@hcengineering/ui'
|
||||
@ -26,7 +26,7 @@
|
||||
attachedTo: '' as Ref<Doc>,
|
||||
attachedToClass: inventory.class.Category,
|
||||
_class: inventory.class.Product,
|
||||
space: inventory.space.Products,
|
||||
space: core.space.Workspace,
|
||||
_id: generateId(),
|
||||
collection: 'products',
|
||||
modifiedOn: Date.now(),
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Account, generateId, Ref } from '@hcengineering/core'
|
||||
import core, { Account, generateId, Ref } from '@hcengineering/core'
|
||||
import { Card, getClient } from '@hcengineering/presentation'
|
||||
import { EditBox, Grid } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
@ -29,7 +29,7 @@
|
||||
attachedTo: product,
|
||||
attachedToClass: inventory.class.Product,
|
||||
_class: inventory.class.Variant,
|
||||
space: inventory.space.Products,
|
||||
space: core.space.Workspace,
|
||||
_id: generateId(),
|
||||
collection: 'variants',
|
||||
modifiedOn: Date.now(),
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { AttachedDoc, Class, Doc, Ref, Space } from '@hcengineering/core'
|
||||
import { AttachedDoc, Class, Doc, Ref } from '@hcengineering/core'
|
||||
import type { Asset, Plugin } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
|
||||
@ -67,10 +67,6 @@ const inventory = plugin(inventoryId, {
|
||||
// Global category root, if not attached to some other object.
|
||||
Category: '' as Ref<Category>
|
||||
},
|
||||
space: {
|
||||
Category: '' as Ref<Space>,
|
||||
Products: '' as Ref<Space>
|
||||
},
|
||||
app: {
|
||||
Inventory: '' as Ref<Doc>
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Class, Data, Ref } from '@hcengineering/core'
|
||||
import core, { Class, Data, Ref } from '@hcengineering/core'
|
||||
import { translate } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Button, DropdownIntlItem } from '@hcengineering/ui'
|
||||
@ -64,7 +64,7 @@
|
||||
if (val._class === love.class.Office) {
|
||||
;(data as Data<Office>).person = null
|
||||
}
|
||||
await client.createDoc(val._class, love.space.Rooms, data)
|
||||
await client.createDoc(val._class, core.space.Workspace, data)
|
||||
dispatch('close')
|
||||
}
|
||||
</script>
|
||||
|
@ -3,7 +3,7 @@
|
||||
import { EditBox } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import love from '../plugin'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import core, { Ref } from '@hcengineering/core'
|
||||
import { Floor } from '@hcengineering/love'
|
||||
|
||||
export let id: Ref<Floor> | undefined = undefined
|
||||
@ -20,11 +20,11 @@
|
||||
}
|
||||
|
||||
async function createFloor (): Promise<void> {
|
||||
await client.createDoc(love.class.Floor, love.space.Rooms, { name })
|
||||
await client.createDoc(love.class.Floor, core.space.Workspace, { name })
|
||||
}
|
||||
async function updateFloor (): Promise<void> {
|
||||
if (id === undefined) return
|
||||
await client.updateDoc(love.class.Floor, love.space.Rooms, id, { name })
|
||||
await client.updateDoc(love.class.Floor, core.space.Workspace, id, { name })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import contact, { getName, type Person, type PersonAccount } from '@hcengineering/contact'
|
||||
import { concatLink, getCurrentAccount, type IdMap, type Ref, type Space } from '@hcengineering/core'
|
||||
import core, { concatLink, getCurrentAccount, type IdMap, type Ref, type Space } from '@hcengineering/core'
|
||||
import { getEmbeddedLabel, getMetadata, type IntlString } from '@hcengineering/platform'
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { getCurrentLocation, navigate, type DropdownTextItem } from '@hcengineering/ui'
|
||||
@ -483,7 +483,7 @@ async function moveToRoom (
|
||||
room: room._id
|
||||
})
|
||||
} else {
|
||||
await client.createDoc(love.class.ParticipantInfo, love.space.Rooms, {
|
||||
await client.createDoc(love.class.ParticipantInfo, core.space.Workspace, {
|
||||
x,
|
||||
y,
|
||||
room: room._id,
|
||||
@ -606,7 +606,7 @@ export async function tryConnect (
|
||||
await client.update(invite, { status: invite.room === room._id ? RequestStatus.Approved : RequestStatus.Rejected })
|
||||
}
|
||||
if (room.access === RoomAccess.Knock && (!isOffice(room) || room.person !== currentPerson._id)) {
|
||||
const _id = await client.createDoc(love.class.JoinRequest, love.space.Rooms, {
|
||||
const _id = await client.createDoc(love.class.JoinRequest, core.space.Workspace, {
|
||||
person: currentPerson._id,
|
||||
room: room._id,
|
||||
status: RequestStatus.Pending
|
||||
@ -630,7 +630,7 @@ export async function invite (person: Ref<Person>, room: Ref<Room> | undefined):
|
||||
if (room === undefined || room === love.ids.Reception) return
|
||||
const client = getClient()
|
||||
const me = getCurrentAccount()
|
||||
await client.createDoc(love.class.Invite, love.space.Rooms, {
|
||||
await client.createDoc(love.class.Invite, core.space.Workspace, {
|
||||
target: person,
|
||||
room,
|
||||
status: RequestStatus.Pending,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Person } from '@hcengineering/contact'
|
||||
import { Class, Doc, Ref, Space } from '@hcengineering/core'
|
||||
import { Class, Doc, Ref } from '@hcengineering/core'
|
||||
import { Drive } from '@hcengineering/drive'
|
||||
import { NotificationType } from '@hcengineering/notification'
|
||||
import { Asset, IntlString, Metadata, Plugin, plugin } from '@hcengineering/platform'
|
||||
@ -145,7 +145,6 @@ const love = plugin(loveId, {
|
||||
ServiceEnpdoint: '' as Metadata<string>
|
||||
},
|
||||
space: {
|
||||
Rooms: '' as Ref<Space>,
|
||||
Drive: '' as Ref<Drive>
|
||||
},
|
||||
component: {
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { IdMap, Ref, toIdMap } from '@hcengineering/core'
|
||||
import core, { IdMap, Ref, toIdMap } from '@hcengineering/core'
|
||||
import type {
|
||||
BaseNotificationType,
|
||||
NotificationGroup,
|
||||
@ -25,7 +25,6 @@
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Grid, Label, ToggleWithLabel } from '@hcengineering/ui'
|
||||
import notification from '../plugin'
|
||||
import { validateHeaderName } from 'http'
|
||||
|
||||
export let group: Ref<NotificationGroup>
|
||||
export let settings: Map<Ref<BaseNotificationType>, NotificationSetting[]>
|
||||
@ -74,7 +73,7 @@
|
||||
}
|
||||
const current = getSetting(settings, typeId, providerId)
|
||||
if (current === undefined) {
|
||||
await client.createDoc(notification.class.NotificationSetting, notification.space.Notifications, {
|
||||
await client.createDoc(notification.class.NotificationSetting, core.space.Workspace, {
|
||||
attachedTo: providerId,
|
||||
type: typeId,
|
||||
enabled: value
|
||||
|
@ -25,7 +25,7 @@ import {
|
||||
isReactionMessage,
|
||||
messageInFocus
|
||||
} from '@hcengineering/activity-resources'
|
||||
import {
|
||||
import core, {
|
||||
SortingOrder,
|
||||
getCurrentAccount,
|
||||
type Class,
|
||||
@ -713,7 +713,7 @@ export async function subscribePush (): Promise<boolean> {
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: publicKey
|
||||
})
|
||||
await client.createDoc(notification.class.PushSubscription, notification.space.Notifications, {
|
||||
await client.createDoc(notification.class.PushSubscription, core.space.Workspace, {
|
||||
user: getCurrentAccount()._id,
|
||||
endpoint: subscription.endpoint,
|
||||
keys: {
|
||||
@ -727,7 +727,7 @@ export async function subscribePush (): Promise<boolean> {
|
||||
endpoint: current.endpoint
|
||||
})
|
||||
if (exists === undefined) {
|
||||
await client.createDoc(notification.class.PushSubscription, notification.space.Notifications, {
|
||||
await client.createDoc(notification.class.PushSubscription, core.space.Workspace, {
|
||||
user: getCurrentAccount()._id,
|
||||
endpoint: current.endpoint,
|
||||
keys: {
|
||||
|
@ -24,7 +24,6 @@ import {
|
||||
Markup,
|
||||
Mixin,
|
||||
Ref,
|
||||
Space,
|
||||
Timestamp,
|
||||
Tx,
|
||||
TxOperations
|
||||
@ -380,9 +379,6 @@ const notification = plugin(notificationId, {
|
||||
Inbox: '' as Asset,
|
||||
BellCrossed: '' as Asset
|
||||
},
|
||||
space: {
|
||||
Notifications: '' as Ref<Space>
|
||||
},
|
||||
string: {
|
||||
Notification: '' as IntlString,
|
||||
Notifications: '' as IntlString,
|
||||
|
@ -49,9 +49,6 @@ const preference = plugin(preferenceId, {
|
||||
Preference: '' as Ref<Class<Preference>>,
|
||||
SpacePreference: '' as Ref<Class<SpacePreference>>
|
||||
},
|
||||
space: {
|
||||
Preference: '' as Ref<Space>
|
||||
},
|
||||
icon: {
|
||||
Star: '' as Asset
|
||||
},
|
||||
|
@ -24,7 +24,7 @@
|
||||
Person
|
||||
} from '@hcengineering/contact'
|
||||
import { ChannelsDropdown, EditableAvatar, PersonPresenter } from '@hcengineering/contact-resources'
|
||||
import {
|
||||
import core, {
|
||||
Account,
|
||||
AttachedData,
|
||||
Data,
|
||||
@ -418,7 +418,7 @@
|
||||
const category = findTagCategory(s, categories)
|
||||
const cinstance = categoriesMap.get(category)
|
||||
e = TxProcessor.createDoc2Doc(
|
||||
client.txFactory.createTxCreateDoc(tags.class.TagElement, tags.space.Tags, {
|
||||
client.txFactory.createTxCreateDoc(tags.class.TagElement, core.space.Workspace, {
|
||||
title,
|
||||
description: `Imported skill ${s} of ${cinstance?.label ?? ''}`,
|
||||
color: getColorNumberByText(s),
|
||||
@ -433,7 +433,7 @@
|
||||
if (e !== undefined) {
|
||||
newSkills.push(
|
||||
TxProcessor.createDoc2Doc(
|
||||
client.txFactory.createTxCreateDoc(tags.class.TagReference, tags.space.Tags, {
|
||||
client.txFactory.createTxCreateDoc(tags.class.TagReference, core.space.Workspace, {
|
||||
title: e.title,
|
||||
color: e.color,
|
||||
tag: e._id,
|
||||
@ -507,7 +507,7 @@
|
||||
attachedTo: '' as Ref<Doc>,
|
||||
attachedToClass: recruit.mixin.Candidate,
|
||||
collection: 'skills',
|
||||
space: tags.space.Tags,
|
||||
space: core.space.Workspace,
|
||||
modifiedOn: 0,
|
||||
modifiedBy: '' as Ref<Account>,
|
||||
title: tag.title,
|
||||
|
@ -16,7 +16,7 @@
|
||||
import calendar from '@hcengineering/calendar'
|
||||
import type { Contact, PersonAccount, Organization, Person } from '@hcengineering/contact'
|
||||
import contact from '@hcengineering/contact'
|
||||
import {
|
||||
import core, {
|
||||
Account,
|
||||
Class,
|
||||
Client,
|
||||
@ -68,7 +68,7 @@
|
||||
attachedTo: candidate,
|
||||
attachedToClass: recruit.mixin.Candidate,
|
||||
_class: recruit.class.Review,
|
||||
space: recruit.space.Reviews,
|
||||
space: core.space.Workspace,
|
||||
_id: generateId(),
|
||||
collection: 'reviews',
|
||||
modifiedOn: Date.now(),
|
||||
@ -129,7 +129,8 @@
|
||||
location,
|
||||
access: 'reader',
|
||||
allDay: false,
|
||||
eventId: ''
|
||||
eventId: '',
|
||||
calendar: undefined
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,11 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Attribute, Class, Doc, Mixin, Ref, Space, Status } from '@hcengineering/core'
|
||||
import type { Attribute, Class, Doc, Mixin, Ref, Status } from '@hcengineering/core'
|
||||
import type { Asset, IntlString, Plugin, Resource } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import type { ProjectTypeDescriptor, TaskType } from '@hcengineering/task'
|
||||
import { AnyComponent, ResolvedLocation } from '@hcengineering/ui'
|
||||
import { AnyComponent, Location, ResolvedLocation } from '@hcengineering/ui'
|
||||
import type { Applicant, ApplicantMatch, Candidate, Opinion, Review, Vacancy, VacancyList } from './types'
|
||||
|
||||
export * from './types'
|
||||
@ -84,9 +84,6 @@ const recruit = plugin(recruitId, {
|
||||
resolver: {
|
||||
Location: '' as Resource<(loc: Location) => Promise<ResolvedLocation | undefined>>
|
||||
},
|
||||
space: {
|
||||
Reviews: '' as Ref<Space>
|
||||
},
|
||||
taskTypes: {
|
||||
Applicant: '' as Ref<TaskType>
|
||||
}
|
||||
|
@ -13,10 +13,11 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import core from '@hcengineering/core'
|
||||
import login from '@hcengineering/login'
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import setting, { InviteSettings } from '@hcengineering/setting'
|
||||
import { Button, EditBox, MiniToggle, Header, Breadcrumb } from '@hcengineering/ui'
|
||||
import { Breadcrumb, Button, EditBox, Header, MiniToggle } from '@hcengineering/ui'
|
||||
|
||||
const client = getClient()
|
||||
let expTime: number = 48
|
||||
@ -43,11 +44,11 @@
|
||||
enabled: true
|
||||
}
|
||||
if (existingInviteSettings.length === 0) {
|
||||
await client.createDoc(setting.class.InviteSettings, setting.space.Setting, newSettings)
|
||||
await client.createDoc(setting.class.InviteSettings, core.space.Workspace, newSettings)
|
||||
} else {
|
||||
await client.updateDoc(
|
||||
setting.class.InviteSettings,
|
||||
setting.space.Setting,
|
||||
core.space.Workspace,
|
||||
existingInviteSettings[0]._id,
|
||||
newSettings
|
||||
)
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { getCurrentAccount } from '@hcengineering/core'
|
||||
import core, { getCurrentAccount } from '@hcengineering/core'
|
||||
import { getResource, translate } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import type { Integration, IntegrationType } from '@hcengineering/setting'
|
||||
@ -62,7 +62,7 @@
|
||||
return
|
||||
}
|
||||
if (integration === undefined) {
|
||||
const id = await client.createDoc(setting.class.Integration, setting.space.Setting, {
|
||||
const id = await client.createDoc(setting.class.Integration, core.space.Workspace, {
|
||||
type: integrationType._id,
|
||||
value: '',
|
||||
disabled: false
|
||||
|
@ -15,6 +15,7 @@
|
||||
<script lang="ts">
|
||||
import { AvatarType } from '@hcengineering/contact'
|
||||
import { EditableAvatar } from '@hcengineering/contact-resources'
|
||||
import core from '@hcengineering/core'
|
||||
import { getEmbeddedLabel } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { WorkspaceSetting } from '@hcengineering/setting'
|
||||
@ -35,7 +36,7 @@
|
||||
const avatar = await avatarEditor.createAvatar()
|
||||
await client.createDoc(
|
||||
setting.class.WorkspaceSetting,
|
||||
setting.space.Setting,
|
||||
core.space.Workspace,
|
||||
{ icon: avatar.avatar },
|
||||
setting.ids.WorkspaceSetting
|
||||
)
|
||||
|
@ -13,13 +13,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Account, AccountRole, Blob, Class, Configuration, Doc, Mixin, Ref, Space } from '@hcengineering/core'
|
||||
import type { Account, AccountRole, Blob, Class, Configuration, Doc, Mixin, Ref } from '@hcengineering/core'
|
||||
import type { Plugin } from '@hcengineering/platform'
|
||||
import { Asset, IntlString, plugin, Resource } from '@hcengineering/platform'
|
||||
import { Asset, IntlString, Resource, plugin } from '@hcengineering/platform'
|
||||
import { TemplateField, TemplateFieldCategory } from '@hcengineering/templates'
|
||||
import { AnyComponent } from '@hcengineering/ui'
|
||||
import { TemplateFieldCategory, TemplateField } from '@hcengineering/templates'
|
||||
|
||||
import { SpaceTypeEditor, SpaceTypeCreator } from './spaceTypeEditor'
|
||||
import { SpaceTypeCreator, SpaceTypeEditor } from './spaceTypeEditor'
|
||||
|
||||
export * from './spaceTypeEditor'
|
||||
export * from './utils'
|
||||
@ -137,9 +137,6 @@ export default plugin(settingId, {
|
||||
SpaceTypeEditor: '' as Ref<Mixin<SpaceTypeEditor>>,
|
||||
SpaceTypeCreator: '' as Ref<Mixin<SpaceTypeCreator>>
|
||||
},
|
||||
space: {
|
||||
Setting: '' as Ref<Space>
|
||||
},
|
||||
class: {
|
||||
SettingsCategory: '' as Ref<Class<SettingsCategory>>,
|
||||
WorkspaceSettingCategory: '' as Ref<Class<SettingsCategory>>,
|
||||
|
@ -1,6 +1,13 @@
|
||||
// Copyright © 2022 Hardcore Engineering Inc.
|
||||
|
||||
import { type Class, type Data, type Doc, type DocumentQuery, type FindResult, type Ref } from '@hcengineering/core'
|
||||
import core, {
|
||||
type Class,
|
||||
type Data,
|
||||
type Doc,
|
||||
type DocumentQuery,
|
||||
type FindResult,
|
||||
type Ref
|
||||
} from '@hcengineering/core'
|
||||
import { type Asset } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { type InitialKnowledge, type TagCategory, type TagElement, type TagReference } from '@hcengineering/tags'
|
||||
@ -81,5 +88,5 @@ export async function createTagElement (
|
||||
}
|
||||
|
||||
const client = getClient()
|
||||
return await client.createDoc<TagElement>(tags.class.TagElement, tags.space.Tags, tagElement)
|
||||
return await client.createDoc<TagElement>(tags.class.TagElement, core.space.Workspace, tagElement)
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { AttachedDoc, Class, Doc, Ref, Space } from '@hcengineering/core'
|
||||
import type { AttachedDoc, Class, Doc, Ref } from '@hcengineering/core'
|
||||
import type { Asset, IntlString, Plugin } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import { AnyComponent } from '@hcengineering/ui'
|
||||
@ -89,9 +89,6 @@ const tagsPlugin = plugin(tagsId, {
|
||||
TagReference: '' as Ref<Class<TagReference>>,
|
||||
TagCategory: '' as Ref<Class<TagCategory>>
|
||||
},
|
||||
space: {
|
||||
Tags: '' as Ref<Space>
|
||||
},
|
||||
icon: {
|
||||
Tags: '' as Asset,
|
||||
Level1: '' as Asset,
|
||||
|
@ -18,7 +18,7 @@
|
||||
import { AttachmentRefInput } from '@hcengineering/attachment-resources'
|
||||
import contact, { Channel, Contact, Person, PersonAccount, getName as getContactName } from '@hcengineering/contact'
|
||||
import { Avatar, personAccountByIdStore, personByIdStore } from '@hcengineering/contact-resources'
|
||||
import { IdMap, Ref, SortingOrder, generateId, getCurrentAccount } from '@hcengineering/core'
|
||||
import core, { IdMap, Ref, SortingOrder, generateId, getCurrentAccount } from '@hcengineering/core'
|
||||
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
||||
import { getEmbeddedLabel, getResource } from '@hcengineering/platform'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
@ -117,7 +117,7 @@
|
||||
const { message, attachments } = event.detail
|
||||
await client.addCollection(
|
||||
telegram.class.NewMessage,
|
||||
telegram.space.Telegram,
|
||||
core.space.Workspace,
|
||||
channel._id,
|
||||
channel._class,
|
||||
'newMessages',
|
||||
@ -173,7 +173,7 @@
|
||||
|
||||
async function onConnectClose (res: any): Promise<void> {
|
||||
if (res?.value) {
|
||||
await client.createDoc(setting.class.Integration, setting.space.Setting, {
|
||||
await client.createDoc(setting.class.Integration, core.space.Workspace, {
|
||||
type: telegram.integrationType.Telegram,
|
||||
value: res.value,
|
||||
disabled: false
|
||||
@ -295,7 +295,7 @@
|
||||
</div>
|
||||
{:else if integration !== undefined && !integration.disabled}
|
||||
<AttachmentRefInput
|
||||
space={telegram.space.Telegram}
|
||||
space={core.space.Workspace}
|
||||
_class={telegram.class.NewMessage}
|
||||
{objectId}
|
||||
on:message={onMessage}
|
||||
|
@ -14,7 +14,7 @@
|
||||
//
|
||||
|
||||
import { ChannelItem } from '@hcengineering/contact'
|
||||
import type { AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
|
||||
import type { AttachedDoc, Class, Doc, Ref, Timestamp } from '@hcengineering/core'
|
||||
import { NotificationType } from '@hcengineering/notification'
|
||||
import type { Plugin } from '@hcengineering/platform'
|
||||
import { Metadata, plugin } from '@hcengineering/platform'
|
||||
@ -86,10 +86,6 @@ export default plugin(telegramId, {
|
||||
SharedMessage: '' as Ref<Class<SharedTelegramMessage>>,
|
||||
SharedMessages: '' as Ref<Class<SharedTelegramMessages>>
|
||||
},
|
||||
space: {
|
||||
// todo should be removed
|
||||
Telegram: '' as Ref<Space>
|
||||
},
|
||||
templateField: {
|
||||
CurrentEmployeeTelegram: '' as Ref<TemplateField>,
|
||||
IntegrationOwnerTG: '' as Ref<TemplateField>
|
||||
|
@ -267,7 +267,7 @@
|
||||
attachedTo: '' as Ref<Doc>,
|
||||
attachedToClass: tracker.class.Issue,
|
||||
collection: 'labels',
|
||||
space: tags.space.Tags,
|
||||
space: core.space.Workspace,
|
||||
modifiedOn: 0,
|
||||
modifiedBy: '' as Ref<Account>,
|
||||
title: tag.title,
|
||||
|
@ -1,91 +0,0 @@
|
||||
<!--
|
||||
// Copyright © 2022 Anticrm Platform Contributors.
|
||||
//
|
||||
// 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 ui, { Label, Icon } from '@hcengineering/ui'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import { FilterAction } from '../utils'
|
||||
|
||||
export let actions: FilterAction[] = []
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const actionElements: HTMLButtonElement[] = []
|
||||
|
||||
const keyDown = (event: KeyboardEvent, index: number) => {
|
||||
if (event.key === 'ArrowDown') {
|
||||
actionElements[(index + 1) % actionElements.length].focus()
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowUp') {
|
||||
actionElements[(actionElements.length + index - 1) % actionElements.length].focus()
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
actionElements[0]?.focus()
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="antiPopup">
|
||||
<div class="ap-space" />
|
||||
<div class="ap-scroll">
|
||||
<div class="ap-box">
|
||||
{#if actions.length === 0}
|
||||
<div class="p-6 error-color">
|
||||
<Label label={ui.string.NoActionsDefined} />
|
||||
</div>
|
||||
{/if}
|
||||
{#each actions as action, i}
|
||||
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
||||
<button
|
||||
bind:this={actionElements[i]}
|
||||
class="ap-menuItem flex-row-center withIcon"
|
||||
on:keydown={(event) => {
|
||||
keyDown(event, i)
|
||||
}}
|
||||
on:mouseover={(event) => {
|
||||
event.currentTarget.focus()
|
||||
}}
|
||||
on:click={(event) => {
|
||||
dispatch('close')
|
||||
|
||||
action.onSelect(event)
|
||||
}}
|
||||
>
|
||||
{#if action.icon}
|
||||
<div class="icon"><Icon icon={action.icon} size={'small'} /></div>
|
||||
{/if}
|
||||
{#if action.label}
|
||||
<div class="ml-3 pr-1"><Label label={action.label} /></div>
|
||||
{/if}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ap-space" />
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.withIcon {
|
||||
margin: 0;
|
||||
|
||||
.icon {
|
||||
color: var(--content-color);
|
||||
}
|
||||
|
||||
&:focus .icon {
|
||||
color: var(--accent-color);
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,137 +0,0 @@
|
||||
<!--
|
||||
// Copyright © 2022 Anticrm Platform Contributors.
|
||||
//
|
||||
// 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 ui, { Label, Icon, CheckBox } from '@hcengineering/ui'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import { FilterSectionElement } from '../utils'
|
||||
|
||||
export let actions: FilterSectionElement[] = []
|
||||
export let onBack: (() => void) | undefined = undefined
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const actionElements: HTMLButtonElement[] = []
|
||||
|
||||
$: selectedElementsMap = getSelectedElementsMap(actions)
|
||||
|
||||
const getSelectedElementsMap = (actions: FilterSectionElement[]) => {
|
||||
const result: Record<number, boolean> = {}
|
||||
|
||||
for (let i = onBack ? 1 : 0; i < actions.length; ++i) {
|
||||
result[i] = !!actions[i].isSelected
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
const keyDown = (event: KeyboardEvent, index: number) => {
|
||||
if (event.key === 'ArrowDown') {
|
||||
actionElements[(index + 1) % actionElements.length].focus()
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowUp') {
|
||||
actionElements[(actionElements.length + index - 1) % actionElements.length].focus()
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowLeft') {
|
||||
dispatch('close')
|
||||
|
||||
onBack?.()
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (actionElements[0]) actionElements[0].focus()
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="antiPopup">
|
||||
<div class="ap-space" />
|
||||
<div class="ap-scroll">
|
||||
<div class="ap-box">
|
||||
{#if actions.length === 0}
|
||||
<div class="p-6 error-color">
|
||||
<Label label={ui.string.NoActionsDefined} />
|
||||
</div>
|
||||
{/if}
|
||||
{#each actions as action, i}
|
||||
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
||||
<button
|
||||
bind:this={actionElements[i]}
|
||||
class="ap-menuItem flex-row-center withIcon"
|
||||
on:keydown={(event) => {
|
||||
keyDown(event, i)
|
||||
}}
|
||||
on:mouseover={(event) => {
|
||||
event.currentTarget.focus()
|
||||
}}
|
||||
on:click={(event) => {
|
||||
if (i === 0 && onBack) {
|
||||
dispatch('close')
|
||||
}
|
||||
|
||||
action.onSelect(event)
|
||||
|
||||
if (i !== 0 || !onBack) {
|
||||
selectedElementsMap[i] = !selectedElementsMap[i]
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="buttonContent">
|
||||
{#if i !== 0 || (i === 0 && !onBack)}
|
||||
<div class="flex check pointer-events-none">
|
||||
<CheckBox checked={selectedElementsMap[i]} kind={'primary'} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if action.icon}
|
||||
<div class="icon" class:ml-3={i > 0 || (i === 0 && !onBack)}>
|
||||
<Icon icon={action.icon} size={'small'} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if action.title}
|
||||
<div class="ml-3 pr-1">{action.title}</div>
|
||||
{/if}
|
||||
{#if action.count !== undefined}
|
||||
<div class="pr-1 countContent">{action.count}</div>
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ap-space" />
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.buttonContent {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.countContent {
|
||||
color: var(--content-color);
|
||||
}
|
||||
|
||||
.withIcon {
|
||||
margin: 0;
|
||||
|
||||
.icon {
|
||||
color: var(--content-color);
|
||||
}
|
||||
|
||||
&:focus .icon {
|
||||
color: var(--accent-color);
|
||||
}
|
||||
}
|
||||
</style>
|
@ -14,7 +14,7 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { AttachmentStyledBox } from '@hcengineering/attachment-resources'
|
||||
import { Account, Doc, generateId, Ref } from '@hcengineering/core'
|
||||
import core, { Account, Doc, generateId, Ref } from '@hcengineering/core'
|
||||
import presentation, { DraftController, getClient, KeyedAttribute } from '@hcengineering/presentation'
|
||||
import tags, { TagElement, TagReference } from '@hcengineering/tags'
|
||||
import { TaskType } from '@hcengineering/task'
|
||||
@ -135,7 +135,7 @@
|
||||
attachedTo: '' as Ref<Doc>,
|
||||
attachedToClass: tracker.class.Issue,
|
||||
collection: 'labels',
|
||||
space: tags.space.Tags,
|
||||
space: core.space.Workspace,
|
||||
modifiedOn: 0,
|
||||
modifiedBy: '' as Ref<Account>,
|
||||
title: tag.title,
|
||||
|
@ -35,15 +35,12 @@ import core, {
|
||||
type TxResult,
|
||||
type TxUpdateDoc
|
||||
} from '@hcengineering/core'
|
||||
import { type Asset, type IntlString } from '@hcengineering/platform'
|
||||
import { type IntlString } from '@hcengineering/platform'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import task, { getStatusIndex, makeRank, type ProjectType } from '@hcengineering/task'
|
||||
import { activeProjects as taskActiveProjects, taskTypeStore } from '@hcengineering/task-resources'
|
||||
import {
|
||||
IssuePriority,
|
||||
IssuesDateModificationPeriod,
|
||||
IssuesGrouping,
|
||||
IssuesOrdering,
|
||||
MilestoneStatus,
|
||||
TimeReportDayType,
|
||||
type Component,
|
||||
@ -52,23 +49,9 @@ import {
|
||||
type Milestone,
|
||||
type Project
|
||||
} from '@hcengineering/tracker'
|
||||
import {
|
||||
MILLISECONDS_IN_WEEK,
|
||||
PaletteColorIndexes,
|
||||
areDatesEqual,
|
||||
getMillisecondsInMonth,
|
||||
isWeekend,
|
||||
type AnyComponent,
|
||||
type AnySvelteComponent
|
||||
} from '@hcengineering/ui'
|
||||
import { PaletteColorIndexes, areDatesEqual, isWeekend } from '@hcengineering/ui'
|
||||
import { type KeyFilter, type ViewletDescriptor } from '@hcengineering/view'
|
||||
import {
|
||||
CategoryQuery,
|
||||
ListSelectionProvider,
|
||||
groupBy,
|
||||
statusStore,
|
||||
type SelectDirection
|
||||
} from '@hcengineering/view-resources'
|
||||
import { CategoryQuery, ListSelectionProvider, statusStore, type SelectDirection } from '@hcengineering/view-resources'
|
||||
import { derived, get } from 'svelte/store'
|
||||
import tracker from './plugin'
|
||||
import { defaultMilestoneStatuses, defaultPriorities } from './types'
|
||||
@ -81,164 +64,6 @@ export const activeProjects = derived(taskActiveProjects, (projects) => {
|
||||
})
|
||||
export * from './types'
|
||||
|
||||
export const UNSET_COLOR = -1
|
||||
|
||||
export interface NavigationItem {
|
||||
id: string
|
||||
label: IntlString
|
||||
icon: Asset
|
||||
component: AnyComponent
|
||||
componentProps?: Record<string, string>
|
||||
top: boolean
|
||||
}
|
||||
|
||||
export interface Selection {
|
||||
currentProject?: Ref<Project>
|
||||
currentSpecial?: string
|
||||
}
|
||||
|
||||
export type IssuesGroupByKeys = keyof Pick<Issue, 'status' | 'priority' | 'assignee' | 'component' | 'milestone'>
|
||||
export type IssuesOrderByKeys = keyof Pick<Issue, 'status' | 'priority' | 'modifiedOn' | 'dueDate' | 'rank'>
|
||||
|
||||
export const issuesGroupKeyMap: Record<IssuesGrouping, IssuesGroupByKeys | undefined> = {
|
||||
[IssuesGrouping.Status]: 'status',
|
||||
[IssuesGrouping.Priority]: 'priority',
|
||||
[IssuesGrouping.Assignee]: 'assignee',
|
||||
[IssuesGrouping.Component]: 'component',
|
||||
[IssuesGrouping.Milestone]: 'milestone',
|
||||
[IssuesGrouping.NoGrouping]: undefined
|
||||
}
|
||||
|
||||
export const issuesOrderKeyMap: Record<IssuesOrdering, IssuesOrderByKeys> = {
|
||||
[IssuesOrdering.Status]: 'status',
|
||||
[IssuesOrdering.Priority]: 'priority',
|
||||
[IssuesOrdering.LastUpdated]: 'modifiedOn',
|
||||
[IssuesOrdering.DueDate]: 'dueDate',
|
||||
[IssuesOrdering.Manual]: 'rank'
|
||||
}
|
||||
|
||||
export const issuesGroupEditorMap: Record<'status' | 'priority' | 'component' | 'milestone', AnyComponent | undefined> =
|
||||
{
|
||||
status: tracker.component.StatusEditor,
|
||||
priority: tracker.component.PriorityEditor,
|
||||
component: tracker.component.ComponentEditor,
|
||||
milestone: tracker.component.MilestoneEditor
|
||||
}
|
||||
|
||||
export const getIssuesModificationDatePeriodTime = (period: IssuesDateModificationPeriod | null): number => {
|
||||
const today = new Date(Date.now())
|
||||
|
||||
switch (period) {
|
||||
case IssuesDateModificationPeriod.PastWeek: {
|
||||
return today.getTime() - MILLISECONDS_IN_WEEK
|
||||
}
|
||||
case IssuesDateModificationPeriod.PastMonth: {
|
||||
return today.getTime() - getMillisecondsInMonth(today)
|
||||
}
|
||||
default: {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface FilterAction {
|
||||
icon?: Asset | AnySvelteComponent
|
||||
label?: IntlString
|
||||
onSelect: (event: MouseEvent | KeyboardEvent) => void
|
||||
}
|
||||
|
||||
export interface FilterSectionElement extends Omit<FilterAction, 'label'> {
|
||||
title?: string
|
||||
count?: number
|
||||
isSelected?: boolean
|
||||
}
|
||||
|
||||
export interface IssueFilter {
|
||||
mode: '$in' | '$nin'
|
||||
query: DocumentQuery<Issue>
|
||||
}
|
||||
|
||||
export const getGroupedIssues = (
|
||||
key: IssuesGroupByKeys | undefined,
|
||||
elements: Issue[],
|
||||
orderedCategories?: any[]
|
||||
): Record<string, Issue[]> => {
|
||||
if (key === undefined) {
|
||||
return { [undefined as any]: elements }
|
||||
}
|
||||
|
||||
const unorderedIssues = groupBy(elements, key)
|
||||
|
||||
if (orderedCategories === undefined || orderedCategories.length === 0) {
|
||||
return unorderedIssues
|
||||
}
|
||||
|
||||
return Object.keys(unorderedIssues)
|
||||
.sort((o1, o2) => {
|
||||
const key1 = o1 === 'null' ? null : o1
|
||||
const key2 = o2 === 'null' ? null : o2
|
||||
|
||||
const i1 = orderedCategories.findIndex((x) => x === key1)
|
||||
const i2 = orderedCategories.findIndex((x) => x === key2)
|
||||
|
||||
return i1 - i2
|
||||
})
|
||||
.reduce((obj: Record<string, any[]>, objKey) => {
|
||||
obj[objKey] = unorderedIssues[objKey]
|
||||
return obj
|
||||
}, {})
|
||||
}
|
||||
|
||||
export const getIssueFilterAssetsByType = (type: string): { icon: Asset, label: IntlString } | undefined => {
|
||||
switch (type) {
|
||||
case 'status': {
|
||||
return {
|
||||
icon: tracker.icon.CategoryBacklog,
|
||||
label: tracker.string.Status
|
||||
}
|
||||
}
|
||||
case 'priority': {
|
||||
return {
|
||||
icon: tracker.icon.PriorityHigh,
|
||||
label: tracker.string.Priority
|
||||
}
|
||||
}
|
||||
case 'component': {
|
||||
return {
|
||||
icon: tracker.icon.Component,
|
||||
label: tracker.string.Component
|
||||
}
|
||||
}
|
||||
case 'milestone': {
|
||||
return {
|
||||
icon: tracker.icon.Milestone,
|
||||
label: tracker.string.Milestone
|
||||
}
|
||||
}
|
||||
default: {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const getArraysIntersection = (a: any[], b: any[]): any[] => {
|
||||
const setB = new Set(b)
|
||||
const intersection = new Set(a.filter((x) => setB.has(x)))
|
||||
|
||||
return Array.from(intersection)
|
||||
}
|
||||
|
||||
export const getArraysUnion = (a: any[], b: any[]): any[] => {
|
||||
const setB = new Set(b)
|
||||
const union = new Set(a)
|
||||
|
||||
for (const element of setB) {
|
||||
union.add(element)
|
||||
}
|
||||
|
||||
return Array.from(union)
|
||||
}
|
||||
|
||||
export type ComponentsFilterMode = 'all' | 'backlog' | 'active' | 'closed'
|
||||
|
||||
export type MilestoneViewMode = 'all' | 'planned' | 'active' | 'closed'
|
||||
|
@ -13,18 +13,17 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import core, { AnyAttribute, ArrOf, Class, Doc, Ref, Type } from '@hcengineering/core'
|
||||
import core, { AnyAttribute, Class, Doc, Ref, Type } from '@hcengineering/core'
|
||||
import { Asset, IntlString } from '@hcengineering/platform'
|
||||
import preferencePlugin from '@hcengineering/preference'
|
||||
import { createQuery, getAttributePresenterClass, getClient, hasResource } from '@hcengineering/presentation'
|
||||
import { Loading, resizeObserver } from '@hcengineering/ui'
|
||||
import DropdownLabelsIntl from '@hcengineering/ui/src/components/DropdownLabelsIntl.svelte'
|
||||
import { BuildModelKey, Viewlet, ViewletPreference } from '@hcengineering/view'
|
||||
import { deepEqual } from 'fast-equals'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import view from '../plugin'
|
||||
import { buildConfigLookup, getKeyLabel } from '../utils'
|
||||
import ViewletClassSettings from './ViewletClassSettings.svelte'
|
||||
import DropdownLabelsIntl from '@hcengineering/ui/src/components/DropdownLabelsIntl.svelte'
|
||||
|
||||
export let viewlet: Viewlet
|
||||
|
||||
@ -273,7 +272,7 @@
|
||||
config
|
||||
})
|
||||
} else {
|
||||
await client.createDoc(view.class.ViewletPreference, preferencePlugin.space.Preference, {
|
||||
await client.createDoc(view.class.ViewletPreference, core.space.Workspace, {
|
||||
attachedTo: viewletId,
|
||||
config
|
||||
})
|
||||
|
@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Class, Doc, Ref, getCurrentAccount } from '@hcengineering/core'
|
||||
import preference from '@hcengineering/preference'
|
||||
import core, { Class, Doc, Ref, getCurrentAccount } from '@hcengineering/core'
|
||||
import { Card, getClient } from '@hcengineering/presentation'
|
||||
import { Button, EditBox, ToggleWithLabel, getCurrentResolvedLocation } from '@hcengineering/ui'
|
||||
import { ViewOptions } from '@hcengineering/view'
|
||||
@ -22,7 +21,7 @@
|
||||
const loc = getCurrentResolvedLocation()
|
||||
loc.fragment = undefined
|
||||
const filters = JSON.stringify($filterStore)
|
||||
await client.createDoc(view.class.FilteredView, preference.space.Preference, {
|
||||
await client.createDoc(view.class.FilteredView, core.space.Workspace, {
|
||||
name: filterName,
|
||||
location: loc,
|
||||
filterClass: _class,
|
||||
|
@ -13,13 +13,12 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { getCurrentAccount, type Ref } from '@hcengineering/core'
|
||||
import core, { getCurrentAccount, type Ref } from '@hcengineering/core'
|
||||
import type { Application } from '@hcengineering/workbench'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import workbench from '@hcengineering/workbench'
|
||||
import { hideApplication, isAppAllowed, showApplication } from '../utils'
|
||||
import { Loading, IconCheck, Label, Icon } from '@hcengineering/ui'
|
||||
import preference from '@hcengineering/preference'
|
||||
// import Drag from './icons/Drag.svelte'
|
||||
|
||||
export let apps: Application[] = []
|
||||
@ -59,7 +58,7 @@
|
||||
hiddenAppsIdsQuery.query(
|
||||
workbench.class.HiddenApplication,
|
||||
{
|
||||
space: preference.space.Preference
|
||||
space: core.space.Workspace
|
||||
},
|
||||
(res) => {
|
||||
hiddenAppsIds = res.map((r) => r.attachedTo)
|
||||
|
@ -13,14 +13,13 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { getCurrentAccount, type Ref } from '@hcengineering/core'
|
||||
import core, { getCurrentAccount, type Ref } from '@hcengineering/core'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Scroller } from '@hcengineering/ui'
|
||||
import { NavLink } from '@hcengineering/view-resources'
|
||||
import type { Application } from '@hcengineering/workbench'
|
||||
import workbench from '@hcengineering/workbench'
|
||||
|
||||
import preference from '@hcengineering/preference'
|
||||
import { isAppAllowed } from '../utils'
|
||||
import AppItem from './AppItem.svelte'
|
||||
|
||||
@ -34,7 +33,7 @@
|
||||
hiddenAppsIdsQuery.query(
|
||||
workbench.class.HiddenApplication,
|
||||
{
|
||||
space: preference.space.Preference
|
||||
space: core.space.Workspace
|
||||
},
|
||||
(res) => {
|
||||
hiddenAppsIds = res.map((r) => r.attachedTo)
|
||||
|
@ -14,8 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { Doc, Ref, Space } from '@hcengineering/core'
|
||||
import { AccountRole, getCurrentAccount, hasAccountRole } from '@hcengineering/core'
|
||||
import core, { Doc, Ref, Space, AccountRole, getCurrentAccount, hasAccountRole } from '@hcengineering/core'
|
||||
import { IntlString, getResource } from '@hcengineering/platform'
|
||||
import preference from '@hcengineering/preference'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
@ -75,7 +74,7 @@
|
||||
label: preference.string.Star,
|
||||
icon: preference.icon.Star,
|
||||
action: async (_id: Ref<Space>): Promise<void> => {
|
||||
await client.createDoc(preference.class.SpacePreference, preference.space.Preference, {
|
||||
await client.createDoc(preference.class.SpacePreference, core.space.Workspace, {
|
||||
attachedTo: _id
|
||||
})
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import core, { hasAccountRole } from '@hcengineering/core'
|
||||
import type { Workspace } from '@hcengineering/login'
|
||||
import login, { loginId } from '@hcengineering/login'
|
||||
import { getResource, setMetadata } from '@hcengineering/platform'
|
||||
import preference from '@hcengineering/preference'
|
||||
import { closeClient, getClient } from '@hcengineering/presentation'
|
||||
import presentation from '@hcengineering/presentation/src/plugin'
|
||||
import {
|
||||
@ -141,7 +140,7 @@ export function isAppAllowed (app: Application, acc: Account): boolean {
|
||||
export async function hideApplication (app: Application): Promise<void> {
|
||||
const client = getClient()
|
||||
|
||||
await client.createDoc(workbench.class.HiddenApplication, preference.space.Preference, {
|
||||
await client.createDoc(workbench.class.HiddenApplication, core.space.Workspace, {
|
||||
attachedTo: app._id
|
||||
})
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import {
|
||||
import core, {
|
||||
Branding,
|
||||
Doc,
|
||||
Hierarchy,
|
||||
@ -85,7 +85,7 @@ export async function getPublicLink (
|
||||
const fragment = getDocFragment(doc, client)
|
||||
await client.createDoc(
|
||||
guest.class.PublicLink,
|
||||
guest.space.Links,
|
||||
core.space.Workspace,
|
||||
{
|
||||
attachedTo: doc._id,
|
||||
location: {
|
||||
|
@ -100,13 +100,13 @@ function getTxes (
|
||||
removed?: Ref<Department>[]
|
||||
): Tx[] {
|
||||
const pushTxes = added.map((dep) =>
|
||||
factory.createTxUpdateDoc(hr.class.Department, hr.space.HR, dep, {
|
||||
factory.createTxUpdateDoc(hr.class.Department, core.space.Workspace, dep, {
|
||||
$push: { members: account }
|
||||
})
|
||||
)
|
||||
if (removed === undefined) return pushTxes
|
||||
const pullTxes = removed.map((dep) =>
|
||||
factory.createTxUpdateDoc(hr.class.Department, hr.space.HR, dep, {
|
||||
factory.createTxUpdateDoc(hr.class.Department, core.space.Workspace, dep, {
|
||||
$pull: { members: account }
|
||||
})
|
||||
)
|
||||
|
@ -80,7 +80,7 @@ async function createUserInfo (acc: Ref<Account>, control: TriggerControl): Prom
|
||||
|
||||
const person = (await control.findAll(contact.class.Person, { _id: personId }))[0]
|
||||
const room = (await control.findAll(love.class.Office, { person: personId }))[0]
|
||||
const tx = control.txFactory.createTxCreateDoc(love.class.ParticipantInfo, love.space.Rooms, {
|
||||
const tx = control.txFactory.createTxCreateDoc(love.class.ParticipantInfo, core.space.Workspace, {
|
||||
person: personId,
|
||||
name: person !== undefined ? getName(control.hierarchy, person, control.branding?.lastNameFirst) : account.email,
|
||||
room: room?._id ?? love.ids.Reception,
|
||||
@ -88,7 +88,7 @@ async function createUserInfo (acc: Ref<Account>, control: TriggerControl): Prom
|
||||
y: 0
|
||||
})
|
||||
const ptx = control.txFactory.createTxApplyIf(
|
||||
love.space.Rooms,
|
||||
core.space.Workspace,
|
||||
personId,
|
||||
[],
|
||||
[
|
||||
@ -149,7 +149,7 @@ async function roomJoinHandler (info: ParticipantInfo, control: TriggerControl,
|
||||
if (roomInfo !== undefined) {
|
||||
roomInfo.persons.push(info.person)
|
||||
return [
|
||||
control.txFactory.createTxUpdateDoc(love.class.RoomInfo, love.space.Rooms, roomInfo._id, {
|
||||
control.txFactory.createTxUpdateDoc(love.class.RoomInfo, core.space.Workspace, roomInfo._id, {
|
||||
persons: Array.from(new Set([...roomInfo.persons, info.person]))
|
||||
})
|
||||
]
|
||||
@ -157,7 +157,7 @@ async function roomJoinHandler (info: ParticipantInfo, control: TriggerControl,
|
||||
const room = (await control.findAll(love.class.Room, { _id: info.room }))[0]
|
||||
if (room === undefined) return []
|
||||
return [
|
||||
control.txFactory.createTxCreateDoc(love.class.RoomInfo, love.space.Rooms, {
|
||||
control.txFactory.createTxCreateDoc(love.class.RoomInfo, core.space.Workspace, {
|
||||
persons: [info.person],
|
||||
room: info.room,
|
||||
isOffice: isOffice(room)
|
||||
@ -182,7 +182,7 @@ async function rejectJoinRequests (
|
||||
})
|
||||
for (const request of requests) {
|
||||
res.push(
|
||||
control.txFactory.createTxUpdateDoc(love.class.JoinRequest, love.space.Rooms, request._id, {
|
||||
control.txFactory.createTxUpdateDoc(love.class.JoinRequest, core.space.Workspace, request._id, {
|
||||
status: RequestStatus.Rejected
|
||||
})
|
||||
)
|
||||
@ -198,14 +198,14 @@ function setDefaultRoomAccess (info: ParticipantInfo, roomInfos: RoomInfo[], con
|
||||
if (oldRoomInfo !== undefined) {
|
||||
oldRoomInfo.persons = oldRoomInfo.persons.filter((p) => p !== info.person)
|
||||
res.push(
|
||||
control.txFactory.createTxUpdateDoc(love.class.RoomInfo, love.space.Rooms, oldRoomInfo._id, {
|
||||
control.txFactory.createTxUpdateDoc(love.class.RoomInfo, core.space.Workspace, oldRoomInfo._id, {
|
||||
persons: oldRoomInfo.persons
|
||||
})
|
||||
)
|
||||
if (oldRoomInfo.persons.length === 0) {
|
||||
const resetAccessTx = control.txFactory.createTxUpdateDoc(
|
||||
oldRoomInfo.isOffice ? love.class.Office : love.class.Room,
|
||||
love.space.Rooms,
|
||||
core.space.Workspace,
|
||||
oldRoomInfo.room,
|
||||
{
|
||||
access: oldRoomInfo.isOffice ? RoomAccess.Knock : RoomAccess.Open
|
||||
|
@ -575,7 +575,7 @@ export async function createPushFromInbox (
|
||||
|
||||
const path = [workbenchId, control.workspace.workspaceUrl, notificationId, encodeObjectURI(id, attachedToClass)]
|
||||
await createPushNotification(control, targetUser, title, body, _id, senderPerson, path)
|
||||
return control.txFactory.createTxCreateDoc(notification.class.BrowserNotification, notification.space.Notifications, {
|
||||
return control.txFactory.createTxCreateDoc(notification.class.BrowserNotification, core.space.Workspace, {
|
||||
user: targetUser,
|
||||
status: NotificationStatus.New,
|
||||
title,
|
||||
|
@ -57,7 +57,7 @@ export async function onTagReference (tx: Tx, control: TriggerControl): Promise<
|
||||
if (!control.hierarchy.isDerived((actualTx as TxCUD<Doc>).objectClass, tags.class.TagReference)) return []
|
||||
if (isCreate) {
|
||||
const doc = TxProcessor.createDoc2Doc(actualTx as TxCreateDoc<TagReference>)
|
||||
const res = control.txFactory.createTxUpdateDoc(tags.class.TagElement, tags.space.Tags, doc.tag, {
|
||||
const res = control.txFactory.createTxUpdateDoc(tags.class.TagElement, core.space.Workspace, doc.tag, {
|
||||
$inc: { refCount: 1 }
|
||||
})
|
||||
return [res]
|
||||
@ -67,7 +67,7 @@ export async function onTagReference (tx: Tx, control: TriggerControl): Promise<
|
||||
const doc = control.removedMap.get(ctx.objectId) as TagReference
|
||||
if (doc !== undefined) {
|
||||
if (!control.removedMap.has(doc.tag)) {
|
||||
const res = control.txFactory.createTxUpdateDoc(tags.class.TagElement, tags.space.Tags, doc.tag, {
|
||||
const res = control.txFactory.createTxUpdateDoc(tags.class.TagElement, core.space.Workspace, doc.tag, {
|
||||
$inc: { refCount: -1 }
|
||||
})
|
||||
return [res]
|
||||
|
@ -70,6 +70,7 @@ export class SpaceSecurityMiddleware extends BaseMiddleware implements Middlewar
|
||||
core.space.DerivedTx,
|
||||
core.space.Model,
|
||||
core.space.Space,
|
||||
core.space.Workspace,
|
||||
core.space.Tx
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user