Commit 92cff96f authored by Filipa Lacerda's avatar Filipa Lacerda

Improvements after review

parent a22f5161
...@@ -208,8 +208,7 @@ ...@@ -208,8 +208,7 @@
* @returns {Object|Undefined} * @returns {Object|Undefined}
*/ */
commitRef() { commitRef() {
if (this.model.last_deployment && if (this.model.last_deployment && this.model.last_deployment.ref) {
this.model.last_deployment.ref) {
return this.model.last_deployment.ref; return this.model.last_deployment.ref;
} }
return undefined; return undefined;
...@@ -327,10 +326,8 @@ ...@@ -327,10 +326,8 @@
* @returns {Boolean} * @returns {Boolean}
*/ */
deploymentHasUser() { deploymentHasUser() {
if (this.model.last_deployment && this.model.last_deployment.user) { return !this.$options.isObjectEmpty(this.model.last_deployment) &&
return true; !this.$options.isObjectEmpty(this.model.last_deployment.user);
}
return false;
}, },
/** /**
...@@ -340,11 +337,38 @@ ...@@ -340,11 +337,38 @@
* @returns {Object} * @returns {Object}
*/ */
deploymentUser() { deploymentUser() {
if (this.model.last_deployment && this.model.last_deployment.user) { if (!this.$options.isObjectEmpty(this.model.last_deployment) &&
!this.$options.isObjectEmpty(this.model.last_deployment.user)) {
return this.model.last_deployment.user; return this.model.last_deployment.user;
} }
return {}; return {};
}, },
/**
* Verifies if the build name column should be rendered by verifing
* if all the information needed is present
* and if the environment is not a folder.
*
* @returns {Boolean}
*/
shouldRenderBuildName() {
return !this.isFolder &&
!this.$options.isObjectEmpty(this.model.last_deployment) &&
!this.$options.isObjectEmpty(this.model.last_deployment.deployable);
},
/**
* Verifies if deplyment internal ID should be rendered by verifing
* if all the information needed is present
* and if the environment is not a folder.
*
* @returns {Boolean}
*/
shouldRenderDeploymentID() {
return !this.isFolder &&
!this.$options.isObjectEmpty(this.model.last_deployment) &&
this.model.last_deployment.iid !== undefined;
},
}, },
/** /**
...@@ -385,7 +409,7 @@ ...@@ -385,7 +409,7 @@
<td class="deployment-column"> <td class="deployment-column">
<span <span
v-if="!isFolder && model.last_deployment && model.last_deployment.iid" v-if="shouldRenderDeploymentID"
v-html="deploymentInternalId"> v-html="deploymentInternalId">
</span> </span>
...@@ -401,7 +425,7 @@ ...@@ -401,7 +425,7 @@
</td> </td>
<td> <td>
<a v-if="!isFolder && model.last_deployment && model.last_deployment.deployable" <a v-if="shouldRenderBuildName"
class="build-link" class="build-link"
:href="model.last_deployment.deployable.build_path" :href="model.last_deployment.deployable.build_path"
v-html="buildName"> v-html="buildName">
...@@ -434,25 +458,29 @@ ...@@ -434,25 +458,29 @@
<td class="hidden-xs"> <td class="hidden-xs">
<div v-if="!isFolder"> <div v-if="!isFolder">
<div v-if="hasManualActions && canCreateDeployment" class="inline js-manual-actions-container"> <div v-if="hasManualActions && canCreateDeployment"
class="inline js-manual-actions-container">
<actions-component <actions-component
:actions="manualActions"> :actions="manualActions">
</actions-component> </actions-component>
</div> </div>
<div v-if="model.external_url && canReadEnvironment" class="inline js-external-url-container"> <div v-if="model.external_url && canReadEnvironment"
class="inline js-external-url-container">
<external-url-component <external-url-component
:external_url="model.external_url"> :external_url="model.external_url">
</external_url-component> </external_url-component>
</div> </div>
<div v-if="isStoppable && canCreateDeployment" class="inline js-stop-component-container"> <div v-if="isStoppable && canCreateDeployment"
class="inline js-stop-component-container">
<stop-component <stop-component
:stop_url="model.environment_path"> :stop_url="model.environment_path">
</stop-component> </stop-component>
</div> </div>
<div v-if="canRetry && canCreateDeployment" class="inline js-rollback-component-container"> <div v-if="canRetry && canCreateDeployment"
class="inline js-rollback-component-container">
<rollback-component <rollback-component
:is_last_deployment="isLastDeployment" :is_last_deployment="isLastDeployment"
:retry_url="retryUrl"> :retry_url="retryUrl">
......
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