mirror of
https://github.com/hcengineering/platform.git
synced 2026-10-01 22:15:04 +02:00
Process bug fixes (#8661)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
import activity from '@hcengineering/activity'
|
||||
import board from '@hcengineering/board'
|
||||
import calendarPlugin, { type Visibility } from '@hcengineering/calendar'
|
||||
import contactPlugin, { type Person } from '@hcengineering/contact'
|
||||
import contactPlugin, { type Employee } from '@hcengineering/contact'
|
||||
import {
|
||||
DOMAIN_MODEL,
|
||||
type Class,
|
||||
@@ -116,8 +116,8 @@ export class TToDo extends TAttachedDoc implements ToDo {
|
||||
|
||||
doneOn?: Timestamp | null
|
||||
|
||||
@Prop(TypeRef(contactPlugin.class.Person), contactPlugin.string.Employee)
|
||||
user!: Ref<Person>
|
||||
@Prop(TypeRef(contactPlugin.mixin.Employee), contactPlugin.string.Employee)
|
||||
user!: Ref<Employee>
|
||||
|
||||
@Prop(Collection(time.class.WorkSlot, time.string.WorkSlot), time.string.WorkSlot)
|
||||
workslots!: number
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { cardId } from '@hcengineering/card'
|
||||
import { Process } from '@hcengineering/process'
|
||||
import { processId, Process } from '@hcengineering/process'
|
||||
import { deviceOptionsStore as deviceInfo, NavItem, Scroller } from '@hcengineering/ui'
|
||||
import { NavLink } from '@hcengineering/view-resources'
|
||||
import { NavFooter, NavHeader, SavedView } from '@hcengineering/workbench-resources'
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="antiPanel-wrap__content hulyNavPanel-container">
|
||||
<NavHeader label={plugin.string.Processes} />
|
||||
{#each specials as special}
|
||||
<NavLink space={special._id}>
|
||||
<NavLink space={special._id} app={processId}>
|
||||
<NavItem
|
||||
_id={special._id}
|
||||
label={special.label}
|
||||
@@ -53,7 +53,7 @@
|
||||
<div class="antiNav-divider line" />
|
||||
<Scroller shrink>
|
||||
{#each processes as process}
|
||||
<NavLink space={process._id}>
|
||||
<NavLink space={process._id} app={processId}>
|
||||
<NavItem
|
||||
_id={process._id}
|
||||
title={process.name}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Person } from '@hcengineering/contact'
|
||||
import { Employee, Person } from '@hcengineering/contact'
|
||||
import { AssigneePopup, EmployeePresenter } from '@hcengineering/contact-resources'
|
||||
import { type Class, type Doc, type Ref, type Space, SortingOrder } from '@hcengineering/core'
|
||||
import { MessageBox, createQuery, getClient } from '@hcengineering/presentation'
|
||||
@@ -87,7 +87,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function assignTodo (user: Ref<Person>): Promise<void> {
|
||||
async function assignTodo (user: Ref<Employee>): Promise<void> {
|
||||
if (todo !== undefined && todo.user === user) return
|
||||
if (objectId === undefined || objectClass === undefined || objectSpace === undefined) return
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function assignTodoConfirm (user: Ref<Person>): Promise<void> {
|
||||
async function assignTodoConfirm (user: Ref<Employee>): Promise<void> {
|
||||
showPopup(
|
||||
MessageBox,
|
||||
{
|
||||
@@ -172,7 +172,7 @@
|
||||
)
|
||||
}
|
||||
|
||||
async function changeAssignee (user: Ref<Person> | undefined): Promise<void> {
|
||||
async function changeAssignee (user: Ref<Employee> | undefined): Promise<void> {
|
||||
const shouldConfirm = todo !== undefined && todo?.workslots > 0
|
||||
if (user !== undefined) {
|
||||
shouldConfirm ? await assignTodoConfirm(user) : await assignTodo(user)
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
import { IntlString, plugin } from '@hcengineering/platform'
|
||||
import { Event, Visibility } from '@hcengineering/calendar'
|
||||
import { AnyComponent } from '@hcengineering/ui'
|
||||
import { Person } from '@hcengineering/contact'
|
||||
import { Employee } from '@hcengineering/contact'
|
||||
import type { Rank } from '@hcengineering/rank'
|
||||
|
||||
export * from './analytics'
|
||||
@@ -61,7 +61,7 @@ export interface ToDo extends AttachedDoc {
|
||||
priority: ToDoPriority
|
||||
visibility: Visibility
|
||||
doneOn?: Timestamp | null
|
||||
user: Ref<Person>
|
||||
user: Ref<Employee>
|
||||
attachedSpace?: Ref<Space>
|
||||
labels?: number
|
||||
rank: Rank
|
||||
|
||||
@@ -278,12 +278,7 @@ export async function OnToDoCreate (txes: TxCUD<Doc>[], control: TriggerControl)
|
||||
}
|
||||
|
||||
const employee = (
|
||||
await control.findAll(
|
||||
control.ctx,
|
||||
contact.mixin.Employee,
|
||||
{ _id: todo.user as Ref<Employee>, active: true },
|
||||
{ limit: 1 }
|
||||
)
|
||||
await control.findAll(control.ctx, contact.mixin.Employee, { _id: todo.user, active: true }, { limit: 1 })
|
||||
)[0]
|
||||
if (employee === undefined) {
|
||||
continue
|
||||
@@ -580,7 +575,7 @@ export async function IssueToDoDone (
|
||||
total = Math.round(total / 15) * 15
|
||||
|
||||
const data: AttachedData<TimeSpendReport> = {
|
||||
employee: todo.user as Ref<Employee>,
|
||||
employee: todo.user,
|
||||
date: new Date().getTime(),
|
||||
value: total / 60,
|
||||
description: ''
|
||||
@@ -620,12 +615,16 @@ async function getIssueToDoData (
|
||||
user: Ref<Person>,
|
||||
control: TriggerControl
|
||||
): Promise<AttachedData<ProjectToDo> | undefined> {
|
||||
const employee = (
|
||||
await control.findAll(control.ctx, contact.mixin.Employee, { _id: user as Ref<Employee> }, { limit: 1 })
|
||||
)[0]
|
||||
if (employee === undefined) return
|
||||
const firstTodoItem = (
|
||||
await control.findAll(
|
||||
control.ctx,
|
||||
time.class.ToDo,
|
||||
{
|
||||
user,
|
||||
user: employee._id,
|
||||
doneOn: null
|
||||
},
|
||||
{
|
||||
@@ -642,7 +641,7 @@ async function getIssueToDoData (
|
||||
priority: ToDoPriority.NoPriority,
|
||||
visibility: 'public',
|
||||
title: issue.title,
|
||||
user,
|
||||
user: employee._id,
|
||||
rank
|
||||
}
|
||||
return data
|
||||
@@ -703,7 +702,7 @@ async function changeIssueStatusHandler (
|
||||
if (issue?.assignee != null) {
|
||||
const todos = await control.findAll(control.ctx, time.class.ToDo, {
|
||||
attachedTo: issue._id,
|
||||
user: issue.assignee
|
||||
user: issue.assignee as Ref<Employee>
|
||||
})
|
||||
if (todos.length === 0) {
|
||||
const tx = await getCreateToDoTx(issue, issue.assignee, control)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { Person } from '@hcengineering/contact'
|
||||
import contact, { Employee, Person } from '@hcengineering/contact'
|
||||
import core, {
|
||||
AttachedData,
|
||||
Doc,
|
||||
@@ -840,10 +840,12 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
todoUser: Ref<Person>,
|
||||
account: PersonId
|
||||
): Promise<void> {
|
||||
const employee = (await client.findAll(contact.mixin.Employee, { _id: todoUser as Ref<Employee> }, { limit: 1 }))[0]
|
||||
if (employee === undefined) return
|
||||
const latestTodo = await client.findOne(
|
||||
time.class.ToDo,
|
||||
{
|
||||
user: todoUser,
|
||||
user: employee._id,
|
||||
doneOn: null
|
||||
},
|
||||
{
|
||||
@@ -860,7 +862,7 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
title: 'Review ' + external.title,
|
||||
description: external.url,
|
||||
attachedSpace: pullRequest.space,
|
||||
user: todoUser,
|
||||
user: employee._id,
|
||||
workslots: 0,
|
||||
priority: ToDoPriority.High,
|
||||
visibility: 'public',
|
||||
@@ -893,10 +895,12 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
todoUser: Ref<Person>,
|
||||
account: PersonId
|
||||
): Promise<void> {
|
||||
const employee = (await client.findAll(contact.mixin.Employee, { _id: todoUser as Ref<Employee> }, { limit: 1 }))[0]
|
||||
if (employee === undefined) return
|
||||
const latestTodo = await client.findOne(
|
||||
time.class.ToDo,
|
||||
{
|
||||
user: todoUser,
|
||||
user: employee._id,
|
||||
doneOn: null
|
||||
},
|
||||
{
|
||||
@@ -914,7 +918,7 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
attachedSpace: pullRequest.space,
|
||||
title: 'Resolve ' + pullRequest.title,
|
||||
description: external.url,
|
||||
user: todoUser,
|
||||
user: employee._id,
|
||||
workslots: 0,
|
||||
priority: ToDoPriority.High,
|
||||
visibility: 'public',
|
||||
|
||||
Reference in New Issue
Block a user