Commit d697b9c8 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds link to actions. Cleans spaces

parent a265826e
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
open: false open: false
}; };
}, },
computed: { computed: {
/** /**
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
isFolder () { isFolder () {
return this.model.children && this.model.children.length ? true : false; return this.model.children && this.model.children.length ? true : false;
}, },
/** /**
* If an item is inside a folder structure will return true. * If an item is inside a folder structure will return true.
* Used for css purposes. * Used for css purposes.
...@@ -52,8 +52,7 @@ ...@@ -52,8 +52,7 @@
isChildren () { isChildren () {
return this.model['vue-isChildren']; return this.model['vue-isChildren'];
}, },
/** /**
* Counts the number of environments in each folder. * Counts the number of environments in each folder.
* Used to show a badge with the counter. * Used to show a badge with the counter.
......
(() => { (() => {
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {}; window.gl.environmentsList = window.gl.environmentsList || {};
gl.environmentsList.EnvironmentsStore = { gl.environmentsList.EnvironmentsStore = {
state: {}, state: {},
create () { create () {
this.state.environments = []; this.state.environments = [];
}, },
/** /**
* In order to display a tree view we need to modify the received * In order to display a tree view we need to modify the received
* data in to a tree structure based on `environment_type` * data in to a tree structure based on `environment_type`
...@@ -87,15 +87,22 @@ ...@@ -87,15 +87,22 @@
return environmentsTree; return environmentsTree;
}, },
sortByName (a,b) { /**
* Sorts the two objects provided by their name.
*
* @param {Object} a
* @param {Object} b
* @returns {Number}
*/
sortByName (a, b) {
const nameA = a.name.toUpperCase(); const nameA = a.name.toUpperCase();
const nameB = b.name.toUpperCase(); const nameB = b.name.toUpperCase();
if (nameA < nameB) { if (nameA < nameB) {
return -1; return -1;
} }
if (nameA > nameB) { if (nameA > nameB) {
return 1; return 1;
} }
......
...@@ -86,7 +86,6 @@ ...@@ -86,7 +86,6 @@
} }
.table.ci-table.environments { .table.ci-table.environments {
.icon-container { .icon-container {
width: 20px; width: 20px;
text-align: center; text-align: center;
......
...@@ -75,11 +75,12 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -75,11 +75,12 @@ class Projects::EnvironmentsController < Projects::ApplicationController
include: { include: {
last_deployment: { last_deployment: {
include: { include: {
user: { only: [:id, :name, :username], methods: [:avatar_url] } user: { only: [:id, :name, :username], methods: [:avatar_url] },
deployable: { only: [:id, :name, :ref, :tag] }
}, },
methods: [:short_sha, :commit_title, :deployable, :commit] methods: [:short_sha, :commit_title, :commit]
}, },
project: { methods: [:namespace]} project: { methods: [:namespace] }
} }
) )
end end
......
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
%ul.dropdown-menu.dropdown-menu-align-right %ul.dropdown-menu.dropdown-menu-align-right
%li{ "v-for" => "action in model.last_deployment.manual_actions" } %li{ "v-for" => "action in model.last_deployment.manual_actions" }
-# transform this = link_to [:play, @project.namespace.becomes(Namespace), @project, action] into href %a{ ":ref" => "'#{namespace_project_path(@project.namespace, @project)}/' + action.id + '/play'",
%a{data: {"method" => ":post", "rel" => "nofollow"}} "data-method" => "post",
"rel" => "nofollow" }
= custom_icon('icon_play') = custom_icon('icon_play')
%span %span
{{action.name}} {{action.name}}
\ No newline at end of file
%script#environment-item-template{ "type"=> "text/x-template" } %script#environment-item-template{ "type"=> "text/x-template" }
%tr %tr
%td{"v-bind:class" => "{ 'children-row': isChildren}"} %td{"v-bind:class" => "{ 'children-row': isChildren}" }
%a.environment-name{ "v-if" => "!isFolder", %a.environment-name{ "v-if" => "!isFolder",
":href" => "'#{namespace_project_environments_path(@project.namespace, @project)}/' + model.id" } ":href" => "'#{namespace_project_environments_path(@project.namespace, @project)}/' + model.id" }
{{model.name}} {{model.name}}
%span.folder-name{ "v-if" => "isFolder", %span.folder-name{ "v-if" => "isFolder",
"@click" => "toggle" } "@click" => "toggle" }
%i.folder-icon{ "v-show" => "open"} %i.folder-icon{ "v-show" => "open" }
=icon ("caret-down") =icon ("caret-down")
%i.folder-icon{ "v-show" => "!open"} %i.folder-icon{ "v-show" => "!open" }
=icon("caret-right") =icon("caret-right")
{{model.name}} {{model.name}}
%span.badge %span.badge
{{childrenCounter}} {{childrenCounter}}
%td.deployment-column %td.deployment-column
%span{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.iid"} %span{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.iid" }
= precede "#" do = precede "#" do
{{model.last_deployment.iid}} {{model.last_deployment.iid}}
%span{ "v-if" => "model.last_deployment.user"} %span{ "v-if" => "model.last_deployment.user" }
by by
%a{":href" => "'/' + model.last_deployment.user.username"} %a{":href" => "'/' + model.last_deployment.user.username" }
%img.avatar.has_tooltip.s20{ ":src" => "model.last_deployment.user.avatar_url", %img.avatar.has_tooltip.s20{ ":src" => "model.last_deployment.user.avatar_url",
":alt" => "model.last_deployment.user.username + 'avatar'", ":alt" => "model.last_deployment.user.username + 'avatar'",
":title" => "model.last_deployment.user.username", ":title" => "model.last_deployment.user.username",
data: {container: "body"}, data: {container: "body" },
width: 20, height: 20} width: 20, height: 20}
%td %td
%a.build-link{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.deployable", %a.build-link{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.deployable",
":href" => "'#{namespace_project_builds_path(@project.namespace, @project)}/' + model.last_deployment.deployable.id"} ":href" => "'#{namespace_project_builds_path(@project.namespace, @project)}/' + model.last_deployment.deployable.id" }
{{model.last_deployment.deployable.name}} {{model.last_deployment.deployable.name}}
= precede "#" do = precede "#" do
{{model.last_deployment.deployable.id}} {{model.last_deployment.deployable.id}}
%td %td
=render "projects/environments/components/commit" =render "projects/environments/components/commit"
%p.commit-title{ "v-if" => "!isFolder && !model.last_deployment"} %p.commit-title{ "v-if" => "!isFolder && !model.last_deployment" }
No deployments yet No deployments yet
%td %td
%span{ "v-if" => "!isFolder && model.last_deployment"} %span{ "v-if" => "!isFolder && model.last_deployment" }
{{model.last_deployment.created_at}} {{model.last_deployment.created_at}}
%td.hidden-xs %td.hidden-xs
.pull-right{ "v-if" => "!isFolder"} .pull-right{ "v-if" => "!isFolder" }
=render "projects/environments/components/external_url" =render "projects/environments/components/external_url"
=render "projects/environments/components/actions" =render "projects/environments/components/actions"
=render "projects/environments/components/stop" =render "projects/environments/components/stop"
=render "projects/environments/components/rollback" =render "projects/environments/components/rollback"
%tr{"v-if" => "open && isFolder", %tr{"v-if" => "open && isFolder",
"is" => "environment-item", "is" => "environment-item",
"v-for" => "model in model.children", "v-for" => "model in model.children",
":model" => "model"} ":model" => "model" }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"data-method" => "post", "data-method" => "post",
"rel" => "nofollow" } "rel" => "nofollow" }
%span{ "v-if" => "model.last_deployment.last"} %span{ "v-if" => "model.last_deployment.last" }
Re-deploy Re-deploy
%span{ "v-if" => "!model.last_deployment.last"} %span{ "v-if" => "!model.last_deployment.last" }
Rollback Rollback
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
.inline{ "v-if" => "model.stop_action" } .inline{ "v-if" => "model.stop_action" }
%a.btn.stop-env-link{":href" => "'#{namespace_project_environments_path(@project.namespace, @project)}/' + model.id", %a.btn.stop-env-link{":href" => "'#{namespace_project_environments_path(@project.namespace, @project)}/' + model.id",
"method" => ":post", "method" => ":post",
"rel" => "nofollow", "confirm" => "Are you sure you want to stop this environment?"} "rel" => "nofollow",
"confirm" => "Are you sure you want to stop this environment?"}
= icon("stop", class: "stop-env-icon") = icon("stop", class: "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