2022-03-31 08:32:42 +00:00
|
|
|
//
|
|
|
|
// Copyright © 2020, 2021 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.
|
|
|
|
//
|
|
|
|
|
2022-06-10 15:48:14 +00:00
|
|
|
import { Class, Client, Ref } from '@anticrm/core'
|
2022-03-31 08:32:42 +00:00
|
|
|
import { Resources } from '@anticrm/platform'
|
2022-06-10 15:48:14 +00:00
|
|
|
import { ObjectSearchResult } from '@anticrm/presentation'
|
2022-07-01 15:24:58 +00:00
|
|
|
import { showPopup } from '@anticrm/ui'
|
2022-06-10 15:48:14 +00:00
|
|
|
import { Issue, Team } from '@anticrm/tracker'
|
|
|
|
import Inbox from './components/inbox/Inbox.svelte'
|
2022-06-28 06:53:39 +00:00
|
|
|
import Issues from './components/issues/Issues.svelte'
|
2022-03-31 08:32:42 +00:00
|
|
|
import Active from './components/issues/Active.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import AssigneePresenter from './components/issues/AssigneePresenter.svelte'
|
2022-03-31 08:32:42 +00:00
|
|
|
import Backlog from './components/issues/Backlog.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import DueDatePresenter from './components/issues/DueDatePresenter.svelte'
|
|
|
|
import EditIssue from './components/issues/edit/EditIssue.svelte'
|
|
|
|
import IssueItem from './components/issues/IssueItem.svelte'
|
2022-03-31 08:32:42 +00:00
|
|
|
import IssuePresenter from './components/issues/IssuePresenter.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import IssuePreview from './components/issues/IssuePreview.svelte'
|
|
|
|
import IssuesView from './components/issues/IssuesView.svelte'
|
|
|
|
import ListView from './components/issues/ListView.svelte'
|
|
|
|
import ModificationDatePresenter from './components/issues/ModificationDatePresenter.svelte'
|
2022-05-04 15:08:24 +00:00
|
|
|
import PriorityEditor from './components/issues/PriorityEditor.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import PriorityPresenter from './components/issues/PriorityPresenter.svelte'
|
2022-05-04 13:46:34 +00:00
|
|
|
import StatusEditor from './components/issues/StatusEditor.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import StatusPresenter from './components/issues/StatusPresenter.svelte'
|
|
|
|
import TitlePresenter from './components/issues/TitlePresenter.svelte'
|
|
|
|
import MyIssues from './components/myissues/MyIssues.svelte'
|
|
|
|
import NewIssueHeader from './components/NewIssueHeader.svelte'
|
|
|
|
import NopeComponent from './components/NopeComponent.svelte'
|
|
|
|
import EditProject from './components/projects/EditProject.svelte'
|
2022-05-18 05:35:34 +00:00
|
|
|
import IconPresenter from './components/projects/IconPresenter.svelte'
|
|
|
|
import LeadPresenter from './components/projects/LeadPresenter.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import ProjectEditor from './components/projects/ProjectEditor.svelte'
|
2022-05-18 05:35:34 +00:00
|
|
|
import ProjectMembersPresenter from './components/projects/ProjectMembersPresenter.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import ProjectPresenter from './components/projects/ProjectPresenter.svelte'
|
2022-06-24 06:05:05 +00:00
|
|
|
import Roadmap from './components/projects/Roadmap.svelte'
|
|
|
|
import TeamProjects from './components/projects/TeamProjects.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import Projects from './components/projects/Projects.svelte'
|
2022-06-09 14:54:54 +00:00
|
|
|
import ProjectStatusEditor from './components/projects/ProjectStatusEditor.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import ProjectStatusPresenter from './components/projects/ProjectStatusPresenter.svelte'
|
|
|
|
import ProjectTitlePresenter from './components/projects/ProjectTitlePresenter.svelte'
|
|
|
|
import TargetDatePresenter from './components/projects/TargetDatePresenter.svelte'
|
|
|
|
import SetDueDateActionPopup from './components/SetDueDateActionPopup.svelte'
|
|
|
|
import SetParentIssueActionPopup from './components/SetParentIssueActionPopup.svelte'
|
2022-07-01 15:24:58 +00:00
|
|
|
import Statuses from './components/workflow/Statuses.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import Views from './components/views/Views.svelte'
|
2022-06-15 04:59:43 +00:00
|
|
|
import KanbanView from './components/issues/KanbanView.svelte'
|
2022-06-10 15:48:14 +00:00
|
|
|
import tracker from './plugin'
|
2022-06-30 03:46:46 +00:00
|
|
|
import { copyToClipboard, getIssueId, getIssueTitle, resolveLocation } from './issues'
|
2022-06-24 12:36:08 +00:00
|
|
|
import CreateIssue from './components/CreateIssue.svelte'
|
2022-07-01 06:14:31 +00:00
|
|
|
import RelationsPopup from './components/RelationsPopup.svelte'
|
2022-04-12 17:41:32 +00:00
|
|
|
|
2022-08-03 07:05:19 +00:00
|
|
|
import Sprints from './components/sprints/Sprints.svelte'
|
|
|
|
import SprintPresenter from './components/sprints/SprintPresenter.svelte'
|
|
|
|
import SprintStatusPresenter from './components/sprints/SprintStatusPresenter.svelte'
|
|
|
|
import SprintTitlePresenter from './components/sprints/SprintTitlePresenter.svelte'
|
|
|
|
import SprintSelector from './components/sprints/SprintSelector.svelte'
|
|
|
|
import SprintEditor from './components/sprints/SprintEditor.svelte'
|
|
|
|
|
2022-08-16 10:19:33 +00:00
|
|
|
import ReportedTimeEditor from './components/issues/timereport/ReportedTimeEditor.svelte'
|
|
|
|
import TimeSpendReport from './components/issues/timereport/TimeSpendReport.svelte'
|
|
|
|
import EstimationEditor from './components/issues/timereport/EstimationEditor.svelte'
|
2022-08-22 18:55:45 +00:00
|
|
|
import SubIssuesSelector from './components/issues/edit/SubIssuesSelector.svelte'
|
|
|
|
import GrowPresenter from './components/issues/GrowPresenter.svelte'
|
2022-08-16 10:19:33 +00:00
|
|
|
|
2022-06-10 15:48:14 +00:00
|
|
|
export async function queryIssue<D extends Issue> (
|
|
|
|
_class: Ref<Class<D>>,
|
|
|
|
client: Client,
|
|
|
|
search: string
|
|
|
|
): Promise<ObjectSearchResult[]> {
|
|
|
|
const teams = await client.findAll<Team>(tracker.class.Team, {})
|
|
|
|
|
|
|
|
const named = new Map(
|
|
|
|
(
|
|
|
|
await client.findAll<Issue>(
|
|
|
|
_class,
|
|
|
|
{ title: { $like: `%${search}%` } },
|
|
|
|
{
|
|
|
|
limit: 200,
|
|
|
|
lookup: { space: tracker.class.Team }
|
|
|
|
}
|
|
|
|
)
|
|
|
|
).map((e) => [e._id, e])
|
|
|
|
)
|
|
|
|
for (const currentTeam of teams) {
|
|
|
|
const nids: number[] = []
|
|
|
|
for (let n = 0; n < currentTeam.sequence; n++) {
|
|
|
|
const v = `${currentTeam.identifier}-${n}`
|
|
|
|
if (v.includes(search)) {
|
|
|
|
nids.push(n)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (nids.length > 0) {
|
|
|
|
const numbered = await client.findAll<Issue>(
|
|
|
|
_class,
|
|
|
|
{ number: { $in: nids } },
|
|
|
|
{ limit: 200, lookup: { space: tracker.class.Team } }
|
|
|
|
)
|
|
|
|
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: getIssueId(e.$lookup?.space as Team, e),
|
|
|
|
icon: tracker.icon.TrackerApplication,
|
|
|
|
component: IssueItem
|
|
|
|
}))
|
|
|
|
}
|
2022-06-27 15:56:24 +00:00
|
|
|
|
2022-07-01 15:24:58 +00:00
|
|
|
async function editWorkflowStatuses (team: Team | undefined): Promise<void> {
|
|
|
|
if (team !== undefined) {
|
|
|
|
showPopup(Statuses, { teamId: team._id, teamClass: team._class }, 'float')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-31 08:32:42 +00:00
|
|
|
export default async (): Promise<Resources> => ({
|
|
|
|
component: {
|
|
|
|
NopeComponent,
|
2022-06-28 06:53:39 +00:00
|
|
|
Issues,
|
2022-03-31 08:32:42 +00:00
|
|
|
Active,
|
|
|
|
Backlog,
|
|
|
|
Inbox,
|
|
|
|
MyIssues,
|
|
|
|
Projects,
|
|
|
|
Views,
|
|
|
|
IssuePresenter,
|
2022-04-27 08:18:59 +00:00
|
|
|
ProjectPresenter,
|
2022-05-18 04:04:54 +00:00
|
|
|
ProjectTitlePresenter,
|
2022-04-08 18:05:49 +00:00
|
|
|
TitlePresenter,
|
|
|
|
ModificationDatePresenter,
|
2022-04-12 17:04:29 +00:00
|
|
|
PriorityPresenter,
|
2022-05-04 15:08:24 +00:00
|
|
|
PriorityEditor,
|
2022-05-16 10:38:51 +00:00
|
|
|
ProjectEditor,
|
2022-04-12 17:41:32 +00:00
|
|
|
StatusPresenter,
|
2022-05-04 13:46:34 +00:00
|
|
|
StatusEditor,
|
2022-04-12 18:12:59 +00:00
|
|
|
AssigneePresenter,
|
2022-04-14 06:07:07 +00:00
|
|
|
DueDatePresenter,
|
2022-03-31 08:32:42 +00:00
|
|
|
EditIssue,
|
2022-04-20 06:06:05 +00:00
|
|
|
NewIssueHeader,
|
2022-05-18 05:35:34 +00:00
|
|
|
IconPresenter,
|
|
|
|
LeadPresenter,
|
|
|
|
TargetDatePresenter,
|
|
|
|
ProjectMembersPresenter,
|
2022-05-19 10:37:14 +00:00
|
|
|
ProjectStatusPresenter,
|
2022-06-09 14:54:54 +00:00
|
|
|
ProjectStatusEditor,
|
2022-05-23 07:24:15 +00:00
|
|
|
SetDueDateActionPopup,
|
2022-06-06 13:44:21 +00:00
|
|
|
SetParentIssueActionPopup,
|
2022-06-08 14:03:26 +00:00
|
|
|
EditProject,
|
|
|
|
IssuesView,
|
2022-06-09 14:49:10 +00:00
|
|
|
ListView,
|
2022-06-15 04:59:43 +00:00
|
|
|
KanbanView,
|
2022-06-24 06:05:05 +00:00
|
|
|
TeamProjects,
|
|
|
|
Roadmap,
|
2022-06-24 12:36:08 +00:00
|
|
|
IssuePreview,
|
2022-07-01 06:14:31 +00:00
|
|
|
RelationsPopup,
|
2022-08-03 07:05:19 +00:00
|
|
|
CreateIssue,
|
|
|
|
Sprints,
|
|
|
|
SprintPresenter,
|
|
|
|
SprintStatusPresenter,
|
|
|
|
SprintTitlePresenter,
|
|
|
|
SprintSelector,
|
2022-08-16 10:19:33 +00:00
|
|
|
SprintEditor,
|
|
|
|
ReportedTimeEditor,
|
|
|
|
TimeSpendReport,
|
2022-08-22 18:55:45 +00:00
|
|
|
EstimationEditor,
|
|
|
|
SubIssuesSelector,
|
|
|
|
GrowPresenter
|
2022-06-06 13:44:21 +00:00
|
|
|
},
|
2022-06-10 15:48:14 +00:00
|
|
|
completion: {
|
|
|
|
IssueQuery: async (client: Client, query: string) => await queryIssue(tracker.class.Issue, client, query)
|
2022-06-24 07:46:53 +00:00
|
|
|
},
|
|
|
|
function: {
|
2022-06-25 17:32:31 +00:00
|
|
|
IssueTitleProvider: getIssueTitle
|
2022-06-27 15:56:24 +00:00
|
|
|
},
|
|
|
|
actionImpl: {
|
2022-07-01 15:24:58 +00:00
|
|
|
CopyToClipboard: copyToClipboard,
|
|
|
|
EditWorkflowStatuses: editWorkflowStatuses
|
2022-06-30 03:46:46 +00:00
|
|
|
},
|
|
|
|
resolver: {
|
|
|
|
Location: resolveLocation
|
2022-03-31 08:32:42 +00:00
|
|
|
}
|
|
|
|
})
|