Commit e7100d88 authored by Alexander Turinske's avatar Alexander Turinske Committed by Savas Vedova

Show checkboxes on the cluster agent vuln list

- the vulnerabiity list allows for bulk actions
- the checkboxes were always displayed before, but they should
  now update according to admin permissions
- fix missing portal target component
parent d967565a
......@@ -9,7 +9,13 @@ export default () => {
return null;
}
const { activityEmptyStateImage, agentName, emptyStateSvgPath, projectPath } = el.dataset;
const {
activityEmptyStateImage,
agentName,
canAdminVulnerability,
emptyStateSvgPath,
projectPath,
} = el.dataset;
return new Vue({
el,
......@@ -17,6 +23,7 @@ export default () => {
provide: {
activityEmptyStateImage,
agentName,
canAdminVulnerability,
emptyStateSvgPath,
projectPath,
},
......
......@@ -5,6 +5,7 @@ module Projects::ClusterAgentsHelper
{
activity_empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'),
agent_name: agent_name,
can_admin_vulnerability: can?(current_user, :admin_vulnerability, project).to_s,
empty_state_svg_path: image_path('illustrations/operations-dashboard_empty.svg'),
project_path: project.full_path
}
......
<script>
import { PortalTarget } from 'portal-vue';
import { helpPagePath } from '~/helpers/help_page_helper';
import VulnerabilityListGraphql from '../shared/vulnerability_report/vulnerability_list_graphql.vue';
import VulnerabilityFilters from '../shared/vulnerability_report/vulnerability_filters.vue';
......@@ -15,6 +16,7 @@ const PORTAL_NAME = 'vulnerability-report-sticky';
export default {
components: {
PortalTarget,
VulnerabilityFilters,
VulnerabilityListGraphql,
},
......@@ -29,7 +31,6 @@ export default {
return {
dashboardDocumentation: helpPagePath('user/application_security/security_dashboard/index'),
dashboardType: DASHBOARD_TYPES.PROJECT,
canAdminVulnerability: true,
fullPath: this.projectPath,
canViewFalsePositive: false,
hasJiraVulnerabilitiesIntegrationEnabled: false,
......
......@@ -5,22 +5,29 @@ require 'spec_helper'
RSpec.describe Projects::ClusterAgentsHelper do
describe '#js_cluster_agent_details_data' do
let_it_be(:project) { create(:project) }
let_it_be(:current_user) { create(:user) }
let(:user_can_admin_vulerability) { true }
let(:agent_name) { 'agent-name' }
subject { helper.js_cluster_agent_details_data(agent_name, project) }
it 'returns name' do
expect(subject[:agent_name]).to eq(agent_name)
before do
allow(helper).to receive(:current_user).and_return(current_user)
allow(helper)
.to receive(:can?)
.with(current_user, :admin_vulnerability, project)
.and_return(user_can_admin_vulerability)
end
it 'returns project path' do
expect(subject[:project_path]).to eq(project.full_path)
end
subject { helper.js_cluster_agent_details_data(agent_name, project) }
it 'returns string contants' do
expect(subject[:activity_empty_state_image]).to be_kind_of(String)
expect(subject[:empty_state_svg_path]).to be_kind_of(String)
end
it {
is_expected.to match({
agent_name: agent_name,
project_path: project.full_path,
activity_empty_state_image: kind_of(String),
empty_state_svg_path: kind_of(String),
can_admin_vulnerability: "true"
})
}
end
end
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