TSK-1158: remove component from sprint. Remove logic for changing component on sprint change (#2998)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-04-18 14:50:50 +05:00 committed by GitHub
parent 8a45bd0e2f
commit 7fdb585dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 2 additions and 115 deletions

View File

@ -405,10 +405,6 @@ export class TSprint extends TDoc implements Sprint {
@Prop(TypeNumber(), tracker.string.Capacity)
capacity!: number
@Prop(TypeRef(tracker.class.Component), tracker.string.Component)
@Index(IndexKind.Indexed)
component!: Ref<Component>
}
/**
@ -1745,7 +1741,7 @@ export function createModel (builder: Builder): void {
)
const sprintOptions: ViewOptionsModel = {
groupBy: ['component', 'lead'],
groupBy: ['lead'],
orderBy: [
['startDate', SortingOrder.Descending],
['modifiedOn', SortingOrder.Descending],
@ -1770,7 +1766,6 @@ export function createModel (builder: Builder): void {
},
{ key: '', presenter: tracker.component.SprintPresenter, props: { shouldUseMargin: true } },
{ key: '', presenter: view.component.GrowPresenter, props: { type: 'grow' } },
{ key: '', presenter: tracker.component.SprintComponentEditor, props: { kind: 'list' } },
{
key: '',
presenter: contact.component.MembersPresenter,

View File

@ -452,14 +452,8 @@
if (sprintId === undefined) {
return
}
let componentSprintId: Ref<ComponentType> | null
if (sprintId != null) {
const sprint = await client.findOne(tracker.class.Sprint, { _id: sprintId })
componentSprintId = sprint && sprint.component ? sprint.component : null
} else componentSprintId = null
object.sprint = sprintId
object.component = componentSprintId
}
function addTagRef (tag: TagElement): void {

View File

@ -17,11 +17,10 @@
import { IntlString } from '@hcengineering/platform'
import { Card, getClient, SpaceSelector } from '@hcengineering/presentation'
import { EmployeeBox, UserBoxList } from '@hcengineering/contact-resources'
import { Component, Sprint, SprintStatus, Project } from '@hcengineering/tracker'
import { Sprint, SprintStatus, Project } from '@hcengineering/tracker'
import ui, { DatePresenter, EditBox } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import tracker from '../../plugin'
import ComponentSelector from '../ComponentSelector.svelte'
import SprintStatusSelector from './SprintStatusSelector.svelte'
import { StyledTextArea } from '@hcengineering/text-editor'
@ -53,14 +52,6 @@
object.status = newSprintStatus
}
const handleComponentIdChanged = async (componentId: Ref<Component> | null | undefined) => {
if (componentId === undefined) {
return
}
object.component = componentId ?? undefined
}
</script>
<Card
@ -82,7 +73,6 @@
/>
<svelte:fragment slot="pool">
<SprintStatusSelector selectedSprintStatus={object.status} onSprintStatusChange={handleComponentStatusChanged} />
<ComponentSelector value={object.component} onChange={handleComponentIdChanged} isEditable={true} />
<EmployeeBox
label={tracker.string.SprintLead}
placeholder={tracker.string.AssignTo}

View File

@ -1,70 +0,0 @@
<!--
// 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 '@hcengineering/core'
import { Sprint, Component } from '@hcengineering/tracker'
import { getClient } from '@hcengineering/presentation'
import { ButtonKind, ButtonShape, ButtonSize, tooltip } from '@hcengineering/ui'
import { IntlString } from '@hcengineering/platform'
import tracker from '../../plugin'
import ComponentSelector from '../ComponentSelector.svelte'
import { activeComponent } from '../../issues'
export let value: Sprint
export let isEditable: boolean = true
export let shouldShowLabel: boolean = true
export let popupPlaceholder: IntlString = tracker.string.MoveToComponent
export let shouldShowPlaceholder = true
export let kind: ButtonKind = 'link'
export let size: ButtonSize = 'large'
export let shape: ButtonShape = undefined
export let justify: 'left' | 'center' = 'left'
export let width: string | undefined = '100%'
export let onlyIcon: boolean = false
export let groupBy: string | undefined = undefined
export let enlargedText = false
const client = getClient()
const handleComponentIdChanged = async (newComponentId: Ref<Component> | null | undefined) => {
if (!isEditable || newComponentId === undefined || value.component === newComponentId) {
return
}
await client.update(value, { component: newComponentId ?? undefined })
}
</script>
{#if (value.component && value.component !== $activeComponent && groupBy !== 'component') || shouldShowPlaceholder}
<div
class="clear-mins"
use:tooltip={{ label: value.component ? tracker.string.MoveToComponent : tracker.string.AddToComponent }}
>
<ComponentSelector
{kind}
{size}
{shape}
{width}
{justify}
{isEditable}
{shouldShowLabel}
{popupPlaceholder}
{onlyIcon}
{enlargedText}
value={value.component}
onChange={handleComponentIdChanged}
/>
</div>
{/if}

View File

@ -66,7 +66,6 @@ import NopeComponent from './components/NopeComponent.svelte'
import RelationsPopup from './components/RelationsPopup.svelte'
import SetDueDateActionPopup from './components/SetDueDateActionPopup.svelte'
import SetParentIssueActionPopup from './components/SetParentIssueActionPopup.svelte'
import SprintComponentEditor from './components/sprints/SprintComponentEditor.svelte'
import SprintDatePresenter from './components/sprints/SprintDatePresenter.svelte'
import SprintLeadPresenter from './components/sprints/SprintLeadPresenter.svelte'
import CreateIssueTemplate from './components/templates/CreateIssueTemplate.svelte'
@ -440,7 +439,6 @@ export default async (): Promise<Resources> => ({
RelatedIssueSelector,
DeleteComponentPresenter,
TimeSpendReportPopup,
SprintComponentEditor,
SprintDatePresenter,
SprintLeadPresenter,
NotificationIssuePresenter

View File

@ -361,7 +361,6 @@ export default mergeIds(trackerId, tracker, {
SprintPresenter: '' as AnyComponent,
SprintStatusPresenter: '' as AnyComponent,
SprintTitlePresenter: '' as AnyComponent,
SprintComponentEditor: '' as AnyComponent,
SprintDatePresenter: '' as AnyComponent,
SprintLeadPresenter: '' as AnyComponent,
ReportedTimeEditor: '' as AnyComponent,

View File

@ -136,8 +136,6 @@ export interface Sprint extends Doc {
// Capacity in man days.
capacity: number
component?: Ref<Component>
}
/**

View File

@ -325,23 +325,6 @@ async function doIssueUpdate (
)
}
if (Object.prototype.hasOwnProperty.call(updateTx.operations, 'sprint')) {
if (updateTx.operations.sprint != null) {
const [sprint] = await control.findAll(tracker.class.Sprint, { _id: updateTx.operations.sprint }, { limit: 1 })
res.push(
control.txFactory.createTxUpdateDoc(updateTx.objectClass, updateTx.objectSpace, updateTx.objectId, {
component: sprint.component
})
)
} else {
res.push(
control.txFactory.createTxUpdateDoc(updateTx.objectClass, updateTx.objectSpace, updateTx.objectId, {
component: null
})
)
}
}
if (
Object.prototype.hasOwnProperty.call(updateTx.operations, 'estimation') ||
Object.prototype.hasOwnProperty.call(updateTx.operations, 'reportedTime')