mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Tracker: fix issue status view for "Activity" (#1632)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
parent
916a8203cb
commit
113161e092
@ -300,6 +300,10 @@ export function createModel (builder: Builder): void {
|
|||||||
const boardId = 'board'
|
const boardId = 'board'
|
||||||
const projectsId = 'projects'
|
const projectsId = 'projects'
|
||||||
|
|
||||||
|
builder.mixin(tracker.class.IssueStatus, core.class.Class, view.mixin.AttributePresenter, {
|
||||||
|
presenter: tracker.component.StatusPresenter
|
||||||
|
})
|
||||||
|
|
||||||
builder.createDoc(
|
builder.createDoc(
|
||||||
workbench.class.Application,
|
workbench.class.Application,
|
||||||
core.space.Model,
|
core.space.Model,
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
import tracker from '../../plugin'
|
import tracker from '../../plugin'
|
||||||
import IssuePresenter from './IssuePresenter.svelte'
|
import IssuePresenter from './IssuePresenter.svelte'
|
||||||
import PriorityPresenter from './PriorityPresenter.svelte'
|
import PriorityPresenter from './PriorityPresenter.svelte'
|
||||||
import StatusPresenter from './StatusPresenter.svelte'
|
import StatusEditor from './StatusEditor.svelte'
|
||||||
|
|
||||||
export let _id: Ref<Issue>
|
export let _id: Ref<Issue>
|
||||||
export let _class: Ref<Class<Issue>>
|
export let _class: Ref<Class<Issue>>
|
||||||
@ -167,7 +167,7 @@
|
|||||||
<span class="label w-24">
|
<span class="label w-24">
|
||||||
<Label label={tracker.string.Status} />
|
<Label label={tracker.string.Status} />
|
||||||
</span>
|
</span>
|
||||||
<StatusPresenter value={issue} statuses={issueStatuses} currentSpace={currentTeam._id} shouldShowLabel />
|
<StatusEditor value={issue} statuses={issueStatuses} currentSpace={currentTeam._id} shouldShowLabel />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-row-center mb-4">
|
<div class="flex-row-center mb-4">
|
||||||
|
@ -351,7 +351,7 @@
|
|||||||
itemsConfig={[
|
itemsConfig={[
|
||||||
{ key: '', presenter: tracker.component.PriorityPresenter, props: { currentSpace } },
|
{ key: '', presenter: tracker.component.PriorityPresenter, props: { currentSpace } },
|
||||||
{ key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } },
|
{ key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } },
|
||||||
{ key: '', presenter: tracker.component.StatusPresenter, props: { currentSpace, statuses } },
|
{ key: '', presenter: tracker.component.StatusEditor, props: { currentSpace, statuses } },
|
||||||
{ key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true } },
|
{ key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true } },
|
||||||
{ key: '', presenter: tracker.component.DueDatePresenter, props: { currentSpace } },
|
{ key: '', presenter: tracker.component.DueDatePresenter, props: { currentSpace } },
|
||||||
{ key: 'modifiedOn', presenter: tracker.component.ModificationDatePresenter },
|
{ key: 'modifiedOn', presenter: tracker.component.ModificationDatePresenter },
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
import { buildModel, getObjectPresenter, LoadingProps, Menu } from '@anticrm/view-resources'
|
import { buildModel, getObjectPresenter, LoadingProps, Menu } from '@anticrm/view-resources'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import tracker from '../../plugin'
|
import tracker from '../../plugin'
|
||||||
import { IssuesGroupByKeys, issuesGroupPresenterMap, IssuesOrderByKeys, issuesSortOrderMap } from '../../utils'
|
import { IssuesGroupByKeys, issuesGroupEditorMap, IssuesOrderByKeys, issuesSortOrderMap } from '../../utils'
|
||||||
import CreateIssue from '../CreateIssue.svelte'
|
import CreateIssue from '../CreateIssue.svelte'
|
||||||
|
|
||||||
export let _class: Ref<Class<Doc>>
|
export let _class: Ref<Class<Doc>>
|
||||||
@ -64,8 +64,7 @@
|
|||||||
|
|
||||||
$: combinedGroupedIssues = Object.values(groupedIssues).flat(1)
|
$: combinedGroupedIssues = Object.values(groupedIssues).flat(1)
|
||||||
$: options = { ...baseOptions, sort: { [orderBy]: issuesSortOrderMap[orderBy] } } as FindOptions<Issue>
|
$: options = { ...baseOptions, sort: { [orderBy]: issuesSortOrderMap[orderBy] } } as FindOptions<Issue>
|
||||||
$: headerComponent =
|
$: headerComponent = groupByKey === undefined || groupByKey === 'assignee' ? null : issuesGroupEditorMap[groupByKey]
|
||||||
groupByKey === undefined || groupByKey === 'assignee' ? null : issuesGroupPresenterMap[groupByKey]
|
|
||||||
$: selectedObjectIdsSet = new Set<Ref<Doc>>(selectedObjectIds.map((it) => it._id))
|
$: selectedObjectIdsSet = new Set<Ref<Doc>>(selectedObjectIds.map((it) => it._id))
|
||||||
$: objectRefs.length = combinedGroupedIssues.length
|
$: objectRefs.length = combinedGroupedIssues.length
|
||||||
|
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
<!--
|
||||||
|
// 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, WithLookup } from '@anticrm/core'
|
||||||
|
import { Issue, IssueStatus, Team } from '@anticrm/tracker'
|
||||||
|
import { getClient } from '@anticrm/presentation'
|
||||||
|
import { Tooltip } from '@anticrm/ui'
|
||||||
|
import tracker from '../../plugin'
|
||||||
|
import StatusSelector from '../StatusSelector.svelte'
|
||||||
|
|
||||||
|
export let value: Issue
|
||||||
|
export let statuses: WithLookup<IssueStatus>[]
|
||||||
|
export let currentSpace: Ref<Team> | undefined = undefined
|
||||||
|
export let isEditable: boolean = true
|
||||||
|
export let shouldShowLabel: boolean = false
|
||||||
|
|
||||||
|
const client = getClient()
|
||||||
|
|
||||||
|
const handleStatusChanged = async (newStatus: Ref<IssueStatus> | undefined) => {
|
||||||
|
if (!isEditable || newStatus === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentIssue = await client.findOne(tracker.class.Issue, { space: currentSpace, _id: value._id })
|
||||||
|
|
||||||
|
if (currentIssue === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await client.update(currentIssue, { status: newStatus })
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if value}
|
||||||
|
{#if isEditable}
|
||||||
|
<Tooltip direction={'bottom'} label={tracker.string.SetStatus}>
|
||||||
|
<StatusSelector
|
||||||
|
kind={'icon'}
|
||||||
|
{isEditable}
|
||||||
|
{shouldShowLabel}
|
||||||
|
{statuses}
|
||||||
|
selectedStatusId={value.status}
|
||||||
|
onStatusChange={handleStatusChanged}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
{:else}
|
||||||
|
<StatusSelector
|
||||||
|
kind={'icon'}
|
||||||
|
{isEditable}
|
||||||
|
{shouldShowLabel}
|
||||||
|
{statuses}
|
||||||
|
selectedStatusId={value.status}
|
||||||
|
onStatusChange={handleStatusChanged}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
@ -13,56 +13,13 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Ref, WithLookup } from '@anticrm/core'
|
import { IssueStatus } from '@anticrm/tracker'
|
||||||
import { Issue, IssueStatus, Team } from '@anticrm/tracker'
|
|
||||||
import { getClient } from '@anticrm/presentation'
|
|
||||||
import { Tooltip } from '@anticrm/ui'
|
|
||||||
import tracker from '../../plugin'
|
|
||||||
import StatusSelector from '../StatusSelector.svelte'
|
|
||||||
|
|
||||||
export let value: Issue
|
export let value: IssueStatus | undefined
|
||||||
export let statuses: WithLookup<IssueStatus>[]
|
|
||||||
export let currentSpace: Ref<Team> | undefined = undefined
|
|
||||||
export let isEditable: boolean = true
|
|
||||||
export let shouldShowLabel: boolean = false
|
|
||||||
|
|
||||||
const client = getClient()
|
|
||||||
|
|
||||||
const handleStatusChanged = async (newStatus: Ref<IssueStatus> | undefined) => {
|
|
||||||
if (!isEditable || newStatus === undefined) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentIssue = await client.findOne(tracker.class.Issue, { space: currentSpace, _id: value._id })
|
|
||||||
|
|
||||||
if (currentIssue === undefined) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await client.update(currentIssue, { status: newStatus })
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if value}
|
{#if value}
|
||||||
{#if isEditable}
|
<span class="overflow-label">
|
||||||
<Tooltip direction={'bottom'} label={tracker.string.SetStatus}>
|
{value.name}
|
||||||
<StatusSelector
|
</span>
|
||||||
kind={'icon'}
|
|
||||||
{isEditable}
|
|
||||||
{shouldShowLabel}
|
|
||||||
{statuses}
|
|
||||||
selectedStatusId={value.status}
|
|
||||||
onStatusChange={handleStatusChanged}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
{:else}
|
|
||||||
<StatusSelector
|
|
||||||
kind={'icon'}
|
|
||||||
{isEditable}
|
|
||||||
{shouldShowLabel}
|
|
||||||
{statuses}
|
|
||||||
selectedStatusId={value.status}
|
|
||||||
onStatusChange={handleStatusChanged}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -30,6 +30,7 @@ import IssuePresenter from './components/issues/IssuePresenter.svelte'
|
|||||||
import TitlePresenter from './components/issues/TitlePresenter.svelte'
|
import TitlePresenter from './components/issues/TitlePresenter.svelte'
|
||||||
import PriorityPresenter from './components/issues/PriorityPresenter.svelte'
|
import PriorityPresenter from './components/issues/PriorityPresenter.svelte'
|
||||||
import StatusPresenter from './components/issues/StatusPresenter.svelte'
|
import StatusPresenter from './components/issues/StatusPresenter.svelte'
|
||||||
|
import StatusEditor from './components/issues/StatusEditor.svelte'
|
||||||
import DueDatePresenter from './components/issues/DueDatePresenter.svelte'
|
import DueDatePresenter from './components/issues/DueDatePresenter.svelte'
|
||||||
import AssigneePresenter from './components/issues/AssigneePresenter.svelte'
|
import AssigneePresenter from './components/issues/AssigneePresenter.svelte'
|
||||||
import ViewOptionsPopup from './components/issues/ViewOptionsPopup.svelte'
|
import ViewOptionsPopup from './components/issues/ViewOptionsPopup.svelte'
|
||||||
@ -55,6 +56,7 @@ export default async (): Promise<Resources> => ({
|
|||||||
ModificationDatePresenter,
|
ModificationDatePresenter,
|
||||||
PriorityPresenter,
|
PriorityPresenter,
|
||||||
StatusPresenter,
|
StatusPresenter,
|
||||||
|
StatusEditor,
|
||||||
AssigneePresenter,
|
AssigneePresenter,
|
||||||
DueDatePresenter,
|
DueDatePresenter,
|
||||||
EditIssue,
|
EditIssue,
|
||||||
|
@ -137,6 +137,7 @@ export default mergeIds(trackerId, tracker, {
|
|||||||
ModificationDatePresenter: '' as AnyComponent,
|
ModificationDatePresenter: '' as AnyComponent,
|
||||||
PriorityPresenter: '' as AnyComponent,
|
PriorityPresenter: '' as AnyComponent,
|
||||||
StatusPresenter: '' as AnyComponent,
|
StatusPresenter: '' as AnyComponent,
|
||||||
|
StatusEditor: '' as AnyComponent,
|
||||||
AssigneePresenter: '' as AnyComponent,
|
AssigneePresenter: '' as AnyComponent,
|
||||||
DueDatePresenter: '' as AnyComponent,
|
DueDatePresenter: '' as AnyComponent,
|
||||||
EditIssue: '' as AnyComponent,
|
EditIssue: '' as AnyComponent,
|
||||||
|
@ -93,8 +93,8 @@ export const issuesSortOrderMap: Record<IssuesOrderByKeys, SortingOrder> = {
|
|||||||
dueDate: SortingOrder.Descending
|
dueDate: SortingOrder.Descending
|
||||||
}
|
}
|
||||||
|
|
||||||
export const issuesGroupPresenterMap: Record<'status' | 'priority', AnyComponent | undefined> = {
|
export const issuesGroupEditorMap: Record<'status' | 'priority', AnyComponent | undefined> = {
|
||||||
status: tracker.component.StatusPresenter,
|
status: tracker.component.StatusEditor,
|
||||||
priority: tracker.component.PriorityPresenter
|
priority: tracker.component.PriorityPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user