TSK-810 Rename Team -> Project, Project -> Component (#2756)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2023-03-17 12:17:53 +06:00
committed by GitHub
parent 26adf14966
commit 0f24fe80d6
110 changed files with 1646 additions and 1324 deletions
@@ -16,7 +16,7 @@
import { AttachedData } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Issue, Team } from '@hcengineering/tracker'
import { Issue, Project } from '@hcengineering/tracker'
import { Button, ButtonKind, ButtonSize, eventToHTMLElement, showPopup } from '@hcengineering/ui'
import EditBoxPopup from '@hcengineering/view-resources/src/components/EditBoxPopup.svelte'
import { createEventDispatcher } from 'svelte'
@@ -31,7 +31,7 @@
export let size: ButtonSize = 'large'
export let justify: 'left' | 'center' = 'left'
export let width: string | undefined = undefined
export let currentTeam: Team | undefined = undefined
export let currentProject: Project | undefined = undefined
const client = getClient()
const dispatch = createEventDispatcher()
@@ -74,7 +74,7 @@
{#if value}
{#if kind === 'list'}
<EstimationStatsPresenter {value} on:click={handleestimationEditorOpened} {currentTeam} />
<EstimationStatsPresenter {value} on:click={handleestimationEditorOpened} {currentProject} />
{:else}
<Button
showTooltip={isEditable ? { label: tracker.string.Estimation } : undefined}
@@ -16,7 +16,7 @@
<script lang="ts">
import { SortingOrder, WithLookup } from '@hcengineering/core'
import presentation, { Card, createQuery, getClient } from '@hcengineering/presentation'
import { Issue, IssueStatus, Team } from '@hcengineering/tracker'
import { Issue, IssueStatus, Project } from '@hcengineering/tracker'
import { Button, EditStyle, eventToHTMLElement, IconAdd, Label, showPopup } from '@hcengineering/ui'
import EditBoxPopup from '@hcengineering/view-resources/src/components/EditBoxPopup.svelte'
import { createEventDispatcher } from 'svelte'
@@ -40,7 +40,7 @@
const query = createQuery()
let currentTeam: Team | undefined
let currentProject: Project | undefined
let issueStatuses: WithLookup<IssueStatus>[] | undefined
$: query.query(
@@ -50,23 +50,23 @@
const r = res.shift()
if (r !== undefined) {
object = r
currentTeam = r.$lookup?.space
currentProject = r.$lookup?.space
}
},
{
lookup: {
space: tracker.class.Team
space: tracker.class.Project
}
}
)
$: defaultTimeReportDay = currentTeam?.defaultTimeReportDay
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
const statusesQuery = createQuery()
$: currentTeam &&
$: currentProject &&
statusesQuery.query(
tracker.class.IssueStatus,
{ attachedTo: currentTeam._id },
{ attachedTo: currentProject._id },
(statuses) => (issueStatuses = statuses),
{
lookup: { category: tracker.class.IssueStatusCategory },
@@ -115,7 +115,7 @@
)
}}
>
<EstimationStatsPresenter value={object} estimation={_value} {currentTeam} />
<EstimationStatsPresenter value={object} estimation={_value} {currentProject} />
</div>
</div>
</svelte:fragment>
@@ -124,18 +124,18 @@
<IssuePresenter value={object} disableClick />
</svelte:fragment>
{#if currentTeam && issueStatuses}
{#if currentProject && issueStatuses}
<SubIssuesEstimations
issue={object}
issueStatuses={new Map([[currentTeam._id, issueStatuses]])}
teams={new Map([[currentTeam?._id, currentTeam]])}
issueStatuses={new Map([[currentProject._id, issueStatuses]])}
projects={new Map([[currentProject?._id, currentProject]])}
/>
{/if}
{#if currentTeam}
{#if currentProject}
<TimeSpendReports
issue={object}
teams={new Map([[currentTeam?._id, currentTeam]])}
projects={new Map([[currentProject?._id, currentProject]])}
query={{ attachedTo: { $in: [object._id, ...childIds] } }}
/>
{/if}
@@ -15,18 +15,18 @@
<script lang="ts">
import { AttachedData } from '@hcengineering/core'
import { Issue, Team } from '@hcengineering/tracker'
import { Issue, Project } from '@hcengineering/tracker'
import { floorFractionDigits } from '@hcengineering/ui'
import EstimationProgressCircle from './EstimationProgressCircle.svelte'
import TimePresenter from './TimePresenter.svelte'
export let value: Issue | AttachedData<Issue>
export let estimation: number | undefined = undefined
export let currentTeam: Team | undefined
export let currentProject: Project | undefined
$: _estimation = estimation ?? value.estimation
$: workDayLength = currentTeam?.workDayLength
$: workDayLength = currentProject?.workDayLength
$: childReportTime = floorFractionDigits(
value.reportedTime + (value.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0),
3
@@ -16,7 +16,7 @@
import contact from '@hcengineering/contact'
import { Ref } from '@hcengineering/core'
import { AssigneeBox } from '@hcengineering/presentation'
import { Issue, Team } from '@hcengineering/tracker'
import { Issue, Project } from '@hcengineering/tracker'
import { deviceOptionsStore as deviceInfo, getEventPositionElement, ListView, showPopup } from '@hcengineering/ui'
import { ContextMenu, FixedColumn, ListSelectionProvider } from '@hcengineering/view-resources'
import { getIssueId } from '../../../issues'
@@ -25,7 +25,7 @@
export let issues: Issue[]
export let teams: Map<Ref<Team>, Team>
export let projects: Map<Ref<Project>, Project>
function showContextMenu (ev: MouseEvent, object: Issue) {
showPopup(ContextMenu, { object }, $deviceInfo.isMobile ? 'top' : getEventPositionElement(ev))
@@ -38,7 +38,7 @@
<ListView count={issues.length} addClass={'step-tb-2-accent'}>
<svelte:fragment slot="item" let:item>
{@const issue = issues[item]}
{@const currentTeam = teams.get(issue.space)}
{@const currentProject = projects.get(issue.space)}
<div
class="{twoRows ? 'flex-col' : 'flex-between'} p-text-2"
on:contextmenu|preventDefault={(ev) => showContextMenu(ev, issue)}
@@ -51,8 +51,8 @@
>
<div class="flex-row-center clear-mins gap-2 flex-grow mr-4" class:p-text={twoRows}>
<FixedColumn key={'estimation_issue'} justify={'left'} addClass={'fs-bold'}>
{#if currentTeam}
{getIssueId(currentTeam, issue)}
{#if currentProject}
{getIssueId(currentProject, issue)}
{/if}
</FixedColumn>
<span class="overflow-label fs-bold caption-color" title={issue.title}>
@@ -71,7 +71,7 @@
/>
</FixedColumn>
<FixedColumn key={'estimation'} justify={'left'}>
<EstimationEditor value={issue} kind={'list'} {currentTeam} />
<EstimationEditor value={issue} kind={'list'} {currentProject} />
</FixedColumn>
</div>
</svelte:fragment>
@@ -16,7 +16,7 @@
<script lang="ts">
import type { IntlString } from '@hcengineering/platform'
import { createQuery } from '@hcengineering/presentation'
import tracker, { Issue, Team } from '@hcengineering/tracker'
import tracker, { Issue, Project } from '@hcengineering/tracker'
import { ActionIcon, eventToHTMLElement, floorFractionDigits, IconAdd, Label, showPopup } from '@hcengineering/ui'
import ReportsPopup from './ReportsPopup.svelte'
import TimePresenter from './TimePresenter.svelte'
@@ -27,19 +27,19 @@
export let object: Issue
export let value: number
export let kind: 'no-border' | 'link' = 'no-border'
export let currentTeam: Team | undefined
export let currentProject: Project | undefined
const spaceQuery = createQuery()
$: if (currentTeam === undefined) {
spaceQuery.query(tracker.class.Team, { _id: object.space }, (res) => {
currentTeam = res.shift()
$: if (currentProject === undefined) {
spaceQuery.query(tracker.class.Project, { _id: object.space }, (res) => {
currentProject = res.shift()
})
} else {
spaceQuery.unsubscribe()
}
$: defaultTimeReportDay = currentTeam?.defaultTimeReportDay
$: workDayLength = currentTeam?.workDayLength
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
$: workDayLength = currentProject?.workDayLength
function addTimeReport (event: MouseEvent): void {
showPopup(
@@ -51,7 +51,7 @@
issueClass: object._class,
space: object.space,
assignee: object.assignee,
currentTeam
currentProject
},
eventToHTMLElement(event)
)
@@ -16,7 +16,7 @@
import contact from '@hcengineering/contact'
import { FindOptions } from '@hcengineering/core'
import presentation, { Card } from '@hcengineering/presentation'
import { Issue, Team, TimeSpendReport } from '@hcengineering/tracker'
import { Issue, Project, TimeSpendReport } from '@hcengineering/tracker'
import { Button, eventToHTMLElement, IconAdd, Scroller, showPopup, tableSP } from '@hcengineering/ui'
import { TableBrowser } from '@hcengineering/view-resources'
import tracker from '../../../plugin'
@@ -24,9 +24,9 @@
import ParentNamesPresenter from '../ParentNamesPresenter.svelte'
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
export let issue: Issue
export let currentTeam: Team | undefined
export let currentProject: Project | undefined
$: defaultTimeReportDay = currentTeam?.defaultTimeReportDay
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
export function canClose (): boolean {
return true
@@ -15,15 +15,15 @@
<script lang="ts">
import { Ref, SortingOrder, WithLookup } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation'
import { Issue, IssueStatus, Team } from '@hcengineering/tracker'
import { Issue, IssueStatus, Project } from '@hcengineering/tracker'
import { Spinner } from '@hcengineering/ui'
import Expandable from '@hcengineering/ui/src/components/Expandable.svelte'
import tracker from '../../../plugin'
import EstimationSubIssueList from './EstimationSubIssueList.svelte'
export let issue: Issue
export let teams: Map<Ref<Team>, Team>
export let issueStatuses: Map<Ref<Team>, WithLookup<IssueStatus>[]>
export let projects: Map<Ref<Project>, Project>
export let issueStatuses: Map<Ref<Project>, WithLookup<IssueStatus>[]>
const subIssuesQuery = createQuery()
@@ -40,7 +40,7 @@
{#if hasSubIssues}
<Expandable label={tracker.string.ChildEstimation} contentColor bordered>
<svelte:fragment slot="title">: <span class="caption-color">{total}</span></svelte:fragment>
<EstimationSubIssueList issues={subIssues} {teams} />
<EstimationSubIssueList issues={subIssues} {projects} />
</Expandable>
{/if}
{:else}
@@ -15,13 +15,13 @@
<script lang="ts">
import { WithLookup } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Issue, Team, TimeSpendReport } from '@hcengineering/tracker'
import { Issue, Project, TimeSpendReport } from '@hcengineering/tracker'
import { eventToHTMLElement, showPopup } from '@hcengineering/ui'
import TimePresenter from './TimePresenter.svelte'
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
export let value: WithLookup<TimeSpendReport>
export let currentTeam: Team | undefined
export let currentProject: Project | undefined
const client = getClient()
$: issue = value.$lookup?.attachedTo
@@ -30,8 +30,8 @@
issue = r as Issue
})
}
$: workDayLength = currentTeam?.workDayLength
$: defaultTimeReportDay = currentTeam?.defaultTimeReportDay
$: workDayLength = currentProject?.workDayLength
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
function editSpendReport (event: MouseEvent): void {
showPopup(
@@ -15,21 +15,21 @@
<script lang="ts">
import { DocumentQuery, Ref, SortingOrder } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation'
import { Issue, Team, TimeSpendReport } from '@hcengineering/tracker'
import { Issue, Project, TimeSpendReport } from '@hcengineering/tracker'
import { Expandable, floorFractionDigits, Label, Spinner } from '@hcengineering/ui'
import tracker from '../../../plugin'
import TimePresenter from './TimePresenter.svelte'
import TimeSpendReportsList from './TimeSpendReportsList.svelte'
export let issue: Issue
export let teams: Map<Ref<Team>, Team>
export let projects: Map<Ref<Project>, Project>
export let query: DocumentQuery<TimeSpendReport>
const subIssuesQuery = createQuery()
let reports: TimeSpendReport[] | undefined
$: workDayLength = teams.get(issue.space)?.workDayLength
$: workDayLength = projects.get(issue.space)?.workDayLength
$: subIssuesQuery.query(tracker.class.TimeSpendReport, query, async (result) => (reports = result), {
sort: { modifiedOn: SortingOrder.Descending },
lookup: {
@@ -51,7 +51,7 @@
<span class="caption-color"><TimePresenter value={total} {workDayLength} /></span>
</span>
</svelte:fragment>
<TimeSpendReportsList {reports} {teams} />
<TimeSpendReportsList {reports} {projects} />
</Expandable>
{:else}
<div class="flex-center">
@@ -16,7 +16,7 @@
import contact from '@hcengineering/contact'
import { Ref, Space, WithLookup } from '@hcengineering/core'
import UserBox from '@hcengineering/presentation/src/components/UserBox.svelte'
import { Team, TimeReportDayType, TimeSpendReport } from '@hcengineering/tracker'
import { Project, TimeReportDayType, TimeSpendReport } from '@hcengineering/tracker'
import {
deviceOptionsStore as deviceInfo,
eventToHTMLElement,
@@ -33,7 +33,7 @@
export let reports: WithLookup<TimeSpendReport>[]
export let teams: Map<Ref<Team>, Team>
export let projects: Map<Ref<Project>, Project>
function showContextMenu (ev: MouseEvent, object: TimeSpendReport) {
showPopup(ContextMenu, { object }, getEventPositionElement(ev))
@@ -41,7 +41,7 @@
const listProvider = new ListSelectionProvider(() => {})
const toTeamId = (ref: Ref<Space>) => ref as Ref<Team>
const toProjectId = (ref: Ref<Space>) => ref as Ref<Project>
function editSpendReport (
event: MouseEvent,
@@ -68,7 +68,7 @@
<ListView count={reports.length} addClass={'step-tb-2-accent'}>
<svelte:fragment slot="item" let:item>
{@const report = reports[item]}
{@const currentTeam = teams.get(toTeamId(report.space))}
{@const currentProject = projects.get(toProjectId(report.space))}
<div
class="{twoRows ? 'flex-col' : 'flex-between'} p-text-2"
on:contextmenu|preventDefault={(ev) => showContextMenu(ev, report)}
@@ -78,12 +78,12 @@
on:focus={() => {
listProvider.updateFocus(report)
}}
on:click={(evt) => editSpendReport(evt, report, currentTeam?.defaultTimeReportDay)}
on:click={(evt) => editSpendReport(evt, report, currentProject?.defaultTimeReportDay)}
>
<div class="flex-row-center clear-mins gap-2 flex-grow mr-4" class:p-text={twoRows}>
<FixedColumn key={'tmiespend_issue'} justify={'left'} addClass={'fs-bold'}>
{#if currentTeam && report.$lookup?.attachedTo}
{getIssueId(currentTeam, report.$lookup?.attachedTo)}
{#if currentProject && report.$lookup?.attachedTo}
{getIssueId(currentProject, report.$lookup?.attachedTo)}
{/if}
</FixedColumn>
{#if report.$lookup?.attachedTo?.title}
@@ -104,7 +104,7 @@
/>
</FixedColumn>
<FixedColumn key={'timespend_reported'} justify={'center'}>
<TimePresenter value={report.value} workDayLength={currentTeam?.workDayLength} />
<TimePresenter value={report.value} workDayLength={currentProject?.workDayLength} />
</FixedColumn>
<FixedColumn key={'timespend_date'} justify={'left'}>
<DatePresenter value={report.date} />