From 288c3986d8c611a9e433c168f4166021ca28e4c0 Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Wed, 27 Apr 2022 08:53:03 +0200 Subject: [PATCH] [NO-JIRA] Fix react-select typings --- .../components/StatusFilter.tsx | 2 +- .../components/TypesFilter.tsx | 4 ++-- .../components/CustomRuleFormModal.tsx | 2 +- .../CustomRuleFormModal-test.tsx.snap | 4 ++-- .../components/MeasureViewSelect.tsx | 2 +- .../MeasureViewSelect-test.tsx.snap | 6 +++--- .../components/ProjectActivityGraphs.tsx | 21 +++++++------------ .../ProjectActivityGraphs-test.tsx.snap | 3 --- .../BaselineSettingReferenceBranch.tsx | 3 +-- .../components/BranchAnalysisListRenderer.tsx | 4 ++-- ...selineSettingReferenceBranch-test.tsx.snap | 3 --- .../BranchAnalysisListRenderer-test.tsx.snap | 6 +++--- .../filters/SearchableFilterFooter.tsx | 2 +- .../js/apps/projectsManagement/Search.tsx | 3 +-- .../__snapshots__/Search-test.tsx.snap | 3 +-- .../main/js/components/controls/Select.tsx | 8 +++---- 16 files changed, 31 insertions(+), 45 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx index 4e80efeca57..6e248342f54 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx @@ -53,8 +53,8 @@ export default class StatusFilter extends React.PureComponent { className="input-medium" onChange={this.handleChange} options={options} - searchable={false} value={options.find(o => o.value === this.props.value)} + isSearchable={false} /> ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx index bb7dd9de5f4..b84b2150539 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx @@ -51,10 +51,10 @@ export default class TypesFilter extends React.PureComponent { graph[0].type); }; - addCustomMetric = (metric: string) => { - const customMetrics = [...this.props.query.customMetrics, metric]; - saveActivityGraph(PROJECT_ACTIVITY_GRAPH, this.props.project, GraphType.custom, customMetrics); - this.props.updateQuery({ customMetrics }); - }; - - removeCustomMetric = (removedMetric: string) => { - const customMetrics = this.props.query.customMetrics.filter(metric => metric !== removedMetric); - saveActivityGraph(PROJECT_ACTIVITY_GRAPH, this.props.project, GraphType.custom, customMetrics); - this.props.updateQuery({ customMetrics }); + updateSelectedMetrics = (selectedMetrics: string[]) => { + saveActivityGraph( + PROJECT_ACTIVITY_GRAPH, + this.props.project, + GraphType.custom, + selectedMetrics + ); + this.props.updateQuery({ customMetrics: selectedMetrics }); }; updateGraph = (graph: GraphType) => { @@ -195,12 +193,10 @@ export default class ProjectActivityGraphs extends React.PureComponent @@ -213,7 +209,6 @@ export default class ProjectActivityGraphs extends React.PureComponent @@ -108,7 +106,6 @@ exports[`should render correctly the graph and legends 1`] = ` }, ] } - removeCustomMetric={[Function]} series={ Array [ Object { diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx index 9cf2517a172..7a34d01e6d3 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx +++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx @@ -112,8 +112,7 @@ export default function BaselineSettingReferenceBranch(props: BaselineSettingRef {translate('baseline.reference_branch.choose')} - - autofocus={false} + { isLoading={this.props.isLoading} onChange={this.handleOptionChange} onInputChange={this.props.onInputChange} - onOpen={this.props.onOpen} + onMenuOpen={this.props.onOpen} options={this.props.options} placeholder={translate('search_verb')} /> diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx index 123ae2ec623..9a51ec49016 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx @@ -153,7 +153,7 @@ export class Search extends React.PureComponent {