2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
class IdeController < ApplicationController
|
2018-11-20 20:47:30 +05:30
|
|
|
layout 'fullscreen'
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
include ClientsidePreviewCSP
|
|
|
|
include StaticObjectExternalStorageCSP
|
2021-04-17 20:07:23 +05:30
|
|
|
include Gitlab::Utils::StrongMemoize
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
before_action do
|
|
|
|
push_frontend_feature_flag(:build_service_proxy)
|
2020-07-28 23:09:34 +05:30
|
|
|
push_frontend_feature_flag(:schema_linting)
|
2021-04-17 20:07:23 +05:30
|
|
|
define_index_vars
|
2020-06-23 00:09:42 +05:30
|
|
|
end
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :web_ide
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
def index
|
2019-10-12 21:52:04 +05:30
|
|
|
Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
2021-04-17 20:07:23 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def define_index_vars
|
|
|
|
return unless project
|
|
|
|
|
|
|
|
@branch = params[:branch]
|
|
|
|
@path = params[:path]
|
|
|
|
@merge_request = params[:merge_request_id]
|
|
|
|
|
|
|
|
unless can?(current_user, :push_code, project)
|
|
|
|
@forked_project = ForkProjectsFinder.new(project, current_user: current_user).execute.first
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
|
|
|
strong_memoize(:project) do
|
|
|
|
next unless params[:project_id].present?
|
|
|
|
|
|
|
|
Project.find_by_full_path(params[:project_id])
|
|
|
|
end
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|