Commit a3edfab1 authored by jakeburden's avatar jakeburden

Show correct deployment date for a manual job

Only display time if the job has deployed

Update JS tests for displaying job deployment time

Simplify boolean check in deployedDate
parent ef0f1509
......@@ -111,12 +111,7 @@ export default {
* @returns {Boolean|Undefined}
*/
canShowDate() {
return (
this.model &&
this.model.last_deployment &&
this.model.last_deployment.deployable &&
this.model.last_deployment.deployable !== undefined
);
return this.model && this.model.last_deployment && this.model.last_deployment.deployed_at;
},
/**
......@@ -124,14 +119,9 @@ export default {
*
* @returns {String}
*/
createdDate() {
if (
this.model &&
this.model.last_deployment &&
this.model.last_deployment.deployable &&
this.model.last_deployment.deployable.created_at
) {
return timeagoInstance.format(this.model.last_deployment.deployable.created_at);
deployedDate() {
if (this.canShowDate) {
return timeagoInstance.format(this.model.last_deployment.deployed_at);
}
return '';
},
......@@ -547,7 +537,7 @@ export default {
<div v-if="!model.isFolder" class="table-section section-10" role="gridcell">
<div role="rowheader" class="table-mobile-header">{{ s__('Environments|Updated') }}</div>
<span v-if="canShowDate" class="environment-created-date-timeago table-mobile-content">
{{ createdDate }}
{{ deployedDate }}
</span>
</div>
......
......@@ -22,7 +22,8 @@
.table-section.section-15{ role: 'gridcell' }
.table-mobile-header{ role: 'rowheader' }= _("Created")
%span.table-mobile-content= time_ago_with_tooltip(deployment.created_at)
- if deployment.deployed_at
%span.table-mobile-content= time_ago_with_tooltip(deployment.deployed_at)
.table-section.section-20.table-button-footer{ role: 'gridcell' }
.btn-group.table-action-buttons
......
---
title: Update the timestamp in Operations > Environments to show correct deployment
date for manual deploy jobs
merge_request: 32072
author:
type: fixed
......@@ -106,6 +106,7 @@ describe('Environment item', () => {
play_path: '/play',
},
],
deployed_at: '2016-11-29T18:11:58.430Z',
},
has_stop_action: true,
environment_path: 'root/ci-folders/environments/31',
......@@ -139,9 +140,7 @@ describe('Environment item', () => {
it('should render last deployment date', () => {
const timeagoInstance = new timeago(); // eslint-disable-line
const formatedDate = timeagoInstance.format(
environment.last_deployment.deployable.created_at,
);
const formatedDate = timeagoInstance.format(environment.last_deployment.deployed_at);
expect(
component.$el.querySelector('.environment-created-date-timeago').textContent,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment