diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/ci/pipeline_details/stores/test_reports/utils.js | 23 | ||||
-rw-r--r-- | app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue | 37 |
2 files changed, 44 insertions, 16 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" |