Skip to content

Commit

Permalink
TSK-413: Implement scrum recording (#2550)
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Brechka <[email protected]>
  • Loading branch information
mrsadman99 authored Feb 3, 2023
1 parent 7f05cbe commit b0b1089
Show file tree
Hide file tree
Showing 78 changed files with 2,138 additions and 334 deletions.
9 changes: 4 additions & 5 deletions models/calendar/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import activity from '@hcengineering/activity'
import { calendarId, Calendar, Event, Reminder } from '@hcengineering/calendar'
import { Employee } from '@hcengineering/contact'
import type { Domain, Markup, Ref, Timestamp } from '@hcengineering/core'
import { IndexKind } from '@hcengineering/core'
import { DateRangeMode, Domain, Markup, Ref, Timestamp, IndexKind } from '@hcengineering/core'
import {
ArrOf,
Builder,
Expand Down Expand Up @@ -66,10 +65,10 @@ export class TEvent extends TAttachedDoc implements Event {
@Index(IndexKind.FullText)
location?: string

@Prop(TypeDate(true), calendar.string.Date)
@Prop(TypeDate(DateRangeMode.DATETIME), calendar.string.Date)
date!: Timestamp

@Prop(TypeDate(true), calendar.string.DueTo)
@Prop(TypeDate(DateRangeMode.DATETIME), calendar.string.DueTo)
dueDate!: Timestamp

@Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files })
Expand All @@ -85,7 +84,7 @@ export class TEvent extends TAttachedDoc implements Event {
@Mixin(calendar.mixin.Reminder, calendar.class.Event)
@UX(calendar.string.Reminder, calendar.icon.Calendar)
export class TReminder extends TEvent implements Reminder {
@Prop(TypeDate(true), calendar.string.Shift)
@Prop(TypeDate(DateRangeMode.DATETIME), calendar.string.Shift)
@Hidden()
shift!: Timestamp

Expand Down
5 changes: 2 additions & 3 deletions models/contact/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import {
Persons,
Status
} from '@hcengineering/contact'
import type { Class, Domain, Ref, Timestamp } from '@hcengineering/core'
import { DOMAIN_MODEL, IndexKind } from '@hcengineering/core'
import { Class, DateRangeMode, Domain, Ref, Timestamp, DOMAIN_MODEL, IndexKind } from '@hcengineering/core'
import {
Builder,
Collection,
Expand Down Expand Up @@ -115,7 +114,7 @@ export class TChannel extends TAttachedDoc implements Channel {
@Model(contact.class.Person, contact.class.Contact)
@UX(contact.string.Person, contact.icon.Person, undefined, 'name')
export class TPerson extends TContact implements Person {
@Prop(TypeDate(false, false), contact.string.Birthday)
@Prop(TypeDate(DateRangeMode.DATE, false), contact.string.Birthday)
birthday?: Timestamp
}

Expand Down
87 changes: 78 additions & 9 deletions models/tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
// limitations under the License.
//

import type { Employee } from '@hcengineering/contact'
import type { Employee, EmployeeAccount } from '@hcengineering/contact'
import contact from '@hcengineering/contact'
import {
DateRangeMode,
Domain,
DOMAIN_MODEL,
FindOptions,
Expand All @@ -41,6 +42,7 @@ import {
TypeNumber,
TypeRef,
TypeString,
TypeTimestamp,
UX
} from '@hcengineering/model'
import attachment from '@hcengineering/model-attachment'
Expand All @@ -65,6 +67,8 @@ import {
IssueTemplateChild,
Project,
ProjectStatus,
Scrum,
ScrumRecord,
Sprint,
SprintStatus,
Team,
Expand Down Expand Up @@ -242,7 +246,7 @@ export class TIssue extends TAttachedDoc implements Issue {

declare space: Ref<Team>

@Prop(TypeDate(true), tracker.string.DueDate)
@Prop(TypeDate(DateRangeMode.DATETIME), tracker.string.DueDate)
dueDate!: Timestamp | null

@Prop(TypeString(), tracker.string.Rank)
Expand Down Expand Up @@ -296,7 +300,7 @@ export class TIssueTemplate extends TDoc implements IssueTemplate {

declare space: Ref<Team>

@Prop(TypeDate(true), tracker.string.DueDate)
@Prop(TypeDate(DateRangeMode.DATETIME), tracker.string.DueDate)
dueDate!: Timestamp | null

@Prop(TypeRef(tracker.class.Sprint), tracker.string.Sprint)
Expand Down Expand Up @@ -396,10 +400,10 @@ export class TProject extends TDoc implements Project {
@Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files })
attachments?: number

@Prop(TypeDate(true), tracker.string.StartDate)
@Prop(TypeDate(DateRangeMode.DATETIME), tracker.string.StartDate)
startDate!: Timestamp | null

@Prop(TypeDate(true), tracker.string.TargetDate)
@Prop(TypeDate(DateRangeMode.DATETIME), tracker.string.TargetDate)
targetDate!: Timestamp | null

declare space: Ref<Team>
Expand Down Expand Up @@ -433,10 +437,10 @@ export class TSprint extends TDoc implements Sprint {
@Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files })
attachments?: number

@Prop(TypeDate(false), tracker.string.StartDate)
@Prop(TypeDate(), tracker.string.StartDate)
startDate!: Timestamp

@Prop(TypeDate(false), tracker.string.TargetDate)
@Prop(TypeDate(), tracker.string.TargetDate)
targetDate!: Timestamp

declare space: Ref<Team>
Expand All @@ -448,6 +452,62 @@ export class TSprint extends TDoc implements Sprint {
project!: Ref<Project>
}

/**
* @public
*/
@Model(tracker.class.Scrum, core.class.Doc, DOMAIN_TRACKER)
@UX(tracker.string.Scrum, tracker.icon.Scrum, tracker.string.Scrum)
export class TScrum extends TDoc implements Scrum {
@Prop(TypeString(), tracker.string.Title)
title!: string

@Prop(TypeMarkup(), tracker.string.Description)
description?: Markup

@Prop(Collection(attachment.class.Attachment), attachment.string.Attachments, { shortLabel: attachment.string.Files })
attachments?: number

@Prop(ArrOf(TypeRef(contact.class.Employee)), tracker.string.Members)
members!: Ref<Employee>[]

@Prop(Collection(tracker.class.Scrum), tracker.string.ScrumRecords)
scrumRecords?: number

@Prop(TypeDate(DateRangeMode.TIME), tracker.string.ScrumBeginTime)
beginTime!: Timestamp

@Prop(TypeDate(DateRangeMode.TIME), tracker.string.ScrumEndTime)
endTime!: Timestamp

declare space: Ref<Team>
}

/**
* @public
*/
@Model(tracker.class.ScrumRecord, core.class.Doc, DOMAIN_TRACKER)
@UX(tracker.string.ScrumRecord, tracker.icon.Scrum, tracker.string.ScrumRecord)
export class TScrumRecord extends TAttachedDoc implements ScrumRecord {
@Prop(TypeString(), tracker.string.Title)
label!: string

@Prop(TypeTimestamp(), tracker.string.ScrumBeginTime)
startTs!: Timestamp

@Prop(TypeTimestamp(), tracker.string.ScrumEndTime)
endTs?: Timestamp

@Prop(Collection(chunter.class.Comment), tracker.string.Comments)
comments!: number

@Prop(Collection(attachment.class.Attachment), tracker.string.Attachments)
attachments!: number

declare attachedTo: Ref<Scrum>
declare space: Ref<Team>
declare scrumRecorder: Ref<EmployeeAccount>
}

@UX(core.string.Number)
@Model(tracker.class.TypeReportedTime, core.class.Type)
export class TTypeReportedTime extends TType {}
Expand All @@ -463,6 +523,8 @@ export function createModel (builder: Builder): void {
TTypeIssuePriority,
TTypeProjectStatus,
TSprint,
TScrum,
TScrumRecord,
TTypeSprintStatus,
TTimeSpendReport,
TTypeReportedTime
Expand Down Expand Up @@ -747,6 +809,7 @@ export function createModel (builder: Builder): void {
const projectsId = 'projects'
const sprintsId = 'sprints'
const templatesId = 'templates'
const scrumsId = 'scrums'

builder.mixin(tracker.class.Issue, core.class.Class, view.mixin.ObjectPresenter, {
presenter: tracker.component.IssuePresenter
Expand Down Expand Up @@ -805,7 +868,7 @@ export function createModel (builder: Builder): void {
})

builder.mixin(tracker.class.Project, core.class.Class, view.mixin.ObjectPresenter, {
presenter: tracker.component.ProjectTitlePresenter
presenter: tracker.component.ProjectPresenter
})

builder.mixin(tracker.class.Team, core.class.Class, view.mixin.ObjectPresenter, {
Expand All @@ -819,7 +882,7 @@ export function createModel (builder: Builder): void {
})

builder.mixin(tracker.class.Sprint, core.class.Class, view.mixin.ObjectPresenter, {
presenter: tracker.component.SprintTitlePresenter
presenter: tracker.component.SprintPresenter
})

builder.mixin(tracker.class.Sprint, core.class.Class, view.mixin.AttributePresenter, {
Expand Down Expand Up @@ -917,6 +980,12 @@ export function createModel (builder: Builder): void {
icon: tracker.icon.Sprint,
component: tracker.component.Sprints
},
{
id: scrumsId,
label: tracker.string.Scrums,
icon: tracker.icon.Scrum,
component: tracker.component.Scrums
},
{
id: templatesId,
label: tracker.string.IssueTemplates,
Expand Down
1 change: 0 additions & 1 deletion models/tracker/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default mergeIds(trackerId, tracker, {
// Required to pass build without errorsF
Nope: '' as AnyComponent,
SprintSelector: '' as AnyComponent,
SubIssuesSelector: '' as AnyComponent,
IssueStatistics: '' as AnyComponent
},
app: {
Expand Down
14 changes: 11 additions & 3 deletions packages/core/src/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,20 @@ export type AttachedData<T extends AttachedDoc> = Omit<T, keyof AttachedDoc>
/**
* @public
*/
export enum DateRangeMode {
DATE = 'date',
TIME = 'time',
DATETIME = 'datetime'
}

/**
* @public
*/
export interface TypeDate extends Type<Date> {
// If not set date mode default
mode: DateRangeMode
// If not set to true, will be false
withTime?: boolean
// If not set to true, will be false
withShift?: boolean
withShift: boolean
}

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/model/src/dsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import core, {
ClassifierKind,
Collection as TypeCollection,
Data,
DateRangeMode,
Doc,
Domain,
Enum,
Expand Down Expand Up @@ -405,8 +406,8 @@ export function TypeTimestamp (): Type<Timestamp> {
/**
* @public
*/
export function TypeDate (withTime?: boolean, withShift?: boolean): TypeDateType {
return { _class: core.class.TypeDate, label: core.string.Date, withTime, withShift }
export function TypeDate (mode: DateRangeMode = DateRangeMode.DATE, withShift: boolean = true): TypeDateType {
return { _class: core.class.TypeDate, label: core.string.Date, mode, withShift }
}

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/panel/src/components/Panel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
export let isHeader: boolean = true
export let isSub: boolean = true
export let isAside: boolean = true
export let isUtils: boolean = true
export let isCustomAttr: boolean = true
export let floatAside = false
export let allowClose = true
Expand Down Expand Up @@ -89,7 +90,7 @@
<svelte:fragment slot="utils">
<Component is={calendar.component.DocReminder} props={{ value: object, title }} />
<Component is={notification.component.LastViewEditor} props={{ value: object }} />
{#if $$slots.utils}
{#if isUtils && $$slots.utils}
<div class="buttons-divider" />
<slot name="utils" />
{/if}
Expand Down
7 changes: 6 additions & 1 deletion packages/ui/src/components/Dropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
-->
<script lang="ts">
import type { Asset, IntlString } from '@hcengineering/platform'
import { createEventDispatcher } from 'svelte'
import { getFocusManager } from '../focus'
import { showPopup } from '../popups'
import type { AnySvelteComponent, ButtonKind, ButtonSize, ListItem, TooltipAlignment } from '../types'
Expand All @@ -37,6 +38,7 @@
let container: HTMLElement
let opened: boolean = false
const dispatch = createEventDispatcher()
const mgr = getFocusManager()
</script>

Expand All @@ -53,7 +55,10 @@
if (!opened) {
opened = true
showPopup(DropdownPopup, { title: label, items, icon }, container, (result) => {
if (result) selected = result
if (result) {
selected = result
dispatch('selected', result)
}
opened = false
mgr?.setFocusPos(focusIndex)
})
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/TimeShiftPicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { DateRangeMode } from '@hcengineering/core'
import type { IntlString } from '@hcengineering/platform'
import { createEventDispatcher, onMount } from 'svelte'
import { showPopup } from '../popups'
Expand Down Expand Up @@ -75,7 +76,7 @@
{#if value?.shift !== undefined}
<TimeShiftPresenter value={value.shift} />
{:else}
<DateRangePresenter value={value?.date} withTime={true} editable={false} />
<DateRangePresenter value={value?.date} mode={DateRangeMode.DATETIME} editable={false} />
{/if}
</div>
</div>
3 changes: 2 additions & 1 deletion packages/ui/src/components/TimeShiftPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { DateRangeMode } from '@hcengineering/core'
import { createEventDispatcher } from 'svelte'
import ui from '../plugin'
import { DateOrShift } from '../types'
Expand All @@ -39,7 +40,7 @@
<div class="flex-center mt-1 mb-1">
<DateRangePresenter
bind:value={date}
withTime={true}
mode={DateRangeMode.DATETIME}
editable={true}
labelNull={ui.string.SelectDate}
on:change={() => {
Expand Down
5 changes: 4 additions & 1 deletion packages/ui/src/components/calendar/DatePicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
-->
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { DateRangeMode } from '@hcengineering/core'
import type { IntlString } from '@hcengineering/platform'
import ui from '../../plugin'
import Label from '../Label.svelte'
Expand All @@ -34,11 +35,13 @@
dispatch('change', value)
}
}
$: mode = withTime ? DateRangeMode.DATETIME : DateRangeMode.DATE
</script>

<div class="antiSelect antiWrapper cursor-default">
<div class="flex-col">
<span class="label mb-1"><Label label={title} /></span>
<DatePresenter {value} {withTime} {icon} {labelOver} {labelNull} editable on:change={changeValue} />
<DatePresenter {value} {mode} {icon} {labelOver} {labelNull} editable on:change={changeValue} />
</div>
</div>
Loading

0 comments on commit b0b1089

Please sign in to comment.