debian-mirror-gitlab/app/controllers/projects/network_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.2 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
class Projects::NetworkController < Projects::ApplicationController
include ExtractsPath
include ApplicationHelper
2015-09-11 14:41:01 +05:30
before_action :require_non_empty_project
before_action :assign_ref_vars
2023-03-04 22:38:38 +05:30
before_action :authorize_read_code!
2019-02-15 15:39:39 +05:30
before_action :assign_options
2017-08-17 22:00:37 +05:30
before_action :assign_commit
2014-09-02 18:07:02 +05:30
2021-01-03 14:25:43 +05:30
feature_category :source_code_management
2021-12-11 22:18:48 +05:30
urgency :low, [:show]
2021-01-03 14:25:43 +05:30
2014-09-02 18:07:02 +05:30
def show
2023-04-23 21:23:45 +05:30
@url = project_network_path(@project, @ref, @options.merge(format: :json, ref_type: ref_type))
2023-03-04 22:38:38 +05:30
@ref_type = ref_type
2018-03-27 19:54:05 +05:30
@commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")
2014-09-02 18:07:02 +05:30
2018-03-27 19:54:05 +05:30
respond_to do |format|
format.html do
if @options[:extended_sha1] && !@commit
flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist."
2018-03-17 18:26:18 +05:30
end
2014-09-02 18:07:02 +05:30
end
2018-03-17 18:26:18 +05:30
2018-03-27 19:54:05 +05:30
format.json do
@graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref])
end
2014-09-02 18:07:02 +05:30
end
2018-03-27 19:54:05 +05:30
render
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
2019-02-15 15:39:39 +05:30
def assign_options
@options = params.permit(:filter_ref, :extended_sha1)
end
2017-08-17 22:00:37 +05:30
def assign_commit
2019-02-15 15:39:39 +05:30
return if @options[:extended_sha1].blank?
2017-08-17 22:00:37 +05:30
@commit = @repo.commit(@options[:extended_sha1])
end
2014-09-02 18:07:02 +05:30
end