Tracker: add priority to sub-issues (#2054)

Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
Sergei Ogorelkov 2022-06-15 10:01:21 +07:00 committed by GitHub
parent 51b19dece2
commit 538f4cc61d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 27 deletions

View File

@ -33,11 +33,11 @@
import tracker from '../plugin'
import AssigneeEditor from './issues/AssigneeEditor.svelte'
import ParentIssue from './issues/ParentIssue.svelte'
import StatusEditor from './issues/StatusEditor.svelte'
import PrioritySelector from './PrioritySelector.svelte'
import SetParentIssueActionPopup from './SetParentIssueActionPopup.svelte'
import ProjectSelector from './ProjectSelector.svelte'
import SetDueDateActionPopup from './SetDueDateActionPopup.svelte'
import SetParentIssueActionPopup from './SetParentIssueActionPopup.svelte'
import StatusEditor from './issues/StatusEditor.svelte'
import PriorityEditor from './issues/PriorityEditor.svelte'
export let space: Ref<Team>
export let status: Ref<IssueStatus> | undefined = undefined
@ -194,14 +194,6 @@
)
}
const handlePriorityChanged = (newPriority: IssuePriority | undefined) => {
if (newPriority === undefined) {
return
}
object.priority = newPriority
}
const handleProjectIdChanged = (projectId: Ref<Project> | null | undefined) => {
if (projectId === undefined) {
return
@ -265,7 +257,16 @@
shouldShowLabel={true}
on:change={({ detail }) => (object.status = detail)}
/>
<PrioritySelector priority={object.priority} onPriorityChange={handlePriorityChanged} />
<PriorityEditor
value={object}
shouldShowLabel
isEditable
kind="no-border"
size="small"
justify="center"
width=""
on:change={({ detail }) => (object.priority = detail)}
/>
<AssigneeEditor
value={object}
size="small"

View File

@ -13,6 +13,8 @@
// limitations under the License.
-->
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { AttachedData } from '@anticrm/core'
import { Issue, IssuePriority } from '@anticrm/tracker'
import { getClient } from '@anticrm/presentation'
import { tooltip } from '@anticrm/ui'
@ -20,7 +22,7 @@
import tracker from '../../plugin'
import PrioritySelector from '../PrioritySelector.svelte'
export let value: Issue
export let value: Issue | AttachedData<Issue>
export let isEditable: boolean = true
export let shouldShowLabel: boolean = false
@ -30,21 +32,18 @@
export let width: string | undefined = '100%'
const client = getClient()
const dispatch = createEventDispatcher()
const handlePriorityChanged = async (newPriority: IssuePriority | undefined) => {
if (!isEditable || newPriority === undefined || value.priority === newPriority) {
return
}
await client.updateCollection(
value._class,
value.space,
value._id,
value.attachedTo,
value.attachedToClass,
value.collection,
{ priority: newPriority }
)
dispatch('change', newPriority)
if ('_id' in value) {
await client.update(value, { priority: newPriority })
}
}
</script>

View File

@ -22,6 +22,7 @@
import tracker from '../../../plugin'
import AssigneeEditor from '../AssigneeEditor.svelte'
import StatusEditor from '../StatusEditor.svelte'
import PriorityEditor from '../PriorityEditor.svelte'
export let parentIssue: Issue
export let issueStatuses: WithLookup<IssueStatus>[]
@ -133,6 +134,16 @@
<div class="mt-4 flex-between">
<div class="buttons-group xsmall-gap">
<!-- <SpaceSelector _class={tracker.class.Team} label={tracker.string.Team} bind:space /> -->
<PriorityEditor
value={newIssue}
shouldShowLabel
isEditable
kind="no-border"
size="small"
justify="center"
width=""
on:change={({ detail }) => (newIssue.priority = detail)}
/>
<AssigneeEditor
value={newIssue}
size="small"

View File

@ -26,6 +26,7 @@
import AssigneeEditor from '../AssigneeEditor.svelte'
import DueDateEditor from '../DueDateEditor.svelte'
import StatusEditor from '../StatusEditor.svelte'
import PriorityEditor from '../PriorityEditor.svelte'
export let issues: Issue[]
export let issueStatuses: WithLookup<IssueStatus>[]
@ -92,6 +93,9 @@
<div class="draggable-mark"><Circles /></div>
</div>
<div class="flex-center ml-6 clear-mins">
<div class="mr-2">
<PriorityEditor value={issue} isEditable kind="transparent" justify="center" width="" />
</div>
<span class="flex-no-shrink text" on:click={() => openIssue(issue)}>
{getIssueId(currentTeam, issue)}
</span>

View File

@ -15,7 +15,7 @@ rush docker:build
To purge content of sanity workspace following command could be used.
```bash
./restore-workdspace.sh
./restore-workspace.sh
```
## Prepare local dev enviornment
@ -55,7 +55,7 @@ rushx dev-debug -g test-name # for local setup
```bash
rushx codegen # for docker setup
ruwhx dev-codegen # for local setup
rushx dev-codegen # for local setup
```
## Test authoring.

View File

@ -18,15 +18,17 @@ test('create-issue-and-sub-issue', async ({ page }) => {
await page.click('button:has-text("Save issue")')
await page.click('.antiNav-element__dropbox :text("Issues")')
await page.click('.listGrid :has-text("test-issue") span')
await page.click('.antiList__row :has-text("test-issue") .issuePresenter')
await page.click('#add-sub-issue')
await page.click('[placeholder="Issue\\ title"]')
await page.fill('[placeholder="Issue\\ title"]', 'sub-issue')
await page.fill('.ProseMirror', 'sub-issue description')
await page.click('#status-editor')
await page.click('button:has-text("In Progress")')
await page.click('button:has-text("Assignee")')
await page.click('.selectPopup button:has-text("In Progress")')
await page.click('.button:has-text("Assignee")')
await page.click('.selectPopup button:has-text("John Appleseed")')
await page.click('button:has-text("No priority")')
await page.click('.selectPopup button:has-text("High")')
await page.click('button:has-text("Save")')
await page.click('span.name:text("sub-issue")')
})