aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html7
-rw-r--r--it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.js10
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js36
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js19
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/styles.css16
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs10
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js20
-rw-r--r--server/sonar-web/src/main/less/init/tables.less16
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties2
11 files changed, 79 insertions, 67 deletions
diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html
index b31c23f2f3a..287d6f86067 100644
--- a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html
+++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html
@@ -51,7 +51,12 @@
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>css=#quality-profiles-restore</td>
+ <td>css=.js-more-admin-actions</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>css=.js-more-admin-actions</td>
<td></td>
</tr>
<tr>
diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html
index bf3dda959a2..261b1f140cb 100644
--- a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html
+++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html
@@ -51,7 +51,7 @@
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>css=.js-restore-built-in[data-language=&quot;xoo&quot;]</td>
+ <td>css=.quality-profiles-table-row[data-name=&quot;sample&quot;]</td>
<td></td>
</tr>
<tr>
@@ -61,12 +61,12 @@
</tr>
<tr>
<td>click</td>
- <td>css=.js-restore-built-in[data-language=&quot;xoo&quot;]</td>
+ <td>css=.js-more-admin-actions</td>
<td></td>
</tr>
<tr>
- <td>waitForElementPresent</td>
- <td>css=#restore-built-in-profiles-submit</td>
+ <td>click</td>
+ <td>css=#quality-profiles-restore-built-in</td>
<td></td>
</tr>
<tr>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.js
index 94db2d7dc71..8001085e09d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/HomeContainer.js
@@ -33,8 +33,14 @@ export default class HomeContainer extends React.Component {
titleTemplate="SonarQube - %s"/>
<PageHeader {...this.props}/>
- <Evolution {...this.props}/>
- <ProfilesList {...this.props}/>
+ <div className="clearfix">
+ <div style={{ float: 'left', width: 750 }}>
+ <ProfilesList {...this.props}/>
+ </div>
+ <div style={{ float: 'right', width: 260, paddingLeft: 30 }}>
+ <Evolution {...this.props}/>
+ </div>
+ </div>
</div>
);
}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js
index 1fcd7aa646e..9d9ed85759f 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js
@@ -20,6 +20,7 @@
import React from 'react';
import CreateProfileView from '../views/CreateProfileView';
import RestoreProfileView from '../views/RestoreProfileView';
+import RestoreBuiltInProfilesView from '../views/RestoreBuiltInProfilesView';
import { translate } from '../../../helpers/l10n';
import { getImporters } from '../../../api/quality-profiles';
@@ -73,12 +74,18 @@ export default class PageHeader extends React.Component {
handleRestoreClick (e) {
e.preventDefault();
- e.target.blur();
new RestoreProfileView()
.on('done', this.props.updateProfiles)
.render();
}
+ handleRestoreBuiltIn (e) {
+ e.preventDefault();
+ new RestoreBuiltInProfilesView({ languages: this.props.languages })
+ .on('done', this.props.updateProfiles)
+ .render();
+ }
+
render () {
return (
<header className="page-header">
@@ -87,19 +94,34 @@ export default class PageHeader extends React.Component {
</h1>
{this.props.canAdmin && (
- <div className="page-actions button-group">
+ <div className="page-actions button-group dropdown">
<button
id="quality-profiles-create"
onClick={this.handleCreateClick.bind(this)}>
{translate('create')}
</button>
-
<button
- id="quality-profiles-restore"
- className="spacer-left"
- onClick={this.handleRestoreClick.bind(this)}>
- {translate('quality_profiles.restore_profile')}
+ className="dropdown-toggle js-more-admin-actions"
+ data-toggle="dropdown">
+ <i className="icon-dropdown"/>
</button>
+ <ul className="dropdown-menu dropdown-menu-right">
+ <li>
+ <a href="#"
+ id="quality-profiles-restore"
+ onClick={this.handleRestoreClick.bind(this)}>
+ {translate('quality_profiles.restore_profile')}
+ </a>
+ </li>
+
+ <li>
+ <a href="#"
+ id="quality-profiles-restore-built-in"
+ onClick={this.handleRestoreBuiltIn.bind(this)}>
+ {translate('quality_profiles.restore_built_in_profiles')}
+ </a>
+ </li>
+ </ul>
</div>
)}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js
index acc5eb4ba6b..51f533c1861 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js
@@ -18,13 +18,12 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
-import { Link, PropTypes as RouterPropTypes } from 'react-router';
+import { PropTypes as RouterPropTypes } from 'react-router';
import groupBy from 'lodash/groupBy';
import pick from 'lodash/pick';
import sortBy from 'lodash/sortBy';
import ProfilesListRow from './ProfilesListRow';
import ProfilesListHeader from './ProfilesListHeader';
-import RestoreBuiltInProfilesView from '../views/RestoreBuiltInProfilesView';
import { ProfilesListType, LanguagesListType } from '../propTypes';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin';
@@ -36,14 +35,6 @@ export default class ProfilesList extends React.Component {
location: RouterPropTypes.location
};
- handleRestoreBuiltIn (languageKey, e) {
- e.preventDefault();
- const language = this.props.languages.find(l => l.key === languageKey);
- new RestoreBuiltInProfilesView({ language })
- .on('done', this.props.updateProfiles)
- .render();
- }
-
renderProfiles (profiles) {
return profiles.map(profile => (
<ProfilesListRow key={profile.key} profile={profile}/>
@@ -62,14 +53,6 @@ export default class ProfilesList extends React.Component {
'quality_profiles.x_profiles',
profilesCount
)}
- {this.props.canAdmin && (
- <button
- className="huge-spacer-left js-restore-built-in"
- data-language={languageKey}
- onClick={this.handleRestoreBuiltIn.bind(this, languageKey)}>
- {translate('quality_profiles.restore_built_in_profiles')}
- </button>
- )}
</th>
<th className="text-right nowrap">
{translate('quality_profiles.list.projects')}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/styles.css b/server/sonar-web/src/main/js/apps/quality-profiles/styles.css
index bfbf0a57db4..0c1a947cfac 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/styles.css
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/styles.css
@@ -20,7 +20,7 @@
.quality-profiles-table-projects,
.quality-profiles-table-rules,
.quality-profiles-table-date {
- min-width: 120px;
+ min-width: 90px;
}
.quality-profiles-list-header {
@@ -108,22 +108,12 @@
}
.quality-profiles-evolution {
- display: flex;
- justify-content: flex-start;
- align-items: stretch;
- margin-bottom: 30px;
-}
-
-.quality-profiles-evolution-deprecated,
-.quality-profiles-evolution-stagnant,
-.quality-profiles-evolution-rules {
- width: 325px;
- box-sizing: border-box;
+ padding-top: 55px;
}
.quality-profiles-evolution-deprecated,
.quality-profiles-evolution-stagnant {
- margin-right: 30px;
+ margin-bottom: 20px;
border-color: #faebcc;
background-color: #fcf8e3;
}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs
index 01ccc528718..41c449e88d4 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs
@@ -4,7 +4,7 @@
</div>
<div class="modal-body">
<div class="alert alert-success">
- {{tp 'quality_profiles.restore_built_in_profiles_success_message' language.name}}
+ {{tp 'quality_profiles.restore_built_in_profiles_success_message' selectedLanguage}}
</div>
</div>
<div class="modal-foot">
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs
index f7473ea8e26..a2cad2141df 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs
@@ -4,7 +4,15 @@
</div>
<div class="modal-body">
<div class="js-modal-messages"></div>
- {{tp 'quality_profiles.restore_built_in_profiles_confirmation' language.name}}
+ <div id="restore-built-in-profiles-form-success" class="alert alert-success hidden"></div>
+ <div class="modal-field">
+ <label for="restore-built-in-profiles-language">{{t 'language'}}<em class="mandatory">*</em></label>
+ <select id="restore-built-in-profiles-language" name="language">
+ {{#each languages}}
+ <option value="{{key}}">{{name}}</option>
+ {{/each}}
+ </select>
+ </div>
</div>
<div class="modal-foot">
<button id="restore-built-in-profiles-submit">{{t 'restore'}}</button>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js b/server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js
index f71f85c06af..f76a9c2c913 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js
@@ -27,7 +27,15 @@ export default ModalFormView.extend({
successTemplate: TemplateSuccess,
getTemplate () {
- return this.done ? this.successTemplate : this.template;
+ return this.selectedLanguage ? this.successTemplate : this.template;
+ },
+
+ onRender () {
+ ModalFormView.prototype.onRender.apply(this, arguments);
+ this.$('select').select2({
+ width: '250px',
+ minimumResultsForSearch: 50
+ });
},
onFormSubmit () {
@@ -37,7 +45,10 @@ export default ModalFormView.extend({
},
sendRequest () {
- restoreBuiltInProfiles(this.options.language.key)
+ const language = this.$('#restore-built-in-profiles-language').val();
+ this.selectedLanguage = this.options.languages
+ .find(l => l.key === language).name;
+ restoreBuiltInProfiles(language)
.then(() => {
this.done = true;
this.render();
@@ -50,7 +61,10 @@ export default ModalFormView.extend({
},
serializeData () {
- return { language: this.options.language };
+ return {
+ languages: this.options.languages,
+ selectedLanguage: this.selectedLanguage
+ };
}
});
diff --git a/server/sonar-web/src/main/less/init/tables.less b/server/sonar-web/src/main/less/init/tables.less
index c5ec9d3ed9d..d5802264ca9 100644
--- a/server/sonar-web/src/main/less/init/tables.less
+++ b/server/sonar-web/src/main/less/init/tables.less
@@ -52,14 +52,6 @@ table.data > thead > tr > th {
border-bottom: 1px solid @barBorderColor;
font-weight: 500;
- &:first-child {
- padding-left: 0
- }
-
- &:last-child {
- padding-right: 0;
- }
-
& > .small {
display: block;
line-height: 1.4;
@@ -78,14 +70,6 @@ table.data > tbody > tr > td {
vertical-align: text-top;
line-height: 16px;
- &:first-child {
- padding-left: 0
- }
-
- &:last-child {
- padding-right: 0;
- }
-
&.text-middle {
vertical-align: middle;
}
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index e2665b960ea..e81b34f6245 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1676,7 +1676,7 @@ quality_profiles.quality_profiles=Quality Profiles
quality_profiles.new_profile=New Profile
quality_profiles.compare_profiles=Compare Profiles
quality_profiles.compare_with=Compare with
-quality_profiles.restore_profile=Restore
+quality_profiles.restore_profile=Restore Profile
quality_profiles.restore_submit=Restore
quality_profiles.restore_profile.success={1} rule(s) restored in profile "{0}"
quality_profiles.restore_profile.warning={1} rule(s) restored, {2} rule(s) ignored in profile "{0}"