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