aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx')
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx40
1 files changed, 22 insertions, 18 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
index 9b1acd46c8e..66476d8c966 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
@@ -69,15 +69,18 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
}
const data = { key: this.props.profile.key };
- getProfileProjects(data).then((r: any) => {
- if (this.mounted) {
- this.setState({
- projects: r.results,
- more: r.more,
- loading: false
- });
- }
- });
+ getProfileProjects(data).then(
+ (r: any) => {
+ if (this.mounted) {
+ this.setState({
+ projects: r.results,
+ more: r.more,
+ loading: false
+ });
+ }
+ },
+ () => {}
+ );
}
handleChangeClick = (event: React.SyntheticEvent<HTMLElement>) => {
@@ -91,6 +94,10 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
};
renderDefault() {
+ if (this.state.loading) {
+ return <i className="spinner" />;
+ }
+
return (
<div>
<span className="badge spacer-right">{translate('default')}</span>
@@ -100,6 +107,10 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
}
renderProjects() {
+ if (this.state.loading) {
+ return <i className="spinner" />;
+ }
+
const { projects } = this.state;
if (projects == null) {
@@ -130,8 +141,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
return (
<div className="boxed-group quality-profile-projects">
{profile.actions &&
- profile.actions.edit &&
- !profile.isDefault && (
+ profile.actions.associateProjects && (
<div className="boxed-group-actions">
<button className="js-change-projects" onClick={this.handleChangeClick}>
{translate('quality_profiles.change_projects')}
@@ -144,13 +154,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
</header>
<div className="boxed-group-inner">
- {this.state.loading ? (
- <i className="spinner" />
- ) : profile.isDefault ? (
- this.renderDefault()
- ) : (
- this.renderProjects()
- )}
+ {profile.isDefault ? this.renderDefault() : this.renderProjects()}
</div>
{this.state.formOpen && (