diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
7 files changed, 82 insertions, 26 deletions
diff --git a/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx index 8c8fb3fa673..a65f7c57fe1 100644 --- a/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx @@ -84,7 +84,11 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State componentDidUpdate(prevProps: Props) { if (prevProps.almInstances.length === 0 && this.props.almInstances.length > 0) { - this.setState({ selectedAlmInstance: this.props.almInstances[0] }, () => this.fetchData()); + this.setState({ selectedAlmInstance: this.props.almInstances[0] }, () => { + this.fetchData().catch(() => { + /* noop */ + }); + }); } } @@ -286,7 +290,11 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State onSelectedAlmInstanceChange = (instance: AlmSettingsInstance) => { this.setState( { selectedAlmInstance: instance, searchResults: undefined, searchQuery: '' }, - () => this.fetchData() + () => { + this.fetchData().catch(() => { + /* noop */ + }); + } ); }; diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx index dd4bf7a1c96..41adf4c9baa 100644 --- a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx @@ -78,7 +78,11 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro componentDidUpdate(prevProps: Props) { if (prevProps.almInstances.length === 0 && this.props.almInstances.length > 0) { - this.setState({ selectedAlmInstance: this.props.almInstances[0] }, () => this.fetchData()); + this.setState({ selectedAlmInstance: this.props.almInstances[0] }, () => { + this.fetchData().catch(() => { + /* noop */ + }); + }); } } @@ -146,11 +150,17 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro projectsPaging: { pageIndex: 1, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE }, searchQuery, }, - async () => { - await this.fetchData(); - if (this.mounted) { - this.setState({ searching: false }); - } + () => { + this.fetchData().then( + () => { + if (this.mounted) { + this.setState({ searching: false }); + } + }, + () => { + /* noop */ + } + ); } ); }; @@ -164,11 +174,17 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro pageSize: state.projectsPaging.pageSize, }, }), - async () => { - await this.fetchData(true); - if (this.mounted) { - this.setState({ loadingMore: false }); - } + () => { + this.fetchData(true).then( + () => { + if (this.mounted) { + this.setState({ loadingMore: false }); + } + }, + () => { + /* noop */ + } + ); } ); }; diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketServer/BitbucketProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketServer/BitbucketProjectCreate.tsx index af60cb12b31..49f19542cb1 100644 --- a/server/sonar-web/src/main/js/apps/create/project/BitbucketServer/BitbucketProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketServer/BitbucketProjectCreate.tsx @@ -77,9 +77,11 @@ export default class BitbucketProjectCreate extends React.PureComponent<Props, S componentDidUpdate(prevProps: Props) { if (prevProps.almInstances.length === 0 && this.props.almInstances.length > 0) { - this.setState({ selectedAlmInstance: this.props.almInstances[0] }, () => - this.fetchInitialData() - ); + this.setState({ selectedAlmInstance: this.props.almInstances[0] }, () => { + this.fetchInitialData().catch(() => { + /* noop */ + }); + }); } } diff --git a/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx index ec40e48c34c..a07808a46ba 100644 --- a/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx @@ -86,9 +86,11 @@ export default class GitHubProjectCreate extends React.Component<Props, State> { componentDidUpdate(prevProps: Props) { if (prevProps.almInstances.length === 0 && this.props.almInstances.length > 0) { - this.setState({ selectedAlmInstance: this.getInitialSelectedAlmInstance() }, () => - this.initialize() - ); + this.setState({ selectedAlmInstance: this.getInitialSelectedAlmInstance() }, () => { + this.initialize().catch(() => { + /* noop */ + }); + }); } } @@ -292,7 +294,11 @@ export default class GitHubProjectCreate extends React.Component<Props, State> { onSelectedAlmInstanceChange = (instance: AlmSettingsInstance) => { this.setState( { selectedAlmInstance: instance, searchQuery: '', organizations: [], repositories: [] }, - () => this.initialize() + () => { + this.initialize().catch(() => { + /* noop */ + }); + } ); }; diff --git a/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx index 45b7aa4e8d7..cfa49099e20 100644 --- a/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx @@ -74,7 +74,11 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat componentDidUpdate(prevProps: Props) { const { almInstances } = this.props; if (prevProps.almInstances.length === 0 && this.props.almInstances.length > 0) { - this.setState({ selectedAlmInstance: almInstances[0] }, () => this.fetchInitialData()); + this.setState({ selectedAlmInstance: almInstances[0] }, () => { + this.fetchInitialData().catch(() => { + /* noop */ + }); + }); } } diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx index 57fa927316d..e679c512546 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx @@ -243,18 +243,34 @@ export default class Template extends React.PureComponent<Props, State> { }; handleSearch = (query: string) => { - this.setState({ query }, this.requestHolders); + this.setState({ query }, () => { + this.requestHolders().catch(() => { + /* noop */ + }); + }); }; handleFilter = (filter: FilterOption) => { - this.setState({ filter }, this.requestHolders); + this.setState({ filter }, () => { + this.requestHolders().catch(() => { + /* noop */ + }); + }); }; handleSelectPermission = (selectedPermission: string) => { if (selectedPermission === this.state.selectedPermission) { - this.setState({ selectedPermission: undefined }, this.requestHolders); + this.setState({ selectedPermission: undefined }, () => { + this.requestHolders().catch(() => { + /* noop */ + }); + }); } else { - this.setState({ selectedPermission }, this.requestHolders); + this.setState({ selectedPermission }, () => { + this.requestHolders().catch(() => { + /* noop */ + }); + }); } }; diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx index 11012335e56..74e09875f66 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx +++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx @@ -132,7 +132,11 @@ export default class BranchAnalysisList extends React.PureComponent<Props, State }; handleRangeChange = ({ value }: { value: number }) => { - this.setState({ range: value }, () => this.fetchAnalyses()); + this.setState({ range: value }, () => { + this.fetchAnalyses().catch(() => { + /* noop */ + }); + }); }; render() { |