Skip to content

Tracker: add priority to sub-issues #2054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions plugins/tracker-resources/src/components/CreateIssue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
// 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'
import type { ButtonKind, ButtonSize } from '@anticrm/ui'
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

Expand All @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>[]
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>[]
Expand Down Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions tests/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions tests/sanity/tests/tracker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")')
})