diff options
Diffstat (limited to 'app')
22 files changed, 56 insertions, 104 deletions
diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss index 7a8a17ced99..551db31db12 100644 --- a/app/assets/stylesheets/generic/typography.scss +++ b/app/assets/stylesheets/generic/typography.scss @@ -110,7 +110,6 @@ textarea.js-gfm-input { } .md-preview { - font-family: $monospace_font; } .strikethrough { diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index a986fafff07..8d75f3aad49 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -297,9 +297,15 @@ pre.light-well { color: #4c4e54; } - .pull-right.light { + .project-controls { + float: right; + color: $gl-gray; line-height: 45px; color: #7f8fa4; + + a:hover { + text-decoration: none; + } } .project-description { diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index 250a2e79313..6111753a7fb 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -1,9 +1,9 @@ module Ci class ProjectsController < Ci::ApplicationController - before_action :authenticate_user!, except: [:build, :badge, :index, :show] + before_action :authenticate_user!, except: [:build, :badge, :show] before_action :authenticate_public_page!, only: :show before_action :project, only: [:build, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml] - before_action :authorize_access_project!, except: [:build, :badge, :index, :show, :new, :disabled] + before_action :authorize_access_project!, except: [:build, :badge, :show, :new, :disabled] before_action :authorize_manage_project!, only: [:edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml] before_action :authenticate_token!, only: [:build] before_action :no_cache, only: [:badge] @@ -15,18 +15,6 @@ module Ci def disabled end - def index - @projects = Ci::Project.all - - if current_user - @projects = @projects.where(gitlab_id: current_user.authorized_projects.pluck(:id)) - end - - @projects = @projects.search(params[:search]) if params[:search].present? - @projects = @projects.includes(:last_commit).order('ci_commits.created_at DESC') - @projects = @projects.page(params[:page]).per(40) - end - def show @ref = params[:ref] diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 54171ff67c5..ad04c646e1b 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -22,6 +22,10 @@ class RootController < Dashboard::ProjectsController when 'stars' flash.keep redirect_to starred_dashboard_projects_path + when 'project_activity' + redirect_to activity_dashboard_path + when 'starred_project_activity' + redirect_to activity_dashboard_path(filter: 'starred') else return end diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index 7f1b6a69926..1b1f4162df4 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -3,7 +3,9 @@ module PreferencesHelper # Maps `dashboard` values to more user-friendly option text DASHBOARD_CHOICES = { projects: 'Your Projects (default)', - stars: 'Starred Projects' + stars: 'Starred Projects', + project_activity: "Your Projects' Activity", + starred_project_activity: "Starred Projects' Activity" }.with_indifferent_access.freeze # Returns an Array usable by a select field for more user-friendly option text diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index e317c8eac4d..f75f999b0d0 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -123,12 +123,12 @@ class MergeRequestDiff < ActiveRecord::Base if new_diffs.any? if new_diffs.size > Commit::DIFF_HARD_LIMIT_FILES self.state = :overflow_diff_files_limit - new_diffs = new_diffs.first[Commit::DIFF_HARD_LIMIT_LINES] + new_diffs = new_diffs.first(Commit::DIFF_HARD_LIMIT_LINES) end if new_diffs.sum { |diff| diff.diff.lines.count } > Commit::DIFF_HARD_LIMIT_LINES self.state = :overflow_diff_lines_limit - new_diffs = new_diffs.first[Commit::DIFF_HARD_LIMIT_LINES] + new_diffs = new_diffs.first(Commit::DIFF_HARD_LIMIT_LINES) end end diff --git a/app/models/project.rb b/app/models/project.rb index a7ea1236b86..e912c48467d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -39,6 +39,7 @@ class Project < ActiveRecord::Base include Gitlab::VisibilityLevel include Referable include Sortable + include AfterCommitQueue extend Gitlab::ConfigHelper extend Enumerize @@ -191,7 +192,7 @@ class Project < ActiveRecord::Base state :finished state :failed - after_transition any => :started, do: :add_import_job + after_transition any => :started, do: :schedule_add_import_job after_transition any => :finished, do: :clear_import_data end @@ -275,13 +276,17 @@ class Project < ActiveRecord::Base id && persisted? end + def schedule_add_import_job + run_after_commit(:add_import_job) + end + def add_import_job if forked? unless RepositoryForkWorker.perform_async(id, forked_from_project.path_with_namespace, self.namespace.path) import_fail end else - RepositoryImportWorker.perform_in(2.seconds, id) + RepositoryImportWorker.perform_async(id) end end diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb index df92c6158e7..23ab206efba 100644 --- a/app/models/project_services/gitlab_ci_service.rb +++ b/app/models/project_services/gitlab_ci_service.rb @@ -21,8 +21,6 @@ class GitlabCiService < CiService include Gitlab::Application.routes.url_helpers - prop_accessor :token - after_save :compose_service_hook, if: :activated? def compose_service_hook @@ -53,6 +51,12 @@ class GitlabCiService < CiService end end + def token + if project.gitlab_ci_project.present? + project.gitlab_ci_project.token + end + end + def get_ci_commit(sha, ref) Ci::Project.find(project.gitlab_ci_project).commits.find_by_sha_and_ref!(sha, ref) end diff --git a/app/models/user.rb b/app/models/user.rb index 25371f9138a..3879f3fd381 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -172,7 +172,7 @@ class User < ActiveRecord::Base # User's Dashboard preference # Note: When adding an option, it MUST go on the end of the array. - enum dashboard: [:projects, :stars] + enum dashboard: [:projects, :stars, :project_activity, :starred_project_activity] # User's Project preference # Note: When adding an option, it MUST go on the end of the array. diff --git a/app/services/ci/create_project_service.rb b/app/services/ci/create_project_service.rb index 839d3f6b444..f42babd2388 100644 --- a/app/services/ci/create_project_service.rb +++ b/app/services/ci/create_project_service.rb @@ -10,7 +10,7 @@ module Ci gl_project = ::Project.find(@project.gitlab_id) gl_project.build_missing_services - gl_project.gitlab_ci_service.update_attributes(active: true, token: @project.token) + gl_project.gitlab_ci_service.update_attributes(active: true) end if forked_project diff --git a/app/views/admin/labels/index.html.haml b/app/views/admin/labels/index.html.haml index 8b11c28c56e..d67454c03e7 100644 --- a/app/views/admin/labels/index.html.haml +++ b/app/views/admin/labels/index.html.haml @@ -12,5 +12,5 @@ = paginate @labels, theme: 'gitlab' - else .light-well - .nothing-here-block There are no any labels yet -
\ No newline at end of file + .nothing-here-block There are no labels yet + diff --git a/app/views/ci/projects/_project.html.haml b/app/views/ci/projects/_project.html.haml deleted file mode 100644 index 58022de9bc1..00000000000 --- a/app/views/ci/projects/_project.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -- last_commit = project.last_commit -%tr - %td - = link_to [:ci, project] do - = project.name - %td - - if last_commit - = ci_status_with_icon(last_commit.status) - = commit_link(last_commit) - · - - if project.last_commit_date - = time_ago_in_words project.last_commit_date - ago - - else - No builds yet - %td - - if project.public - %i.fa.fa-globe - Public - - else - %i.fa.fa-lock - Private - %td - = project.commits.count diff --git a/app/views/ci/projects/_public.html.haml b/app/views/ci/projects/_public.html.haml deleted file mode 100644 index bcbd60b83f0..00000000000 --- a/app/views/ci/projects/_public.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= content_for :title do - %h3.project-title - Public projects - -- if @projects.present? - .projects - %table.table - %tr - %th Name - %th Last commit - %th Access - %th Commits - = render @projects - = paginate @projects -- else - %h4 No public projects yet diff --git a/app/views/ci/projects/_search.html.haml b/app/views/ci/projects/_search.html.haml deleted file mode 100644 index a956ed4c0bc..00000000000 --- a/app/views/ci/projects/_search.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.search - = form_tag ci_root_path, method: :get, class: 'ci-search-form' do |f| - .input-group - = search_field_tag "search", params[:search], placeholder: "Search", class: "search-input form-control" - .input-group-addon - %i.fa.fa-search diff --git a/app/views/ci/projects/index.html.haml b/app/views/ci/projects/index.html.haml deleted file mode 100644 index 046095a3c12..00000000000 --- a/app/views/ci/projects/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- if current_user - .gray-content-block.top-block - = render "search" - .projects - .wide-table-holder - %table.table.projects-table.content-list - %thead - %tr - %th Project Name - %th Last commit - %th Access - %th Commits - - = render @projects - = paginate @projects, theme: 'gitlab' -- else - = render 'public' diff --git a/app/views/dashboard/projects/_projects.html.haml b/app/views/dashboard/projects/_projects.html.haml index ef9b9ce756a..c8c315c73d8 100644 --- a/app/views/dashboard/projects/_projects.html.haml +++ b/app/views/dashboard/projects/_projects.html.haml @@ -7,4 +7,4 @@ = link_to new_project_path, class: 'btn btn-success' do New project - = render 'shared/projects/list', projects: @projects + = render 'shared/projects/list', projects: @projects, ci: true diff --git a/app/views/layouts/ci/_nav_project.html.haml b/app/views/layouts/ci/_nav_project.html.haml index 284735e45c4..7daf9342e42 100644 --- a/app/views/layouts/ci/_nav_project.html.haml +++ b/app/views/layouts/ci/_nav_project.html.haml @@ -1,8 +1,9 @@ %ul.nav.nav-sidebar = nav_link do - = link_to ci_root_path, title: 'Back to CI projects', data: {placement: 'right'}, class: 'back-link' do + = link_to project_path(@project.gl_project), title: 'Back to project', data: {placement: 'right'}, class: 'back-link' do = icon('caret-square-o-left fw') - %span= 'Back to CI projects' + %span + Back to project %li.separate-item = nav_link path: ['projects#show', 'commits#show', 'builds#show'] do = link_to ci_project_path(@project) do diff --git a/app/views/layouts/ci/_page.html.haml b/app/views/layouts/ci/_page.html.haml index c598f63c4c8..bb5ec727bff 100644 --- a/app/views/layouts/ci/_page.html.haml +++ b/app/views/layouts/ci/_page.html.haml @@ -2,10 +2,11 @@ = render "layouts/broadcast" .sidebar-wrapper.nicescroll .header-logo - = link_to ci_root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do + = link_to root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do = brand_header_logo .gitlab-text-container - %h3 GitLab CI + %h3 GitLab + - if defined?(sidebar) && sidebar = render "layouts/ci/#{sidebar}" - elsif current_user diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index b94165aac39..21d8655131f 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -31,11 +31,6 @@ %span Merge Requests %span.count= current_user.assigned_merge_requests.opened.count - = nav_link(path: ['ci/projects#index', 'ci/projects#disabled']) do - = link_to ci_projects_path, title: 'Continuous Integration', data: {placement: 'right'} do - = icon('building fw') - %span - Continuous Integration = nav_link(controller: :snippets) do = link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do = icon('clipboard fw') diff --git a/app/views/projects/network/show.json.erb b/app/views/projects/network/show.json.erb index dc82adcb2c6..122e84b41b2 100644 --- a/app/views/projects/network/show.json.erb +++ b/app/views/projects/network/show.json.erb @@ -9,7 +9,7 @@ author: { name: c.author_name, email: c.author_email, - icon: avatar_icon(c.author_email, 20) + icon: image_path(avatar_icon(c.author_email, 20)) }, time: c.time, space: c.spaces.first, diff --git a/app/views/shared/projects/_list.html.haml b/app/views/shared/projects/_list.html.haml index 330b0626d63..16e1d8421de 100644 --- a/app/views/shared/projects/_list.html.haml +++ b/app/views/shared/projects/_list.html.haml @@ -1,12 +1,13 @@ - projects_limit = 20 unless local_assigns[:projects_limit] - avatar = true unless local_assigns[:avatar] == false - stars = true unless local_assigns[:stars] == false +- ci = false unless local_assigns[:ci] == true %ul.projects-list - projects.each_with_index do |project, i| - css_class = (i >= projects_limit) ? 'hide' : nil = render "shared/projects/project", project: project, - avatar: avatar, stars: stars, css_class: css_class + avatar: avatar, stars: stars, css_class: css_class, ci: ci - if projects.size > projects_limit %li.bottom.center diff --git a/app/views/shared/projects/_project.html.haml b/app/views/shared/projects/_project.html.haml index 5318c6011f4..e67e5a8a638 100644 --- a/app/views/shared/projects/_project.html.haml +++ b/app/views/shared/projects/_project.html.haml @@ -1,9 +1,10 @@ - avatar = true unless local_assigns[:avatar] == false - stars = true unless local_assigns[:stars] == false +- ci = false unless local_assigns[:ci] == true - css_class = '' unless local_assigns[:css_class] - css_class += " no-description" unless project.description.present? %li.project-row{ class: css_class } - = cache [project.namespace, project, controller.controller_name, controller.action_name, 'v2.1'] do + = cache [project.namespace, project, controller.controller_name, controller.action_name, 'v2.2'] do = link_to project_path(project), class: dom_class(project) do - if avatar .dash-project-avatar @@ -15,8 +16,16 @@ \/ %span.project-name.filter-title = project.name + + .project-controls + - if ci && !project.empty_repo? && project.commit + - if ci_commit = project.ci_commit(project.commit.sha) + = link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}", + title: "Build status: #{ci_commit.status}", data: {toggle: 'tooltip', placement: 'left'} do + = ci_status_icon(ci_commit) + - if stars - %span.pull-right.light + %span %i.fa.fa-star = project.star_count - if project.description.present? |