Files
huly-platform/models/tracker/src/viewlets.ts
T
63e28dc964 feat(tracker): Gantt chart for the issue tracker (#10992)
* feat(tracker): Gantt chart for the issue tracker

Builds on the merged search/filter rework (#10998). Introduces @hcengineering/gantt, a dependency-free scheduling/zoom/drag/viewport engine package (with a neutral GanttDependency contract), and wires the tracker-specific adapter, Svelte UI, model schema, dependency-shift notifications and sanity coverage in tracker-resources.

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>

* fix(tracker): source Gantt holidays from HR and scope confirm-gate per view

Follow-up to review feedback on #10992:

- Confirm-gate: the module-global flag is replaced by a createConfirmGate()
  factory - one instance per mounted GanttView, so two Gantt views mounted at
  once in the same JS context no longer block each other's pointer input. A
  two-instance independence test guards the regression.

- Sidebar sorting: the stale deadline cast is dropped and issue.deadline is
  read directly (the field was added to the Issue model in this PR).

- HR holidays: the per-project WorkingDaysConfig.holidays field duplicated the
  workspace-wide hr.class.PublicHoliday concept and could drift from the real
  HR calendar. It is removed. WorkingDaysConfig now carries only the weekday
  mask and an optional holidayDepartment. The tracker adapter resolves holidays
  for the selected department plus all ancestors up to hr.ids.Head, matching
  HR's existing inheritance semantics (hr-resources ScheduleView). A missing or
  invalid reference falls back to company-wide (root) holidays; unrelated
  departments are never included. The ancestor walk is cycle/missing-parent
  safe.

  A small WorkingDaysEditor in the existing project create/edit dialog lets
  users with the existing project permission enable the mode, choose weekdays,
  and select an HR department (default: Company-wide). It persists through the
  existing project create/update transaction paths (createDoc on create,
  client.update on edit) and uses $unset when the mode is disabled. At least
  one working day must stay active.

  Calendar loading is explicit via a CalendarStateMachine: project-scoped drag,
  resize, cascade, keyboard-shift and auto-schedule mutations stay disabled
  until both the project config and the holiday data have loaded. A monotonic
  generation ticket (bumped synchronously on project switch) is re-checked
  immediately before every calendar-dependent date commit, so work started in
  one project can never persist after a switch to another. The all-projects
  view has no single project calendar, so calendar-dependent edits are
  read-only there; display, selection, the context menu and the manual
  date-picker (which does no calendar arithmetic and takes no mutation ticket)
  stay available.

  This depends on the lightweight @hcengineering/hr model package, but not on
  hr-resources; the tracker adapter uses hr.class.* and hr.ids.Head at runtime,
  and actual HR model presence is checked through the hierarchy - without the
  HR model, holidays resolve to an empty set. The @hcengineering/gantt engine
  package stays domain-neutral (no @hcengineering imports, no runtime deps).

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>

* fix(gantt): measure FS gap-preservation floor in working days

The finish-to-start gap-preservation floor in the cascade scheduler mixed
two time measures: the FS snap anchor is working-calendar aware, but the
floor added a raw calendar-millisecond start-side delta. With an active
working calendar the two diverge, so dragging a predecessor over a weekend
over-shifted the successor across non-working days (a Fri->Mon body drag is
3 calendar days but only 1 working day, and could even land a successor on
a Saturday).

Measure the floor on the DUE side in working days instead: translate the
predecessor's shift via the new workingDayDelta helper and advance the
floor base with addWorkingDays over the calendar. A day-granular resize
gate (utcMidnight comparison, not a raw === 0 test) arms the floor only on
a start-DAY move, so a pure due-resize stays a pure snap even when the
stored issue carries a time-of-day on the cascade-commit path. The floor
base is normalized via utcMidnight(targetAnchor). The legacy path
(cfg === undefined) stays byte-identical to today's raw-ms floor. A
left-resize in working-days mode now correctly no-ops the floor (the due,
and thus the FS gap, did not move) instead of shifting on the raw start
delta.

Engine: add workingDayDelta (signed, half-open from-exclusive/to-inclusive
working-day step count) and export the previously-private utcMidnight from
packages/gantt/src/working-days.ts. The engine stays domain-neutral (no
@hcengineering imports, empty dependencies).

Adds engine and adapter test coverage: workingDayDelta cases and the full
FS floor matrix (right-resize no-push, weekend-spanner body drag, floor
wins over snap, holiday in the floor path, floor-dominant multi-hop chain,
negative delta, legacy no-cfg, SS pure-snap, raw time-of-day right-resize,
direct left-resize).

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>

---------

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
Co-authored-by: Michael Uray <michaeluray@users.noreply.github.com>
2026-08-27 20:24:38 +07:00

1067 lines
32 KiB
TypeScript

//
// Copyright © 2023 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.
//
import contact from '@hcengineering/contact'
import { SortingOrder } from '@hcengineering/core'
import { type Builder } from '@hcengineering/model'
import core from '@hcengineering/model-core'
import task from '@hcengineering/model-task'
import view, { showColorsViewOption } from '@hcengineering/model-view'
import tags from '@hcengineering/tags'
import { type ViewOptionModel, type BuildModelKey, type ViewOptionsModel } from '@hcengineering/view'
import tracker from './plugin'
// Shared Customize-View knobs reused by both `issuesOptions()`
// (List + Kanban) and the Gantt viewlet block. Keep this list as the single
// source of truth so a change in one place can never disagree with the
// other half of the UI.
const SEARCH_VIEW_OPTIONS: ViewOptionModel[] = [
{
key: 'showQuickModeSelector',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.ShowQuickModeSelector
},
{
key: 'searchScope',
type: 'dropdown',
defaultValue: 'all',
values: [
{ id: 'title', label: tracker.string.SearchScopeTitle },
{ id: 'title-description', label: tracker.string.SearchScopeTitleDescription },
{ id: 'all', label: tracker.string.SearchScopeAll }
],
label: tracker.string.SearchScopeLabel
},
{
key: 'searchHighlight',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.SearchHighlight
}
]
export const issuesOptions = (kanban: boolean): ViewOptionsModel => ({
groupBy: [
'status',
'kind',
'assignee',
'priority',
'space',
'component',
'milestone',
'createdBy',
'modifiedBy',
'estimation',
'remainingTime',
'reportedTime'
],
orderBy: [
['modifiedOn', SortingOrder.Descending],
['status', SortingOrder.Ascending],
['kind', SortingOrder.Ascending],
['priority', SortingOrder.Ascending],
['createdOn', SortingOrder.Descending],
['dueDate', SortingOrder.Ascending],
['rank', SortingOrder.Ascending],
['estimation', SortingOrder.Descending],
['remainingTime', SortingOrder.Descending],
['reportedTime', SortingOrder.Descending]
],
other: [
{
key: 'shouldShowSubIssues',
type: 'toggle',
defaultValue: true,
actionTarget: 'query',
action: tracker.function.SubIssueQuery,
label: tracker.string.SubIssues
},
{
key: 'shouldShowAll',
type: 'toggle',
defaultValue: false,
actionTarget: 'category',
action: view.function.ShowEmptyGroups,
label: view.string.ShowEmptyGroups
},
{
key: 'hideArchived',
type: 'toggle',
defaultValue: true,
actionTarget: 'options',
action: view.function.HideArchived,
label: view.string.HideArchived
},
...(!kanban ? [showColorsViewOption] : []),
...SEARCH_VIEW_OPTIONS
]
})
export function issueConfig (
key: string = '',
compact: boolean = false,
milestone: boolean = true,
component: boolean = true
): (BuildModelKey | string)[] {
return [
{
key: '',
label: tracker.string.Priority,
presenter: tracker.component.PriorityEditor,
props: { type: 'priority', kind: 'list', size: 'small' },
displayProps: { key: 'priority' }
},
{
key: '',
label: tracker.string.Identifier,
presenter: tracker.component.IssuePresenter,
displayProps: { key: key + 'issue', fixed: 'left' }
},
{
key: '',
label: tracker.string.Status,
presenter: tracker.component.StatusEditor,
props: { kind: 'list', size: 'small', justify: 'center' },
displayProps: { key: key + 'status' }
},
{
key: 'kind',
label: task.string.TaskType,
presenter: task.component.TaskTypeListPresenter,
props: { kind: 'list', size: 'small', justify: 'center' },
displayProps: { key: key + 'kind' }
},
{
key: '',
label: tracker.string.Title,
presenter: tracker.component.TitlePresenter,
props: compact
? { shouldUseMargin: true, showParent: false, grow: true, minWidth: '5rem' }
: { grow: true, minWidth: '5rem' },
displayProps: { key: key + 'title' }
},
{
key: '',
label: tracker.string.SubIssues,
presenter: tracker.component.SubIssuesSelector,
props: {}
},
{ key: 'comments', displayProps: { key: key + 'comments', suffix: true } },
{ key: 'attachments', displayProps: { key: key + 'attachments', suffix: true } },
{ key: '', displayProps: { grow: true } },
{
key: 'labels',
presenter: tags.component.LabelsPresenter,
displayProps: { compression: true },
props: { kind: 'list', full: false }
},
{
key: '',
label: tracker.string.Extensions,
presenter: tracker.component.IssueExtra,
displayProps: { compression: true },
props: { kind: 'list', full: false }
},
...(milestone
? [
{
key: '',
label: tracker.string.Milestone,
presenter: tracker.component.MilestoneEditor,
props: {
kind: 'list',
size: 'small',
shouldShowPlaceholder: false,
maxWidth: '30rem'
},
displayProps: {
key: key + 'milestone',
excludeByKey: 'milestone',
compression: true
}
}
]
: []),
...(component
? [
{
key: '',
label: tracker.string.Component,
presenter: tracker.component.ComponentEditor,
props: {
kind: 'list',
size: 'small',
shouldShowPlaceholder: false,
maxWidth: '30rem'
},
displayProps: {
key: key + 'component',
excludeByKey: 'component',
compression: true
}
}
]
: []),
{
key: '',
label: tracker.string.DueDate,
presenter: tracker.component.DueDatePresenter,
displayProps: { key: key + 'dueDate', compression: true },
props: { kind: 'list' }
},
{
// Predecessors column. Opt-in via "Configure columns"
// (displayProps.optional = true) because the vast majority of issues
// have zero predecessors and the cell would otherwise be permanently
// empty in a default list. Renders the upstream Issue identifier
// followed by kind+lag, e.g. "PROJ-3 FS+2d"; multiple predecessors
// collapse to "first +N more" with a hover tooltip showing every
// dependency. Sortable is intentionally NOT enabled — there is no
// meaningful total order across predecessor lists.
key: '',
label: tracker.string.Predecessors,
presenter: tracker.component.PredecessorsColumn,
displayProps: { key: key + 'predecessors', optional: true }
},
{
key: '',
label: tracker.string.Estimation,
presenter: tracker.component.EstimationEditor,
props: { kind: 'list', size: 'small' },
displayProps: { key: key + 'estimation', fixed: 'left', dividerBefore: true, optional: true }
},
{
key: 'modifiedOn',
presenter: tracker.component.ModificationDatePresenter,
displayProps: { key: key + 'modified', fixed: 'left', dividerBefore: true }
},
{
key: 'assignee',
presenter: tracker.component.AssigneeEditor,
displayProps: { key: 'assignee', fixed: 'right' },
props: { kind: 'list', shouldShowName: false, avatarSize: 'x-small' }
}
]
}
export function ganttViewOptions (): ViewOptionsModel {
// The Gantt viewlet deliberately leaves the generic `groupBy` list empty and
// exposes its own `ganttGroupBy` toggle below instead: the canvas groups into
// swimlanes itself, which the shared grouped-list machinery cannot render.
// The sidebar-column toggles below are wired up to GanttSidebar.
return {
groupBy: [],
orderBy: [
['startDate', SortingOrder.Ascending],
['rank', SortingOrder.Ascending],
['dueDate', SortingOrder.Ascending]
],
other: [
{
key: 'ganttShowIssueCode',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttShowIssueCode
},
{
key: 'ganttShowTitle',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.GanttShowTitle
},
{
key: 'ganttShowStatus',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.GanttShowStatus
},
{
// Default-on safety prompt: when set, dragging an issue's bar to a
// new date range shows a confirm dialog before writing the change.
// Easy to misclick a bar while panning,
// and a one-click confirm prevents accidental schedule edits.
key: 'ganttConfirmMove',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.GanttConfirmMove
},
{
// Same idea but for left/right resize handles.
key: 'ganttConfirmResize',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.GanttConfirmResize
},
{
// Sidebar column showing predecessor notation (e.g. "12FS+2d").
// Hidden by default so existing users don't see a new column appear.
// Toggling on requires no migration — the column is purely derived
// from the IssueRelation collection.
key: 'ganttShowPredecessors',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttShowPredecessors
},
{
// Critical-path overlay toggle. When on, critical bars get a red
// border and fill overlay; critical relations get red arrows; non-critical
// bars show a grey slack glyph.
key: 'ganttCriticalPath',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.CriticalPathOn
},
{
// Slack column in the sidebar. Shows numeric slack days or "CP" badge
// for critical issues. Requires ganttCriticalPath to be meaningful.
key: 'ganttSlackColumn',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.SlackColumn
},
{
// Bar label slot (left of bar).
// Default 'none' so existing users see no left-side label.
key: 'ganttBarLabelLeft',
type: 'dropdown',
defaultValue: 'none',
actionTarget: 'display',
label: tracker.string.GanttBarLabelLeft,
values: [
{ id: 'none', label: tracker.string.BarLabelNone },
{ id: 'title', label: tracker.string.BarLabelTitle },
{ id: 'identifier', label: tracker.string.BarLabelIdentifier },
{ id: 'assignee', label: tracker.string.BarLabelAssignee },
{ id: 'priority', label: tracker.string.BarLabelPriority },
{ id: 'status', label: tracker.string.BarLabelStatus },
{ id: 'estimation', label: tracker.string.BarLabelEstimation },
{ id: 'progress', label: tracker.string.BarLabelProgress }
]
},
{
// Bar label slot (inside bar, rendered only if bar > 60px wide).
// Default 'title' preserves the legacy in-bar title rendering.
key: 'ganttBarLabelInside',
type: 'dropdown',
defaultValue: 'title',
actionTarget: 'display',
label: tracker.string.GanttBarLabelInside,
values: [
{ id: 'none', label: tracker.string.BarLabelNone },
{ id: 'title', label: tracker.string.BarLabelTitle },
{ id: 'identifier', label: tracker.string.BarLabelIdentifier },
{ id: 'assignee', label: tracker.string.BarLabelAssignee },
{ id: 'priority', label: tracker.string.BarLabelPriority },
{ id: 'status', label: tracker.string.BarLabelStatus },
{ id: 'estimation', label: tracker.string.BarLabelEstimation },
{ id: 'progress', label: tracker.string.BarLabelProgress }
]
},
{
// Bar label slot (right of bar).
// Default 'none'.
key: 'ganttBarLabelRight',
type: 'dropdown',
defaultValue: 'none',
actionTarget: 'display',
label: tracker.string.GanttBarLabelRight,
values: [
{ id: 'none', label: tracker.string.BarLabelNone },
{ id: 'title', label: tracker.string.BarLabelTitle },
{ id: 'identifier', label: tracker.string.BarLabelIdentifier },
{ id: 'assignee', label: tracker.string.BarLabelAssignee },
{ id: 'priority', label: tracker.string.BarLabelPriority },
{ id: 'status', label: tracker.string.BarLabelStatus },
{ id: 'estimation', label: tracker.string.BarLabelEstimation },
{ id: 'progress', label: tracker.string.BarLabelProgress }
]
},
{
// Opt-in for the Quick-Info popover.
// false (default = legacy) = single-click only selects + focuses
// the bar (no popup, no editor); double-click on the bar opens
// the full editor as before. No behaviour change for existing users.
// true = single-click selects + focuses AND opens the lightweight
// Quick-Info popover. Double-click continues to open the full
// editor on top of the popover.
key: 'ganttQuickInfoOnClick',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttQuickInfoOnClick
},
{
// Extended sidebar grid. When on, the sidebar renders a sortable
// header row + per-column cells (identifier, title, predecessors,
// slack, plus any toggled columns below). When off, the legacy
// compact layout is preserved.
key: 'ganttSidebarColumnsExtended',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarColumnsExtended
},
// Per-column visibility toggles for the extended sidebar. Hidden when
// ganttSidebarColumnsExtended is off. Identifier + Title + Predecessors
// + Slack are always shown (default column set).
{
key: 'ganttSidebarShowStatus',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowStatus,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
key: 'ganttSidebarShowPriority',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowPriority,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
key: 'ganttSidebarShowAssignee',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowAssignee,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
key: 'ganttSidebarShowEstimation',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowEstimation,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
key: 'ganttSidebarShowStartDate',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowStartDate,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
key: 'ganttSidebarShowDueDate',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowDueDate,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
key: 'ganttSidebarShowDeadline',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowDeadline,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
key: 'ganttSidebarShowProgress',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttSidebarShowProgress,
dependsOn: 'ganttSidebarColumnsExtended'
},
{
// Group-by swimlanes. Issues group into horizontal lanes
// by status/priority/assignee/component/milestone/label. Default
// 'none' preserves the legacy hierarchy view bit-for-bit. The
// sidebar shows a chevron + label + count header per lane; the
// canvas paints a tint band behind each header.
key: 'ganttGroupBy',
type: 'dropdown',
defaultValue: 'none',
values: [
{ id: 'none', label: tracker.string.GanttGroupByNone },
{ id: 'status', label: tracker.string.GanttGroupByStatus },
{ id: 'priority', label: tracker.string.GanttGroupByPriority },
{ id: 'assignee', label: tracker.string.GanttGroupByAssignee },
{ id: 'component', label: tracker.string.GanttGroupByComponent },
{ id: 'milestone', label: tracker.string.GanttGroupByMilestone },
{ id: 'label', label: tracker.string.GanttGroupByLabel }
],
actionTarget: 'display',
label: tracker.string.GanttGroupBy
},
{
// Overlay toggles. When past-due is on, overdue bars
// get a diagonal red-stripe overlay; when blocked is on, bars with
// an unsatisfied predecessor get a hatch overlay. Both default ON
// so new users immediately see the visual cues.
key: 'ganttShowPastDueOverlay',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.GanttShowPastDueOverlay
},
{
key: 'ganttShowBlockedOverlay',
type: 'toggle',
defaultValue: true,
actionTarget: 'display',
label: tracker.string.GanttShowBlockedOverlay
},
{
// Sub-issue progress fill: when ON, parent bars show a secondary
// fill proportional to child-issue completion. Default OFF to keep
// the chart uncluttered for teams that don't use sub-issues.
key: 'ganttShowSubIssueProgress',
type: 'toggle',
defaultValue: false,
actionTarget: 'display',
label: tracker.string.GanttShowSubIssueProgress
},
// Plan-2 — search-scope / quick-filter / highlight toggles.
...SEARCH_VIEW_OPTIONS
]
}
}
export function ganttConfig (): BuildModelKey[] {
// Minimal config — Gantt drives its own column layout.
return [
{
key: '',
presenter: tracker.component.PriorityEditor,
label: tracker.string.Priority,
props: { kind: 'list', size: 'small' }
},
{ key: '', presenter: tracker.component.IssuePresenter, label: tracker.string.Issue }
]
}
export function defineViewlets (builder: Builder): void {
builder.createDoc(
view.class.ViewletDescriptor,
core.space.Model,
{
label: tracker.string.Board,
icon: task.icon.Kanban,
component: tracker.component.KanbanView
},
tracker.viewlet.Kanban
)
builder.createDoc(
view.class.ViewletDescriptor,
core.space.Model,
{
label: tracker.string.Gantt,
icon: tracker.icon.Gantt,
component: tracker.component.GanttView
},
tracker.viewlet.Gantt
)
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Issue,
descriptor: view.viewlet.List,
viewOptions: issuesOptions(false),
configOptions: {
strict: true,
hiddenKeys: [
'title',
'blockedBy',
'relations',
'description',
'number',
'reportedTime',
'reports',
'priority',
'component',
'milestone',
'estimation',
'remainingTime',
'status',
'dueDate',
'attachedTo',
'createdBy',
'modifiedBy'
]
},
config: issueConfig()
},
tracker.viewlet.IssueList
)
const subIssuesOptions: ViewOptionsModel = {
groupBy: ['status', 'kind', 'assignee', 'priority', 'milestone', 'createdBy', 'modifiedBy'],
orderBy: [
['rank', SortingOrder.Ascending],
['kind', SortingOrder.Ascending],
['status', SortingOrder.Ascending],
['priority', SortingOrder.Ascending],
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending],
['dueDate', SortingOrder.Ascending]
],
groupDepth: 1,
other: [showColorsViewOption]
}
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Issue,
descriptor: view.viewlet.List,
viewOptions: subIssuesOptions,
variant: 'subissue',
configOptions: {
strict: true,
hiddenKeys: [
'priority',
'number',
'status',
'title',
'dueDate',
'milestone',
'estimation',
'remainingTime',
'createdBy',
'modifiedBy'
]
},
config: issueConfig('sub', true, true)
},
tracker.viewlet.SubIssues
)
const milestoneIssueOptions: ViewOptionsModel = {
groupBy: ['status', 'assignee', 'priority', 'component', 'createdBy', 'modifiedBy'],
orderBy: [
['rank', SortingOrder.Ascending],
['status', SortingOrder.Ascending],
['priority', SortingOrder.Ascending],
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending],
['dueDate', SortingOrder.Ascending]
],
groupDepth: 1,
other: [showColorsViewOption]
}
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Issue,
descriptor: view.viewlet.List,
viewOptions: milestoneIssueOptions,
variant: 'milestone',
configOptions: {
strict: true,
hiddenKeys: [
'priority',
'number',
'status',
'title',
'dueDate',
'milestone',
'estimation',
'remainingTime',
'createdBy',
'modifiedBy'
]
},
config: issueConfig('sub', true, false, true)
},
tracker.viewlet.MilestoneIssuesList
)
const componentIssueOptions: ViewOptionsModel = {
groupBy: ['status', 'assignee', 'priority', 'milestone', 'createdBy', 'modifiedBy'],
orderBy: [
['rank', SortingOrder.Ascending],
['status', SortingOrder.Ascending],
['priority', SortingOrder.Ascending],
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending],
['dueDate', SortingOrder.Ascending]
],
groupDepth: 1,
other: [showColorsViewOption]
}
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Issue,
descriptor: view.viewlet.List,
viewOptions: componentIssueOptions,
variant: 'component',
configOptions: {
strict: true,
hiddenKeys: [
'priority',
'number',
'status',
'title',
'dueDate',
'component',
'estimation',
'remainingTime',
'createdBy',
'modifiedBy'
]
},
config: issueConfig('sub', true, true, false)
},
tracker.viewlet.ComponentIssuesList
)
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.IssueTemplate,
descriptor: view.viewlet.List,
viewOptions: {
groupBy: ['assignee', 'priority', 'component', 'milestone', 'createdBy', 'modifiedBy'],
orderBy: [
['priority', SortingOrder.Ascending],
['modifiedOn', SortingOrder.Descending],
['dueDate', SortingOrder.Ascending],
['rank', SortingOrder.Ascending]
],
other: [showColorsViewOption]
},
configOptions: {
strict: true,
hiddenKeys: [
'milestone',
'estimation',
'remainingTime',
'reportedTime',
'component',
'title',
'description',
'createdBy',
'modifiedBy'
]
},
config: [
// { key: '', presenter: tracker.component.PriorityEditor, props: { kind: 'list', size: 'small' } },
{
key: '',
presenter: tracker.component.IssueTemplatePresenter,
props: { type: 'issue', shouldUseMargin: true }
},
// { key: '', presenter: tracker.component.DueDatePresenter, props: { kind: 'list' } },
{
key: '',
presenter: tracker.component.ComponentEditor,
label: tracker.string.Component,
props: {
kind: 'list',
size: 'small',
shouldShowPlaceholder: false,
maxWidth: '30rem'
},
displayProps: { key: 'component', compression: true }
},
{
key: '',
label: tracker.string.Milestone,
presenter: tracker.component.MilestoneEditor,
props: {
kind: 'list',
size: 'small',
shouldShowPlaceholder: false,
maxWidth: '30rem'
},
displayProps: { key: 'milestone', compression: true }
},
{
key: '',
label: tracker.string.Estimation,
presenter: tracker.component.TemplateEstimationEditor,
props: {
kind: 'list',
size: 'small'
},
displayProps: { key: 'estimation', compression: true }
},
{ key: '', displayProps: { grow: true } },
{
key: 'modifiedOn',
presenter: tracker.component.ModificationDatePresenter,
displayProps: { fixed: 'right', dividerBefore: true }
},
{
key: 'assignee',
presenter: tracker.component.AssigneeEditor,
props: { kind: 'list', shouldShowName: false, avatarSize: 'x-small' }
}
]
},
tracker.viewlet.IssueTemplateList
)
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Issue,
descriptor: tracker.viewlet.Kanban,
viewOptions: {
...issuesOptions(true),
groupDepth: 1
},
configOptions: {
strict: true
},
config: [
'subIssues',
'priority',
'component',
'milestone',
'dueDate',
'labels',
'estimation',
'attachments',
'comments'
]
},
tracker.viewlet.IssueKanban
)
// Gantt is registered AFTER List + Kanban so List remains the default
// viewlet (ViewletSelector falls back to viewlets[0] when no preference
// is saved). Putting Gantt last avoids surprising users with an empty
// canvas on first visit.
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Issue,
descriptor: tracker.viewlet.Gantt,
viewOptions: ganttViewOptions(),
configOptions: { strict: true, hiddenKeys: ['title'] },
config: ganttConfig()
},
tracker.viewlet.IssueGantt
)
const componentListViewOptions: ViewOptionsModel = {
groupBy: ['lead', 'createdBy', 'modifiedBy'],
orderBy: [
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending]
],
other: [showColorsViewOption]
}
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Component,
descriptor: view.viewlet.List,
viewOptions: componentListViewOptions,
configOptions: {
strict: true,
hiddenKeys: ['label', 'description']
},
config: [
{
key: '',
presenter: tracker.component.ComponentPresenter,
props: { kind: 'list' },
displayProps: { key: 'component', fixed: 'left' }
},
{ key: '', displayProps: { grow: true } },
{
key: '$lookup.lead',
presenter: tracker.component.LeadPresenter,
displayProps: {
dividerBefore: true,
key: 'lead'
},
props: { _class: tracker.class.Component, defaultClass: contact.mixin.Employee, shouldShowLabel: false }
}
]
},
tracker.viewlet.ComponentList
)
const hideArchivedOption: ViewOptionModel = {
key: 'hideArchived',
type: 'toggle',
defaultValue: false,
actionTarget: 'options',
action: view.function.HideArchived,
label: view.string.HideArchived
}
const tableOptions: ViewOptionsModel = {
groupBy: [],
orderBy: [],
other: [hideArchivedOption]
}
const projectListOptions: ViewOptionsModel = {
groupBy: ['createdBy', 'modifiedBy'],
orderBy: [
['name', SortingOrder.Ascending],
['identifier', SortingOrder.Ascending],
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending]
],
other: [hideArchivedOption]
}
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Project,
descriptor: view.viewlet.Table,
viewOptions: tableOptions,
configOptions: {
hiddenKeys: ['identifier', 'name', 'description'],
sortable: true
},
config: [
{
key: '',
presenter: tracker.component.ProjectPresenter,
props: {
openIssues: true
}
},
'members',
{
key: 'defaultAssignee',
props: { kind: 'list' }
},
{
key: 'modifiedOn',
presenter: tracker.component.ModificationDatePresenter,
displayProps: { fixed: 'right', dividerBefore: true }
}
],
options: {
showArchived: true
}
},
tracker.viewlet.ProjectList
)
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Project,
descriptor: view.viewlet.List,
viewOptions: projectListOptions,
configOptions: {
strict: true,
hiddenKeys: ['identifier', 'name', 'description']
},
config: [
{
key: '',
presenter: tracker.component.ProjectPresenter,
props: {
openIssues: true,
shouldUseMargin: true
}
},
'members',
{
key: 'defaultAssignee',
props: { kind: 'list' }
},
{
key: 'modifiedOn',
presenter: tracker.component.ModificationDatePresenter,
displayProps: { fixed: 'right', dividerBefore: true }
}
],
options: {
showArchived: true
}
},
tracker.viewlet.ProjectListGrouped
)
const milestoneOptions: ViewOptionsModel = {
groupBy: ['status', 'createdBy', 'modifiedBy'],
orderBy: [
['modifiedOn', SortingOrder.Descending],
['targetDate', SortingOrder.Descending],
['createdOn', SortingOrder.Descending]
],
other: [showColorsViewOption]
}
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: tracker.class.Milestone,
descriptor: view.viewlet.List,
viewOptions: milestoneOptions,
configOptions: {
strict: true,
hiddenKeys: ['startDate', 'targetDate', 'label', 'description']
},
config: [
{
key: 'status',
props: { width: '1rem', kind: 'list', size: 'small', justify: 'center' }
},
{ key: '', presenter: tracker.component.MilestonePresenter, props: { shouldUseMargin: true } },
{ key: '', displayProps: { grow: true } },
{
key: '',
label: tracker.string.StartDate,
presenter: tracker.component.MilestoneDatePresenter,
props: { field: 'startDate' }
},
{
key: '',
label: tracker.string.TargetDate,
presenter: tracker.component.MilestoneDatePresenter,
props: { field: 'targetDate' }
}
]
},
tracker.viewlet.MilestoneList
)
}