Merge pull request #2823 from hiroponz/switchable-branch-on-network-graph
Switchable the main branch on network graph
This commit is contained in:
commit
8c50707dd4
11 changed files with 45 additions and 24 deletions
18
app/controllers/graph_controller.rb
Normal file
18
app/controllers/graph_controller.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
class GraphController < ProjectResourceController
|
||||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_code_access!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json do
|
||||
graph = Gitlab::Graph::JsonBuilder.new(project, @ref)
|
||||
render :json => graph.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -90,16 +90,6 @@ class ProjectsController < ProjectResourceController
|
|||
end
|
||||
end
|
||||
|
||||
def graph
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json do
|
||||
graph = Gitlab::Graph::JsonBuilder.new(project)
|
||||
render :json => graph.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
return access_denied! unless can?(current_user, :remove_project, project)
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ class RefsController < ProjectResourceController
|
|||
format.html do
|
||||
new_path = if params[:destination] == "tree"
|
||||
project_tree_path(@project, (@ref + "/" + params[:path]))
|
||||
elsif params[:destination] == "graph"
|
||||
project_graph_path(@project, @ref)
|
||||
else
|
||||
project_commits_path(@project, @ref)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
%h3.page_title Project Network Graph
|
||||
%br
|
||||
|
||||
= render partial: 'shared/ref_switcher', locals: {destination: 'graph', path: @path}
|
||||
%br
|
||||
.graph_holder
|
||||
%h4
|
||||
%small You can move around the graph by using the arrow keys.
|
||||
|
@ -11,7 +12,8 @@
|
|||
var branch_graph;
|
||||
$(function(){
|
||||
branch_graph = new BranchGraph($("#holder"), {
|
||||
url: '#{url_for controller: 'projects', action: 'graph', format: :json}',
|
||||
commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}'
|
||||
url: '#{project_graph_path(@project, @ref, format: :json)}',
|
||||
commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}',
|
||||
ref: '#{@ref}'
|
||||
});
|
||||
});
|
|
@ -20,8 +20,8 @@
|
|||
= link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref)
|
||||
= nav_link(controller: %w(commit commits compare repositories protected_branches)) do
|
||||
= link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref)
|
||||
= nav_link(path: 'projects#graph') do
|
||||
= link_to "Network", graph_project_path(@project)
|
||||
= nav_link(controller: %w(graph)) do
|
||||
= link_to "Network", project_graph_path(@project, @ref || @repository.root_ref)
|
||||
|
||||
- if @project.issues_enabled
|
||||
= nav_link(controller: %w(issues milestones labels)) do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue