Commit 4296326521ee1bc82ce0f838a8f23f1449ca9329
Exists in
colab
and in
2 other branches
Merge pull request #346 from mezuro/expose_notify_push_url
Expose notify push url
Showing
8 changed files
with
36 additions
and
2 deletions
Show diff stats
CHANGELOG.rdoc
| @@ -14,6 +14,7 @@ Prezento is the web interface for Mezuro. | @@ -14,6 +14,7 @@ Prezento is the web interface for Mezuro. | ||
| 14 | * Add missing translation for CompoundMetric | 14 | * Add missing translation for CompoundMetric |
| 15 | * Make Compound Metric Config. metric list not include Hotspot metrics | 15 | * Make Compound Metric Config. metric list not include Hotspot metrics |
| 16 | * Fix 'Tree Metrics' and 'Hotspot Metrics' PT translations in Configuration show view | 16 | * Fix 'Tree Metrics' and 'Hotspot Metrics' PT translations in Configuration show view |
| 17 | +* Show the notify push url for the repository's owner (Gitlab only) | ||
| 17 | 18 | ||
| 18 | == v0.11.3 - 01/04/2016 | 19 | == v0.11.3 - 01/04/2016 |
| 19 | 20 |
app/views/repositories/show.html.erb
| @@ -37,6 +37,15 @@ | @@ -37,6 +37,15 @@ | ||
| 37 | <%= @kalibro_configuration.name %> | 37 | <%= @kalibro_configuration.name %> |
| 38 | </p> | 38 | </p> |
| 39 | 39 | ||
| 40 | +<% if repository_owner? @repository.id %> | ||
| 41 | + <strong><%= t('repository.show.notify_push_url') %>:</strong> | ||
| 42 | + <input id="notify_url" value="<%= repository_notify_push_url(@repository.id) %>" readonly=""> | ||
| 43 | + | ||
| 44 | + <button id="btn" data-clipboard-target="#notify_url"> | ||
| 45 | + <i class="fa fa-copy" alt="Copy to clipboard"></i> | ||
| 46 | + </button> | ||
| 47 | +<% end %> | ||
| 48 | + | ||
| 40 | <p><strong> <%= t('repository.show.date_processing') %>: </strong></p> | 49 | <p><strong> <%= t('repository.show.date_processing') %>: </strong></p> |
| 41 | 50 | ||
| 42 | <%= form_tag(repository_state_with_date_path(@repository.id), method: "get", remote: true) do %> | 51 | <%= form_tag(repository_state_with_date_path(@repository.id), method: "get", remote: true) do %> |
| @@ -74,9 +83,14 @@ | @@ -74,9 +83,14 @@ | ||
| 74 | <div id="metric_results"><%= image_tag 'loader.gif' %> <%= t('repository.show.loading') %></div> | 83 | <div id="metric_results"><%= image_tag 'loader.gif' %> <%= t('repository.show.loading') %></div> |
| 75 | </div> | 84 | </div> |
| 76 | </div> | 85 | </div> |
| 86 | + | ||
| 87 | +<!-- Copy to clipboard --> | ||
| 88 | +<%= javascript_include_tag "https://cdn.rawgit.com/zenorocha/clipboard.js/v1.5.10/dist/clipboard.min.js" %> | ||
| 89 | + | ||
| 77 | <script type="text/javascript"> | 90 | <script type="text/javascript"> |
| 78 | $(document).ready(function () { | 91 | $(document).ready(function () { |
| 79 | - (new Repository.State(<%= @repository.id %>)).poll_state('') | 92 | + (new Repository.State(<%= @repository.id %>)).poll_state(''); |
| 93 | + new Clipboard('#btn'); | ||
| 80 | }); | 94 | }); |
| 81 | 95 | ||
| 82 | //Loads the accordion | 96 | //Loads the accordion |
config/locales/views/repository/en.yml
| @@ -38,3 +38,4 @@ en: | @@ -38,3 +38,4 @@ en: | ||
| 38 | metric_results: "Tree Metric Results" | 38 | metric_results: "Tree Metric Results" |
| 39 | loading: "Loading data. Please, wait." | 39 | loading: "Loading data. Please, wait." |
| 40 | date_processing: "Retrieve the closest processing information from" | 40 | date_processing: "Retrieve the closest processing information from" |
| 41 | + notify_push_url: 'Notify Push Url for Gitlab' |
config/locales/views/repository/pt.yml
| @@ -38,3 +38,4 @@ pt: | @@ -38,3 +38,4 @@ pt: | ||
| 38 | metric_results: "Resultados de Métrica" | 38 | metric_results: "Resultados de Métrica" |
| 39 | loading: "Carregando os dados. Por favor, aguarde." | 39 | loading: "Carregando os dados. Por favor, aguarde." |
| 40 | date_processing: "Obtenha a informação de processamento mais próxima a" | 40 | date_processing: "Obtenha a informação de processamento mais próxima a" |
| 41 | + notify_push_url: 'Url para notificações do Gitlab' |
features/repository/show/repository_info.feature
| @@ -19,6 +19,7 @@ Feature: Show Repository | @@ -19,6 +19,7 @@ Feature: Show Repository | ||
| 19 | And I should see "Description" | 19 | And I should see "Description" |
| 20 | And I should see "License" | 20 | And I should see "License" |
| 21 | And I should see the given repository's content | 21 | And I should see the given repository's content |
| 22 | + And I should not see "Notify Push Url for Gitlab" | ||
| 22 | 23 | ||
| 23 | @kalibro_configuration_restart @kalibro_processor_restart @javascript | 24 | @kalibro_configuration_restart @kalibro_processor_restart @javascript |
| 24 | Scenario: With a ready processing and asking to reprocess | 25 | Scenario: With a ready processing and asking to reprocess |
| @@ -32,6 +33,7 @@ Feature: Show Repository | @@ -32,6 +33,7 @@ Feature: Show Repository | ||
| 32 | And I wait up for a ready processing | 33 | And I wait up for a ready processing |
| 33 | When I visit the repository show page | 34 | When I visit the repository show page |
| 34 | Then I should see the sample repository name | 35 | Then I should see the sample repository name |
| 36 | + And I should see the correct notify push url | ||
| 35 | And I should see "State" | 37 | And I should see "State" |
| 36 | And I should see "Creation Date" | 38 | And I should see "Creation Date" |
| 37 | And I should see "PREPARING time" | 39 | And I should see "PREPARING time" |
features/step_definitions/repository_steps.rb
| @@ -281,3 +281,8 @@ end | @@ -281,3 +281,8 @@ end | ||
| 281 | Then(/^I should get a not found error$/) do | 281 | Then(/^I should get a not found error$/) do |
| 282 | expect(page.driver.status_code).to eq(404) | 282 | expect(page.driver.status_code).to eq(404) |
| 283 | end | 283 | end |
| 284 | + | ||
| 285 | +Then(/^I should see the correct notify push url$/) do | ||
| 286 | + step "I should see \"Notify Push Url for Gitlab\"" | ||
| 287 | + expect(page).to have_selector("input[value=\"#{repository_notify_push_url(host: Capybara.current_session.server.host, port: Capybara.current_session.server.port, locale: :en, id: @repository.id)}\"]") | ||
| 288 | +end |
features/support/env.rb
| @@ -86,4 +86,4 @@ Cucumber::Rails::Database.javascript_strategy = :truncation | @@ -86,4 +86,4 @@ Cucumber::Rails::Database.javascript_strategy = :truncation | ||
| 86 | require 'kalibro_client/kalibro_cucumber_helpers/hooks.rb' | 86 | require 'kalibro_client/kalibro_cucumber_helpers/hooks.rb' |
| 87 | 87 | ||
| 88 | Warden.test_mode! | 88 | Warden.test_mode! |
| 89 | -World(Warden::Test::Helpers, HeaderUtils, TableUtils) | 89 | +World(Warden::Test::Helpers, HeaderUtils, TableUtils, ActionView::Helpers::UrlHelper) |
spec/controllers/repositories_controller_spec.rb
| @@ -556,5 +556,15 @@ describe RepositoriesController, :type => :controller do | @@ -556,5 +556,15 @@ describe RepositoriesController, :type => :controller do | ||
| 556 | 556 | ||
| 557 | it { is_expected.to respond_with(:not_found) } | 557 | it { is_expected.to respond_with(:not_found) } |
| 558 | end | 558 | end |
| 559 | + | ||
| 560 | + context 'with an invalid request' do | ||
| 561 | + before :each do | ||
| 562 | + Repository.expects(:find).with(repository.id).returns(repository) | ||
| 563 | + Webhooks::GitLab.any_instance.expects(:valid_request?).returns(false) | ||
| 564 | + post_push | ||
| 565 | + end | ||
| 566 | + | ||
| 567 | + it { is_expected.to respond_with(:unprocessable_entity) } | ||
| 568 | + end | ||
| 559 | end | 569 | end |
| 560 | end | 570 | end |