mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
parent
d5d98f64e7
commit
e1af333fc6
@ -52,7 +52,7 @@
|
||||
export let isFullSize = false
|
||||
export let embedded = false
|
||||
export let contentClasses: string | undefined = undefined
|
||||
export let content: HTMLElement | undefined = undefined
|
||||
export let content: HTMLElement | undefined | null = undefined
|
||||
|
||||
let lastHref: string
|
||||
let timer: any
|
||||
|
@ -13,13 +13,13 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { SvelteComponent } from 'svelte'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import { deepEqual } from 'fast-equals'
|
||||
import { SvelteComponent } from 'svelte'
|
||||
import type { AnyComponent } from '../types'
|
||||
// import Icon from './Icon.svelte'
|
||||
import ErrorPresenter from './ErrorPresenter.svelte'
|
||||
import ErrorBoundary from './internal/ErrorBoundary'
|
||||
import Loading from './Loading.svelte'
|
||||
import ErrorBoundary from './internal/ErrorBoundary'
|
||||
|
||||
// Reference to rendered component instance
|
||||
export let innerRef: SvelteComponent | undefined = undefined
|
||||
@ -30,10 +30,20 @@
|
||||
export let inline: boolean = false
|
||||
export let disabled: boolean = false
|
||||
|
||||
$: component = is != null ? getResource(is) : Promise.reject(new Error('is not defined'))
|
||||
let _is: any = is
|
||||
let _props: any = props
|
||||
|
||||
$: if (!deepEqual(_is, is)) {
|
||||
_is = is
|
||||
}
|
||||
$: if (!deepEqual(_props, props)) {
|
||||
_props = props
|
||||
}
|
||||
|
||||
$: component = _is != null ? getResource<any>(_is) : Promise.reject(new Error('is not defined'))
|
||||
</script>
|
||||
|
||||
{#if is}
|
||||
{#if _is}
|
||||
{#await component}
|
||||
{#if showLoading}
|
||||
<Loading {shrink} />
|
||||
@ -43,7 +53,7 @@
|
||||
{#if $$slots.default !== undefined}
|
||||
<Ctor
|
||||
bind:this={innerRef}
|
||||
{...props}
|
||||
{..._props}
|
||||
{inline}
|
||||
{disabled}
|
||||
on:change
|
||||
@ -59,7 +69,7 @@
|
||||
{:else}
|
||||
<Ctor
|
||||
bind:this={innerRef}
|
||||
{...props}
|
||||
{..._props}
|
||||
{inline}
|
||||
{disabled}
|
||||
on:change
|
||||
|
@ -36,7 +36,7 @@
|
||||
export let noStretch: boolean = autoscroll
|
||||
export let buttons: 'normal' | 'union' | false = false
|
||||
export let shrink: boolean = false
|
||||
export let divScroll: HTMLElement | undefined = undefined
|
||||
export let divScroll: HTMLElement | undefined | null = undefined
|
||||
export let checkForHeaders: boolean = false
|
||||
export let stickedScrollBars: boolean = false
|
||||
export let thinScrollBars: boolean = false
|
||||
|
@ -13,13 +13,13 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Ref, WithLookup } from '@hcengineering/core'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { WithLookup } from '@hcengineering/core'
|
||||
import { Asset } from '@hcengineering/platform'
|
||||
import type { Issue, Project } from '@hcengineering/tracker'
|
||||
import { AnySvelteComponent, Icon, tooltip } from '@hcengineering/ui'
|
||||
import { DocNavLink } from '@hcengineering/view-resources'
|
||||
import tracker from '../../plugin'
|
||||
import { Asset } from '@hcengineering/platform'
|
||||
import { activeProjects } from '../../utils'
|
||||
|
||||
export let value: WithLookup<Issue>
|
||||
export let disabled = false
|
||||
@ -30,19 +30,10 @@
|
||||
export let kind: 'list' | undefined = undefined
|
||||
export let icon: Asset | AnySvelteComponent | undefined = undefined
|
||||
|
||||
// Extra properties
|
||||
export let projects: Map<Ref<Project>, Project> | undefined = undefined
|
||||
|
||||
const spaceQuery = createQuery()
|
||||
let currentProject: Project | undefined = value?.$lookup?.space
|
||||
|
||||
$: if (value !== undefined) {
|
||||
if (value.$lookup?.space === undefined && !projects?.has(value.space)) {
|
||||
spaceQuery.query(tracker.class.Project, { _id: value.space }, (res) => ([currentProject] = res))
|
||||
} else {
|
||||
currentProject = value?.$lookup?.space ?? projects?.get(value?.space)
|
||||
spaceQuery.unsubscribe()
|
||||
}
|
||||
currentProject = $activeProjects.get(value?.space)
|
||||
}
|
||||
|
||||
$: title = currentProject ? `${currentProject.identifier}-${value?.number}` : `${value?.number}`
|
||||
|
@ -18,10 +18,11 @@
|
||||
import chunter from '@hcengineering/chunter'
|
||||
import { CommentPopup } from '@hcengineering/chunter-resources'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { createQuery, getClient, MessageViewer, IconForward } from '@hcengineering/presentation'
|
||||
import { IconForward, MessageViewer, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { Label, Scroller, resizeObserver } from '@hcengineering/ui'
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
import AssigneeEditor from './AssigneeEditor.svelte'
|
||||
import IssueStatusActivity from './IssueStatusActivity.svelte'
|
||||
import PriorityEditor from './PriorityEditor.svelte'
|
||||
@ -33,7 +34,6 @@
|
||||
const client = getClient()
|
||||
$: space = object.space
|
||||
const issueQuery = createQuery()
|
||||
const spaceQuery = createQuery()
|
||||
|
||||
$: issueQuery.query(
|
||||
object._class,
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
let currentProject: Project | undefined
|
||||
|
||||
$: spaceQuery.query(tracker.class.Project, { _id: space }, (res) => ([currentProject] = res))
|
||||
$: currentProject = $activeProjects.get(space)
|
||||
$: issueName = currentProject && issue && `${currentProject.identifier}-${issue.number}`
|
||||
|
||||
const limit: number = 350
|
||||
|
@ -72,6 +72,7 @@
|
||||
import view from '@hcengineering/view-resources/src/plugin'
|
||||
import { onMount } from 'svelte'
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
import ComponentEditor from '../components/ComponentEditor.svelte'
|
||||
import CreateIssue from '../CreateIssue.svelte'
|
||||
import AssigneeEditor from './AssigneeEditor.svelte'
|
||||
@ -104,12 +105,8 @@
|
||||
|
||||
$: dontUpdateRank = orderBy[0] !== IssuesOrdering.Manual
|
||||
|
||||
const spaceQuery = createQuery()
|
||||
|
||||
let currentProject: Project | undefined
|
||||
$: spaceQuery.query(tracker.class.Project, { _id: currentSpace }, (res) => {
|
||||
currentProject = res.shift()
|
||||
})
|
||||
$: currentProject = $activeProjects.get(currentSpace)
|
||||
|
||||
let resultQuery: DocumentQuery<any> = query
|
||||
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => (resultQuery = p))
|
||||
|
@ -13,16 +13,14 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import type { Issue, Project } from '@hcengineering/tracker'
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
|
||||
export let value: Issue
|
||||
|
||||
const spaceQuery = createQuery()
|
||||
let currentProject: Project | undefined = undefined
|
||||
|
||||
$: spaceQuery.query(tracker.class.Project, { _id: value.space }, (res) => ([currentProject] = res))
|
||||
$: currentProject = $activeProjects.get(value.space)
|
||||
|
||||
$: title = currentProject ? `${currentProject.identifier}-${value?.number}` : `${value?.number}`
|
||||
</script>
|
||||
|
@ -13,22 +13,21 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Project, Issue } from '@hcengineering/tracker'
|
||||
import { Spinner, IconClose, Button } from '@hcengineering/ui'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { Button, IconClose, Spinner } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import tracker from '../../plugin'
|
||||
import { getIssueId } from '../../issues'
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
import PriorityRefPresenter from './PriorityRefPresenter.svelte'
|
||||
|
||||
export let issue: Issue
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const spaceQuery = createQuery()
|
||||
|
||||
let project: Project | undefined
|
||||
|
||||
$: spaceQuery.query(tracker.class.Project, { _id: issue.space }, (res) => ([project] = res))
|
||||
$: project = $activeProjects.get(issue.space)
|
||||
$: issueId = project && getIssueId(project, issue)
|
||||
</script>
|
||||
|
||||
|
@ -14,13 +14,13 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { AttachedData, IdMap, Ref, Status, WithLookup } from '@hcengineering/core'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Issue, IssueDraft, IssueStatus, Project } from '@hcengineering/tracker'
|
||||
import {
|
||||
Button,
|
||||
ButtonKind,
|
||||
ButtonSize,
|
||||
IconSize,
|
||||
Button,
|
||||
SelectPopup,
|
||||
TooltipAlignment,
|
||||
eventToHTMLElement,
|
||||
@ -29,6 +29,7 @@
|
||||
import { statusStore } from '@hcengineering/view-resources'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
import IssueStatusIcon from './IssueStatusIcon.svelte'
|
||||
import StatusPresenter from './StatusPresenter.svelte'
|
||||
type ValueType = Issue | (AttachedData<Issue> & { space: Ref<Project> }) | IssueDraft
|
||||
@ -83,10 +84,7 @@
|
||||
|
||||
let space: Project | undefined = undefined
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query(tracker.class.Project, { _id: value.space }, (res) => {
|
||||
space = res[0]
|
||||
})
|
||||
$: space = $activeProjects.get(value.space)
|
||||
|
||||
function getStatuses (statuses: IdMap<Status>, space: Project | undefined): IssueStatus[] {
|
||||
if (space === undefined) return []
|
||||
|
@ -246,12 +246,7 @@
|
||||
<div class="mt-6">
|
||||
{#key issue._id && currentProject !== undefined}
|
||||
{#if currentProject !== undefined}
|
||||
<SubIssues
|
||||
focusIndex={50}
|
||||
{issue}
|
||||
shouldSaveDraft
|
||||
projects={new Map([[currentProject?._id, currentProject]])}
|
||||
/>
|
||||
<SubIssues focusIndex={50} {issue} shouldSaveDraft />
|
||||
{/if}
|
||||
{/key}
|
||||
</div>
|
||||
|
@ -13,9 +13,9 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Class, Doc, DocumentQuery, Ref, toIdMap } from '@hcengineering/core'
|
||||
import { Class, Doc, DocumentQuery, Ref } from '@hcengineering/core'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { Issue } from '@hcengineering/tracker'
|
||||
import { Button, Chevron, ExpandCollapse, IconAdd, closeTooltip, showPopup } from '@hcengineering/ui'
|
||||
import view, { ViewOptions, Viewlet, ViewletPreference } from '@hcengineering/view'
|
||||
import { ViewletsSettingButton } from '@hcengineering/view-resources'
|
||||
@ -24,7 +24,6 @@
|
||||
import CreateIssue from '../../CreateIssue.svelte'
|
||||
import SubIssueList from './SubIssueList.svelte'
|
||||
|
||||
export let projects: Map<Ref<Project>, Project> | undefined = undefined
|
||||
export let shouldSaveDraft: boolean = false
|
||||
export let object: Doc
|
||||
export let query: DocumentQuery<Issue> = {}
|
||||
@ -39,23 +38,12 @@
|
||||
|
||||
let viewlet: Viewlet | undefined
|
||||
let viewOptions: ViewOptions | undefined
|
||||
let _projects = projects
|
||||
export let focusIndex = -1
|
||||
|
||||
const projectsQuery = createQuery()
|
||||
|
||||
function openNewIssueDialog (): void {
|
||||
showPopup(tracker.component.CreateIssue, { space: object.space, ...createParams, shouldSaveDraft }, 'top')
|
||||
}
|
||||
|
||||
$: if (projects === undefined) {
|
||||
projectsQuery.query(tracker.class.Project, { archived: false }, async (result) => {
|
||||
_projects = toIdMap(result)
|
||||
})
|
||||
} else {
|
||||
projectsQuery.unsubscribe()
|
||||
}
|
||||
|
||||
let lastIssueId: Ref<Doc>
|
||||
afterUpdate(() => {
|
||||
if (lastIssueId !== object._id) {
|
||||
@ -178,7 +166,6 @@
|
||||
createItemLabel={tracker.string.AddIssueTooltip}
|
||||
createItemDialogProps={{ space: object.space, ...createParams, shouldSaveDraft }}
|
||||
focusIndex={focusIndex === -1 ? -1 : focusIndex + 1}
|
||||
projects={_projects}
|
||||
{configurations}
|
||||
{preference}
|
||||
{viewlet}
|
||||
|
@ -16,12 +16,12 @@
|
||||
import { Class, Doc, DocumentQuery, Ref } from '@hcengineering/core'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { ActionContext } from '@hcengineering/presentation'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { Issue } from '@hcengineering/tracker'
|
||||
import { AnyComponent, AnySvelteComponent, registerFocus } from '@hcengineering/ui'
|
||||
import { ViewOptions, Viewlet, ViewletPreference } from '@hcengineering/view'
|
||||
import { List, ListSelectionProvider, SelectDirection, selectionStore } from '@hcengineering/view-resources'
|
||||
import tracker from '../../../plugin'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import tracker from '../../../plugin'
|
||||
|
||||
export let query: DocumentQuery<Issue> | undefined = undefined
|
||||
export let viewlet: Viewlet
|
||||
@ -31,9 +31,6 @@
|
||||
export let configurations: Record<Ref<Class<Doc>>, Viewlet['config']> = {}
|
||||
export let preference: ViewletPreference[] = []
|
||||
|
||||
// Extra properties
|
||||
export let projects: Map<Ref<Project>, Project> | undefined
|
||||
|
||||
let list: List
|
||||
|
||||
const listProvider = new ListSelectionProvider(
|
||||
@ -87,7 +84,6 @@
|
||||
{configurations}
|
||||
{query}
|
||||
flatHeaders={true}
|
||||
props={{ projects }}
|
||||
{disableHeader}
|
||||
{createItemDialog}
|
||||
{createItemDialogProps}
|
||||
|
@ -13,15 +13,13 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { Issue, Project, trackerId } from '@hcengineering/tracker'
|
||||
import { Issue, trackerId } from '@hcengineering/tracker'
|
||||
import { Button, IconScaleFull, Label, closeTooltip, getCurrentResolvedLocation, navigate } from '@hcengineering/ui'
|
||||
import { createFilter, setFilters } from '@hcengineering/view-resources'
|
||||
import tracker from '../../../plugin'
|
||||
import QueryIssuesList from './QueryIssuesList.svelte'
|
||||
|
||||
export let issue: Issue
|
||||
export let projects: Map<Ref<Project>, Project> | undefined
|
||||
export let shouldSaveDraft: boolean = false
|
||||
|
||||
// showPopup(tracker.component.CreateIssue, { space: issue.space, parentIssue: issue, shouldSaveDraft }, 'top')
|
||||
@ -37,7 +35,6 @@
|
||||
createLabel={tracker.string.AddSubIssues}
|
||||
hasSubIssues={issue.subIssues > 0}
|
||||
{focusIndex}
|
||||
{projects}
|
||||
{shouldSaveDraft}
|
||||
on:docs={(evt) => {
|
||||
size = evt.detail.length
|
||||
|
@ -13,15 +13,11 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Doc, DocumentQuery, Ref } from '@hcengineering/core'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { Label, Spinner } from '@hcengineering/ui'
|
||||
import { Doc, DocumentQuery } from '@hcengineering/core'
|
||||
import { Issue } from '@hcengineering/tracker'
|
||||
import { ViewOptions, Viewlet } from '@hcengineering/view'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import tracker from '../../../plugin'
|
||||
import CreateIssue from '../../CreateIssue.svelte'
|
||||
import AddIssueDuo from '../../icons/AddIssueDuo.svelte'
|
||||
import SubIssueList from '../edit/SubIssueList.svelte'
|
||||
|
||||
export let object: Doc
|
||||
@ -30,49 +26,20 @@
|
||||
export let disableHeader: boolean = false
|
||||
export let compactMode: boolean = false
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let query: DocumentQuery<Issue>
|
||||
$: query = { 'relations._id': object._id, 'relations._class': object._class }
|
||||
|
||||
let projects: Map<Ref<Project>, Project> | undefined
|
||||
|
||||
const projectsQuery = createQuery()
|
||||
|
||||
$: projectsQuery.query(tracker.class.Project, { archived: false }, async (result) => {
|
||||
projects = new Map(result.map((it) => [it._id, it]))
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if viewlet !== undefined}
|
||||
{#if projects}
|
||||
<SubIssueList
|
||||
bind:viewOptions
|
||||
{viewlet}
|
||||
{query}
|
||||
{projects}
|
||||
{disableHeader}
|
||||
{compactMode}
|
||||
createItemDialog={CreateIssue}
|
||||
createItemLabel={tracker.string.AddIssueTooltip}
|
||||
createItemDialogProps={{ relatedTo: object }}
|
||||
/>
|
||||
{:else}
|
||||
<div class="antiSection-empty solid flex-col">
|
||||
<div class="flex-center content-color">
|
||||
<AddIssueDuo size={'large'} />
|
||||
</div>
|
||||
<div class="text-sm content-dark-color" style:pointer-events="none">
|
||||
<Label label={tracker.string.RelatedIssuesNotFound} />
|
||||
</div>
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div class="over-underline text-sm content-color" on:click={() => dispatch('add-issue')}>
|
||||
<Label label={tracker.string.NewRelatedIssue} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex-center">
|
||||
<Spinner />
|
||||
</div>
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<SubIssueList
|
||||
bind:viewOptions
|
||||
{viewlet}
|
||||
{query}
|
||||
{disableHeader}
|
||||
{compactMode}
|
||||
createItemDialog={CreateIssue}
|
||||
createItemLabel={tracker.string.AddIssueTooltip}
|
||||
createItemDialogProps={{ relatedTo: object }}
|
||||
/>
|
||||
{/if}
|
||||
|
@ -112,15 +112,11 @@
|
||||
</svelte:fragment>
|
||||
|
||||
{#if currentProject}
|
||||
<SubIssuesEstimations issue={object} projects={new Map([[currentProject?._id, currentProject]])} />
|
||||
<SubIssuesEstimations issue={object} />
|
||||
{/if}
|
||||
|
||||
{#if currentProject}
|
||||
<TimeSpendReports
|
||||
issue={object}
|
||||
projects={new Map([[currentProject?._id, currentProject]])}
|
||||
query={{ attachedTo: { $in: [object._id, ...childIds] } }}
|
||||
/>
|
||||
<TimeSpendReports issue={object} query={{ attachedTo: { $in: [object._id, ...childIds] } }} />
|
||||
{/if}
|
||||
<svelte:fragment slot="buttons">
|
||||
<Button
|
||||
|
@ -14,19 +14,17 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import contact from '@hcengineering/contact'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { AssigneeBox } from '@hcengineering/contact-resources'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { deviceOptionsStore as deviceInfo, getEventPositionElement, ListView, showPopup } from '@hcengineering/ui'
|
||||
import { Issue } from '@hcengineering/tracker'
|
||||
import { ListView, deviceOptionsStore as deviceInfo, getEventPositionElement, showPopup } from '@hcengineering/ui'
|
||||
import { ContextMenu, FixedColumn, ListSelectionProvider } from '@hcengineering/view-resources'
|
||||
import { getIssueId } from '../../../issues'
|
||||
import tracker from '../../../plugin'
|
||||
import { activeProjects } from '../../../utils'
|
||||
import EstimationEditor from './EstimationEditor.svelte'
|
||||
|
||||
export let issues: Issue[]
|
||||
|
||||
export let projects: Map<Ref<Project>, Project>
|
||||
|
||||
function showContextMenu (ev: MouseEvent, object: Issue) {
|
||||
showPopup(ContextMenu, { object }, $deviceInfo.isMobile ? 'top' : getEventPositionElement(ev))
|
||||
}
|
||||
@ -35,10 +33,11 @@
|
||||
$: twoRows = $deviceInfo.twoRows
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<ListView count={issues.length} addClass={'step-tb-2-accent'}>
|
||||
<svelte:fragment slot="item" let:item>
|
||||
{@const issue = issues[item]}
|
||||
{@const currentProject = projects.get(issue.space)}
|
||||
{@const currentProject = $activeProjects.get(issue.space)}
|
||||
<div
|
||||
class="{twoRows ? 'flex-col' : 'flex-between'} p-text-2 clear-mins"
|
||||
on:contextmenu|preventDefault={(ev) => showContextMenu(ev, issue)}
|
||||
|
@ -15,9 +15,9 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { IntlString } from '@hcengineering/platform'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import tracker, { Issue, Project } from '@hcengineering/tracker'
|
||||
import { ActionIcon, eventToHTMLElement, floorFractionDigits, IconAdd, Label, showPopup } from '@hcengineering/ui'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { ActionIcon, IconAdd, Label, eventToHTMLElement, floorFractionDigits, showPopup } from '@hcengineering/ui'
|
||||
import { activeProjects } from '../../../utils'
|
||||
import ReportsPopup from './ReportsPopup.svelte'
|
||||
import TimePresenter from './TimePresenter.svelte'
|
||||
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
|
||||
@ -30,13 +30,8 @@
|
||||
export let size: 'small' | 'medium' | 'large' = 'large'
|
||||
export let currentProject: Project | undefined
|
||||
|
||||
const spaceQuery = createQuery()
|
||||
$: if (currentProject === undefined) {
|
||||
spaceQuery.query(tracker.class.Project, { _id: object.space }, (res) => {
|
||||
currentProject = res.shift()
|
||||
})
|
||||
} else {
|
||||
spaceQuery.unsubscribe()
|
||||
currentProject = $activeProjects.get(object.space)
|
||||
}
|
||||
|
||||
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
|
||||
|
@ -13,15 +13,14 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Ref, SortingOrder } from '@hcengineering/core'
|
||||
import { SortingOrder } from '@hcengineering/core'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { Issue } from '@hcengineering/tracker'
|
||||
import { Expandable, Spinner } from '@hcengineering/ui'
|
||||
import tracker from '../../../plugin'
|
||||
import EstimationSubIssueList from './EstimationSubIssueList.svelte'
|
||||
|
||||
export let issue: Issue
|
||||
export let projects: Map<Ref<Project>, Project>
|
||||
|
||||
const subIssuesQuery = createQuery()
|
||||
|
||||
@ -38,7 +37,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} {projects} />
|
||||
<EstimationSubIssueList issues={subIssues} />
|
||||
</Expandable>
|
||||
{/if}
|
||||
{:else}
|
||||
|
@ -13,16 +13,15 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { DocumentQuery, Ref, SortingOrder } from '@hcengineering/core'
|
||||
import { DocumentQuery, SortingOrder } from '@hcengineering/core'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Issue, Project, TimeSpendReport } from '@hcengineering/tracker'
|
||||
import { Expandable, floorFractionDigits, Label, Spinner } from '@hcengineering/ui'
|
||||
import { Issue, TimeSpendReport } from '@hcengineering/tracker'
|
||||
import { Expandable, Label, Spinner, floorFractionDigits } from '@hcengineering/ui'
|
||||
import tracker from '../../../plugin'
|
||||
import TimePresenter from './TimePresenter.svelte'
|
||||
import TimeSpendReportsList from './TimeSpendReportsList.svelte'
|
||||
|
||||
export let issue: Issue
|
||||
export let projects: Map<Ref<Project>, Project>
|
||||
export let query: DocumentQuery<TimeSpendReport>
|
||||
|
||||
const subIssuesQuery = createQuery()
|
||||
@ -50,7 +49,7 @@
|
||||
<span class="caption-color"><TimePresenter value={floorFractionDigits(total / 8, 3)} /></span>
|
||||
</span>
|
||||
</svelte:fragment>
|
||||
<TimeSpendReportsList {reports} {projects} />
|
||||
<TimeSpendReportsList {reports} />
|
||||
</Expandable>
|
||||
{:else}
|
||||
<div class="flex-center">
|
||||
|
@ -30,11 +30,10 @@
|
||||
import tracker from '../../../plugin'
|
||||
import TimePresenter from './TimePresenter.svelte'
|
||||
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
|
||||
import { activeProjects } from '../../../utils'
|
||||
|
||||
export let reports: WithLookup<TimeSpendReport>[]
|
||||
|
||||
export let projects: Map<Ref<Project>, Project>
|
||||
|
||||
function showContextMenu (ev: MouseEvent, object: TimeSpendReport) {
|
||||
showPopup(ContextMenu, { object }, getEventPositionElement(ev))
|
||||
}
|
||||
@ -65,10 +64,11 @@
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<ListView count={reports.length} addClass={'step-tb-2-accent'}>
|
||||
<svelte:fragment slot="item" let:item>
|
||||
{@const report = reports[item]}
|
||||
{@const currentProject = projects.get(toProjectId(report.space))}
|
||||
{@const currentProject = $activeProjects.get(toProjectId(report.space))}
|
||||
<div
|
||||
class="{twoRows ? 'flex-col' : 'flex-between'} p-text-2 clear-mins"
|
||||
on:contextmenu|preventDefault={(ev) => showContextMenu(ev, report)}
|
||||
|
@ -1,12 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import presentation, { getClient } from '@hcengineering/presentation'
|
||||
import { getStates } from '@hcengineering/task'
|
||||
import { Issue, IssueStatus, Project } from '@hcengineering/tracker'
|
||||
import { Button, Label, SelectPopup, eventToHTMLElement, showPopup } from '@hcengineering/ui'
|
||||
import { StatusPresenter, statusStore } from '@hcengineering/view-resources'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
import IssueStatusIcon from '../issues/IssueStatusIcon.svelte'
|
||||
|
||||
export let projectId: Ref<Project>
|
||||
@ -17,10 +18,7 @@
|
||||
|
||||
let _space: Project | undefined = undefined
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query(tracker.class.Project, { space: projectId }, (result) => {
|
||||
_space = result[0]
|
||||
})
|
||||
$: _space = $activeProjects.get(projectId)
|
||||
|
||||
const client = getClient()
|
||||
|
||||
|
@ -69,7 +69,7 @@ import {
|
||||
groupBy,
|
||||
statusStore
|
||||
} from '@hcengineering/view-resources'
|
||||
import { get } from 'svelte/store'
|
||||
import { get, writable } from 'svelte/store'
|
||||
import tracker from './plugin'
|
||||
import { defaultMilestoneStatuses, defaultPriorities } from './types'
|
||||
|
||||
@ -371,6 +371,13 @@ export async function milestoneSort (
|
||||
})
|
||||
}
|
||||
|
||||
export const activeProjects = writable<IdMap<Project>>(new Map())
|
||||
const activeProjectsQuery = createQuery(true)
|
||||
|
||||
activeProjectsQuery.query(tracker.class.Project, { archived: false }, (projects) => {
|
||||
activeProjects.set(toIdMap(projects))
|
||||
})
|
||||
|
||||
export async function moveIssuesToAnotherMilestone (
|
||||
client: TxOperations,
|
||||
oldMilestone: Milestone,
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
showPopup(
|
||||
ViewOptionsEditor,
|
||||
{ viewlet, config: mergedModel, viewOptions },
|
||||
{ viewlet, config: mergedModel, viewOptions: getClient().getHierarchy().clone(viewOptions) },
|
||||
eventToHTMLElement(event),
|
||||
undefined,
|
||||
(result) => {
|
||||
@ -93,8 +93,8 @@
|
||||
// Clear selection on view settings change.
|
||||
focusStore.set({})
|
||||
|
||||
dispatch('viewOptions', viewOptions)
|
||||
setViewOptions(viewlet, viewOptions)
|
||||
dispatch('viewOptions', viewOptions)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -76,7 +76,7 @@
|
||||
revert?: () => void
|
||||
}
|
||||
export let listDiv: HTMLDivElement
|
||||
export let selection: number | undefined = undefined
|
||||
export let selection: number | undefined
|
||||
export let groupPersistKey: string
|
||||
export let compactMode: boolean = false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user