mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Tracker: fix issue priority view for "Activity" (#1635)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
parent
e4e2af93dc
commit
5d84e38c79
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import type { Employee } from '@anticrm/contact'
|
import type { Employee } from '@anticrm/contact'
|
||||||
import contact from '@anticrm/contact'
|
import contact from '@anticrm/contact'
|
||||||
import { Domain, DOMAIN_MODEL, IndexKind, Markup, Ref, Timestamp } from '@anticrm/core'
|
import { Domain, DOMAIN_MODEL, IndexKind, Markup, Ref, Timestamp, Type } from '@anticrm/core'
|
||||||
import {
|
import {
|
||||||
ArrOf,
|
ArrOf,
|
||||||
Builder,
|
Builder,
|
||||||
@ -33,7 +33,7 @@ import {
|
|||||||
} from '@anticrm/model'
|
} from '@anticrm/model'
|
||||||
import attachment from '@anticrm/model-attachment'
|
import attachment from '@anticrm/model-attachment'
|
||||||
import chunter from '@anticrm/model-chunter'
|
import chunter from '@anticrm/model-chunter'
|
||||||
import core, { DOMAIN_SPACE, TAttachedDoc, TDoc, TSpace } from '@anticrm/model-core'
|
import core, { DOMAIN_SPACE, TAttachedDoc, TDoc, TSpace, TType } from '@anticrm/model-core'
|
||||||
import { createAction } from '@anticrm/model-view'
|
import { createAction } from '@anticrm/model-view'
|
||||||
import workbench, { createNavigateAction } from '@anticrm/model-workbench'
|
import workbench, { createNavigateAction } from '@anticrm/model-workbench'
|
||||||
import { Asset, IntlString } from '@anticrm/platform'
|
import { Asset, IntlString } from '@anticrm/platform'
|
||||||
@ -84,6 +84,19 @@ export class TIssueStatusCategory extends TDoc implements IssueStatusCategory {
|
|||||||
order!: number
|
order!: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export function TypeIssuePriority (): Type<IssuePriority> {
|
||||||
|
return { _class: tracker.class.TypeIssuePriority, label: 'TypeIssuePriority' as IntlString }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
@Model(tracker.class.TypeIssuePriority, core.class.Type, DOMAIN_MODEL)
|
||||||
|
export class TTypeIssuePriority extends TType {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
@ -126,7 +139,7 @@ export class TIssue extends TDoc implements Issue {
|
|||||||
@Prop(TypeRef(tracker.class.IssueStatus), tracker.string.Status)
|
@Prop(TypeRef(tracker.class.IssueStatus), tracker.string.Status)
|
||||||
status!: Ref<IssueStatus>
|
status!: Ref<IssueStatus>
|
||||||
|
|
||||||
@Prop(TypeNumber(), tracker.string.Priority)
|
@Prop(TypeIssuePriority(), tracker.string.Priority)
|
||||||
priority!: IssuePriority
|
priority!: IssuePriority
|
||||||
|
|
||||||
@Prop(TypeNumber(), tracker.string.Number)
|
@Prop(TypeNumber(), tracker.string.Number)
|
||||||
@ -227,7 +240,7 @@ export class TProject extends TDoc implements Project {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function createModel (builder: Builder): void {
|
export function createModel (builder: Builder): void {
|
||||||
builder.createModel(TTeam, TProject, TIssue, TIssueStatus, TIssueStatusCategory)
|
builder.createModel(TTeam, TProject, TIssue, TIssueStatus, TIssueStatusCategory, TTypeIssuePriority)
|
||||||
|
|
||||||
builder.createDoc(
|
builder.createDoc(
|
||||||
tracker.class.IssueStatusCategory,
|
tracker.class.IssueStatusCategory,
|
||||||
@ -300,6 +313,10 @@ export function createModel (builder: Builder): void {
|
|||||||
const boardId = 'board'
|
const boardId = 'board'
|
||||||
const projectsId = 'projects'
|
const projectsId = 'projects'
|
||||||
|
|
||||||
|
builder.mixin(tracker.class.TypeIssuePriority, core.class.Class, view.mixin.AttributePresenter, {
|
||||||
|
presenter: tracker.component.PriorityPresenter
|
||||||
|
})
|
||||||
|
|
||||||
builder.mixin(tracker.class.IssueStatus, core.class.Class, view.mixin.AttributePresenter, {
|
builder.mixin(tracker.class.IssueStatus, core.class.Class, view.mixin.AttributePresenter, {
|
||||||
presenter: tracker.component.StatusPresenter
|
presenter: tracker.component.StatusPresenter
|
||||||
})
|
})
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
import CreateIssue from '../CreateIssue.svelte'
|
import CreateIssue from '../CreateIssue.svelte'
|
||||||
import AssigneePresenter from './AssigneePresenter.svelte'
|
import AssigneePresenter from './AssigneePresenter.svelte'
|
||||||
import IssuePresenter from './IssuePresenter.svelte'
|
import IssuePresenter from './IssuePresenter.svelte'
|
||||||
import PriorityPresenter from './PriorityPresenter.svelte'
|
import PriorityEditor from './PriorityEditor.svelte'
|
||||||
|
|
||||||
export let currentSpace: Ref<Team>
|
export let currentSpace: Ref<Team>
|
||||||
export let baseMenuClass: Ref<Class<Doc>> | undefined = undefined
|
export let baseMenuClass: Ref<Class<Doc>> | undefined = undefined
|
||||||
@ -161,7 +161,7 @@
|
|||||||
{object.title}
|
{object.title}
|
||||||
</span>
|
</span>
|
||||||
<div class="flex gap-2 mt-2 mb-2">
|
<div class="flex gap-2 mt-2 mb-2">
|
||||||
<PriorityPresenter value={issue} {currentSpace} isEditable={true} />
|
<PriorityEditor value={issue} {currentSpace} isEditable={true} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
import { createEventDispatcher, onMount } from 'svelte'
|
import { createEventDispatcher, onMount } from 'svelte'
|
||||||
import tracker from '../../plugin'
|
import tracker from '../../plugin'
|
||||||
import IssuePresenter from './IssuePresenter.svelte'
|
import IssuePresenter from './IssuePresenter.svelte'
|
||||||
import PriorityPresenter from './PriorityPresenter.svelte'
|
import PriorityEditor from './PriorityEditor.svelte'
|
||||||
import StatusEditor from './StatusEditor.svelte'
|
import StatusEditor from './StatusEditor.svelte'
|
||||||
|
|
||||||
export let _id: Ref<Issue>
|
export let _id: Ref<Issue>
|
||||||
@ -174,7 +174,7 @@
|
|||||||
<span class="label w-24">
|
<span class="label w-24">
|
||||||
<Label label={tracker.string.Priority} />
|
<Label label={tracker.string.Priority} />
|
||||||
</span>
|
</span>
|
||||||
<PriorityPresenter value={issue} currentSpace={currentTeam._id} shouldShowLabel />
|
<PriorityEditor value={issue} currentSpace={currentTeam._id} shouldShowLabel />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-row-center mb-4">
|
<div class="flex-row-center mb-4">
|
||||||
|
@ -349,7 +349,7 @@
|
|||||||
{employees}
|
{employees}
|
||||||
categories={displayedCategories}
|
categories={displayedCategories}
|
||||||
itemsConfig={[
|
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.IssuePresenter, props: { currentTeam } },
|
||||||
{ key: '', presenter: tracker.component.StatusEditor, 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 } },
|
||||||
|
@ -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.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Ref } from '@anticrm/core'
|
import { IssuePriority } from '@anticrm/tracker'
|
||||||
import { Issue, IssuePriority, Team } from '@anticrm/tracker'
|
import { Label } from '@anticrm/ui'
|
||||||
import { getClient } from '@anticrm/presentation'
|
import { issuePriorities } from '../../utils'
|
||||||
import { Tooltip } from '@anticrm/ui'
|
|
||||||
import tracker from '../../plugin'
|
|
||||||
import PrioritySelector from '../PrioritySelector.svelte'
|
|
||||||
|
|
||||||
export let value: Issue
|
export let value: IssuePriority | undefined
|
||||||
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>
|
</script>
|
||||||
|
|
||||||
{#if value}
|
{#if value}
|
||||||
{#if isEditable}
|
<span class="overflow-label">
|
||||||
<Tooltip direction={'bottom'} label={tracker.string.SetPriority}>
|
<Label label={issuePriorities[value].label} />
|
||||||
<PrioritySelector
|
</span>
|
||||||
kind={'icon'}
|
|
||||||
{isEditable}
|
|
||||||
{shouldShowLabel}
|
|
||||||
priority={value.priority}
|
|
||||||
onPriorityChange={handlePriorityChanged}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
{:else}
|
|
||||||
<PrioritySelector kind={'icon'} {isEditable} {shouldShowLabel} priority={value.priority} />
|
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -29,6 +29,7 @@ import Views from './components/views/Views.svelte'
|
|||||||
import IssuePresenter from './components/issues/IssuePresenter.svelte'
|
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 PriorityEditor from './components/issues/PriorityEditor.svelte'
|
||||||
import StatusPresenter from './components/issues/StatusPresenter.svelte'
|
import StatusPresenter from './components/issues/StatusPresenter.svelte'
|
||||||
import StatusEditor from './components/issues/StatusEditor.svelte'
|
import StatusEditor from './components/issues/StatusEditor.svelte'
|
||||||
import DueDatePresenter from './components/issues/DueDatePresenter.svelte'
|
import DueDatePresenter from './components/issues/DueDatePresenter.svelte'
|
||||||
@ -55,6 +56,7 @@ export default async (): Promise<Resources> => ({
|
|||||||
TitlePresenter,
|
TitlePresenter,
|
||||||
ModificationDatePresenter,
|
ModificationDatePresenter,
|
||||||
PriorityPresenter,
|
PriorityPresenter,
|
||||||
|
PriorityEditor,
|
||||||
StatusPresenter,
|
StatusPresenter,
|
||||||
StatusEditor,
|
StatusEditor,
|
||||||
AssigneePresenter,
|
AssigneePresenter,
|
||||||
|
@ -136,6 +136,7 @@ export default mergeIds(trackerId, tracker, {
|
|||||||
TitlePresenter: '' as AnyComponent,
|
TitlePresenter: '' as AnyComponent,
|
||||||
ModificationDatePresenter: '' as AnyComponent,
|
ModificationDatePresenter: '' as AnyComponent,
|
||||||
PriorityPresenter: '' as AnyComponent,
|
PriorityPresenter: '' as AnyComponent,
|
||||||
|
PriorityEditor: '' as AnyComponent,
|
||||||
StatusPresenter: '' as AnyComponent,
|
StatusPresenter: '' as AnyComponent,
|
||||||
StatusEditor: '' as AnyComponent,
|
StatusEditor: '' as AnyComponent,
|
||||||
AssigneePresenter: '' as AnyComponent,
|
AssigneePresenter: '' as AnyComponent,
|
||||||
|
@ -95,7 +95,7 @@ export const issuesSortOrderMap: Record<IssuesOrderByKeys, SortingOrder> = {
|
|||||||
|
|
||||||
export const issuesGroupEditorMap: Record<'status' | 'priority', AnyComponent | undefined> = {
|
export const issuesGroupEditorMap: Record<'status' | 'priority', AnyComponent | undefined> = {
|
||||||
status: tracker.component.StatusEditor,
|
status: tracker.component.StatusEditor,
|
||||||
priority: tracker.component.PriorityPresenter
|
priority: tracker.component.PriorityEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getIssuesModificationDatePeriodTime = (period: IssuesDateModificationPeriod | null): number => {
|
export const getIssuesModificationDatePeriodTime = (period: IssuesDateModificationPeriod | null): number => {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import { Employee } from '@anticrm/contact'
|
import { Employee } from '@anticrm/contact'
|
||||||
import type { AttachedDoc, Class, Doc, Markup, Ref, Space, Timestamp } from '@anticrm/core'
|
import type { AttachedDoc, Class, Doc, Markup, Ref, Space, Timestamp, Type } from '@anticrm/core'
|
||||||
import type { Asset, IntlString, Plugin } from '@anticrm/platform'
|
import type { Asset, IntlString, Plugin } from '@anticrm/platform'
|
||||||
import { plugin } from '@anticrm/platform'
|
import { plugin } from '@anticrm/platform'
|
||||||
import { AnyComponent } from '@anticrm/ui'
|
import { AnyComponent } from '@anticrm/ui'
|
||||||
@ -181,7 +181,8 @@ export default plugin(trackerId, {
|
|||||||
Document: '' as Ref<Class<Document>>,
|
Document: '' as Ref<Class<Document>>,
|
||||||
Project: '' as Ref<Class<Project>>,
|
Project: '' as Ref<Class<Project>>,
|
||||||
IssueStatus: '' as Ref<Class<IssueStatus>>,
|
IssueStatus: '' as Ref<Class<IssueStatus>>,
|
||||||
IssueStatusCategory: '' as Ref<Class<IssueStatusCategory>>
|
IssueStatusCategory: '' as Ref<Class<IssueStatusCategory>>,
|
||||||
|
TypeIssuePriority: '' as Ref<Class<Type<IssuePriority>>>
|
||||||
},
|
},
|
||||||
component: {
|
component: {
|
||||||
Tracker: '' as AnyComponent,
|
Tracker: '' as AnyComponent,
|
||||||
|
Loading…
Reference in New Issue
Block a user