Commit 05e57a07 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds rollback and stop component

parent 32784d21
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
}, },
template: ` template: `
<a class="btn external_url":href="external_url" :target="_blank"> <a class="btn external_url" :href="external_url" :target="_blank">
<i class="fa fa-external-link"></i> <i class="fa fa-external-link"></i>
</a> </a>
`, `,
......
/*= require vue_common_component/commit /*= require vue_common_component/commit
/*= require ./environment_actions /*= require ./environment_actions
/*= require ./environment_external_url /*= require ./environment_external_url
/*= require ./environment_stop
/*= require ./environment_rollback
/* globals Vue, timeago */ /* globals Vue, timeago */
(() => { (() => {
...@@ -24,6 +27,8 @@ ...@@ -24,6 +27,8 @@
'commit-component': window.gl.CommitComponent, 'commit-component': window.gl.CommitComponent,
'actions-component': window.gl.environmentsList.ActionsComponent, 'actions-component': window.gl.environmentsList.ActionsComponent,
'external-url-component': window.gl.environmentsList.ExternalUrlComponent, 'external-url-component': window.gl.environmentsList.ExternalUrlComponent,
'stop-component': window.gl.environmentsList.StopComponent,
'rollback-component': window.gl.environmentsList.RollbackComponent,
}, },
props: ['model', 'can-create-deployment', 'can-create-deployment', 'can-read-environment'], props: ['model', 'can-create-deployment', 'can-create-deployment', 'can-read-environment'],
...@@ -248,11 +253,26 @@ ...@@ -248,11 +253,26 @@
return undefined; return undefined;
}, },
retryUrl() {
if (this.model.last_deployment &&
this.model.last_deployment.deployable &&
this.model.last_deployment.deployable.retry_url) {
return this.model.last_deployment.deployable.retry_url;
}
return undefined;
},
isLastDeployment() {
return this.model.last_deployment && this.model.last_deployment['last?'];
},
canReadEnvironmentParsed() { canReadEnvironmentParsed() {
return true;
return this.$options.convertPermissionToBoolean(this.canReadEnvironment); return this.$options.convertPermissionToBoolean(this.canReadEnvironment);
}, },
canCreateDeploymentParsed() { canCreateDeploymentParsed() {
return true;
return this.$options.convertPermissionToBoolean(this.canCreateDeployment); return this.$options.convertPermissionToBoolean(this.canCreateDeployment);
}, },
}, },
...@@ -295,7 +315,7 @@ ...@@ -295,7 +315,7 @@
template: ` template: `
<tr> <tr>
<td v-bind:class="rowClass"> <td v-bind:class="{ 'children-row': isChildren}" class="col-sm-2">
<a v-if="!isFolder" class="environment-name" :href="model.environment_url"> <a v-if="!isFolder" class="environment-name" :href="model.environment_url">
{{model.name}} {{model.name}}
</a> </a>
...@@ -313,7 +333,7 @@ ...@@ -313,7 +333,7 @@
</span> </span>
</td> </td>
<td class="deployment-column"> <td class="deployment-column col-sm-2">
<span v-if="!isFolder && model.last_deployment && model.last_deployment.iid"> <span v-if="!isFolder && model.last_deployment && model.last_deployment.iid">
#{{model.last_deployment.iid}} #{{model.last_deployment.iid}}
...@@ -329,7 +349,7 @@ ...@@ -329,7 +349,7 @@
</span> </span>
</td> </td>
<td> <td class="col-sm-2">
<a v-if="!isFolder && model.last_deployment && model.last_deployment.deployable" <a v-if="!isFolder && model.last_deployment && model.last_deployment.deployable"
class="build-link" class="build-link"
:href="model.last_deployment.deployable.build_url"> :href="model.last_deployment.deployable.build_url">
...@@ -337,7 +357,7 @@ ...@@ -337,7 +357,7 @@
</a> </a>
</td> </td>
<td> <td class="col-sm-2">
<div v-if="!isFolder && model.last_deployment"> <div v-if="!isFolder && model.last_deployment">
<commit-component <commit-component
:tag="commitTag" :tag="commitTag"
...@@ -353,23 +373,38 @@ ...@@ -353,23 +373,38 @@
</p> </p>
</td> </td>
<td> <td class="col-sm-1">
<span v-if="!isFolder && model.last_deployment" class="environment-created-date-timeago"> <span v-if="!isFolder && model.last_deployment" class="environment-created-date-timeago">
{{createdDate}} {{createdDate}}
</span> </span>
</td> </td>
<td class="hidden-xs"> <td class="hidden-xs col-sm-3">
<div v-if="!isFolder"> <div v-if="!isFolder">
<div v-if="hasManualActions && canCreateDeploymentParsed"> <div v-if="hasManualActions && canCreateDeploymentParsed" class="inline">
<actions-component :actions="manualActions"></actions-component> <actions-component
:actions="manualActions">
</actions-component>
</div> </div>
<div v-if="model.external_url && canReadEnvironmentParsed"> <div v-if="model.external_url && canReadEnvironmentParsed" class="inline">
<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 && canCreateDeploymentParsed" class="inline">
<stop-component
:stop_url="model.environment_url">
</stop-component>
</div>
<div v-if="canRetry && canCreateDeploymentParsed" class="inline">
<rollback-component
:is_last_deployment="isLastDeployment"
:retry_url="retryUrl">
</rollback-component>
</div>
</div> </div>
</td> </td>
</tr> </tr>
......
/*= require vue
/* global Vue */
(() => {
window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {};
window.gl.environmentsList.RollbackComponent = Vue.component('rollback-component', {
props: {
retry_url: {
type: String,
default: '',
},
is_last_deployment: {
type: Boolean,
default: true,
},
},
template: `
<a class="btn" :href="retry_url" data-method="post" rel="nofollow">
<span v-if="is_last_deployment">
Re-deploy
</span>
<span v-else>
Rollback
</span>
</a>
`,
});
})();
/*= require vue
/* global Vue */
(() => {
window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {};
window.gl.environmentsList.StopComponent = Vue.component('stop-component', {
props: {
stop_url: {
type: String,
default: '',
},
},
template: `
<a class="btn stop-env-link"
:href="stop_url"
method="post"
rel="nofollow",
data-confirm="Are you sure you want to stop this environment?">
<i class="fa fa-stop stop-env-icon"></i>
</a>
`,
});
})();
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
color: $gl-dark-link-color; color: $gl-dark-link-color;
} }
.stop-env-link { .stop-env-link,
.external-url {
color: $table-text-gray; color: $table-text-gray;
.stop-env-icon { .stop-env-icon {
......
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