Commit 54e62874 authored by Filipa Lacerda's avatar Filipa Lacerda

Improvements after review

parent edc97c9d
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {}; window.gl.environmentsList = window.gl.environmentsList || {};
window.gl.environmentsList.timeagoInstance = new timeago(); // eslint-disable-line
gl.environmentsList.EnvironmentItem = Vue.component('environment-item', { gl.environmentsList.EnvironmentItem = Vue.component('environment-item', {
...@@ -147,10 +148,15 @@ ...@@ -147,10 +148,15 @@
this.model.last_deployment.deployable; this.model.last_deployment.deployable;
}, },
/**
* Verifies if the date to be shown is present.
*
* @returns {Boolean|Undefined}
*/
canShowDate() { canShowDate() {
return this.model.last_deployment && return this.model.last_deployment &&
this.model.last_deployment.deployable && this.model.last_deployment.deployable &&
this.model.last_deployment.deployable.created_at; this.model.last_deployment.deployable !== undefined;
}, },
/** /**
...@@ -159,9 +165,9 @@ ...@@ -159,9 +165,9 @@
* @returns {String} * @returns {String}
*/ */
createdDate() { createdDate() {
const timeagoInstance = new timeago(); // eslint-disable-line return window.gl.environmentsList.timeagoInstance.format(
this.model.last_deployment.deployable.created_at
return timeagoInstance.format(this.model.last_deployment.deployable.created_at); );
}, },
/** /**
......
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