mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-18 14:23:36 +00:00
UBERF-5861 (#4861)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
d5eb02c926
commit
643015a664
@ -81,6 +81,10 @@ function defineSortAndGrouping (builder: Builder): void {
|
|||||||
builder.mixin(tracker.class.Milestone, core.class.Class, view.mixin.AllValuesFunc, {
|
builder.mixin(tracker.class.Milestone, core.class.Class, view.mixin.AllValuesFunc, {
|
||||||
func: tracker.function.GetAllMilestones
|
func: tracker.function.GetAllMilestones
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.mixin(tracker.class.IssueStatus, core.class.Class, view.mixin.AllValuesFunc, {
|
||||||
|
func: tracker.function.GetAllStates
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function defineNotifications (builder: Builder): void {
|
function defineNotifications (builder: Builder): void {
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import { get, writable } from 'svelte/store'
|
|
||||||
import {
|
import {
|
||||||
toIdMap,
|
toIdMap,
|
||||||
type Attribute,
|
type Attribute,
|
||||||
@ -39,9 +38,9 @@ import task, {
|
|||||||
import { getCurrentLocation, navigate, showPopup } from '@hcengineering/ui'
|
import { getCurrentLocation, navigate, showPopup } from '@hcengineering/ui'
|
||||||
import { type ViewletDescriptor } from '@hcengineering/view'
|
import { type ViewletDescriptor } from '@hcengineering/view'
|
||||||
import { CategoryQuery, statusStore } from '@hcengineering/view-resources'
|
import { CategoryQuery, statusStore } from '@hcengineering/view-resources'
|
||||||
|
import { get, writable } from 'svelte/store'
|
||||||
|
|
||||||
import AssignedTasks from './components/AssignedTasks.svelte'
|
import AssignedTasks from './components/AssignedTasks.svelte'
|
||||||
import CreateStatePopup from './components/state/CreateStatePopup.svelte'
|
|
||||||
import Dashboard from './components/Dashboard.svelte'
|
import Dashboard from './components/Dashboard.svelte'
|
||||||
import DueDateEditor from './components/DueDateEditor.svelte'
|
import DueDateEditor from './components/DueDateEditor.svelte'
|
||||||
import KanbanTemplatePresenter from './components/KanbanTemplatePresenter.svelte'
|
import KanbanTemplatePresenter from './components/KanbanTemplatePresenter.svelte'
|
||||||
@ -54,26 +53,27 @@ import TemplatesIcon from './components/TemplatesIcon.svelte'
|
|||||||
import TypesView from './components/TypesView.svelte'
|
import TypesView from './components/TypesView.svelte'
|
||||||
import KanbanView from './components/kanban/KanbanView.svelte'
|
import KanbanView from './components/kanban/KanbanView.svelte'
|
||||||
import ProjectEditor from './components/projectTypes/ProjectEditor.svelte'
|
import ProjectEditor from './components/projectTypes/ProjectEditor.svelte'
|
||||||
|
import ProjectTypePresenter from './components/projectTypes/ProjectTypePresenter.svelte'
|
||||||
import ProjectTypeSelector from './components/projectTypes/ProjectTypeSelector.svelte'
|
import ProjectTypeSelector from './components/projectTypes/ProjectTypeSelector.svelte'
|
||||||
|
import CreateStatePopup from './components/state/CreateStatePopup.svelte'
|
||||||
import StateEditor from './components/state/StateEditor.svelte'
|
import StateEditor from './components/state/StateEditor.svelte'
|
||||||
|
import StateIconPresenter from './components/state/StateIconPresenter.svelte'
|
||||||
import StatePresenter from './components/state/StatePresenter.svelte'
|
import StatePresenter from './components/state/StatePresenter.svelte'
|
||||||
import StateRefPresenter from './components/state/StateRefPresenter.svelte'
|
import StateRefPresenter from './components/state/StateRefPresenter.svelte'
|
||||||
import TypeStatesPopup from './components/state/TypeStatesPopup.svelte'
|
import TypeStatesPopup from './components/state/TypeStatesPopup.svelte'
|
||||||
import TaskTypeClassPresenter from './components/taskTypes/TaskTypeClassPresenter.svelte'
|
|
||||||
import ProjectTypeClassPresenter from './components/taskTypes/ProjectTypeClassPresenter.svelte'
|
import ProjectTypeClassPresenter from './components/taskTypes/ProjectTypeClassPresenter.svelte'
|
||||||
import TaskTypePresenter from './components/taskTypes/TaskTypePresenter.svelte'
|
|
||||||
import ProjectTypePresenter from './components/projectTypes/ProjectTypePresenter.svelte'
|
|
||||||
import StateIconPresenter from './components/state/StateIconPresenter.svelte'
|
|
||||||
import TaskKindSelector from './components/taskTypes/TaskKindSelector.svelte'
|
import TaskKindSelector from './components/taskTypes/TaskKindSelector.svelte'
|
||||||
|
import TaskTypeClassPresenter from './components/taskTypes/TaskTypeClassPresenter.svelte'
|
||||||
|
import TaskTypePresenter from './components/taskTypes/TaskTypePresenter.svelte'
|
||||||
|
|
||||||
import ManageProjects from './components/projectTypes/ManageProjects.svelte'
|
import ManageProjects from './components/projectTypes/ManageProjects.svelte'
|
||||||
import ManageProjectsTools from './components/projectTypes/ManageProjectsTools.svelte'
|
|
||||||
import ManageProjectsContent from './components/projectTypes/ManageProjectsContent.svelte'
|
import ManageProjectsContent from './components/projectTypes/ManageProjectsContent.svelte'
|
||||||
|
import ManageProjectsTools from './components/projectTypes/ManageProjectsTools.svelte'
|
||||||
|
|
||||||
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'
|
||||||
export * from './utils'
|
export * from './utils'
|
||||||
export { StatePresenter, StateRefPresenter, TypeStatesPopup, TaskKindSelector }
|
export { StatePresenter, StateRefPresenter, TaskKindSelector, TypeStatesPopup }
|
||||||
|
|
||||||
async function editStatuses (object: Project, ev: Event): Promise<void> {
|
async function editStatuses (object: Project, ev: Event): Promise<void> {
|
||||||
const loc = getCurrentLocation()
|
const loc = getCurrentLocation()
|
||||||
@ -140,18 +140,17 @@ export default async (): Promise<Resources> => ({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
async function getAllStates (
|
export async function getAllStates (
|
||||||
query: DocumentQuery<Doc> | undefined,
|
query: DocumentQuery<Doc> | undefined,
|
||||||
onUpdate: () => void,
|
onUpdate: () => void,
|
||||||
queryId: Ref<Doc>,
|
queryId: Ref<Doc>,
|
||||||
attr: Attribute<Status>
|
attr: Attribute<Status>,
|
||||||
|
filterDone: boolean = true
|
||||||
): Promise<any[]> {
|
): Promise<any[]> {
|
||||||
const typeId = get(selectedTypeStore)
|
const typeId = get(selectedTypeStore)
|
||||||
const taskTypeId = get(selectedTaskTypeStore)
|
|
||||||
if (taskTypeId === undefined) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
const type = typeId !== undefined ? get(typeStore).get(typeId) : undefined
|
const type = typeId !== undefined ? get(typeStore).get(typeId) : undefined
|
||||||
|
const taskTypeId = get(selectedTaskTypeStore)
|
||||||
|
if (taskTypeId !== undefined) {
|
||||||
const taskType = get(taskTypeStore).get(taskTypeId)
|
const taskType = get(taskTypeStore).get(taskTypeId)
|
||||||
if (taskType === undefined) {
|
if (taskType === undefined) {
|
||||||
return []
|
return []
|
||||||
@ -159,9 +158,13 @@ async function getAllStates (
|
|||||||
if (type !== undefined) {
|
if (type !== undefined) {
|
||||||
const statusMap = get(statusStore).byId
|
const statusMap = get(statusStore).byId
|
||||||
const statuses = (taskType.statuses.map((p) => statusMap.get(p)) as Status[]) ?? []
|
const statuses = (taskType.statuses.map((p) => statusMap.get(p)) as Status[]) ?? []
|
||||||
|
if (filterDone) {
|
||||||
return statuses
|
return statuses
|
||||||
.filter((p) => p?.category !== task.statusCategory.Lost && p?.category !== task.statusCategory.Won)
|
.filter((p) => p?.category !== task.statusCategory.Lost && p?.category !== task.statusCategory.Won)
|
||||||
.map((p) => p?._id)
|
.map((p) => p?._id)
|
||||||
|
} else {
|
||||||
|
return statuses.map((p) => p?._id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const _space = query?.space
|
const _space = query?.space
|
||||||
if (_space !== undefined) {
|
if (_space !== undefined) {
|
||||||
@ -171,9 +174,14 @@ async function getAllStates (
|
|||||||
refresh = lq.query(task.class.Project, { _id: _space as Ref<Project> }, (res) => {
|
refresh = lq.query(task.class.Project, { _id: _space as Ref<Project> }, (res) => {
|
||||||
const statusMap = get(statusStore).byId
|
const statusMap = get(statusStore).byId
|
||||||
const statuses = (taskType.statuses.map((p) => statusMap.get(p)) as Status[]) ?? []
|
const statuses = (taskType.statuses.map((p) => statusMap.get(p)) as Status[]) ?? []
|
||||||
const result = statuses
|
let result: Array<Ref<Status>> = []
|
||||||
|
if (filterDone) {
|
||||||
|
result = statuses
|
||||||
.filter((p) => p?.category !== task.statusCategory.Lost && p?.category !== task.statusCategory.Won)
|
.filter((p) => p?.category !== task.statusCategory.Lost && p?.category !== task.statusCategory.Won)
|
||||||
.map((p) => p?._id)
|
.map((p) => p?._id)
|
||||||
|
} else {
|
||||||
|
result = statuses.map((p) => p?._id)
|
||||||
|
}
|
||||||
CategoryQuery.results.set(queryId, result)
|
CategoryQuery.results.set(queryId, result)
|
||||||
resolve(result)
|
resolve(result)
|
||||||
onUpdate()
|
onUpdate()
|
||||||
@ -185,12 +193,25 @@ async function getAllStates (
|
|||||||
})
|
})
|
||||||
return await promise
|
return await promise
|
||||||
}
|
}
|
||||||
return get(statusStore)
|
} else if (type !== undefined) {
|
||||||
.array.filter(
|
const statusMap = get(statusStore).byId
|
||||||
(p) =>
|
const statuses = (type.statuses.map((p) => statusMap.get(p._id)) as Status[]) ?? []
|
||||||
p.ofAttribute === attr._id && p.category !== task.statusCategory.Lost && p.category !== task.statusCategory.Won
|
if (filterDone) {
|
||||||
)
|
return statuses
|
||||||
.map((p) => p._id)
|
.filter((p) => p?.category !== task.statusCategory.Lost && p?.category !== task.statusCategory.Won)
|
||||||
|
.map((p) => p?._id)
|
||||||
|
} else {
|
||||||
|
return statuses.map((p) => p?._id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allStates = get(statusStore).array.filter((p) => p.ofAttribute === attr._id)
|
||||||
|
if (filterDone) {
|
||||||
|
return allStates
|
||||||
|
.filter((p) => p?.category !== task.statusCategory.Lost && p?.category !== task.statusCategory.Won)
|
||||||
|
.map((p) => p?._id)
|
||||||
|
} else {
|
||||||
|
return allStates.map((p) => p?._id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function statusSort (
|
async function statusSort (
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
|
|
||||||
import { Analytics } from '@hcengineering/analytics'
|
import { Analytics } from '@hcengineering/analytics'
|
||||||
import core, {
|
import core, {
|
||||||
|
type Attribute,
|
||||||
ClassifierKind,
|
ClassifierKind,
|
||||||
DOMAIN_CONFIGURATION,
|
DOMAIN_CONFIGURATION,
|
||||||
DOMAIN_MODEL,
|
DOMAIN_MODEL,
|
||||||
getCurrentAccount,
|
getCurrentAccount,
|
||||||
|
type Space,
|
||||||
toIdMap,
|
toIdMap,
|
||||||
type AttachedDoc,
|
type AttachedDoc,
|
||||||
type Class,
|
type Class,
|
||||||
@ -29,7 +31,7 @@ import core, {
|
|||||||
type RelatedDocument,
|
type RelatedDocument,
|
||||||
type TxOperations
|
type TxOperations
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { translate, type Resources } from '@hcengineering/platform'
|
import { type Status, translate, type Resources } from '@hcengineering/platform'
|
||||||
import { getClient, MessageBox, type ObjectSearchResult } from '@hcengineering/presentation'
|
import { getClient, MessageBox, type ObjectSearchResult } from '@hcengineering/presentation'
|
||||||
import { type Issue, type Milestone, type Project } from '@hcengineering/tracker'
|
import { type Issue, type Milestone, type Project } from '@hcengineering/tracker'
|
||||||
import { getCurrentLocation, navigate, showPopup, themeStore } from '@hcengineering/ui'
|
import { getCurrentLocation, navigate, showPopup, themeStore } from '@hcengineering/ui'
|
||||||
@ -156,6 +158,7 @@ import ProjectSpacePresenter from './components/projects/ProjectSpacePresenter.s
|
|||||||
import { get } from 'svelte/store'
|
import { get } from 'svelte/store'
|
||||||
|
|
||||||
import { settingId } from '@hcengineering/setting'
|
import { settingId } from '@hcengineering/setting'
|
||||||
|
import { getAllStates } from '@hcengineering/task-resources'
|
||||||
import EstimationValueEditor from './components/issues/timereport/EstimationValueEditor.svelte'
|
import EstimationValueEditor from './components/issues/timereport/EstimationValueEditor.svelte'
|
||||||
import TimePresenter from './components/issues/timereport/TimePresenter.svelte'
|
import TimePresenter from './components/issues/timereport/TimePresenter.svelte'
|
||||||
|
|
||||||
@ -527,6 +530,12 @@ export default async (): Promise<Resources> => ({
|
|||||||
GetAllPriority: getAllPriority,
|
GetAllPriority: getAllPriority,
|
||||||
GetAllComponents: getAllComponents,
|
GetAllComponents: getAllComponents,
|
||||||
GetAllMilestones: getAllMilestones,
|
GetAllMilestones: getAllMilestones,
|
||||||
|
GetAllStates: async (
|
||||||
|
query: DocumentQuery<Doc<Space>> | undefined,
|
||||||
|
onUpdate: () => void,
|
||||||
|
queryId: Ref<Doc<Space>>,
|
||||||
|
attr: Attribute<Status>
|
||||||
|
) => await getAllStates(query, onUpdate, queryId, attr, false),
|
||||||
GetVisibleFilters: getVisibleFilters,
|
GetVisibleFilters: getVisibleFilters,
|
||||||
IssueChatTitleProvider: getIssueChatTitle,
|
IssueChatTitleProvider: getIssueChatTitle,
|
||||||
IsProjectJoined: async (project: Project) => !project.private || project.members.includes(getCurrentAccount()._id),
|
IsProjectJoined: async (project: Project) => !project.private || project.members.includes(getCurrentAccount()._id),
|
||||||
|
@ -390,6 +390,7 @@ export default mergeIds(trackerId, tracker, {
|
|||||||
GetAllPriority: '' as GetAllValuesFunc,
|
GetAllPriority: '' as GetAllValuesFunc,
|
||||||
GetAllComponents: '' as GetAllValuesFunc,
|
GetAllComponents: '' as GetAllValuesFunc,
|
||||||
GetAllMilestones: '' as GetAllValuesFunc,
|
GetAllMilestones: '' as GetAllValuesFunc,
|
||||||
|
GetAllStates: '' as GetAllValuesFunc,
|
||||||
GetVisibleFilters: '' as Resource<(filters: KeyFilter[], space?: Ref<Space>) => Promise<KeyFilter[]>>,
|
GetVisibleFilters: '' as Resource<(filters: KeyFilter[], space?: Ref<Space>) => Promise<KeyFilter[]>>,
|
||||||
IsProjectJoined: '' as Resource<(space: Space) => Promise<boolean>>,
|
IsProjectJoined: '' as Resource<(space: Space) => Promise<boolean>>,
|
||||||
IssueChatTitleProvider: '' as Resource<(object: Doc) => string>,
|
IssueChatTitleProvider: '' as Resource<(object: Doc) => string>,
|
||||||
|
Loading…
Reference in New Issue
Block a user