From eeb111bf441cdd3972f8b2b466f5ac3aaace0565 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Wed, 4 Oct 2023 01:22:33 +0700 Subject: [PATCH] UBER-977: A remaining time (#3783) Signed-off-by: Andrey Sobolev --- models/tracker/src/index.ts | 9 ++++++++- models/tracker/src/plugin.ts | 3 ++- plugins/tracker-assets/lang/en.json | 9 +++++---- plugins/tracker-assets/lang/ru.json | 3 ++- tests/sanity/tests/tracker.spec.ts | 10 +++++----- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 20b969c39c..78d092303f 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -236,6 +236,13 @@ export class TIssue extends TTask implements Issue { @ReadOnly() reportedTime!: number + // A fully virtual property with calculated content. + // TODO: Add proper support for this kind of fields + @Prop(TypeNumber(), tracker.string.RemainingTime) + @ReadOnly() + @Hidden() + remainingTime!: number + @Prop(Collection(tracker.class.TimeSpendReport), tracker.string.TimeSpendReports) reports!: number @@ -298,7 +305,7 @@ export class TIssueTemplate extends TDoc implements IssueTemplate { @Model(tracker.class.TimeSpendReport, core.class.AttachedDoc, DOMAIN_TRACKER) @UX(tracker.string.TimeSpendReport, tracker.icon.TimeReport) export class TTimeSpendReport extends TAttachedDoc implements TimeSpendReport { - @Prop(TypeRef(tracker.class.Issue), tracker.string.Parent) + @Prop(TypeRef(tracker.class.Issue), tracker.string.Issue) declare attachedTo: Ref @Prop(TypeRef(contact.mixin.Employee), contact.string.Employee) diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index c52a3cb162..d4e7da49d7 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -42,7 +42,8 @@ export default mergeIds(trackerId, tracker, { ConfigDescription: '' as IntlString, Unarchive: '' as IntlString, UnarchiveConfirm: '' as IntlString, - AllProjects: '' as IntlString + AllProjects: '' as IntlString, + RemainingTime: '' as IntlString }, activity: { TxIssueCreated: '' as AnyComponent, diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index 25593b65e5..2ebba7db4d 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -227,13 +227,14 @@ "MoveAndDeleteMilestoneConfirm": "Do you want to delete milestone and move issues to another milestone?", "Estimation": "Estimation", - "ReportedTime": "Reported Time", - "TimeSpendReports": "Time spend reports", + "ReportedTime": "Spent time", + "RemainingTime": "Remaining Time", + "TimeSpendReports": "Time spent reports", "TimeSpendReport": "Time", "TimeSpendReportAdd": "Add time report", "TimeSpendReportDate": "Date", - "TimeSpendReportValue": "Reported days", - "TimeSpendReportValueTooltip": "Reported time in man days", + "TimeSpendReportValue": "Spent time", + "TimeSpendReportValueTooltip": "Spent time in hours", "TimeSpendReportDescription": "Description", "TimeSpendValue": "{value}d", "TimeSpendHours": "{value}h", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index c6298acdb0..92fd268755 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -227,7 +227,8 @@ "MoveAndDeleteMilestoneConfirm": "Вы действительно хотите удалить этап и перенести задачи в другой?", "Estimation": "Оценка", - "ReportedTime": "Использовано", + "ReportedTime": "Потраченное времени", + "RemainingTime": "Осталось времени", "TimeSpendReports": "Отчеты по времени", "TimeSpendReport": "Время", "TimeSpendReportAdd": "Добавить затраченное время", diff --git a/tests/sanity/tests/tracker.spec.ts b/tests/sanity/tests/tracker.spec.ts index cddb186510..1cad34eb5d 100644 --- a/tests/sanity/tests/tracker.spec.ts +++ b/tests/sanity/tests/tracker.spec.ts @@ -159,11 +159,11 @@ test('report-time-from-issue-card', async ({ page }) => { } await page.click('#ReportedTimeEditor') - await page.waitForSelector('text="Time spend reports"') + await page.waitForSelector('text="Time spent reports"') await page.click('#ReportsPopupAddButton') await page.waitForSelector('text="Add time report"') await expect(page.locator('button:has-text("Create")')).toBeDisabled() - await page.fill('[placeholder="Reported\\ days"]', `${time}`) + await page.fill('[placeholder="Spent time"]', `${time}`) await expect(page.locator('button:has-text("Create")')).toBeEnabled() await page.click('button:has-text("Create")') await page.click('#card-close') @@ -194,11 +194,11 @@ test('report-multiple-time-from-issue-card', async ({ page }) => { for (let i = 0; i < 5; i++) { await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i}`) - await page.waitForSelector('text="Time spend reports"') + await page.waitForSelector('text="Time spent reports"') await page.click('#ReportsPopupAddButton') await page.waitForSelector('text="Add time report"') await expect(page.locator('button:has-text("Create")')).toBeDisabled() - await page.fill('[placeholder="Reported\\ days"]', `${time}`) + await page.fill('[placeholder="Spent time"]', `${time}`) await expect(page.locator('button:has-text("Create")')).toBeEnabled() await page.click('button:has-text("Create")') await expect(page.locator('.antiCard-content >> .footer')).toContainText(`Total: ${i + 1}`) @@ -240,7 +240,7 @@ test('report-time-from-main-view', async ({ page }) => { await page.click('button:has-text("Add time report")') await page.waitForSelector('[id="tracker\\:string\\:TimeSpendReportAdd"] >> text=Add time report') await expect(page.locator('button:has-text("Create")')).toBeDisabled() - await page.fill('[placeholder="Reported\\ days"]', `${time}`) + await page.fill('[placeholder="Spent time"]', `${time}`) await expect(page.locator('button:has-text("Create")')).toBeEnabled() await page.click('button:has-text("Create")') await page.click('#card-close')