浏览代码

apply feedback for the quality profiles page

tags/6.0-RC1
Stas Vilchik 8 年前
父节点
当前提交
405256e05e

+ 6
- 1
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>

+ 4
- 4
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>

+ 8
- 2
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>
);
}

+ 29
- 7
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>
)}


+ 1
- 18
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')}

+ 3
- 13
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;
}

+ 1
- 1
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">

+ 9
- 1
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>

+ 17
- 3
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
};
}
});


+ 0
- 16
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;
}

+ 1
- 1
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}"

正在加载...
取消
保存