2018-12-03 12:59:11 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module IdeHelper
|
|
|
|
def ide_data
|
|
|
|
{
|
2021-03-05 10:09:12 -05:00
|
|
|
'empty-state-svg-path' => image_path('illustrations/multi_file_editor_empty.svg'),
|
|
|
|
'no-changes-state-svg-path' => image_path('illustrations/multi-editor_no_changes_empty.svg'),
|
|
|
|
'committed-state-svg-path' => image_path('illustrations/multi-editor_all_changes_committed_empty.svg'),
|
|
|
|
'pipelines-empty-state-svg-path': image_path('illustrations/pipelines_empty.svg'),
|
|
|
|
'promotion-svg-path': image_path('illustrations/web-ide_promotion.svg'),
|
2021-07-22 02:08:43 -04:00
|
|
|
'ci-help-page-path' => help_page_path('ci/quick_start/index'),
|
2021-03-05 10:09:12 -05:00
|
|
|
'web-ide-help-page-path' => help_page_path('user/project/web_ide/index.md'),
|
|
|
|
'clientside-preview-enabled': Gitlab::CurrentSettings.web_ide_clientside_preview_enabled?.to_s,
|
|
|
|
'render-whitespace-in-code': current_user.render_whitespace_in_code.to_s,
|
|
|
|
'codesandbox-bundler-url': Gitlab::CurrentSettings.web_ide_clientside_preview_bundler_url,
|
|
|
|
'branch-name' => @branch,
|
2021-06-14 20:10:11 -04:00
|
|
|
'default-branch' => @project && @project.default_branch,
|
2021-03-05 10:09:12 -05:00
|
|
|
'file-path' => @path,
|
|
|
|
'merge-request' => @merge_request,
|
2021-03-22 20:09:09 -04:00
|
|
|
'fork-info' => @fork_info&.to_json,
|
2021-05-07 17:10:34 -04:00
|
|
|
'project' => convert_to_project_entity_json(@project),
|
2021-08-24 11:10:36 -04:00
|
|
|
'enable-environments-guidance' => enable_environments_guidance?.to_s,
|
2022-03-23 08:07:27 -04:00
|
|
|
'preview-markdown-path' => @project && preview_markdown_path(@project),
|
|
|
|
'web-terminal-svg-path' => image_path('illustrations/web-ide_promotion.svg'),
|
|
|
|
'web-terminal-help-path' => help_page_path('user/project/web_ide/index.md', anchor: 'interactive-web-terminals-for-the-web-ide'),
|
|
|
|
'web-terminal-config-help-path' => help_page_path('user/project/web_ide/index.md', anchor: 'web-ide-configuration-file'),
|
|
|
|
'web-terminal-runners-help-path' => help_page_path('user/project/web_ide/index.md', anchor: 'runner-configuration')
|
2018-12-03 12:59:11 -05:00
|
|
|
}
|
|
|
|
end
|
2021-03-05 10:09:12 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def convert_to_project_entity_json(project)
|
|
|
|
return unless project
|
|
|
|
|
2021-12-15 16:11:32 -05:00
|
|
|
API::Entities::Project.represent(project, current_user: current_user).to_json
|
2021-03-05 10:09:12 -05:00
|
|
|
end
|
2021-05-07 17:10:34 -04:00
|
|
|
|
|
|
|
def enable_environments_guidance?
|
|
|
|
experiment(:in_product_guidance_environments_webide, project: @project) do |e|
|
2022-02-04 16:16:06 -05:00
|
|
|
e.candidate { !has_dismissed_ide_environments_callout? }
|
2021-05-07 17:10:34 -04:00
|
|
|
|
|
|
|
e.run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_dismissed_ide_environments_callout?
|
|
|
|
current_user.dismissed_callout?(feature_name: 'web_ide_ci_environments_guidance')
|
|
|
|
end
|
2018-12-03 12:59:11 -05:00
|
|
|
end
|