routes.rb 3.8 KB
Newer Older
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
1
require 'sidekiq/web'
2
require 'sidekiq/cron/web'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
3

Valery Sizov's avatar
Valery Sizov committed
4
Rails.application.routes.draw do
5 6
  concern :access_requestable do
    post :request_access, on: :collection
7
    post :approve_access_request, on: :member
8 9
  end

10 11 12 13
  concern :awardable do
    post :toggle_award_emoji, on: :member
  end

14 15 16 17 18 19
  favicon_redirect = redirect do |_params, _request|
    ActionController::Base.helpers.asset_url(Gitlab::Favicon.main)
  end
  get 'favicon.png', to: favicon_redirect
  get 'favicon.ico', to: favicon_redirect

20 21 22
  draw :sherlock
  draw :development
  draw :ci
23

24

25 26 27 28
  # This is here so we can "reserve" the path for the Jira integration in GitLab EE
  # Having a non-existent controller here does not affect the scope in any way since all possible routes
  # get a 404 proc returned. It is written in this way to minimize merge conflicts with EE
  scope path: '/login/oauth', controller: 'oauth/jira/authorizations', as: :oauth_jira do
29
    match '*all', via: [:get, :post], to: proc { [404, {}, ['']] }
30 31
  end

32 33
  draw :oauth

34 35
  use_doorkeeper_openid_connect

36 37 38
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'
39
  get '/autocomplete/projects' => 'autocomplete#projects'
40
  get '/autocomplete/award_emojis' => 'autocomplete#award_emojis'
41

42
  # Search
43 44
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
Valery Sizov's avatar
Valery Sizov committed
45

Kamil Trzcinski's avatar
Kamil Trzcinski committed
46 47 48
  # JSON Web Token
  get 'jwt/auth' => 'jwt#auth'

49
  # Health check
50
  get 'health_check(/:checks)' => 'health_check#index', as: :health_check
51

52
  scope path: '-' do
53
    # '/-/health' implemented by BasicHealthMiddleware
54 55
    get 'liveness' => 'health#liveness'
    get 'readiness' => 'health#readiness'
56
    resources :metrics, only: [:index]
57
    mount Peek::Railtie => '/peek', as: 'peek_routes'
58 59 60 61 62 63 64 65 66 67 68 69 70

    # Boards resources shared between group and projects
    resources :boards, only: [] do
      resources :lists, module: :boards, only: [:index, :create, :update, :destroy] do
        collection do
          post :generate
        end

        resources :issues, only: [:index, :create, :update]
      end

      resources :issues, module: :boards, only: [:index, :update]
    end
71

72 73 74 75 76 77 78 79
    # UserCallouts
    resources :user_callouts, only: [:create]

    get 'ide' => 'ide#index'
    get 'ide/*vueroute' => 'ide#index', format: false

    draw :operations
    draw :instance_statistics
80

81 82 83 84 85 86
    if ENV['GITLAB_ENABLE_CHAOS_ENDPOINTS']
      get '/chaos/leakmem' => 'chaos#leakmem'
      get '/chaos/cpuspin' => 'chaos#cpuspin'
      get '/chaos/sleep' => 'chaos#sleep'
      get '/chaos/kill' => 'chaos#kill'
    end
87 88 89 90
  end

  concern :clusterable do
    resources :clusters, only: [:index, :new, :show, :update, :destroy] do
91 92 93 94 95 96 97 98
      collection do
        post :create_user
        post :create_gcp
      end

      member do
        scope :applications do
          post '/:application', to: 'clusters/applications#create', as: :install_applications
99
          patch '/:application', to: 'clusters/applications#update', as: :update_applications
100 101
        end

102
        get :cluster_status, format: :json
103 104
      end
    end
105 106
  end

107 108 109 110
  draw :api
  draw :sidekiq
  draw :help
  draw :snippets
Andrew8xx8's avatar
Andrew8xx8 committed
111

Douwe Maan's avatar
Douwe Maan committed
112 113 114 115
  # Invites
  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
Douwe Maan's avatar
Douwe Maan committed
116
      match :decline, via: [:get, :post]
Douwe Maan's avatar
Douwe Maan committed
117 118
    end
  end
119

120
  resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
121 122 123 124 125
    member do
      get :unsubscribe
    end
  end

126 127 128
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

129 130 131
  # Notification settings
  resources :notification_settings, only: [:create, :update]

132
  draw :google_api
133 134 135 136 137 138 139 140 141
  draw :import
  draw :uploads
  draw :explore
  draw :admin
  draw :profile
  draw :dashboard
  draw :group
  draw :user
  draw :project
gitlabhq's avatar
gitlabhq committed
142

143
  root to: "root#index"
144

145
  get '*unmatched_route', to: 'application#route_not_found'
gitlabhq's avatar
gitlabhq committed
146
end