summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-10-24 12:42:01 +0100
committerFilipa Lacerda <filipa@gitlab.com>2016-11-16 11:57:57 +0000
commitd697b9c86d76603a6eda906572e37ccb049e78cd (patch)
tree81d9192f16c79a0747aab351eb82ac32f67742f0
parenta265826e01dec5341521deb029d6d3aa93ffa6d4 (diff)
downloadgitlab-ce-d697b9c86d76603a6eda906572e37ccb049e78cd.tar.gz
Adds link to actions. Cleans spaces
-rw-r--r--app/assets/javascripts/environments/components/environment_item.js.es67
-rw-r--r--app/assets/javascripts/environments/stores/environmnets_store.js.es621
-rw-r--r--app/assets/stylesheets/pages/environments.scss1
-rw-r--r--app/controllers/projects/environments_controller.rb7
-rw-r--r--app/views/projects/environments/components/_actions.html.haml6
-rw-r--r--app/views/projects/environments/components/_environment.html.haml44
-rw-r--r--app/views/projects/environments/components/_rollback.html.haml4
-rw-r--r--app/views/projects/environments/components/_stop.html.haml3
8 files changed, 51 insertions, 42 deletions
diff --git a/app/assets/javascripts/environments/components/environment_item.js.es6 b/app/assets/javascripts/environments/components/environment_item.js.es6
index 5159d5c4dee..df9f28b1c59 100644
--- a/app/assets/javascripts/environments/components/environment_item.js.es6
+++ b/app/assets/javascripts/environments/components/environment_item.js.es6
@@ -29,7 +29,7 @@
open: false
};
},
-
+
computed: {
/**
@@ -42,7 +42,7 @@
isFolder () {
return this.model.children && this.model.children.length ? true : false;
},
-
+
/**
* If an item is inside a folder structure will return true.
* Used for css purposes.
@@ -52,8 +52,7 @@
isChildren () {
return this.model['vue-isChildren'];
},
-
-
+
/**
* Counts the number of environments in each folder.
* Used to show a badge with the counter.
diff --git a/app/assets/javascripts/environments/stores/environmnets_store.js.es6 b/app/assets/javascripts/environments/stores/environmnets_store.js.es6
index 8b5cb67ed37..35563b0d7fa 100644
--- a/app/assets/javascripts/environments/stores/environmnets_store.js.es6
+++ b/app/assets/javascripts/environments/stores/environmnets_store.js.es6
@@ -1,14 +1,14 @@
(() => {
window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {};
-
+
gl.environmentsList.EnvironmentsStore = {
state: {},
-
+
create () {
this.state.environments = [];
},
-
+
/**
* In order to display a tree view we need to modify the received
* data in to a tree structure based on `environment_type`
@@ -87,15 +87,22 @@
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 nameB = b.name.toUpperCase();
-
+
if (nameA < nameB) {
return -1;
}
-
+
if (nameA > nameB) {
return 1;
}
diff --git a/app/assets/stylesheets/pages/environments.scss b/app/assets/stylesheets/pages/environments.scss
index ed0151bb120..2565036eae7 100644
--- a/app/assets/stylesheets/pages/environments.scss
+++ b/app/assets/stylesheets/pages/environments.scss
@@ -86,7 +86,6 @@
}
.table.ci-table.environments {
-
.icon-container {
width: 20px;
text-align: center;
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index 6858b6da3ea..b9e2187bc3b 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -75,11 +75,12 @@ class Projects::EnvironmentsController < Projects::ApplicationController
include: {
last_deployment: {
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
diff --git a/app/views/projects/environments/components/_actions.html.haml b/app/views/projects/environments/components/_actions.html.haml
index 50a731475ba..82acda0de9c 100644
--- a/app/views/projects/environments/components/_actions.html.haml
+++ b/app/views/projects/environments/components/_actions.html.haml
@@ -7,8 +7,10 @@
%ul.dropdown-menu.dropdown-menu-align-right
%li{ "v-for" => "action in model.last_deployment.manual_actions" }
- -# transform this = link_to [:play, @project.namespace.becomes(Namespace), @project, action] into href
- %a{data: {"method" => ":post", "rel" => "nofollow"}}
+ %a{ ":ref" => "'#{namespace_project_path(@project.namespace, @project)}/' + action.id + '/play'",
+ "data-method" => "post",
+ "rel" => "nofollow" }
+
= custom_icon('icon_play')
%span
{{action.name}} \ No newline at end of file
diff --git a/app/views/projects/environments/components/_environment.html.haml b/app/views/projects/environments/components/_environment.html.haml
index e479d5ef85b..1aa0d7ac5e2 100644
--- a/app/views/projects/environments/components/_environment.html.haml
+++ b/app/views/projects/environments/components/_environment.html.haml
@@ -1,62 +1,62 @@
%script#environment-item-template{ "type"=> "text/x-template" }
%tr
- %td{"v-bind:class" => "{ 'children-row': isChildren}"}
+ %td{"v-bind:class" => "{ 'children-row': isChildren}" }
%a.environment-name{ "v-if" => "!isFolder",
":href" => "'#{namespace_project_environments_path(@project.namespace, @project)}/' + model.id" }
{{model.name}}
-
+
%span.folder-name{ "v-if" => "isFolder",
"@click" => "toggle" }
-
- %i.folder-icon{ "v-show" => "open"}
+
+ %i.folder-icon{ "v-show" => "open" }
=icon ("caret-down")
- %i.folder-icon{ "v-show" => "!open"}
+ %i.folder-icon{ "v-show" => "!open" }
=icon("caret-right")
-
+
{{model.name}}
-
+
%span.badge
{{childrenCounter}}
-
+
%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
{{model.last_deployment.iid}}
- %span{ "v-if" => "model.last_deployment.user"}
+ %span{ "v-if" => "model.last_deployment.user" }
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",
":alt" => "model.last_deployment.user.username + 'avatar'",
":title" => "model.last_deployment.user.username",
- data: {container: "body"},
+ data: {container: "body" },
width: 20, height: 20}
-
+
%td
%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}}
= precede "#" do
{{model.last_deployment.deployable.id}}
-
+
%td
=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
-
+
%td
- %span{ "v-if" => "!isFolder && model.last_deployment"}
+ %span{ "v-if" => "!isFolder && model.last_deployment" }
{{model.last_deployment.created_at}}
-
+
%td.hidden-xs
- .pull-right{ "v-if" => "!isFolder"}
+ .pull-right{ "v-if" => "!isFolder" }
=render "projects/environments/components/external_url"
=render "projects/environments/components/actions"
=render "projects/environments/components/stop"
=render "projects/environments/components/rollback"
-
+
%tr{"v-if" => "open && isFolder",
"is" => "environment-item",
"v-for" => "model in model.children",
- ":model" => "model"}
+ ":model" => "model" }
diff --git a/app/views/projects/environments/components/_rollback.html.haml b/app/views/projects/environments/components/_rollback.html.haml
index bcc54187b6d..2258f6ec32d 100644
--- a/app/views/projects/environments/components/_rollback.html.haml
+++ b/app/views/projects/environments/components/_rollback.html.haml
@@ -4,7 +4,7 @@
"data-method" => "post",
"rel" => "nofollow" }
- %span{ "v-if" => "model.last_deployment.last"}
+ %span{ "v-if" => "model.last_deployment.last" }
Re-deploy
- %span{ "v-if" => "!model.last_deployment.last"}
+ %span{ "v-if" => "!model.last_deployment.last" }
Rollback
diff --git a/app/views/projects/environments/components/_stop.html.haml b/app/views/projects/environments/components/_stop.html.haml
index 741a72704c5..55cccf9e72e 100644
--- a/app/views/projects/environments/components/_stop.html.haml
+++ b/app/views/projects/environments/components/_stop.html.haml
@@ -2,5 +2,6 @@
.inline{ "v-if" => "model.stop_action" }
%a.btn.stop-env-link{":href" => "'#{namespace_project_environments_path(@project.namespace, @project)}/' + model.id",
"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")