import { connect } from 'react-redux';
import { getGlobalSettingValue, Store } from '../../../store/rootReducer';
import { BranchLike } from '../../../types/branch-like';
-import { ComponentQualifier } from '../../../types/component';
+import { ComponentQualifier, isApplication, isPortfolioLike } from '../../../types/component';
import {
Facet,
ReferencedComponent,
export class Sidebar extends React.PureComponent<Props> {
renderComponentFacets() {
const { component, facets, loadingFacets, openFacets, query, branchLike } = this.props;
- if (!component) {
+ const hasFileOrDirectory =
+ !isApplication(component?.qualifier) && !isPortfolioLike(component?.qualifier);
+ if (!component || !hasFileOrDirectory) {
return null;
}
const commonProps = {
expect(renderSidebar({ component: mockComponent() })).toMatchSnapshot();
});
-it('should render facets for module', () => {
- expect(
- renderSidebar({ component: mockComponent({ qualifier: ComponentQualifier.SubProject }) })
- ).toMatchSnapshot();
-});
-
-it('should render facets for directory', () => {
- expect(
- renderSidebar({ component: mockComponent({ qualifier: ComponentQualifier.Directory }) })
- ).toMatchSnapshot();
-});
-
-it('should render facets for developer', () => {
- expect(
- renderSidebar({ component: mockComponent({ qualifier: ComponentQualifier.Developper }) })
- ).toMatchSnapshot();
+it.each([
+ [ComponentQualifier.Application],
+ [ComponentQualifier.Portfolio],
+ [ComponentQualifier.SubPortfolio],
+ [ComponentQualifier.SubProject],
+ [ComponentQualifier.Directory],
+ [ComponentQualifier.Developper]
+])('should render facets for %p', qualifier => {
+ expect(renderSidebar({ component: mockComponent({ qualifier }) })).toMatchSnapshot();
});
it('should render facets when my issues are selected', () => {
]
`;
-exports[`should render facets for developer 1`] = `
+exports[`should render facets for "APP" 1`] = `
Array [
"TypeFacet",
"SeverityFacet",
"RuleFacet",
"TagFacet",
"ProjectFacet",
+ "AssigneeFacet",
+ "AuthorFacet",
+]
+`;
+
+exports[`should render facets for "BRC" 1`] = `
+Array [
+ "TypeFacet",
+ "SeverityFacet",
+ "ScopeFacet",
+ "ResolutionFacet",
+ "StatusFacet",
+ "StandardFacet",
+ "InjectIntl(CreationDateFacet)",
+ "Connect(LanguageFacet)",
+ "RuleFacet",
+ "TagFacet",
"DirectoryFacet",
"FileFacet",
"AssigneeFacet",
+ "AuthorFacet",
]
`;
-exports[`should render facets for directory 1`] = `
+exports[`should render facets for "DEV" 1`] = `
+Array [
+ "TypeFacet",
+ "SeverityFacet",
+ "ScopeFacet",
+ "ResolutionFacet",
+ "StatusFacet",
+ "StandardFacet",
+ "InjectIntl(CreationDateFacet)",
+ "Connect(LanguageFacet)",
+ "RuleFacet",
+ "TagFacet",
+ "ProjectFacet",
+ "DirectoryFacet",
+ "FileFacet",
+ "AssigneeFacet",
+]
+`;
+
+exports[`should render facets for "DIR" 1`] = `
Array [
"TypeFacet",
"SeverityFacet",
]
`;
-exports[`should render facets for global page 1`] = `
+exports[`should render facets for "SVW" 1`] = `
Array [
"TypeFacet",
"SeverityFacet",
]
`;
-exports[`should render facets for module 1`] = `
+exports[`should render facets for "VW" 1`] = `
Array [
"TypeFacet",
"SeverityFacet",
"Connect(LanguageFacet)",
"RuleFacet",
"TagFacet",
- "DirectoryFacet",
- "FileFacet",
+ "ProjectFacet",
+ "AssigneeFacet",
+ "AuthorFacet",
+]
+`;
+
+exports[`should render facets for global page 1`] = `
+Array [
+ "TypeFacet",
+ "SeverityFacet",
+ "ScopeFacet",
+ "ResolutionFacet",
+ "StatusFacet",
+ "StandardFacet",
+ "InjectIntl(CreationDateFacet)",
+ "Connect(LanguageFacet)",
+ "RuleFacet",
+ "TagFacet",
+ "ProjectFacet",
"AssigneeFacet",
"AuthorFacet",
]