diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-25 03:15:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-25 03:15:02 +0300 |
commit | f0764e58dd3877cf255cee4e2df905ebfb23eb79 (patch) | |
tree | bad6192bdd10462242cac324206b60da20e36e1e | |
parent | 1881f0ee95e0d293285dac5d9c1231e45b841963 (diff) |
Add latest changes from gitlab-org/gitlab@master
5 files changed, 80 insertions, 19 deletions
diff --git a/app/assets/javascripts/ci/pipeline_details/stores/test_reports/utils.js b/app/assets/javascripts/ci/pipeline_details/stores/test_reports/utils.js index 6b616601bc5..e3984685094 100644 --- a/app/assets/javascripts/ci/pipeline_details/stores/test_reports/utils.js +++ b/app/assets/javascripts/ci/pipeline_details/stores/test_reports/utils.js @@ -1,4 +1,5 @@ import { __, sprintf } from '~/locale'; +import { parseSeconds, stringifyTime } from '~/lib/utils/datetime_utility'; import { TestStatus } from '../../constants'; /** @@ -25,15 +26,27 @@ export function iconForTestStatus(status) { return 'status_notfound'; } } - export const formattedTime = (seconds = 0) => { if (seconds < 1) { - const milliseconds = seconds * 1000; - return sprintf(__('%{milliseconds}ms'), { milliseconds: milliseconds.toFixed(2) }); + return sprintf(__('%{milliseconds}ms'), { + milliseconds: (seconds * 1000).toFixed(2), + }); + } + if (seconds < 60) { + return sprintf(__('%{seconds}s'), { + seconds: (seconds % 60).toFixed(2), + }); } - return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) }); -}; + const hoursAndMinutes = stringifyTime(parseSeconds(seconds)); + const remainingSeconds = + seconds % 60 >= 1 + ? sprintf(__('%{seconds}s'), { + seconds: Math.floor(seconds % 60), + }) + : ''; + return `${hoursAndMinutes} ${remainingSeconds}`.trim(); +}; export const addIconStatus = (testCase) => ({ ...testCase, icon: iconForTestStatus(testCase.status), diff --git a/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue b/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue index 7d09a003926..01545fe91c9 100644 --- a/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue +++ b/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue @@ -28,7 +28,10 @@ export default { WorkItemAssignees, WorkItemDueDate, WorkItemParent, - WorkItemWeight: () => import('ee_component/work_items/components/work_item_weight.vue'), + WorkItemWeightInline: () => + import('ee_component/work_items/components/work_item_weight_inline.vue'), + WorkItemWeight: () => + import('ee_component/work_items/components/work_item_weight_with_edit.vue'), WorkItemProgress: () => import('ee_component/work_items/components/work_item_progress.vue'), WorkItemIteration: () => import('ee_component/work_items/components/work_item_iteration.vue'), WorkItemHealthStatus: () => @@ -154,16 +157,28 @@ export default { :can-update="canUpdate" @error="$emit('error', $event)" /> - <work-item-weight - v-if="workItemWeight" - class="gl-mb-5" - :can-update="canUpdate" - :weight="workItemWeight.weight" - :work-item-id="workItem.id" - :work-item-iid="workItem.iid" - :work-item-type="workItemType" - @error="$emit('error', $event)" - /> + <template v-if="workItemWeight"> + <work-item-weight + v-if="glFeatures.workItemsMvc2" + class="gl-mb-5" + :can-update="canUpdate" + :weight="workItemWeight.weight" + :work-item-id="workItem.id" + :work-item-iid="workItem.iid" + :work-item-type="workItemType" + @error="$emit('error', $event)" + /> + <work-item-weight-inline + v-else + class="gl-mb-5" + :can-update="canUpdate" + :weight="workItemWeight.weight" + :work-item-id="workItem.id" + :work-item-iid="workItem.iid" + :work-item-type="workItemType" + @error="$emit('error', $event)" + /> + </template> <work-item-progress v-if="workItemProgress" class="gl-mb-5" diff --git a/doc/user/tasks.md b/doc/user/tasks.md index 29461e58500..41f2204491e 100644 --- a/doc/user/tasks.md +++ b/doc/user/tasks.md @@ -271,7 +271,8 @@ To add a task to a milestone: ## Set task weight **(PREMIUM ALL)** -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/362550) in GitLab 15.3. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/362550) in GitLab 15.3. +> - Edit button [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/429137) in GitLab 16.7. Prerequisites: @@ -284,8 +285,9 @@ To set issue weight of a task: 1. In the issue description, in the **Tasks** section, select the title of the task you want to edit. The task window opens. -1. Next to **Weight**, enter a whole, positive number. -1. Select the close icon (**{close}**). +1. Next to **Weight**, select **Edit**. +1. Enter a whole, positive number. +1. Select **Apply** or press <kbd>Enter</kbd>. ## Add a task to an iteration **(PREMIUM ALL)** diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 36c271bec7c..164daed5f77 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -40008,6 +40008,9 @@ msgstr "" msgid "Remove user from project" msgstr "" +msgid "Remove weight" +msgstr "" + msgid "Removed" msgstr "" diff --git a/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js b/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js index c0ffc2b34fb..ecc61ab43c0 100644 --- a/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js +++ b/spec/frontend/ci/pipeline_details/test_reports/stores/utils_spec.js @@ -36,5 +36,33 @@ describe('Test reports utils', () => { expect(result).toBe('4.82s'); }); }); + + describe('when time is greater than a minute', () => { + it('should return time in minutes', () => { + const result = formattedTime(99); + expect(result).toBe('1m 39s'); + }); + }); + + describe('when time is greater than a hour', () => { + it('should return time in hours', () => { + const result = formattedTime(3606); + expect(result).toBe('1h 6s'); + }); + }); + + describe('when time is exact a hour', () => { + it('should return time as one hour', () => { + const result = formattedTime(3600); + expect(result).toBe('1h'); + }); + }); + + describe('when time is greater than a hour with some minutes', () => { + it('should return time in hours', () => { + const result = formattedTime(3662); + expect(result).toBe('1h 1m 2s'); + }); + }); }); }); |