mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 07:10:02 +00:00
UBERF-9032: Fix proper query initializers (#7563)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
2d64f89584
commit
4214ace603
@ -21,6 +21,7 @@ import core, {
|
|||||||
TxProcessor,
|
TxProcessor,
|
||||||
getCurrentAccount,
|
getCurrentAccount,
|
||||||
reduceCalls,
|
reduceCalls,
|
||||||
|
type Account,
|
||||||
type AnyAttribute,
|
type AnyAttribute,
|
||||||
type ArrOf,
|
type ArrOf,
|
||||||
type AttachedDoc,
|
type AttachedDoc,
|
||||||
@ -253,6 +254,18 @@ export function getClient (): TxOperations & Client {
|
|||||||
return clientProxy
|
return clientProxy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type OnClientListener = (client: Client, account: Account) => void
|
||||||
|
const onClientListeners: OnClientListener[] = []
|
||||||
|
|
||||||
|
export function onClient (l: OnClientListener): void {
|
||||||
|
onClientListeners.push(l)
|
||||||
|
if (client !== undefined) {
|
||||||
|
setTimeout(() => {
|
||||||
|
l(client, getCurrentAccount())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let txQueue: Tx[] = []
|
let txQueue: Tx[] = []
|
||||||
|
|
||||||
export type RefreshListener = () => void
|
export type RefreshListener = () => void
|
||||||
@ -306,6 +319,10 @@ export async function setClient (_client: Client): Promise<void> {
|
|||||||
if (needRefresh || globalQueries.length > 0) {
|
if (needRefresh || globalQueries.length > 0) {
|
||||||
await refreshClient(true)
|
await refreshClient(true)
|
||||||
}
|
}
|
||||||
|
const acc = getCurrentAccount()
|
||||||
|
onClientListeners.forEach((l) => {
|
||||||
|
l(_client, acc)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
|
@ -14,18 +14,15 @@
|
|||||||
//
|
//
|
||||||
import activity, { type ActivityMessage, type SavedMessage } from '@hcengineering/activity'
|
import activity, { type ActivityMessage, type SavedMessage } from '@hcengineering/activity'
|
||||||
import core, { type Ref, SortingOrder, type WithLookup } from '@hcengineering/core'
|
import core, { type Ref, SortingOrder, type WithLookup } from '@hcengineering/core'
|
||||||
|
import { createQuery, onClient } from '@hcengineering/presentation'
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
|
||||||
|
|
||||||
export const savedMessagesStore = writable<Array<WithLookup<SavedMessage>>>([])
|
export const savedMessagesStore = writable<Array<WithLookup<SavedMessage>>>([])
|
||||||
export const messageInFocus = writable<Ref<ActivityMessage> | undefined>(undefined)
|
export const messageInFocus = writable<Ref<ActivityMessage> | undefined>(undefined)
|
||||||
|
|
||||||
const savedMessagesQuery = createQuery(true)
|
const savedMessagesQuery = createQuery(true)
|
||||||
|
|
||||||
export function loadSavedMessages (): void {
|
onClient(() => {
|
||||||
const client = getClient()
|
|
||||||
|
|
||||||
if (client !== undefined) {
|
|
||||||
savedMessagesQuery.query(
|
savedMessagesQuery.query(
|
||||||
activity.class.SavedMessage,
|
activity.class.SavedMessage,
|
||||||
{ space: core.space.Workspace },
|
{ space: core.space.Workspace },
|
||||||
@ -34,11 +31,4 @@ export function loadSavedMessages (): void {
|
|||||||
},
|
},
|
||||||
{ lookup: { attachedTo: activity.class.ActivityMessage }, sort: { modifiedOn: SortingOrder.Descending } }
|
{ lookup: { attachedTo: activity.class.ActivityMessage }, sort: { modifiedOn: SortingOrder.Descending } }
|
||||||
)
|
)
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
loadSavedMessages()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loadSavedMessages()
|
|
||||||
|
@ -5,12 +5,12 @@ import {
|
|||||||
type ReccuringInstance,
|
type ReccuringInstance,
|
||||||
generateEventId
|
generateEventId
|
||||||
} from '@hcengineering/calendar'
|
} from '@hcengineering/calendar'
|
||||||
import { type IdMap, type Timestamp, getCurrentAccount, toIdMap, type DocumentUpdate } from '@hcengineering/core'
|
import { type DocumentUpdate, type IdMap, type Timestamp, getCurrentAccount, toIdMap } from '@hcengineering/core'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient, onClient } from '@hcengineering/presentation'
|
||||||
import { showPopup, closePopup, DAY } from '@hcengineering/ui'
|
import { closePopup, DAY, showPopup } from '@hcengineering/ui'
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
import calendar from './plugin'
|
|
||||||
import UpdateRecInstancePopup from './components/UpdateRecInstancePopup.svelte'
|
import UpdateRecInstancePopup from './components/UpdateRecInstancePopup.svelte'
|
||||||
|
import calendar from './plugin'
|
||||||
|
|
||||||
export function saveUTC (date: Timestamp): Timestamp {
|
export function saveUTC (date: Timestamp): Timestamp {
|
||||||
const utcdate = new Date(date)
|
const utcdate = new Date(date)
|
||||||
@ -74,24 +74,14 @@ export const calendarByIdStore = writable<IdMap<Calendar>>(new Map())
|
|||||||
export const calendarStore = writable<Calendar[]>([])
|
export const calendarStore = writable<Calendar[]>([])
|
||||||
export const visibleCalendarStore = writable<Calendar[]>([])
|
export const visibleCalendarStore = writable<Calendar[]>([])
|
||||||
|
|
||||||
function fillStores (): void {
|
const query = createQuery(true)
|
||||||
const client = getClient()
|
onClient((client, account) => {
|
||||||
|
|
||||||
if (client !== undefined) {
|
|
||||||
const query = createQuery(true)
|
|
||||||
query.query(calendar.class.Calendar, {}, (res) => {
|
query.query(calendar.class.Calendar, {}, (res) => {
|
||||||
calendarStore.set(res)
|
calendarStore.set(res)
|
||||||
visibleCalendarStore.set(res.filter((p) => !p.hidden))
|
visibleCalendarStore.set(res.filter((p) => !p.hidden))
|
||||||
calendarByIdStore.set(toIdMap(res))
|
calendarByIdStore.set(toIdMap(res))
|
||||||
})
|
})
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
fillStores()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fillStores()
|
|
||||||
|
|
||||||
export async function updatePast (ops: DocumentUpdate<Event>, object: ReccuringInstance): Promise<void> {
|
export async function updatePast (ops: DocumentUpdate<Event>, object: ReccuringInstance): Promise<void> {
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
|
@ -28,7 +28,7 @@ import core, {
|
|||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import notification, { type DocNotifyContext } from '@hcengineering/notification'
|
import notification, { type DocNotifyContext } from '@hcengineering/notification'
|
||||||
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
||||||
import { createQuery, getClient, MessageBox } from '@hcengineering/presentation'
|
import { createQuery, getClient, MessageBox, onClient } from '@hcengineering/presentation'
|
||||||
import { type Action, showPopup } from '@hcengineering/ui'
|
import { type Action, showPopup } from '@hcengineering/ui'
|
||||||
import view from '@hcengineering/view'
|
import view from '@hcengineering/view'
|
||||||
import workbench, { type SpecialNavModel } from '@hcengineering/workbench'
|
import workbench, { type SpecialNavModel } from '@hcengineering/workbench'
|
||||||
@ -364,12 +364,9 @@ function archiveActivityChannels (contexts: DocNotifyContext[]): void {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const savedAttachmentsQuery = createQuery(true)
|
||||||
export function loadSavedAttachments (): void {
|
export function loadSavedAttachments (): void {
|
||||||
const client = getClient()
|
onClient(() => {
|
||||||
|
|
||||||
if (client !== undefined) {
|
|
||||||
const savedAttachmentsQuery = createQuery(true)
|
|
||||||
|
|
||||||
savedAttachmentsQuery.query(
|
savedAttachmentsQuery.query(
|
||||||
attachment.class.SavedAttachments,
|
attachment.class.SavedAttachments,
|
||||||
{ space: core.space.Workspace },
|
{ space: core.space.Workspace },
|
||||||
@ -378,11 +375,7 @@ export function loadSavedAttachments (): void {
|
|||||||
},
|
},
|
||||||
{ lookup: { attachedTo: attachment.class.Attachment }, sort: { modifiedOn: SortingOrder.Descending } }
|
{ lookup: { attachedTo: attachment.class.Attachment }, sort: { modifiedOn: SortingOrder.Descending } }
|
||||||
)
|
)
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
loadSavedAttachments()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function hideActivityChannels (contexts: DocNotifyContext[]): Promise<void> {
|
export async function hideActivityChannels (contexts: DocNotifyContext[]): Promise<void> {
|
||||||
|
@ -52,7 +52,7 @@ import core, {
|
|||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import notification, { type DocNotifyContext, type InboxNotification } from '@hcengineering/notification'
|
import notification, { type DocNotifyContext, type InboxNotification } from '@hcengineering/notification'
|
||||||
import { type IntlString, getEmbeddedLabel, getResource, translate } from '@hcengineering/platform'
|
import { type IntlString, getEmbeddedLabel, getResource, translate } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient, onClient } from '@hcengineering/presentation'
|
||||||
import { type TemplateDataProvider } from '@hcengineering/templates'
|
import { type TemplateDataProvider } from '@hcengineering/templates'
|
||||||
import {
|
import {
|
||||||
getCurrentResolvedLocation,
|
getCurrentResolvedLocation,
|
||||||
@ -323,19 +323,17 @@ export const personByIdStore = derived([personAccountPersonByIdStore, employeeBy
|
|||||||
return new Map([...m1, ...m2])
|
return new Map([...m1, ...m2])
|
||||||
})
|
})
|
||||||
|
|
||||||
function fillStores (): void {
|
const query = createQuery(true)
|
||||||
const client = getClient()
|
const accountQ = createQuery(true)
|
||||||
|
const accountPersonQuery = createQuery(true)
|
||||||
|
const providerQuery = createQuery(true)
|
||||||
|
|
||||||
if (client !== undefined) {
|
onClient(() => {
|
||||||
const accountPersonQuery = createQuery(true)
|
|
||||||
|
|
||||||
const query = createQuery(true)
|
|
||||||
query.query(contact.mixin.Employee, { active: { $in: [true, false] } }, (res) => {
|
query.query(contact.mixin.Employee, { active: { $in: [true, false] } }, (res) => {
|
||||||
employeesStore.set(res)
|
employeesStore.set(res)
|
||||||
employeeByIdStore.set(toIdMap(res))
|
employeeByIdStore.set(toIdMap(res))
|
||||||
})
|
})
|
||||||
|
|
||||||
const accountQ = createQuery(true)
|
|
||||||
accountQ.query(contact.class.PersonAccount, {}, (res) => {
|
accountQ.query(contact.class.PersonAccount, {}, (res) => {
|
||||||
personAccountByIdStore.set(toIdMap(res))
|
personAccountByIdStore.set(toIdMap(res))
|
||||||
|
|
||||||
@ -347,18 +345,10 @@ function fillStores (): void {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const providerQuery = createQuery(true)
|
|
||||||
providerQuery.query(contact.class.ChannelProvider, {}, (res) => {
|
providerQuery.query(contact.class.ChannelProvider, {}, (res) => {
|
||||||
channelProviders.set(res)
|
channelProviders.set(res)
|
||||||
})
|
})
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
fillStores()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fillStores()
|
|
||||||
|
|
||||||
const userStatusesQuery = createQuery(true)
|
const userStatusesQuery = createQuery(true)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
type Room,
|
type Room,
|
||||||
type MeetingMinutes
|
type MeetingMinutes
|
||||||
} from '@hcengineering/love'
|
} from '@hcengineering/love'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, onClient } from '@hcengineering/presentation'
|
||||||
import { derived, get, writable } from 'svelte/store'
|
import { derived, get, writable } from 'svelte/store'
|
||||||
import { personIdByAccountId } from '@hcengineering/contact-resources'
|
import { personIdByAccountId } from '@hcengineering/contact-resources'
|
||||||
import aiBot from '@hcengineering/ai-bot'
|
import aiBot from '@hcengineering/ai-bot'
|
||||||
@ -79,31 +79,32 @@ function filterParticipantInfo (value: ParticipantInfo[]): ParticipantInfo[] {
|
|||||||
|
|
||||||
export const storePromise = writable<Promise<void>>(new Promise((resolve) => {}))
|
export const storePromise = writable<Promise<void>>(new Promise((resolve) => {}))
|
||||||
|
|
||||||
function fillStores (): void {
|
const query = createQuery(true)
|
||||||
const client = getClient()
|
const statusQuery = createQuery(true)
|
||||||
if (client !== undefined || getCurrentAccount() != null) {
|
const floorsQuery = createQuery(true)
|
||||||
const query = createQuery(true)
|
const requestsQuery = createQuery(true)
|
||||||
|
const preferencesQuery = createQuery(true)
|
||||||
|
const invitesQuery = createQuery(true)
|
||||||
|
|
||||||
|
onClient(() => {
|
||||||
const roomPromise = new Promise<void>((resolve) =>
|
const roomPromise = new Promise<void>((resolve) =>
|
||||||
query.query(love.class.Room, {}, (res) => {
|
query.query(love.class.Room, {}, (res) => {
|
||||||
rooms.set(res)
|
rooms.set(res)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
const statusQuery = createQuery(true)
|
|
||||||
const infoPromise = new Promise<void>((resolve) =>
|
const infoPromise = new Promise<void>((resolve) =>
|
||||||
statusQuery.query(love.class.ParticipantInfo, {}, (res) => {
|
statusQuery.query(love.class.ParticipantInfo, {}, (res) => {
|
||||||
infos.set(filterParticipantInfo(res))
|
infos.set(filterParticipantInfo(res))
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
const floorsQuery = createQuery(true)
|
|
||||||
const floorPromise = new Promise<void>((resolve) =>
|
const floorPromise = new Promise<void>((resolve) =>
|
||||||
floorsQuery.query(love.class.Floor, {}, (res) => {
|
floorsQuery.query(love.class.Floor, {}, (res) => {
|
||||||
floors.set(res)
|
floors.set(res)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
const requestsQuery = createQuery(true)
|
|
||||||
const requestPromise = new Promise<void>((resolve) =>
|
const requestPromise = new Promise<void>((resolve) =>
|
||||||
requestsQuery.query(
|
requestsQuery.query(
|
||||||
love.class.JoinRequest,
|
love.class.JoinRequest,
|
||||||
@ -114,7 +115,6 @@ function fillStores (): void {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
const preferencesQuery = createQuery(true)
|
|
||||||
const preferencePromise = new Promise<void>((resolve) =>
|
const preferencePromise = new Promise<void>((resolve) =>
|
||||||
preferencesQuery.query(love.class.DevicesPreference, {}, (res) => {
|
preferencesQuery.query(love.class.DevicesPreference, {}, (res) => {
|
||||||
myPreferences.set(res[0])
|
myPreferences.set(res[0])
|
||||||
@ -122,7 +122,7 @@ function fillStores (): void {
|
|||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
const invitesQuery = createQuery(true)
|
|
||||||
const invitesPromise = new Promise<void>((resolve) =>
|
const invitesPromise = new Promise<void>((resolve) =>
|
||||||
invitesQuery.query(love.class.Invite, { status: RequestStatus.Pending }, (res) => {
|
invitesQuery.query(love.class.Invite, { status: RequestStatus.Pending }, (res) => {
|
||||||
invites.set(res)
|
invites.set(res)
|
||||||
@ -143,13 +143,5 @@ function fillStores (): void {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
fillStores()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fillStores()
|
|
||||||
|
|
||||||
export const lockedRoom = writable<string>('')
|
export const lockedRoom = writable<string>('')
|
||||||
|
@ -14,8 +14,10 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import activity from '@hcengineering/activity'
|
||||||
|
import chunter from '@hcengineering/chunter'
|
||||||
|
import { type Employee, type PersonAccount } from '@hcengineering/contact'
|
||||||
import core, {
|
import core, {
|
||||||
getCurrentAccount,
|
|
||||||
toIdMap,
|
toIdMap,
|
||||||
type Attribute,
|
type Attribute,
|
||||||
type Class,
|
type Class,
|
||||||
@ -27,7 +29,7 @@ import core, {
|
|||||||
type TxOperations
|
type TxOperations
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { type IntlString, type Resources } from '@hcengineering/platform'
|
import { type IntlString, type Resources } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient, onClient } from '@hcengineering/presentation'
|
||||||
import task, {
|
import task, {
|
||||||
getStatusIndex,
|
getStatusIndex,
|
||||||
makeRank,
|
makeRank,
|
||||||
@ -41,9 +43,6 @@ import { getCurrentLocation, navigate, showPopup } from '@hcengineering/ui'
|
|||||||
import { type ViewletDescriptor } from '@hcengineering/view'
|
import { type ViewletDescriptor } from '@hcengineering/view'
|
||||||
import { CategoryQuery, groupBy, statusStore } from '@hcengineering/view-resources'
|
import { CategoryQuery, groupBy, statusStore } from '@hcengineering/view-resources'
|
||||||
import { get, writable } from 'svelte/store'
|
import { get, writable } from 'svelte/store'
|
||||||
import { type Employee, type PersonAccount } from '@hcengineering/contact'
|
|
||||||
import activity from '@hcengineering/activity'
|
|
||||||
import chunter from '@hcengineering/chunter'
|
|
||||||
|
|
||||||
import AssignedTasks from './components/AssignedTasks.svelte'
|
import AssignedTasks from './components/AssignedTasks.svelte'
|
||||||
import Dashboard from './components/Dashboard.svelte'
|
import Dashboard from './components/Dashboard.svelte'
|
||||||
@ -69,14 +68,14 @@ import TaskKindSelector from './components/taskTypes/TaskKindSelector.svelte'
|
|||||||
import TaskTypeClassPresenter from './components/taskTypes/TaskTypeClassPresenter.svelte'
|
import TaskTypeClassPresenter from './components/taskTypes/TaskTypeClassPresenter.svelte'
|
||||||
import TaskTypePresenter from './components/taskTypes/TaskTypePresenter.svelte'
|
import TaskTypePresenter from './components/taskTypes/TaskTypePresenter.svelte'
|
||||||
|
|
||||||
import ProjectTypeSelector from './components/projectTypes/ProjectTypeSelector.svelte'
|
import { employeeByIdStore, personAccountByIdStore, personByIdStore } from '@hcengineering/contact-resources'
|
||||||
import CreateProjectType from './components/projectTypes/CreateProjectType.svelte'
|
import CreateProjectType from './components/projectTypes/CreateProjectType.svelte'
|
||||||
import ProjectTypeGeneralSectionEditor from './components/projectTypes/ProjectTypeGeneralSectionEditor.svelte'
|
|
||||||
import ProjectTypeTasksTypeSectionEditor from './components/projectTypes/ProjectTypeTasksTypeSectionEditor.svelte'
|
|
||||||
import ProjectTypeAutomationsSectionEditor from './components/projectTypes/ProjectTypeAutomationsSectionEditor.svelte'
|
import ProjectTypeAutomationsSectionEditor from './components/projectTypes/ProjectTypeAutomationsSectionEditor.svelte'
|
||||||
import ProjectTypeCollectionsSectionEditor from './components/projectTypes/ProjectTypeCollectionsSectionEditor.svelte'
|
import ProjectTypeCollectionsSectionEditor from './components/projectTypes/ProjectTypeCollectionsSectionEditor.svelte'
|
||||||
|
import ProjectTypeGeneralSectionEditor from './components/projectTypes/ProjectTypeGeneralSectionEditor.svelte'
|
||||||
|
import ProjectTypeSelector from './components/projectTypes/ProjectTypeSelector.svelte'
|
||||||
|
import ProjectTypeTasksTypeSectionEditor from './components/projectTypes/ProjectTypeTasksTypeSectionEditor.svelte'
|
||||||
import TaskTypeEditor from './components/taskTypes/TaskTypeEditor.svelte'
|
import TaskTypeEditor from './components/taskTypes/TaskTypeEditor.svelte'
|
||||||
import { employeeByIdStore, personAccountByIdStore, personByIdStore } from '@hcengineering/contact-resources'
|
|
||||||
|
|
||||||
export { default as AssigneePresenter } from './components/AssigneePresenter.svelte'
|
export { default as AssigneePresenter } from './components/AssigneePresenter.svelte'
|
||||||
export { default as TypeSelector } from './components/TypeSelector.svelte'
|
export { default as TypeSelector } from './components/TypeSelector.svelte'
|
||||||
@ -364,33 +363,24 @@ export const taskTypeStore = writable<IdMap<TaskType>>(new Map())
|
|||||||
export const typesOfJoinedProjectsStore = writable<Array<Ref<ProjectType>>>()
|
export const typesOfJoinedProjectsStore = writable<Array<Ref<ProjectType>>>()
|
||||||
export const joinedProjectsStore = writable<Project[]>()
|
export const joinedProjectsStore = writable<Project[]>()
|
||||||
|
|
||||||
function fillStores (): void {
|
const query = createQuery(true)
|
||||||
const client = getClient()
|
const taskQuery = createQuery(true)
|
||||||
|
const projectQuery = createQuery(true)
|
||||||
|
|
||||||
if (client !== undefined && getCurrentAccount() != null) {
|
onClient((client, user) => {
|
||||||
const query = createQuery(true)
|
|
||||||
query.query(task.class.ProjectType, {}, (res) => {
|
query.query(task.class.ProjectType, {}, (res) => {
|
||||||
typeStore.set(toIdMap(res))
|
typeStore.set(toIdMap(res))
|
||||||
})
|
})
|
||||||
|
|
||||||
const taskQuery = createQuery(true)
|
|
||||||
taskQuery.query(task.class.TaskType, {}, (res) => {
|
taskQuery.query(task.class.TaskType, {}, (res) => {
|
||||||
taskTypeStore.set(toIdMap(res))
|
taskTypeStore.set(toIdMap(res))
|
||||||
})
|
})
|
||||||
|
|
||||||
const projectQuery = createQuery(true)
|
projectQuery.query(task.class.Project, { members: user._id }, (res) => {
|
||||||
projectQuery.query(task.class.Project, { members: getCurrentAccount()._id }, (res) => {
|
|
||||||
typesOfJoinedProjectsStore.set(res.map((r) => r.type).filter((it, idx, arr) => arr.indexOf(it) === idx))
|
typesOfJoinedProjectsStore.set(res.map((r) => r.type).filter((it, idx, arr) => arr.indexOf(it) === idx))
|
||||||
joinedProjectsStore.set(res)
|
joinedProjectsStore.set(res)
|
||||||
})
|
})
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
fillStores()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fillStores()
|
|
||||||
|
|
||||||
export const selectedTypeStore = writable<Ref<ProjectType> | undefined>(undefined)
|
export const selectedTypeStore = writable<Ref<ProjectType> | undefined>(undefined)
|
||||||
export const selectedTaskTypeStore = writable<Ref<TaskType> | undefined>(undefined)
|
export const selectedTaskTypeStore = writable<Ref<TaskType> | undefined>(undefined)
|
||||||
|
@ -36,7 +36,7 @@ import core, {
|
|||||||
type TxUpdateDoc
|
type TxUpdateDoc
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { type IntlString } from '@hcengineering/platform'
|
import { type IntlString } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient, onClient } from '@hcengineering/presentation'
|
||||||
import task, { getStatusIndex, makeRank, type ProjectType } from '@hcengineering/task'
|
import task, { getStatusIndex, makeRank, type ProjectType } from '@hcengineering/task'
|
||||||
import { activeProjects as taskActiveProjects, taskTypeStore } from '@hcengineering/task-resources'
|
import { activeProjects as taskActiveProjects, taskTypeStore } from '@hcengineering/task-resources'
|
||||||
import {
|
import {
|
||||||
@ -577,12 +577,8 @@ export interface IssueRef {
|
|||||||
export type IssueReverseRevMap = Map<Ref<Doc>, IssueRef[]>
|
export type IssueReverseRevMap = Map<Ref<Doc>, IssueRef[]>
|
||||||
export const relatedIssues = writable<IssueReverseRevMap>(new Map())
|
export const relatedIssues = writable<IssueReverseRevMap>(new Map())
|
||||||
|
|
||||||
function fillStores (): void {
|
const relatedIssuesQuery = createQuery(true)
|
||||||
const client = getClient()
|
onClient(() => {
|
||||||
|
|
||||||
if (client !== undefined) {
|
|
||||||
const relatedIssuesQuery = createQuery(true)
|
|
||||||
|
|
||||||
relatedIssuesQuery.query(
|
relatedIssuesQuery.query(
|
||||||
tracker.class.Issue,
|
tracker.class.Issue,
|
||||||
{ 'relations._id': { $exists: true } },
|
{ 'relations._id': { $exists: true } },
|
||||||
@ -602,11 +598,4 @@ function fillStores (): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
fillStores()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fillStores()
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import core, { type IdMap, type Status, toIdMap } from '@hcengineering/core'
|
import core, { type IdMap, type Status, toIdMap } from '@hcengineering/core'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, onClient } from '@hcengineering/presentation'
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
interface Store {
|
interface Store {
|
||||||
@ -28,11 +28,8 @@ export const statusStore = writable<Store>({
|
|||||||
array: []
|
array: []
|
||||||
})
|
})
|
||||||
|
|
||||||
function fillStores (): void {
|
const query = createQuery(true)
|
||||||
const client = getClient()
|
onClient(() => {
|
||||||
|
|
||||||
if (client !== undefined) {
|
|
||||||
const query = createQuery(true)
|
|
||||||
query.query(core.class.Status, {}, (res) => {
|
query.query(core.class.Status, {}, (res) => {
|
||||||
const obj = {
|
const obj = {
|
||||||
byId: toIdMap(res),
|
byId: toIdMap(res),
|
||||||
@ -40,11 +37,4 @@ function fillStores (): void {
|
|||||||
}
|
}
|
||||||
statusStore.set(obj)
|
statusStore.set(obj)
|
||||||
})
|
})
|
||||||
} else {
|
})
|
||||||
setTimeout(() => {
|
|
||||||
fillStores()
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fillStores()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user