summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-23 15:00:05 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-23 15:00:05 +0200
commit0731a7af319e4c19e98a43b7355fa26f5e8bd6f5 (patch)
tree0b45bd004de1f011528a6baaacf66d1760c73109
parentaba9668acebd3bc741affc4ff06ca3e75224d66a (diff)
downloadgitlab-ce-0731a7af319e4c19e98a43b7355fa26f5e8bd6f5.tar.gz
Show only enabled CI projects
Since CI is enabled by pushing .gitlab-ci.yml file there is no need to add CI project via dashboard Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/assets/javascripts/ci/pager.js.coffee42
-rw-r--r--app/controllers/ci/projects_controller.rb27
-rw-r--r--app/views/ci/projects/_project.html.haml11
-rw-r--r--app/views/ci/projects/_search.html.haml7
-rw-r--r--app/views/ci/projects/index.html.haml43
5 files changed, 21 insertions, 109 deletions
diff --git a/app/assets/javascripts/ci/pager.js.coffee b/app/assets/javascripts/ci/pager.js.coffee
deleted file mode 100644
index 226fbd654ab..00000000000
--- a/app/assets/javascripts/ci/pager.js.coffee
+++ /dev/null
@@ -1,42 +0,0 @@
-@CiPager =
- init: (@url, @limit = 0, preload, @disable = false) ->
- if preload
- @offset = 0
- @getItems()
- else
- @offset = @limit
- @initLoadMore()
-
- getItems: ->
- $(".loading").show()
- $.ajax
- type: "GET"
- url: @url
- data: "limit=" + @limit + "&offset=" + @offset
- complete: =>
- $(".loading").hide()
- success: (data) =>
- CiPager.append(data.count, data.html)
- dataType: "json"
-
- append: (count, html) ->
- if count > 1
- $(".content-list").append html
- if count == @limit
- @offset += count
- else
- @disable = true
-
- initLoadMore: ->
- $(document).unbind('scroll')
- $(document).endlessScroll
- bottomPixels: 400
- fireDelay: 1000
- fireOnce: true
- ceaseFire: ->
- CiPager.disable
-
- callback: (i) =>
- unless $(".loading").is(':visible')
- $(".loading").show()
- CiPager.getItems()
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb
index 40b61edb0a9..e480c0be907 100644
--- a/app/controllers/ci/projects_controller.rb
+++ b/app/controllers/ci/projects_controller.rb
@@ -1,11 +1,9 @@
module Ci
class ProjectsController < Ci::ApplicationController
- PROJECTS_BATCH = 100
-
before_action :authenticate_user!, except: [:build, :badge, :index, :show]
before_action :authenticate_public_page!, only: :show
before_action :project, only: [:build, :integration, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
- before_action :authorize_access_project!, except: [:build, :badge, :index, :show, :new, :create, :disabled]
+ before_action :authorize_access_project!, except: [:build, :badge, :index, :show, :new, :disabled]
before_action :authorize_manage_project!, only: [:edit, :integration, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
before_action :authenticate_token!, only: [:build]
before_action :no_cache, only: [:badge]
@@ -18,14 +16,9 @@ module Ci
end
def index
- @limit, @offset = (params[:limit] || PROJECTS_BATCH).to_i, (params[:offset] || 0).to_i
- @page = @offset == 0 ? 1 : (@offset / @limit + 1)
-
if current_user
@projects = ProjectListBuilder.new.execute(current_user, params[:search])
-
- @projects = @projects.page(@page).per(@limit)
-
+ @projects = @projects.page(params[:page]).per(40)
@total_count = @projects.size
end
@@ -48,22 +41,6 @@ module Ci
def integration
end
- def create
- project_data = OpenStruct.new(JSON.parse(params["project"]))
-
- unless can?(current_user, :admin_project, ::Project.find(project_data.id))
- return redirect_to ci_root_path, alert: 'You have to have at least master role to enable CI for this project'
- end
-
- @project = Ci::CreateProjectService.new.execute(current_user, project_data)
-
- if @project.persisted?
- redirect_to ci_project_path(@project, show_guide: true), notice: 'Project was successfully created.'
- else
- redirect_to :back, alert: 'Cannot save project'
- end
- end
-
def edit
end
diff --git a/app/views/ci/projects/_project.html.haml b/app/views/ci/projects/_project.html.haml
index 844b6677b3d..e0ea02cf1af 100644
--- a/app/views/ci/projects/_project.html.haml
+++ b/app/views/ci/projects/_project.html.haml
@@ -24,14 +24,3 @@
Private
%td
= ci_project.commits.count
-- else
- %tr.light
- %td
- = project.name_with_namespace
- %td
- %small Not added to CI
- %td
- %td
- = form_tag ci_projects_path do
- = hidden_field_tag :project, project.to_json(methods: [:name_with_namespace, :path_with_namespace, :ssh_url_to_repo])
- = submit_tag 'Add project to CI', class: 'btn btn-default btn-sm'
diff --git a/app/views/ci/projects/_search.html.haml b/app/views/ci/projects/_search.html.haml
index 4ab43a403f7..a956ed4c0bc 100644
--- a/app/views/ci/projects/_search.html.haml
+++ b/app/views/ci/projects/_search.html.haml
@@ -1,11 +1,6 @@
.search
- = form_tag "#", method: :get, class: 'ci-search-form' do |f|
+ = 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
-
-:coffeescript
- $('.ci-search-form').submit ->
- CiPager.init "#{ci_projects_path}" + "?search=" + query, #{Ci::ProjectsController::PROJECTS_BATCH}, false
- false
diff --git a/app/views/ci/projects/index.html.haml b/app/views/ci/projects/index.html.haml
index 2b618d61f79..efb1a1e4208 100644
--- a/app/views/ci/projects/index.html.haml
+++ b/app/views/ci/projects/index.html.haml
@@ -1,30 +1,23 @@
- if current_user
- - if @offset > 0
- = render @projects
- - else
- .gray-content-block.top-block
- = render "search"
- .projects
- .gray-content-block.clearfix.light.second-block
- .pull-left.fetch-status
- - if params[:search].present?
- by keyword: "#{params[:search]}",
- #{@total_count} projects
+ .gray-content-block.top-block
+ = render "search"
+ .projects
+ .gray-content-block.clearfix.light.second-block
+ .pull-left.fetch-status
+ - if params[:search].present?
+ by keyword: "#{params[:search]}",
+ #{@total_count} projects
- .wide-table-holder
- %table.table.projects-table.content-list
- %thead
- %tr
- %th Project Name
- %th Last commit
- %th Access
- %th Commits
-
- = render @projects
- %p.text-center.hide.loading
- %i.fa.fa-refresh.fa-spin
- :coffeescript
- CiPager.init "#{ci_projects_path}", #{Ci::ProjectsController::PROJECTS_BATCH}, false
+ .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'