summaryrefslogtreecommitdiff
path: root/app/views/projects/ci_web_hooks/index.html.haml
blob: 369086b39ed0d59d393c93602258bd8e8178e307 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%h3.page-title
  CI Web hooks

%p.light
  Web Hooks can be used for binding events when build completed.

%hr.clearfix

= form_for @web_hook, url: namespace_project_ci_web_hooks_path(@project.namespace, @project), html: { class: 'form-horizontal' } do |f|
  -if @web_hook.errors.any?
    .alert.alert-danger
      - @web_hook.errors.full_messages.each do |msg|
        %p= msg
  .form-group
    = f.label :url, "URL", class: 'control-label'
    .col-sm-10
      = f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json'
  .form-actions
    = f.submit "Add Web Hook", class: "btn btn-create"

-if @web_hooks.any?
  %h4 Activated web hooks (#{@web_hooks.count})
  .table-holder
    %table.table
      - @web_hooks.each do |hook|
        %tr
          %td
            .clearfix
              %span.monospace= hook.url
          %td
            .pull-right
              - if @ci_project.commits.any?
                = link_to 'Test Hook', test_namespace_project_ci_web_hook_path(@project.namespace, @project, hook), class: "btn btn-sm btn-grouped"
              = link_to 'Remove', namespace_project_ci_web_hook_path(@project.namespace, @project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped"

%h4 Web Hook data example

:erb
  <pre>
    <code>
      {
        "build_id": 2,
        "build_name":"rspec_linux"
        "build_status": "failed",
        "build_started_at": "2014-05-05T18:01:02.563Z",
        "build_finished_at": "2014-05-05T18:01:07.611Z",
        "project_id": 1,
        "project_name": "Brightbox \/ Brightbox Cli",
        "gitlab_url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli",
        "ref": "master",
        "sha": "a26cf5de9ed9827746d4970872376b10d9325f40",
        "before_sha": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
        "push_data": {
          "before": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
          "after": "a26cf5de9ed9827746d4970872376b10d9325f40",
          "ref": "refs\/heads\/master",
          "user_id": 1,
          "user_name": "Administrator",
          "project_id": 5,
          "repository": {
            "name": "Brightbox Cli",
            "url": "dzaporozhets@localhost:brightbox\/brightbox-cli.git",
            "description": "Voluptatibus quae error consectetur voluptas dolores vel excepturi possimus.",
            "homepage": "http:\/\/localhost:3000\/brightbox\/brightbox-cli"
          },
          "commits": [
            {
              "id": "a26cf5de9ed9827746d4970872376b10d9325f40",
              "message": "Release v1.2.2",
              "timestamp": "2014-04-22T16:46:42+03:00",
              "url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli\/commit\/a26cf5de9ed9827746d4970872376b10d9325f40",
              "author": {
                "name": "Paul Thornthwaite",
                "email": "tokengeek@gmail.com"
              }
            },
            {
              "id": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
              "message": "Fix server user data update\n\nIncorrect condition was being used so Base64 encoding option was having\nopposite effect from desired.",
              "timestamp": "2014-04-11T18:17:26+03:00",
              "url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli\/commit\/34f57f6ba3ed0c21c5e361bbb041c3591411176c",
              "author": {
                "name": "Paul Thornthwaite",
                "email": "tokengeek@gmail.com"
              }
            }
          ],
          "total_commits_count": 2,
          "ci_yaml_file":"rspec_linux:\r\n  script: ls\r\n"
        }
      }
    </code>
  </pre>