Skip to content
Snippets Groups Projects
Commit 52352be6 authored by Kushal Pandya's avatar Kushal Pandya Committed by Dmitriy Zaporozhets
Browse files

Cleaning up navigational order - Project

parent f14ee823
No related branches found
No related tags found
No related merge requests found
Showing
with 199 additions and 152 deletions
Loading
Loading
@@ -16,9 +16,6 @@ require('./shortcuts');
Mousetrap.bind('g p', function() {
return ShortcutsNavigation.findAndFollowLink('.shortcuts-project');
});
Mousetrap.bind('g e', function() {
return ShortcutsNavigation.findAndFollowLink('.shortcuts-project-activity');
});
Mousetrap.bind('g f', function() {
return ShortcutsNavigation.findAndFollowLink('.shortcuts-tree');
});
Loading
Loading
@@ -31,9 +28,6 @@ require('./shortcuts');
Mousetrap.bind('g n', function() {
return ShortcutsNavigation.findAndFollowLink('.shortcuts-network');
});
Mousetrap.bind('g g', function() {
return ShortcutsNavigation.findAndFollowLink('.shortcuts-graphs');
});
Mousetrap.bind('g i', function() {
return ShortcutsNavigation.findAndFollowLink('.shortcuts-issues');
});
Loading
Loading
Loading
Loading
@@ -178,3 +178,29 @@
margin-left: $btn-side-margin;
}
}
.repo-charts {
.sub-header {
margin: 20px 0;
}
.sub-header-block.border-top {
margin-top: 20px;
padding: 0;
border-top: 1px solid $white-dark;
border-bottom: none;
}
.commit-stats li {
font-size: 16px;
}
.tree-ref-header {
margin-bottom: 20px;
h4 {
margin: 0;
line-height: 36px;
}
}
}
Loading
Loading
@@ -17,6 +17,25 @@ class Projects::GraphsController < Projects::ApplicationController
end
 
def commits
redirect_to action: 'charts'
end
def languages
redirect_to action: 'charts'
end
def charts
get_commits
get_languages
end
def ci
redirect_to charts_namespace_project_pipelines_path(@project.namespace, @project)
end
private
def get_commits
@commits = @project.repository.commits(@ref, limit: 2000, skip_merges: true)
@commits_graph = Gitlab::Graphs::Commits.new(@commits)
@commits_per_week_days = @commits_graph.commits_per_week_days
Loading
Loading
@@ -24,15 +43,7 @@ class Projects::GraphsController < Projects::ApplicationController
@commits_per_month = @commits_graph.commits_per_month
end
 
def ci
@charts = {}
@charts[:week] = Ci::Charts::WeekChart.new(project)
@charts[:month] = Ci::Charts::MonthChart.new(project)
@charts[:year] = Ci::Charts::YearChart.new(project)
@charts[:build_times] = Ci::Charts::BuildTime.new(project)
end
def languages
def get_languages
@languages = Linguist::Repository.new(@repository.rugged, @repository.rugged.head.target_id).languages
total = @languages.map(&:last).sum
 
Loading
Loading
@@ -52,8 +63,6 @@ class Projects::GraphsController < Projects::ApplicationController
end
end
 
private
def fetch_graph
@commits = @project.repository.commits(@ref, limit: 6000, skip_merges: true)
@log = []
Loading
Loading
class Projects::PipelinesController < Projects::ApplicationController
before_action :pipeline, except: [:index, :new, :create]
before_action :pipeline, except: [:index, :new, :create, :charts]
before_action :commit, only: [:show, :builds]
before_action :authorize_read_pipeline!
before_action :authorize_create_pipeline!, only: [:new, :create]
before_action :authorize_update_pipeline!, only: [:retry, :cancel]
before_action :builds_enabled, only: :charts
 
def index
@scope = params[:scope]
Loading
Loading
@@ -92,6 +93,14 @@ class Projects::PipelinesController < Projects::ApplicationController
redirect_back_or_default default: namespace_project_pipelines_path(project.namespace, project)
end
 
def charts
@charts = {}
@charts[:week] = Ci::Charts::WeekChart.new(project)
@charts[:month] = Ci::Charts::MonthChart.new(project)
@charts[:year] = Ci::Charts::YearChart.new(project)
@charts[:build_times] = Ci::Charts::BuildTime.new(project)
end
private
 
def create_params
Loading
Loading
Loading
Loading
@@ -128,12 +128,6 @@
.key p
%td
Go to the project's home page
%tr
%td.shortcut
.key g
.key e
%td
Go to the project's activity feed
%tr
%td.shortcut
.key g
Loading
Loading
@@ -158,12 +152,6 @@
.key n
%td
Go to network graph
%tr
%td.shortcut
.key g
.key g
%td
Go to graphs
%tr
%td.shortcut
.key g
Loading
Loading
Loading
Loading
@@ -21,40 +21,23 @@
.fade-right
= icon('angle-right')
%ul.nav-links.scrolling-tabs
= nav_link(path: 'projects#show', html_options: {class: 'home'}) do
= nav_link(path: ['projects#show', 'projects#activity', 'cycle_analytics#show'], html_options: { class: 'home' }) do
= link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do
%span
Project
 
= nav_link(path: 'projects#activity') do
= link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do
%span
Activity
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare repositories tags branches releases network)) do
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare repositories tags branches releases graphs network)) do
= link_to project_files_path(@project), title: 'Repository', class: 'shortcuts-tree' do
%span
Repository
 
- if project_nav_tab? :pipelines
= nav_link(controller: [:pipelines, :builds, :environments, :cycle_analytics]) do
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
%span
Pipelines
- if project_nav_tab? :container_registry
= nav_link(controller: %w(container_registry)) do
= link_to project_container_registry_path(@project), title: 'Container Registry', class: 'shortcuts-container-registry' do
%span
Registry
 
- if project_nav_tab? :graphs
= nav_link(controller: %w(graphs)) do
= link_to namespace_project_graph_path(@project.namespace, @project, current_ref), title: 'Graphs', class: 'shortcuts-graphs' do
%span
Graphs
- if project_nav_tab? :issues
= nav_link(controller: [:issues, :labels, :milestones, :boards]) do
= link_to namespace_project_issues_path(@project.namespace, @project), title: 'Issues', class: 'shortcuts-issues' do
Loading
Loading
@@ -70,6 +53,12 @@
Merge Requests
%span.badge.count.merge_counter= number_with_delimiter(MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened.count)
 
- if project_nav_tab? :pipelines
= nav_link(controller: [:pipelines, :builds, :environments]) do
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
%span
Pipelines
- if project_nav_tab? :wiki
= nav_link(controller: :wikis) do
= link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do
Loading
Loading
- @no_container = true
= render "projects/head"
 
%div{ class: container_class }
.nav-block.activity-filter-block
Loading
Loading
= content_for :sub_nav do
.scrolling-tabs-container.sub-nav-scroll
= render 'shared/nav_scroll'
.nav-links.sub-nav.scrolling-tabs
%ul{ class: container_class }
= nav_link(path: 'projects#show') do
= link_to project_path(@project), title: 'Project home', class: 'shortcuts-project' do
%span
Home
= nav_link(path: 'projects#activity') do
= link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do
%span
Activity
- if can?(current_user, :read_cycle_analytics, @project)
= nav_link(path: 'cycle_analytics#show') do
= link_to project_cycle_analytics_path(@project), title: 'Cycle Analytics', class: 'shortcuts-project-cycle-analytics' do
%span
Cycle Analytics
Loading
Loading
@@ -11,14 +11,6 @@
= link_to namespace_project_commits_path(@project.namespace, @project, current_ref) do
Commits
 
= nav_link(controller: %w(network)) do
= link_to namespace_project_network_path(@project.namespace, @project, current_ref) do
Network
= nav_link(controller: :compare) do
= link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: current_ref) do
Compare
= nav_link(html_options: {class: branches_tab_class}) do
= link_to namespace_project_branches_path(@project.namespace, @project) do
Branches
Loading
Loading
@@ -26,3 +18,19 @@
= nav_link(controller: [:tags, :releases]) do
= link_to namespace_project_tags_path(@project.namespace, @project) do
Tags
= nav_link(path: 'graphs#show') do
= link_to namespace_project_graph_path(@project.namespace, @project, current_ref) do
Contributors
= nav_link(controller: %w(network)) do
= link_to namespace_project_network_path(@project.namespace, @project, current_ref) do
Graph
= nav_link(controller: :compare) do
= link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: current_ref) do
Compare
= nav_link(path: 'graphs#charts') do
= link_to charts_namespace_project_graph_path(@project.namespace, @project, current_ref) do
Charts
Loading
Loading
@@ -3,7 +3,7 @@
- content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('cycle_analytics')
 
= render "projects/pipelines/head"
= render "projects/head"
 
#cycle-analytics{ class: container_class, "v-cloak" => "true", data: { request_path: project_cycle_analytics_path(@project) } }
- if @cycle_analytics_no_data
Loading
Loading
= content_for :sub_nav do
.scrolling-tabs-container.sub-nav-scroll
= render 'shared/nav_scroll'
.nav-links.sub-nav.scrolling-tabs
%ul{ class: (container_class) }
- content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('lib_chart')
= page_specific_javascript_bundle_tag('graphs')
= nav_link(action: :show) do
= link_to 'Contributors', namespace_project_graph_path
= nav_link(action: :commits) do
= link_to 'Commits', commits_namespace_project_graph_path
= nav_link(action: :languages) do
= link_to 'Languages', languages_namespace_project_graph_path
- if @project.feature_available?(:builds, current_user)
= nav_link(action: :ci) do
= link_to ci_namespace_project_graph_path do
Continuous Integration
- @no_container = true
- page_title "Commits", "Graphs"
= render 'head'
- page_title "Charts"
- content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('lib_chart')
= page_specific_javascript_bundle_tag('graphs')
= render "projects/commits/head"
 
%div{ class: container_class }
.sub-header-block
.tree-ref-holder
= render 'shared/ref_switcher', destination: 'graphs_commits'
%ul.breadcrumb.repo-breadcrumb
= commits_breadcrumbs
.repo-charts{ class: container_class }
%h4.sub-header
Programming languages used in this repository
 
%p.lead
Commit statistics for
%strong= @ref
#{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')}
.row
.col-md-4
%ul.bordered-list
- @languages.each do |language|
%li
%span{ style: "color: #{language[:color]}" }
= icon('circle')
&nbsp;
= language[:label]
.pull-right
= language[:value]
\%
.col-md-8
%canvas#languages-chart{ height: 400 }
.repo-charts{ class: container_class }
.sub-header-block.border-top
.row.tree-ref-header
.col-md-6
%h4
Commit statistics for
%strong= @ref
#{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')}
.col-md-6
.tree-ref-container
.tree-ref-holder
= render 'shared/ref_switcher', destination: 'graphs_commits'
%ul.breadcrumb.repo-breadcrumb
= commits_breadcrumbs
 
.row
.col-md-6
%ul
%ul.commit-stats
%li
%p.lead
%strong= @commits_graph.commits.size
commits during
%strong= @commits_graph.duration
days
Total:
%strong #{@commits_graph.commits.size} commits
%li
%p.lead
Average
%strong= @commits_graph.commit_per_day
commits per day
Average per day:
%strong #{@commits_graph.commit_per_day} commits
%li
%p.lead
Contributed by
%strong= @commits_graph.authors
authors
Authors:
%strong= @commits_graph.authors
.col-md-6
%div
%p.slead
Loading
Loading
@@ -40,15 +60,18 @@
%canvas#month-chart
.row
.col-md-6
%div
%p.slead
Commits per day hour (UTC)
%canvas#hour-chart
.col-md-6
%div
%p.slead
Commits per weekday
%canvas#weekday-chart
.row
.col-md-6
.col-md-6
%div
%p.slead
Commits per day hour (UTC)
%canvas#hour-chart
 
:javascript
var responsiveChart = function (selector, data) {
Loading
Loading
@@ -93,3 +116,12 @@
 
var monthData = chartData(#{@commits_per_month.keys.to_json}, #{@commits_per_month.values.to_json});
responsiveChart($('#month-chart'), monthData);
var data = #{@languages.to_json};
var ctx = $("#languages-chart").get(0).getContext("2d");
var options = {
scaleOverlay: true,
responsive: true,
maintainAspectRatio: false
}
var myPieChart = new Chart(ctx).Pie(data, options);
- @no_container = true
- page_title "Languages", "Graphs"
= render 'head'
%div{ class: container_class }
.sub-header-block
.oneline
Programming languages used in this repository
.row
.col-md-8
%canvas#languages-chart{ height: 400 }
.col-md-4
%ul.bordered-list
- @languages.each do |language|
%li
%span{ style: "color: #{language[:color]}" }
= icon('circle')
&nbsp;
= language[:label]
.pull-right
= language[:value]
\%
:javascript
var data = #{@languages.to_json};
var ctx = $("#languages-chart").get(0).getContext("2d");
var options = {
scaleOverlay: true,
responsive: true,
maintainAspectRatio: false
}
var myPieChart = new Chart(ctx).Pie(data, options);
- @no_container = true
- page_title "Contributors", "Graphs"
= render 'head'
- page_title "Contributors"
- content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('lib_chart')
= page_specific_javascript_bundle_tag('graphs')
= render 'projects/commits/head'
 
%div{ class: container_class }
.sub-header-block
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@
= nav_link(controller: :issues) do
= link_to namespace_project_issues_path(@project.namespace, @project), title: 'Issues' do
%span
Issues
List
 
= nav_link(controller: :boards) do
= link_to namespace_project_boards_path(@project.namespace, @project), title: 'Board' do
Loading
Loading
Loading
Loading
@@ -2,7 +2,6 @@
- @bulk_edit = can?(current_user, :admin_merge_request, @project)
 
- page_title "Merge Requests"
= render "projects/issues/head"
= render 'projects/last_push'
 
- content_for :page_specific_javascripts do
Loading
Loading
- page_title "Network", @ref
- page_title "Graph", @ref
- content_for :page_specific_javascripts do
= page_specific_javascript_tag('lib/raphael.js')
= page_specific_javascript_bundle_tag('network')
Loading
Loading
Loading
Loading
@@ -4,25 +4,25 @@
.nav-links.sub-nav.scrolling-tabs{ class: ('build' if local_assigns.fetch(:build_subnav, false)) }
%ul{ class: (container_class) }
- if project_nav_tab? :pipelines
= nav_link(controller: :pipelines) do
= nav_link(path: 'pipelines#index', controller: :pipelines) do
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
%span
Pipelines
 
- if project_nav_tab? :builds
= nav_link(controller: %w(builds)) do
= nav_link(path: 'builds#index', controller: :builds) do
= link_to project_builds_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
%span
Jobs
 
- if project_nav_tab? :environments
= nav_link(controller: %w(environments)) do
= nav_link(path: 'environments#index', controller: :environments) do
= link_to project_environments_path(@project), title: 'Environments', class: 'shortcuts-environments' do
%span
Environments
 
- if can?(current_user, :read_cycle_analytics, @project)
= nav_link(controller: %w(cycle_analytics)) do
= link_to project_cycle_analytics_path(@project), title: 'Cycle Analytics' do
- if @project.feature_available?(:builds, current_user) && !@project.empty_repo?
= nav_link(path: 'pipelines#charts') do
= link_to charts_namespace_project_pipelines_path(@project.namespace, @project), title: 'Charts', class: 'shortcuts-pipelines-charts' do
%span
Cycle Analytics
Charts
- @no_container = true
- page_title "Continuous Integration", "Graphs"
- page_title "Charts", "Pipelines"
- content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('lib_chart')
= page_specific_javascript_bundle_tag('graphs')
= render 'head'
 
%div{ class: container_class }
Loading
Loading
@@ -10,9 +13,9 @@
#charts.ci-charts
.row
.col-md-6
= render 'projects/graphs/ci/overall'
= render 'projects/pipelines/charts/overall'
.col-md-6
= render 'projects/graphs/ci/build_times'
= render 'projects/pipelines/charts/build_times'
 
%hr
= render 'projects/graphs/ci/builds'
= render 'projects/pipelines/charts/builds'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment