diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2016-11-29 18:54:34 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2016-11-30 12:44:42 +0000 |
commit | 54e628740417a2f7fc0f8d77db095ff31798a335 (patch) | |
tree | eadcff5e390fc5c93164063788a7b0d8b7e8ac7e /app/assets/javascripts/environments | |
parent | edc97c9dc6c3fa43778068f2067cb5911e7ee3f0 (diff) | |
download | gitlab-ce-54e628740417a2f7fc0f8d77db095ff31798a335.tar.gz |
Improvements after review
Diffstat (limited to 'app/assets/javascripts/environments')
-rw-r--r-- | app/assets/javascripts/environments/components/environment_item.js.es6 | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/environments/components/environment_item.js.es6 b/app/assets/javascripts/environments/components/environment_item.js.es6 index a3ba3c762d7..c842b9e418f 100644 --- a/app/assets/javascripts/environments/components/environment_item.js.es6 +++ b/app/assets/javascripts/environments/components/environment_item.js.es6 @@ -23,6 +23,7 @@ window.gl = window.gl || {}; window.gl.environmentsList = window.gl.environmentsList || {}; + window.gl.environmentsList.timeagoInstance = new timeago(); // eslint-disable-line gl.environmentsList.EnvironmentItem = Vue.component('environment-item', { @@ -147,10 +148,15 @@ this.model.last_deployment.deployable; }, + /** + * Verifies if the date to be shown is present. + * + * @returns {Boolean|Undefined} + */ canShowDate() { return this.model.last_deployment && this.model.last_deployment.deployable && - this.model.last_deployment.deployable.created_at; + this.model.last_deployment.deployable !== undefined; }, /** @@ -159,9 +165,9 @@ * @returns {String} */ createdDate() { - const timeagoInstance = new timeago(); // eslint-disable-line - - return timeagoInstance.format(this.model.last_deployment.deployable.created_at); + return window.gl.environmentsList.timeagoInstance.format( + this.model.last_deployment.deployable.created_at + ); }, /** |