From dcffd32abbcc008f044f7f2e27aabc69d1ac3541 Mon Sep 17 00:00:00 2001 From: David Cho-Lerat Date: Thu, 20 Jul 2023 14:33:55 +0200 Subject: [PATCH] SONAR-19986 Limit bulk issue change to 100 issues when re-indexing --- .../js/apps/issues/components/IssuesApp.tsx | 87 ++++++++++--------- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx index f506e9d1a64..b8ac93b2d81 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx @@ -167,8 +167,8 @@ export class App extends React.PureComponent { issues: [], loading: true, loadingFacets: {}, - loadingRule: false, loadingMore: false, + loadingRule: false, locationsNavigator: false, myIssues: areMyIssuesSelected(props.location.query), openFacets: { @@ -183,7 +183,6 @@ export class App extends React.PureComponent { standards: shouldOpenStandardsFacet({}, query), types: true, }, - showVariantsFilter: false, query, referencedComponentsById: {}, referencedComponentsByKey: {}, @@ -191,6 +190,7 @@ export class App extends React.PureComponent { referencedRules: {}, referencedUsers: {}, selected: getOpen(props.location.query), + showVariantsFilter: false, }; } @@ -201,8 +201,8 @@ export class App extends React.PureComponent { return { myIssues: areMyIssuesSelected(query), - query: parseQuery(query), openIssue: getOpenIssue(props, state.issues), + query: parseQuery(query), }; } @@ -283,6 +283,7 @@ export class App extends React.PureComponent { if (event.key === KeyboardKeys.Alt) { event.preventDefault(); this.setState(actions.enableLocationsNavigator); + return; } @@ -464,6 +465,7 @@ export class App extends React.PureComponent { ...query, }).then((response) => { const { components, issues, rules } = response; + const parsedIssues = issues.map((issue) => parseIssueFromResponse(issue, components, undefined, rules) ); @@ -580,15 +582,12 @@ export class App extends React.PureComponent { } this.setState(({ showVariantsFilter }) => ({ - cannotShowOpenIssue: Boolean(openIssueKey && !openIssue), + cannotShowOpenIssue: Boolean(openIssueKey) && !openIssue, effortTotal, facets: parseFacets(facets), - showVariantsFilter: firstRequest - ? Boolean(facets?.find((f) => f.property === VARIANTS_FACET)?.values.length) - : showVariantsFilter, + issues, loading: false, locationsNavigator: true, - issues, openIssue, paging, referencedComponentsById: keyBy(other.components, 'uuid'), @@ -599,6 +598,9 @@ export class App extends React.PureComponent { selected, selectedFlowIndex: 0, selectedLocationIndex: undefined, + showVariantsFilter: firstRequest + ? Boolean(facets?.find((f) => f.property === VARIANTS_FACET)?.values.length) + : showVariantsFilter, })); } @@ -642,8 +644,8 @@ export class App extends React.PureComponent { (response) => { if (this.mounted) { this.setState((state) => ({ - loadingMore: false, issues: [...state.issues, ...response.issues], + loadingMore: false, paging: response.paging, })); } @@ -709,7 +711,7 @@ export class App extends React.PureComponent { let count; - if (checkAll && paging) { + if (checkAll && paging && !this.props.component?.needIssueSync) { count = paging.total > MAX_PAGE_SIZE ? MAX_PAGE_SIZE : paging.total; } else { count = Math.min(checked.length, MAX_PAGE_SIZE); @@ -923,7 +925,7 @@ export class App extends React.PureComponent { }; renderBulkChange() { - const { currentUser } = this.props; + const { component, currentUser } = this.props; const { checkAll, bulkChangeModal, checked, issues, paging } = this.state; const isAllChecked = checked.length > 0 && issues.length === checked.length; @@ -947,9 +949,9 @@ export class App extends React.PureComponent { /> {this.getButtonLabel(checked, checkAll, paging)} @@ -957,7 +959,10 @@ export class App extends React.PureComponent { {bulkChangeModal && ( @@ -969,17 +974,17 @@ export class App extends React.PureComponent { renderFacets(warning?: React.ReactNode) { const { component, currentUser, branchLike } = this.props; const { - query, facets, loadingFacets, myIssues, openFacets, - showVariantsFilter, + query, referencedComponentsById, referencedComponentsByKey, referencedLanguages, referencedRules, referencedUsers, + showVariantsFilter, } = this.state; return ( @@ -1011,19 +1016,19 @@ export class App extends React.PureComponent { component={component} createdAfterIncludesTime={this.createdAfterIncludesTime()} facets={facets} - loadSearchResultCount={this.loadSearchResultCount} loadingFacets={loadingFacets} + loadSearchResultCount={this.loadSearchResultCount} myIssues={myIssues} onFacetToggle={this.handleFacetToggle} onFilterChange={this.handleFilterChange} openFacets={openFacets} - showVariantsFilter={showVariantsFilter} query={query} referencedComponentsById={referencedComponentsById} referencedComponentsByKey={referencedComponentsByKey} referencedLanguages={referencedLanguages} referencedRules={referencedRules} referencedUsers={referencedUsers} + showVariantsFilter={showVariantsFilter} /> ); @@ -1222,13 +1227,12 @@ export class App extends React.PureComponent { {/* eslint-disable-next-line local-rules/no-conditional-rendering-of-deferredspinner */} {openIssue && openRuleDetails ? ( + } codeTabContent={ { selectedLocationIndex={this.state.selectedLocationIndex} /> } - activityTabContent={ - - } + extendedDescription={openRuleDetails.htmlNote} + issue={openIssue} + onIssueChange={this.handleIssueChange} + ruleDescriptionContextKey={openIssue.ruleDescriptionContextKey} + ruleDetails={openRuleDetails} + selectedFlowIndex={this.state.selectedFlowIndex} + selectedLocationIndex={this.state.selectedLocationIndex} /> ) : (
{ style={{ marginTop: `-${PSEUDO_SHADOW_HEIGHT}px` }} > {checkAll && paging && paging.total > MAX_PAGE_SIZE && ( - - - {MAX_PAGE_SIZE} }} - /> - - +
+ + + {MAX_PAGE_SIZE} }} + /> + + +
)} {cannotShowOpenIssue && (!paging || paging.total > 0) && ( -- 2.39.5