]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16731 [891586] [891587] Form elements must have labels
authorJeremy Davis <jeremy.davis@sonarsource.com>
Wed, 3 Aug 2022 15:20:57 +0000 (17:20 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 5 Aug 2022 20:03:27 +0000 (20:03 +0000)
server/sonar-web/src/main/js/app/styles/init/misc.css
server/sonar-web/src/main/js/apps/projects/components/PageSidebar.tsx
server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageSidebar-test.tsx.snap [deleted file]
server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterFooter.tsx
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 2d476444af1bcd8ec452b48ea982573883ed31c7..7c626a19ffdce9c43d221e4968777baf829783f0 100644 (file)
@@ -216,6 +216,10 @@ th.hide-overflow {
   padding-top: 40px;
 }
 
+.huge-padded-bottom {
+  padding-bottom: 40px;
+}
+
 td.little-spacer-left {
   padding-left: 4px !important;
 }
index c9dbb8d8d0b1cb8a5f581009eb6cc8f9592de730..a5ba9ec507bca5f021ad8cfeb216beb91aeaf101 100644 (file)
@@ -60,7 +60,7 @@ export default function PageSidebar(props: PageSidebarProps) {
   const facetProps = { onQueryChange, maxFacetValue };
 
   return (
-    <div>
+    <div className="huge-spacer-bottom huge-padded-bottom">
       <FavoriteFilter />
 
       <div className="projects-facets-header clearfix">
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageSidebar-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/PageSidebar-test.tsx.snap
deleted file mode 100644 (file)
index b76b625..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render \`leak\` view correctly 1`] = `
-<div>
-  <withRouter(withCurrentUserContext(FavoriteFilter)) />
-  <div
-    className="projects-facets-header clearfix"
-  >
-    <h2
-      className="h3"
-    >
-      filters
-    </h2>
-  </div>
-  <QualityGateFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewReliabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewSecurityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SecurityReviewFilter
-    className="leak-facet-box"
-    onQueryChange={[MockFunction]}
-    property="new_security_review"
-  />
-  <NewMaintainabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewCoverageFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewDuplicationsFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewLinesFilter
-    onQueryChange={[MockFunction]}
-  />
-  <withLanguagesContext(LanguagesFilter)
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "view": "leak",
-      }
-    }
-  />
-  <QualifierFilter
-    onQueryChange={[MockFunction]}
-  />
-  <TagsFilter
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "view": "leak",
-      }
-    }
-  />
-</div>
-`;
-
-exports[`should render \`leak\` view correctly with no applications 1`] = `
-<div>
-  <withRouter(withCurrentUserContext(FavoriteFilter)) />
-  <div
-    className="projects-facets-header clearfix"
-  >
-    <h2
-      className="h3"
-    >
-      filters
-    </h2>
-  </div>
-  <QualityGateFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewReliabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewSecurityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SecurityReviewFilter
-    className="leak-facet-box"
-    onQueryChange={[MockFunction]}
-    property="new_security_review"
-  />
-  <NewMaintainabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewCoverageFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewDuplicationsFilter
-    onQueryChange={[MockFunction]}
-  />
-  <NewLinesFilter
-    onQueryChange={[MockFunction]}
-  />
-  <withLanguagesContext(LanguagesFilter)
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "view": "leak",
-      }
-    }
-  />
-  <TagsFilter
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "view": "leak",
-      }
-    }
-  />
-</div>
-`;
-
-exports[`should render correctly 1`] = `
-<div>
-  <withRouter(withCurrentUserContext(FavoriteFilter)) />
-  <div
-    className="projects-facets-header clearfix"
-  >
-    <ClearAll
-      onClearAll={[MockFunction]}
-    />
-    <h2
-      className="h3"
-    >
-      filters
-    </h2>
-  </div>
-  <QualityGateFilter
-    onQueryChange={[MockFunction]}
-  />
-  <ReliabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SecurityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SecurityReviewFilter
-    onQueryChange={[MockFunction]}
-  />
-  <MaintainabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <CoverageFilter
-    onQueryChange={[MockFunction]}
-  />
-  <DuplicationsFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SizeFilter
-    onQueryChange={[MockFunction]}
-    value="3"
-  />
-  <withLanguagesContext(LanguagesFilter)
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "size": "3",
-      }
-    }
-  />
-  <QualifierFilter
-    onQueryChange={[MockFunction]}
-  />
-  <TagsFilter
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "size": "3",
-      }
-    }
-  />
-</div>
-`;
-
-exports[`should render correctly with no applications 1`] = `
-<div>
-  <withRouter(withCurrentUserContext(FavoriteFilter)) />
-  <div
-    className="projects-facets-header clearfix"
-  >
-    <ClearAll
-      onClearAll={[MockFunction]}
-    />
-    <h2
-      className="h3"
-    >
-      filters
-    </h2>
-  </div>
-  <QualityGateFilter
-    onQueryChange={[MockFunction]}
-  />
-  <ReliabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SecurityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SecurityReviewFilter
-    onQueryChange={[MockFunction]}
-  />
-  <MaintainabilityFilter
-    onQueryChange={[MockFunction]}
-  />
-  <CoverageFilter
-    onQueryChange={[MockFunction]}
-  />
-  <DuplicationsFilter
-    onQueryChange={[MockFunction]}
-  />
-  <SizeFilter
-    onQueryChange={[MockFunction]}
-    value="3"
-  />
-  <withLanguagesContext(LanguagesFilter)
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "size": "3",
-      }
-    }
-  />
-  <TagsFilter
-    onQueryChange={[MockFunction]}
-    query={
-      Object {
-        "size": "3",
-      }
-    }
-  />
-</div>
-`;
index cc9baa67013f8d6b27aa684ea64dabcfdbc57622..b523c8a1edb7273dc84a44d31d81971fdce67644 100644 (file)
@@ -32,25 +32,29 @@ interface Props {
   query: Dict<any>;
 }
 
-export default class SearchableFilterFooter extends React.PureComponent<Props> {
-  handleOptionChange = ({ value }: { value: string }) => {
-    const urlOptions = (this.props.query[this.props.property] || []).concat(value).join(',');
-    this.props.onQueryChange({ [this.props.property]: urlOptions });
+export default function SearchableFilterFooter(props: Props) {
+  const { property, query } = props;
+
+  const handleOptionChange = ({ value }: { value: string }) => {
+    if (value) {
+      const urlOptions = (query[property] || []).concat(value).join(',');
+      props.onQueryChange({ [property]: urlOptions });
+    }
   };
 
-  render() {
-    return (
-      <div className="search-navigator-facet-footer projects-facet-footer">
-        <Select
-          className="input-super-large"
-          isLoading={this.props.isLoading}
-          onChange={this.handleOptionChange}
-          onInputChange={this.props.onInputChange}
-          onMenuOpen={this.props.onOpen}
-          options={this.props.options}
-          placeholder={translate('search_verb')}
-        />
-      </div>
-    );
-  }
+  return (
+    <div className="search-navigator-facet-footer projects-facet-footer">
+      <Select
+        aria-label={translate('projects.facets.search', property)}
+        className="input-super-large"
+        controlShouldRenderValue={false}
+        isLoading={props.isLoading}
+        onChange={handleOptionChange}
+        onInputChange={props.onInputChange}
+        onMenuOpen={props.onOpen}
+        options={props.options}
+        placeholder={translate('search_verb')}
+      />
+    </div>
+  );
 }
index de3dc9b43737b09aac0dbc14d520b9e1e21c7e96..0a81ba4f272c53ff66dc11990e57f9950c7d2028 100644 (file)
@@ -1061,8 +1061,10 @@ projects.facets.quality_gate=Quality Gate
 projects.facets.quality_gate.warning_help=Warning status is deprecated. This filter will disappear when no Warning Quality Gate remains.
 projects.facets.rating_x={0} rating
 projects.facets.languages=Languages
+projects.facets.search.languages=Search for languages
 projects.facets.new_lines=New Lines
 projects.facets.tags=Tags
+projects.facets.search.tags=Search for tags
 projects.facets.qualifier=Type
 projects.facets.qualitygate_label_x=Click to filter projects with a {0} quality gate.
 projects.facets.rating_label_single_x=Click to filter projects with a {0} rating of {1}.