Minor fixes (#2249)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-08-09 13:40:21 +07:00 committed by GitHub
parent 122cf92165
commit 14181885a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 55 additions and 13 deletions

View File

@ -35,6 +35,11 @@
component?: AnySvelteComponent
props?: Record<string, any>
category?: {
icon?: Asset
label: IntlString
}
}
export let placeholder: IntlString | undefined = undefined
@ -151,6 +156,19 @@
</div>
</button>
</svelte:fragment>
<svelte:fragment slot="category" let:item={row}>
{@const obj = filteredObjects[row]}
{#if obj.category && ((row === 0 && obj.category.label !== undefined) || obj.category.label !== filteredObjects[row - 1]?.category?.label)}
<div class="flex p-1">
<div class="icon mr-2">
{#if obj.category.icon}
<Icon icon={obj.category.icon} size={'small'} />
{/if}
</div>
<Label label={obj.category.label} />
</div>
{/if}
</svelte:fragment>
</ListView>
</div>
</div>

View File

@ -41,13 +41,14 @@
import SetDueDateActionPopup from './SetDueDateActionPopup.svelte'
import SetParentIssueActionPopup from './SetParentIssueActionPopup.svelte'
import SprintSelector from './sprints/SprintSelector.svelte'
import { activeProject, activeSprint } from '../issues'
export let space: Ref<Team>
export let status: Ref<IssueStatus> | undefined = undefined
export let priority: IssuePriority = IssuePriority.NoPriority
export let assignee: Ref<Employee> | null = null
export let project: Ref<Project> | null = null
export let sprint: Ref<Sprint> | null = null
export let project: Ref<Project> | null = $activeProject ?? null
export let sprint: Ref<Sprint> | null = $activeSprint ?? null
let issueStatuses: WithLookup<IssueStatus>[] | undefined
export let parentIssue: Issue | undefined
@ -140,6 +141,7 @@
description: object.description,
assignee: object.assignee,
project: object.project,
sprint: object.sprint,
number: (incResult as any).object.sequence,
status: object.status,
priority: object.priority,

View File

@ -7,6 +7,8 @@
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
@ -22,6 +24,12 @@
}
})
}
$: $activeProject = project?._id
onDestroy(() => {
$activeProject = undefined
})
</script>
<IssuesView query={{ project: project._id, space: project.space }} label={project.label}>

View File

@ -4,6 +4,8 @@
import { Sprint } from '@anticrm/tracker'
import { Button, EditBox, Icon, showPopup } from '@anticrm/ui'
import { DocAttributeBar } from '@anticrm/view-resources'
import { onDestroy } from 'svelte'
import { activeSprint } from '../../issues'
import tracker from '../../plugin'
import Expanded from '../icons/Expanded.svelte'
import IssuesView from '../issues/IssuesView.svelte'
@ -24,6 +26,12 @@
}
})
}
$: $activeSprint = sprint?._id
onDestroy(() => {
$activeSprint = undefined
})
</script>
<IssuesView query={{ sprint: sprint._id, space: sprint.space }} label={sprint.label}>

View File

@ -34,7 +34,7 @@
const resultSprintsQuery = createQuery()
const sprintOptions: FindOptions<Sprint> = {
sort: { modifiedOn: SortingOrder.Descending },
sort: { startDate: SortingOrder.Descending },
limit: ENTRIES_LIMIT,
lookup: { lead: contact.class.Employee }
}

View File

@ -20,6 +20,7 @@
import type { ButtonKind, ButtonSize } from '@anticrm/ui'
import { Button, ButtonShape, eventToHTMLElement, SelectPopup, showPopup } from '@anticrm/ui'
import tracker from '../../plugin'
import { sprintStatusAssets } from '../../types'
export let value: Ref<Sprint> | null | undefined
export let shouldShowLabel: boolean = true
@ -45,7 +46,7 @@
rawSprints = res
},
{
sort: { modifiedOn: SortingOrder.Ascending }
sort: { startDate: SortingOrder.Descending }
}
)
@ -76,7 +77,8 @@
...rawSprints.map((p) => ({
id: p._id,
icon: tracker.icon.Sprint,
text: p.label
text: p.label,
category: sprintStatusAssets[p.status]
}))
]

View File

@ -1,10 +1,14 @@
import { Doc, Ref, TxOperations } from '@anticrm/core'
import { getClient } from '@anticrm/presentation'
import { Issue, Team, trackerId } from '@anticrm/tracker'
import { Issue, Project, Sprint, Team, trackerId } from '@anticrm/tracker'
import { getCurrentLocation, getPanelURI, Location } from '@anticrm/ui'
import { workbenchId } from '@anticrm/workbench'
import { writable } from 'svelte/store'
import tracker from './plugin'
export const activeProject = writable<Ref<Project> | undefined>(undefined)
export const activeSprint = writable<Ref<Sprint> | undefined>(undefined)
export function getIssueId (team: Team, issue: Issue): string {
return `${team.identifier}-${issue.number}`
}

View File

@ -156,7 +156,7 @@
}
function hasNested (type: KeyFilter): boolean {
const targetClass = (hierarchy.getAttribute(_class, type.key).type as RefTo<Doc>).to
const targetClass = (hierarchy.getAttribute(type._class, type.key).type as RefTo<Doc>).to
const clazz = hierarchy.getClass(targetClass)
return hierarchy.hasMixin(clazz, view.mixin.ClassFilters)
}

View File

@ -32,14 +32,14 @@
const hierarchy = client.getHierarchy()
const tkey = '$lookup.' + filter.key.key
const key = { key: tkey }
const lookup = buildConfigLookup(hierarchy, _class, [tkey])
const promise = getPresenter(client, _class, key, key, lookup)
const lookup = buildConfigLookup(hierarchy, filter.key._class, [tkey])
const promise = getPresenter(client, filter.key._class, key, key, lookup)
filter.modes = filter.modes === undefined ? [view.filter.FilterObjectIn, view.filter.FilterObjectNin] : filter.modes
filter.mode = filter.mode === undefined ? filter.modes[0] : filter.mode
let values: (Doc | undefined | null)[] = []
let objectsPromise: Promise<FindResult<Doc>> | undefined
$: targetClass = (hierarchy.getAttribute(_class, filter.key.key).type as RefTo<Doc>).to
$: targetClass = (hierarchy.getAttribute(filter.key._class, filter.key.key).type as RefTo<Doc>).to
$: clazz = hierarchy.getClass(targetClass)
const targets = new Map<any, number>()
$: isState = clazz._id === task.class.State ?? false
@ -69,7 +69,7 @@
await objectsPromise
}
targets.clear()
const baseObjects = await client.findAll(_class, {}, { projection: { [filter.key.key]: 1 } })
const baseObjects = await client.findAll(filter.key._class, {}, { projection: { [filter.key.key]: 1 } })
for (const object of baseObjects) {
const value = getObjectValue(filter.key.key, object) ?? undefined
targets.set(value, (targets.get(value) ?? 0) + 1)

View File

@ -29,11 +29,11 @@ test.describe('project tests', () => {
await page.click('button:has-text("New issue")')
await page.fill('[placeholder="Issue\\ title"]', 'issue')
await page.click('form button:has-text("Project")')
await page.click(`.popup button:has-text("${prjId}")`)
await page.click(`.selectPopup button:has-text("${prjId}")`)
await page.click('form button:has-text("Save issue")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`.gridElement button:has-text("${prjId}")`)
await page.click('.popup button:has-text("No project")')
await page.click('.selectPopup button:has-text("No project")')
})
test('create-project-with-status', async ({ page }) => {