mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 12:35:02 +02:00
Fix TSK-96 (#2052)
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
wonStates = result.filter((x) => x._class === task.class.WonState)
|
||||
lostStates = result.filter((x) => x._class === task.class.LostState)
|
||||
})
|
||||
} else {
|
||||
doneStatesQ.unsubscribe()
|
||||
}
|
||||
|
||||
let hoveredDoneState: Ref<DoneState> | undefined
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
},
|
||||
{ limit: 1 }
|
||||
)
|
||||
} else {
|
||||
query.unsubscribe()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,11 +14,10 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Class, Client, Ref } from '@anticrm/core'
|
||||
import { IntlString, Resources, translate } from '@anticrm/platform'
|
||||
import { ObjectSearchResult } from '@anticrm/presentation'
|
||||
import { SpaceWithStates, Task } from '@anticrm/task'
|
||||
import { Resources } from '@anticrm/platform'
|
||||
import { SpaceWithStates } from '@anticrm/task'
|
||||
import { showPopup } from '@anticrm/ui'
|
||||
import AssignedTasks from './components/AssignedTasks.svelte'
|
||||
import CreateProject from './components/CreateProject.svelte'
|
||||
import EditIssue from './components/EditIssue.svelte'
|
||||
import KanbanTemplateEditor from './components/kanban/KanbanTemplateEditor.svelte'
|
||||
@@ -32,59 +31,17 @@ import StateEditor from './components/state/StateEditor.svelte'
|
||||
import StatePresenter from './components/state/StatePresenter.svelte'
|
||||
import StatusTableView from './components/StatusTableView.svelte'
|
||||
import TaskHeader from './components/TaskHeader.svelte'
|
||||
import TaskItem from './components/TaskItem.svelte'
|
||||
import TaskPresenter from './components/TaskPresenter.svelte'
|
||||
import TemplatesIcon from './components/TemplatesIcon.svelte'
|
||||
import TodoItemPresenter from './components/todos/TodoItemPresenter.svelte'
|
||||
import TodoItemsPopup from './components/todos/TodoItemsPopup.svelte'
|
||||
import Todos from './components/todos/Todos.svelte'
|
||||
import TodoStatePresenter from './components/todos/TodoStatePresenter.svelte'
|
||||
import AssignedTasks from './components/AssignedTasks.svelte'
|
||||
import task from './plugin'
|
||||
|
||||
async function editStatuses (object: SpaceWithStates): Promise<void> {
|
||||
showPopup(EditStatuses, { _id: object._id, spaceClass: object._class }, 'float')
|
||||
}
|
||||
|
||||
export async function queryTask<D extends Task> (
|
||||
_class: Ref<Class<D>>,
|
||||
client: Client,
|
||||
search: string
|
||||
): Promise<ObjectSearchResult[]> {
|
||||
const cl = client.getHierarchy().getClass(_class)
|
||||
const shortLabel = (await translate(cl.shortLabel ?? ('' as IntlString), {})).toUpperCase()
|
||||
|
||||
// Check number pattern
|
||||
|
||||
const sequence = (await client.findOne(task.class.Sequence, { attachedTo: _class }))?.sequence ?? 0
|
||||
|
||||
const named = new Map(
|
||||
(await client.findAll<Task>(_class, { name: { $like: `%${search}%` } }, { limit: 200 })).map((e) => [e._id, e])
|
||||
)
|
||||
const nids: number[] = []
|
||||
if (sequence > 0) {
|
||||
for (let n = 0; n < sequence; n++) {
|
||||
const v = `${n}`
|
||||
if (v.includes(search)) {
|
||||
nids.push(n)
|
||||
}
|
||||
}
|
||||
const numbered = await client.findAll<Task>(_class, { number: { $in: nids } }, { limit: 200 })
|
||||
for (const d of numbered) {
|
||||
if (!named.has(d._id)) {
|
||||
named.set(d._id, d)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(named.values()).map((e) => ({
|
||||
doc: e,
|
||||
title: `${shortLabel}-${e.number}`,
|
||||
icon: task.icon.Task,
|
||||
component: TaskItem
|
||||
}))
|
||||
}
|
||||
|
||||
export type StatesBarPosition = 'start' | 'middle' | 'end' | undefined
|
||||
|
||||
export default async (): Promise<Resources> => ({
|
||||
@@ -111,8 +68,5 @@ export default async (): Promise<Resources> => ({
|
||||
},
|
||||
actionImpl: {
|
||||
EditStatuses: editStatuses
|
||||
},
|
||||
completion: {
|
||||
IssueQuery: async (client: Client, query: string) => await queryTask(task.class.Issue, client, query)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user