Skip to content

Commit

Permalink
feat(gitlab): add special info when submitting data from past days
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Dec 8, 2023
1 parent b34886d commit 2e77ef9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ <h3>For project: <strong>{{(project$|async)?.title}}</strong></h3>
*matCellDef="let tmpTask"
mat-cell
>
<span
class="past-info-ico"
*ngIf="tmpTask.isPastTrackedData"
[matTooltip]="T.F.GITLAB.DIALOG_SUBMIT_WORKLOG.PAST_DAY_INFO|translate"
>!!!</span
>
<inline-input
(changed)="updateTimeSpentTodayForTask(tmpTask, $event)"
[displayValue]="tmpTask.timeToSubmit|msToClockString"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@
transform: translate(-50%, -50%);
}
}

.past-info-ico {
position: absolute;
right: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface TmpTask {
timeSpentOnDay: TimeSpentOnDay;
issueTimeTracked: IssueTaskTimeTracked | null;
timeTrackedAlreadyRemote: number;
isPastTrackedData: boolean;
}

@Component({
Expand All @@ -41,6 +42,12 @@ export class DialogGitlabSubmitWorklogForDayComponent {
issueTimeTracked: t.issueTimeTracked,
timeSpentOnDay: t.timeSpentOnDay,
timeTrackedAlreadyRemote: 0,
isPastTrackedData: !!Object.keys(t.timeSpentOnDay).find(
(dayStr) =>
dayStr !== this.day &&
t.timeSpentOnDay[dayStr] >
((t.issueTimeTracked && t.issueTimeTracked[dayStr]) || 0),
),
timeToSubmit: Object.keys(t.timeSpentOnDay).reduce((acc, dayStr) => {
if (t.issueTimeTracked && t.issueTimeTracked[dayStr]) {
const diff = t.timeSpentOnDay[dayStr] - t.issueTimeTracked[dayStr];
Expand Down Expand Up @@ -83,6 +90,7 @@ export class DialogGitlabSubmitWorklogForDayComponent {
updateTimeSpentTodayForTask(task: TmpTask, newVal: number | string): void {
this.updateTmpTask(task.id, {
timeToSubmit: +newVal,
isPastTrackedData: false,
});
}

Expand Down
1 change: 1 addition & 0 deletions src/app/t.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ const T = {
TITLE: 'F.GITLAB.DIALOG_INITIAL.TITLE',
},
DIALOG_SUBMIT_WORKLOG: {
PAST_DAY_INFO: 'F.GITLAB.DIALOG_SUBMIT_WORKLOG.PAST_DAY_INFO',
TITLE: 'F.GITLAB.DIALOG_SUBMIT_WORKLOG.TITLE',
T_ALREADY_TRACKED: 'F.GITLAB.DIALOG_SUBMIT_WORKLOG.T_ALREADY_TRACKED',
T_TITLE: 'F.GITLAB.DIALOG_SUBMIT_WORKLOG.T_TITLE',
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
"TITLE": "Setup GitLab for Project"
},
"DIALOG_SUBMIT_WORKLOG": {
"PAST_DAY_INFO": "The prefilled duration contains untracked data from past days.",
"TITLE": "Submit Time Spent on Issues to GitLab",
"T_ALREADY_TRACKED": "Already Tracked",
"T_TITLE": "Title",
Expand Down

0 comments on commit 2e77ef9

Please sign in to comment.