Tracker fixes (#2255)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-08-23 01:55:45 +07:00
committed by GitHub
parent ccd2048ad0
commit f1fad745bd
23 changed files with 202 additions and 102 deletions
@@ -4,15 +4,16 @@
import { Project } from '@anticrm/tracker'
import { Button, EditBox, Icon, showPopup } from '@anticrm/ui'
import { DocAttributeBar } from '@anticrm/view-resources'
import { createEventDispatcher, onDestroy } from 'svelte'
import { activeProject } from '../../issues'
import tracker from '../../plugin'
import IssuesView from '../issues/IssuesView.svelte'
import ProjectPopup from './ProjectPopup.svelte'
import { activeProject } from '../../issues'
import { onDestroy } from 'svelte'
export let project: Project
const client = getClient()
const dispatch = createEventDispatcher()
async function change (field: string, value: any) {
await client.update(project, { [field]: value })
@@ -21,6 +22,7 @@
showPopup(ProjectPopup, { _class: tracker.class.Project }, evt.target as HTMLElement, (value) => {
if (value != null) {
project = value
dispatch('project', project._id)
}
})
}
@@ -33,7 +33,7 @@
export let justify: 'left' | 'center' = 'left'
export let width: string | undefined = '100%'
export let onlyIcon: boolean = false
export let groupBy: string | undefined
export let groupBy: string | undefined = undefined
const client = getClient()
@@ -17,7 +17,7 @@
import { IntlString } from '@anticrm/platform'
import { createQuery } from '@anticrm/presentation'
import { Project } from '@anticrm/tracker'
import { closePopup, closeTooltip, location } from '@anticrm/ui'
import { closePopup, closeTooltip, getCurrentLocation, location, navigate } from '@anticrm/ui'
import { onDestroy } from 'svelte'
import tracker from '../../plugin'
import { ProjectsViewMode } from '../../utils'
@@ -43,10 +43,8 @@
const projectQuery = createQuery()
$: if (projectId !== undefined) {
console.log('call query for', projectId)
projectQuery.query(tracker.class.Project, { _id: projectId }, (result) => {
project = result.shift()
console.log('recieve result for', projectId, project)
})
} else {
projectQuery.unsubscribe()
@@ -55,7 +53,14 @@
</script>
{#if project}
<EditProject {project} />
<EditProject
{project}
on:project={(evt) => {
const loc = getCurrentLocation()
loc.path[5] = evt.detail
navigate(loc)
}}
/>
{:else}
<ProjectBrowser {label} {query} {search} {mode} />
{/if}