summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-10-20 20:37:54 +0100
committerFilipa Lacerda <filipa@gitlab.com>2016-11-16 11:57:54 +0000
commitd873a3bd552bf63d8037392bdf56b86b1c7996d9 (patch)
tree5bcff2b77859e2be7f747167b20c7c6d53490449
parente4ff8dd2f100daaec614881c2b2733a92f4ec4d8 (diff)
downloadgitlab-ce-d873a3bd552bf63d8037392bdf56b86b1c7996d9.tar.gz
Adds commit partial for vue component
-rw-r--r--app/controllers/projects/environments_controller.rb5
-rw-r--r--app/views/projects/environments/components/_commit.html.haml20
-rw-r--r--app/views/projects/environments/components/_environment.html.haml6
3 files changed, 26 insertions, 5 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index c760f885a4c..20b4ed46d0a 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -76,8 +76,9 @@ class Projects::EnvironmentsController < Projects::ApplicationController
last_deployment: {
include: {
user: { only: [:id, :name, :username], methods: [:avatar_url] },
- deployable: { only: [:id, :name, :ref, :tag, :short_sha] }
- }
+ deployable: { only: [:id, :name, :ref, :tag] }
+ },
+ methods: [:short_sha, :commit_title, :commit]
}
}
)
diff --git a/app/views/projects/environments/components/_commit.html.haml b/app/views/projects/environments/components/_commit.html.haml
new file mode 100644
index 00000000000..25bd6223841
--- /dev/null
+++ b/app/views/projects/environments/components/_commit.html.haml
@@ -0,0 +1,20 @@
+.branch-commit{"v-if" => "!isFolder && model.last_deployment"}
+ %div{ "v-if" => "model.last_deployment.ref" }
+ .icon-container{ "v-if" => "model.last_deployment.tag" }
+ =icon("tag")
+ .icon-container{ "v-if" => "!model.last_deployment.tag" }
+ =icon("code-fork")
+ %a.monospace.branch-name{}
+ {{model.last_deployment.ref}}
+
+ .icon-container.commit-icon
+ = custom_icon("icon_commit")
+ %a.commit-id.monospace{":href" => ""}
+ {{model.last_deployment.short_sha}}
+
+ %p.commit-title
+ %span{ "v-if" => "model.last_deployment.commit_title"}
+ %a.commit-row-message{":href" => ""}
+ {{model.last_deployment.commit_title}}
+ %span{ "v-if" => "!model.last_deployment.commit_title"}
+ Cant find HEAD commit for this branch
diff --git a/app/views/projects/environments/components/_environment.html.haml b/app/views/projects/environments/components/_environment.html.haml
index 76d921e9fd3..3e11141d01a 100644
--- a/app/views/projects/environments/components/_environment.html.haml
+++ b/app/views/projects/environments/components/_environment.html.haml
@@ -31,13 +31,13 @@
%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"}
- {{model.last_deployment.deployble.name}}
+ {{model.last_deployment.deployable.name}}
= precede "#" do
{{model.last_deployment.deployable.id}}
%td
- %a{ "v-if" => "!isFolder && model.last_deployment"}
- commit message goes here
+ =render "projects/environments/components/commit"
+
%p.commit-title{ "v-if" => "!isFolder && !model.last_deployment"}
No deployments yet