Commit 350fec4b authored by Jason Goodman's avatar Jason Goodman Committed by Kushal Pandya

Handle a deployment without a deployable in the Environment Dashboard

Display no deployment information
parent 7df9cd9c
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
return !_.isEmpty(this.environment.last_deployment) ? this.environment.last_deployment : null; return !_.isEmpty(this.environment.last_deployment) ? this.environment.last_deployment : null;
}, },
deployable() { deployable() {
return !_.isEmpty(this.lastDeployment.deployable) ? this.lastDeployment.deployable : null; return this.lastDeployment ? this.lastDeployment.deployable : null;
}, },
commit() { commit() {
return !_.isEmpty(this.lastDeployment.commit) ? this.lastDeployment.commit : {}; return !_.isEmpty(this.lastDeployment.commit) ? this.lastDeployment.commit : {};
...@@ -102,15 +102,7 @@ export default { ...@@ -102,15 +102,7 @@ export default {
); );
}, },
buildName() { buildName() {
if ( return this.deployable ? `${this.deployable.name} #${this.deployable.id}` : '';
this.environment &&
this.environment.last_deployment &&
this.environment.last_deployment.deployable
) {
const { deployable } = this.environment.last_deployment;
return `${deployable.name} #${deployable.id}`;
}
return '';
}, },
}, },
}; };
...@@ -124,7 +116,7 @@ export default { ...@@ -124,7 +116,7 @@ export default {
/> />
<div :class="cardClasses" class="dashboard-card-body card-body"> <div :class="cardClasses" class="dashboard-card-body card-body">
<div v-if="lastDeployment" class="row"> <div v-if="deployable" class="row">
<div class="col-1 align-self-center"> <div class="col-1 align-self-center">
<user-avatar-link <user-avatar-link
v-if="user" v-if="user"
......
...@@ -81,4 +81,37 @@ describe('Environment', () => { ...@@ -81,4 +81,37 @@ describe('Environment', () => {
}); });
}); });
}); });
it('renders an environment without a deployment', () => {
propsData = {
environment: {
...environment,
last_deployment: null,
},
};
wrapper = shallowMount(Component, {
localVue,
propsData,
});
expect(wrapper.text()).toContain('This environment has no deployments yet.');
});
it('renders an environment with a deployment without a deployable', () => {
propsData = {
environment: {
...environment,
last_deployment: {
...environment.last_deployment,
deployable: null,
},
},
};
wrapper = shallowMount(Component, {
localVue,
propsData,
});
expect(wrapper.text()).toContain('This environment has no deployments yet.');
});
}); });
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