]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20738 Remove useless "current issue" counter on issues page
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Thu, 12 Oct 2023 07:31:07 +0000 (09:31 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 12 Oct 2023 20:02:51 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
server/sonar-web/src/main/js/apps/issues/components/IssuesCounter.tsx
server/sonar-web/src/main/js/apps/issues/components/PageActions.tsx
server/sonar-web/src/main/js/apps/issues/issues-subnavigation/SubnavigationIssuesList.tsx
server/sonar-web/src/main/js/apps/issues/issues-subnavigation/SubnavigationIssuesListHeader.tsx

index 80a291dc4f4f698098c5b867a5bcca35cd9a4e58..11766feb3d4aa50ffbd238779bae9bdefdb53d33 100644 (file)
@@ -1184,11 +1184,9 @@ export class App extends React.PureComponent<Props, State> {
   renderHeader({
     openIssue,
     paging,
-    selectedIndex,
   }: {
     openIssue: Issue | undefined;
     paging: Paging | undefined;
-    selectedIndex: number | undefined;
   }) {
     return openIssue ? (
       <A11ySkipTarget anchor="issues_main" />
@@ -1202,7 +1200,6 @@ export class App extends React.PureComponent<Props, State> {
             canSetHome={!this.props.component}
             effortTotal={this.state.effortTotal}
             paging={this.props.component?.needIssueSync ? undefined : paging}
-            selectedIndex={selectedIndex}
           />
         </div>
       </>
@@ -1221,8 +1218,6 @@ export class App extends React.PureComponent<Props, State> {
       loadingRule,
     } = this.state;
 
-    const selectedIndex = this.getSelectedIndex();
-
     return (
       <ScreenPositionHelper>
         {({ top }) => (
@@ -1233,7 +1228,7 @@ export class App extends React.PureComponent<Props, State> {
             })}
             style={{ height: `calc((100vh - ${top + LAYOUT_FOOTER_HEIGHT}px)` }}
           >
-            {this.renderHeader({ openIssue, paging, selectedIndex })}
+            {this.renderHeader({ openIssue, paging })}
 
             <Spinner loading={loadingRule}>
               {/* eslint-disable-next-line local-rules/no-conditional-rendering-of-deferredspinner */}
index 1f603d0a7da0f80deb2651cda867add7957906be..09c4f00f5be8c3d4ae8e868442914d847b427820 100644 (file)
@@ -22,17 +22,11 @@ import PageCounter from '../../../components/common/PageCounter';
 import { translate } from '../../../helpers/l10n';
 
 interface Props {
-  current: number | undefined;
   total: number;
 }
 
 export default function IssuesCounter(props: Props) {
   return (
-    <PageCounter
-      className="spacer-left"
-      current={props.current}
-      label={translate('issues.issues')}
-      total={props.total}
-    />
+    <PageCounter className="spacer-left" label={translate('issues.issues')} total={props.total} />
   );
 }
index 6af94914793cc5e60553bef48189da61b683ad70..ed87e3a39ba851ba84c847e6a7d889324603356e 100644 (file)
@@ -29,18 +29,17 @@ export interface PageActionsProps {
   canSetHome: boolean;
   effortTotal: number | undefined;
   paging?: Paging;
-  selectedIndex?: number;
 }
 
 export default function PageActions(props: PageActionsProps) {
-  const { canSetHome, effortTotal, paging, selectedIndex } = props;
+  const { canSetHome, effortTotal, paging } = props;
 
   return (
     <div className="sw-body-sm sw-flex sw-items-center sw-gap-6 sw-justify-end sw-flex-1">
       <KeyboardHint title={translate('issues.to_select_issues')} command="ArrowUp ArrowDown" />
       <KeyboardHint title={translate('issues.to_navigate')} command="ArrowLeft ArrowRight" />
 
-      {paging != null && <IssuesCounter current={selectedIndex} total={paging.total} />}
+      {paging != null && <IssuesCounter total={paging.total} />}
       {effortTotal !== undefined && <TotalEffort effort={effortTotal} />}
 
       {canSetHome && <HomePageSelect currentPage={{ type: 'ISSUES' }} />}
index 4fcdbf16cac0e95205f6ad9fa210906f4dd6ab09..0b37db4b348a0e258b51b547ded9b7d49dd0498b 100644 (file)
@@ -51,16 +51,9 @@ export default function SubnavigationIssuesList(props: Props) {
     selectedLocationIndex,
   } = props;
 
-  let selectedIndex: number | undefined = issues.findIndex((issue) => issue.key === selected);
-  selectedIndex = selectedIndex === -1 ? undefined : selectedIndex;
-
   return (
     <StyledWrapper>
-      <SubnavigationIssuesListHeader
-        loading={loading}
-        paging={paging}
-        selectedIndex={selectedIndex}
-      />
+      <SubnavigationIssuesListHeader loading={loading} paging={paging} />
       <StyledList>
         {issues.map((issue, index) => {
           const previousIssue = index > 0 ? issues[index - 1] : undefined;
index 17c203ef2279db0f125bca94b932e559a7131571..6ea525abe5d049fdffe606af07c67f1ddf833d7e 100644 (file)
@@ -26,17 +26,14 @@ import IssuesCounter from '../components/IssuesCounter';
 interface Props {
   loading: boolean;
   paging: Paging | undefined;
-  selectedIndex: number | undefined;
 }
 
 export default function SubnavigationIssuesListHeader(props: Props) {
-  const { loading, paging, selectedIndex } = props;
+  const { loading, paging } = props;
 
   return (
     <StyledHeader>
-      <Spinner loading={loading}>
-        {paging && <IssuesCounter current={selectedIndex} total={paging.total} />}
-      </Spinner>
+      <Spinner loading={loading}>{paging && <IssuesCounter total={paging.total} />}</Spinner>
     </StyledHeader>
   );
 }