Tracker: fix issue priority view for "Activity" (#1635)

Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
Sergei Ogorelkov
2022-05-04 22:08:24 +07:00
committed by GitHub
parent e4e2af93dc
commit 5d84e38c79
10 changed files with 99 additions and 51 deletions
@@ -27,7 +27,7 @@
import CreateIssue from '../CreateIssue.svelte'
import AssigneePresenter from './AssigneePresenter.svelte'
import IssuePresenter from './IssuePresenter.svelte'
import PriorityPresenter from './PriorityPresenter.svelte'
import PriorityEditor from './PriorityEditor.svelte'
export let currentSpace: Ref<Team>
export let baseMenuClass: Ref<Class<Doc>> | undefined = undefined
@@ -161,7 +161,7 @@
{object.title}
</span>
<div class="flex gap-2 mt-2 mb-2">
<PriorityPresenter value={issue} {currentSpace} isEditable={true} />
<PriorityEditor value={issue} {currentSpace} isEditable={true} />
</div>
</div>
</svelte:fragment>
@@ -24,7 +24,7 @@
import { createEventDispatcher, onMount } from 'svelte'
import tracker from '../../plugin'
import IssuePresenter from './IssuePresenter.svelte'
import PriorityPresenter from './PriorityPresenter.svelte'
import PriorityEditor from './PriorityEditor.svelte'
import StatusEditor from './StatusEditor.svelte'
export let _id: Ref<Issue>
@@ -174,7 +174,7 @@
<span class="label w-24">
<Label label={tracker.string.Priority} />
</span>
<PriorityPresenter value={issue} currentSpace={currentTeam._id} shouldShowLabel />
<PriorityEditor value={issue} currentSpace={currentTeam._id} shouldShowLabel />
</div>
<div class="flex-row-center mb-4">
@@ -349,7 +349,7 @@
{employees}
categories={displayedCategories}
itemsConfig={[
{ key: '', presenter: tracker.component.PriorityPresenter, props: { currentSpace } },
{ key: '', presenter: tracker.component.PriorityEditor, props: { currentSpace } },
{ key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } },
{ key: '', presenter: tracker.component.StatusEditor, props: { currentSpace, statuses } },
{ key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true } },
@@ -0,0 +1,59 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
//
// 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.
-->
<script lang="ts">
import { Ref } from '@anticrm/core'
import { Issue, IssuePriority, Team } from '@anticrm/tracker'
import { getClient } from '@anticrm/presentation'
import { Tooltip } from '@anticrm/ui'
import tracker from '../../plugin'
import PrioritySelector from '../PrioritySelector.svelte'
export let value: Issue
export let currentSpace: Ref<Team> | undefined = undefined
export let isEditable: boolean = true
export let shouldShowLabel: boolean = false
const client = getClient()
const handlePriorityChanged = async (newPriority: IssuePriority | undefined) => {
if (!isEditable || newPriority === undefined) {
return
}
const currentIssue = await client.findOne(tracker.class.Issue, { space: currentSpace, _id: value._id })
if (currentIssue === undefined) {
return
}
await client.update(currentIssue, { priority: newPriority })
}
</script>
{#if value}
{#if isEditable}
<Tooltip direction={'bottom'} label={tracker.string.SetPriority}>
<PrioritySelector
kind={'icon'}
{isEditable}
{shouldShowLabel}
priority={value.priority}
onPriorityChange={handlePriorityChanged}
/>
</Tooltip>
{:else}
<PrioritySelector kind={'icon'} {isEditable} {shouldShowLabel} priority={value.priority} />
{/if}
{/if}
@@ -13,47 +13,15 @@
// limitations under the License.
-->
<script lang="ts">
import { Ref } from '@anticrm/core'
import { Issue, IssuePriority, Team } from '@anticrm/tracker'
import { getClient } from '@anticrm/presentation'
import { Tooltip } from '@anticrm/ui'
import tracker from '../../plugin'
import PrioritySelector from '../PrioritySelector.svelte'
import { IssuePriority } from '@anticrm/tracker'
import { Label } from '@anticrm/ui'
import { issuePriorities } from '../../utils'
export let value: Issue
export let currentSpace: Ref<Team> | undefined = undefined
export let isEditable: boolean = true
export let shouldShowLabel: boolean = false
const client = getClient()
const handlePriorityChanged = async (newPriority: IssuePriority | undefined) => {
if (!isEditable || newPriority === undefined) {
return
}
const currentIssue = await client.findOne(tracker.class.Issue, { space: currentSpace, _id: value._id })
if (currentIssue === undefined) {
return
}
await client.update(currentIssue, { priority: newPriority })
}
export let value: IssuePriority | undefined
</script>
{#if value}
{#if isEditable}
<Tooltip direction={'bottom'} label={tracker.string.SetPriority}>
<PrioritySelector
kind={'icon'}
{isEditable}
{shouldShowLabel}
priority={value.priority}
onPriorityChange={handlePriorityChanged}
/>
</Tooltip>
{:else}
<PrioritySelector kind={'icon'} {isEditable} {shouldShowLabel} priority={value.priority} />
{/if}
<span class="overflow-label">
<Label label={issuePriorities[value].label} />
</span>
{/if}
+2
View File
@@ -29,6 +29,7 @@ import Views from './components/views/Views.svelte'
import IssuePresenter from './components/issues/IssuePresenter.svelte'
import TitlePresenter from './components/issues/TitlePresenter.svelte'
import PriorityPresenter from './components/issues/PriorityPresenter.svelte'
import PriorityEditor from './components/issues/PriorityEditor.svelte'
import StatusPresenter from './components/issues/StatusPresenter.svelte'
import StatusEditor from './components/issues/StatusEditor.svelte'
import DueDatePresenter from './components/issues/DueDatePresenter.svelte'
@@ -55,6 +56,7 @@ export default async (): Promise<Resources> => ({
TitlePresenter,
ModificationDatePresenter,
PriorityPresenter,
PriorityEditor,
StatusPresenter,
StatusEditor,
AssigneePresenter,
+1
View File
@@ -136,6 +136,7 @@ export default mergeIds(trackerId, tracker, {
TitlePresenter: '' as AnyComponent,
ModificationDatePresenter: '' as AnyComponent,
PriorityPresenter: '' as AnyComponent,
PriorityEditor: '' as AnyComponent,
StatusPresenter: '' as AnyComponent,
StatusEditor: '' as AnyComponent,
AssigneePresenter: '' as AnyComponent,
+1 -1
View File
@@ -95,7 +95,7 @@ export const issuesSortOrderMap: Record<IssuesOrderByKeys, SortingOrder> = {
export const issuesGroupEditorMap: Record<'status' | 'priority', AnyComponent | undefined> = {
status: tracker.component.StatusEditor,
priority: tracker.component.PriorityPresenter
priority: tracker.component.PriorityEditor
}
export const getIssuesModificationDatePeriodTime = (period: IssuesDateModificationPeriod | null): number => {