Commit fb62644e authored by Stan Hu's avatar Stan Hu

Merge branch '14061-license-app-data' into 'master'

Load js app data in controller

See merge request gitlab-org/gitlab!24831
parents e38207a1 c353515d
......@@ -8,6 +8,7 @@ module Projects
def index
respond_to do |format|
format.html do
@licenses_app_data = licenses_app_data
render status: :ok
end
format.json do
......@@ -80,5 +81,13 @@ module Projects
def truthy?(value)
value.in?(%w[true 1])
end
def licenses_app_data
{
endpoint: project_licenses_path(project, detected: true, format: :json),
documentation_path: help_page_path('user/application_security/license_compliance/index'),
empty_state_svg_path: helpers.image_path('illustrations/Dependency-list-empty-state.svg')
}
end
end
end
- breadcrumb_title _('License Compliance')
- page_title _('License Compliance')
#js-licenses-app{ data: { endpoint: project_licenses_path(@project, detected: true, format: :json),
documentation_path: help_page_path('user/application_security/license_compliance/index'),
empty_state_svg_path: image_path('illustrations/Dependency-list-empty-state.svg') } }
#js-licenses-app{ data: licenses_app_data }
......@@ -27,6 +27,10 @@ describe Projects::LicensesController do
get :index, params: params
expect(response).to have_gitlab_http_status(:ok)
licenses_app_data = assigns(:licenses_app_data)
expect(licenses_app_data[:endpoint]).to eql(controller.helpers.project_licenses_path(project, detected: true, format: :json))
expect(licenses_app_data[:documentation_path]).to eql(help_page_path('user/application_security/license_compliance/index'))
expect(licenses_app_data[:empty_state_svg_path]).to eql(controller.helpers.image_path('illustrations/Dependency-list-empty-state.svg'))
end
it 'counts usage of the feature' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment