Skip to content
Snippets Groups Projects
Commit b5740adf authored by Samantha Ming's avatar Samantha Ming
Browse files

Add disabled state and tooltip to tool filter

Issue: #383294
parent 5550fb7e
No related branches found
No related tags found
1 merge request!106199Add disabled state and tooltip to tool filter
......@@ -5,6 +5,7 @@ import groupScannersQuery from 'ee/security_dashboard/graphql/queries/group_spec
import instanceScannersQuery from 'ee/security_dashboard/graphql/queries/instance_specific_scanners.query.graphql';
import { getFormattedScanners } from 'ee/security_dashboard/helpers';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { s__ } from '~/locale';
import SimpleFilter from './simple_filter.vue';
import FilterBody from './filter_body.vue';
import FilterItem from './filter_item.vue';
......@@ -82,6 +83,9 @@ export default {
return { fullPath: this[fullPath] };
},
},
i18n: {
disabledTooltip: s__('SecurityReports|Not available'),
},
};
</script>
......@@ -102,6 +106,8 @@ export default {
:key="option.id"
:is-checked="isSelected(option)"
:text="option.name"
:disabled="option.disabled"
:tooltip="option.disabled ? $options.i18n.disabledTooltip : ''"
:data-testid="`option:${option.id}`"
@click="toggleOption(option)"
/>
......
......@@ -106,6 +106,8 @@ describe('Tool Filter component', () => {
expect(findFilterItems().at(0).props()).toMatchObject({
isChecked: true,
text: allOptionName,
disabled: false,
tooltip: '',
});
});
......@@ -148,12 +150,17 @@ describe('Tool Filter component', () => {
it('populates the filter options from the query response', async () => {
await createWrapper();
defaultFormattedScanners.forEach(({ name }, index) => {
defaultFormattedScanners.forEach(({ name, disabled }, index) => {
expect(
findFilterItems()
.at(index + 1)
.props(),
).toMatchObject({ isChecked: false, text: name });
).toMatchObject({
isChecked: false,
text: name,
disabled,
tooltip: `${disabled ? ToolFilter.i18n.disabledTooltip : ''}`,
});
});
});
......
......@@ -37244,6 +37244,9 @@ msgstr ""
msgid "SecurityReports|No vulnerabilities found for this pipeline"
msgstr ""
 
msgid "SecurityReports|Not available"
msgstr ""
msgid "SecurityReports|Oops, something doesn't seem right."
msgstr ""
 
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment