summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorPascal Mugnier <pascal.mugnier@sonarsource.com>2018-04-12 15:10:51 +0200
committerSonarTech <sonartech@sonarsource.com>2018-04-12 20:20:49 +0200
commiteccdc7a58857bf96be6a4721981b2de0f5dbe3c2 (patch)
tree70ba871105246fe34d8cebf0ab4b5d132976239d /server
parent8ff38012dcce4be5b9fec27b3483bba1254c8158 (diff)
downloadsonarqube-eccdc7a58857bf96be6a4721981b2de0f5dbe3c2.tar.gz
sonarqube-eccdc7a58857bf96be6a4721981b2de0f5dbe3c2.zip
Feature/pm/hardening 10 04 (#130)
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/app/styles/components/page.css1
-rw-r--r--server/sonar-web/src/main/js/app/theme.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx41
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap130
6 files changed, 134 insertions, 59 deletions
diff --git a/server/sonar-web/src/main/js/app/styles/components/page.css b/server/sonar-web/src/main/js/app/styles/components/page.css
index 9e9996aea7b..c493b82d22c 100644
--- a/server/sonar-web/src/main/js/app/styles/components/page.css
+++ b/server/sonar-web/src/main/js/app/styles/components/page.css
@@ -255,6 +255,7 @@
flex-grow: 1;
min-width: 740px;
padding: 20px;
+ z-index: var(--pageMainZIndex);
}
.layout-page-main-inner {
diff --git a/server/sonar-web/src/main/js/app/theme.js b/server/sonar-web/src/main/js/app/theme.js
index 434a6bc2ecc..37ff59c71bd 100644
--- a/server/sonar-web/src/main/js/app/theme.js
+++ b/server/sonar-web/src/main/js/app/theme.js
@@ -93,6 +93,8 @@ module.exports = {
belowNormalZIndex: '1',
// ui elements
+ pageMainZIndex: '50',
+
tooltipZIndex: '8000',
dropdownMenuZIndex: '7500',
diff --git a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
index 17d496bfae5..a58ead1f8c7 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
@@ -202,7 +202,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
const query = pickBy(
{
add_tags: this.state.addTags && this.state.addTags.map(t => t.value).join(),
- assign: this.state.assignee,
+ assign: this.state.assignee ? this.state.assignee.value : null,
comment: this.state.comment,
do_transition: this.state.transition,
remove_tags: this.state.removeTags && this.state.removeTags.map(t => t.value).join(),
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
index 24dac728e91..949bc4e1d78 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/App.tsx
@@ -32,6 +32,7 @@ import {
import { translate } from '../../../helpers/l10n';
import { getValues } from '../../../api/settings';
import { formatMeasure } from '../../../helpers/measures';
+import Tooltip from '../../../components/controls/Tooltip';
interface Props {
branchLikes: BranchLike[];
@@ -77,6 +78,10 @@ export default class App extends React.PureComponent<Props, State> {
);
}
+ isOrphan = (branchLike: BranchLike) => {
+ return (isShortLivingBranch(branchLike) || isPullRequest(branchLike)) && branchLike.isOrphan;
+ };
+
renderBranchLifeTime() {
const { branchLifeTime } = this.state;
if (!branchLifeTime) {
@@ -140,18 +145,30 @@ export default class App extends React.PureComponent<Props, State> {
</tr>
</thead>
<tbody>
- {sortBranchesAsTree(branchLikes).map(branchLike => (
- <BranchRow
- branchLike={branchLike}
- component={component.key}
- isOrphan={
- (isShortLivingBranch(branchLike) || isPullRequest(branchLike)) &&
- branchLike.isOrphan
- }
- key={getBranchLikeKey(branchLike)}
- onChange={onBranchesChange}
- />
- ))}
+ {sortBranchesAsTree(branchLikes).map((branchLike, index) => {
+ const isOrphan = this.isOrphan(branchLike);
+ const previous = index > 0 ? branchLikes[index - 1] : undefined;
+ const isPreviousOrphan = previous !== undefined && this.isOrphan(previous);
+ const showOrphanHeader = isOrphan && !isPreviousOrphan;
+ return (
+ <React.Fragment key={getBranchLikeKey(branchLike)}>
+ {showOrphanHeader && (
+ <li className="dropdown-header">
+ {translate('branches.orphan_branches')}
+ <Tooltip overlay={translate('branches.orphan_branches.tooltip')}>
+ <i className="icon-help spacer-left" />
+ </Tooltip>
+ </li>
+ )}
+ <BranchRow
+ branchLike={branchLike}
+ component={component.key}
+ isOrphan={isOrphan}
+ onChange={onBranchesChange}
+ />
+ </React.Fragment>
+ );
+ })}
</tbody>
</table>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
index ee90b112e98..36faa6a97e2 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
@@ -40,11 +40,24 @@ beforeEach(() => {
});
it('renders sorted list of branches', () => {
- const branchLikes: [MainBranch, LongLivingBranch, ShortLivingBranch, PullRequest] = [
+ const branchLikes: [
+ MainBranch,
+ LongLivingBranch,
+ ShortLivingBranch,
+ PullRequest,
+ ShortLivingBranch
+ ] = [
{ isMain: true, name: 'master' },
{ isMain: false, name: 'branch-1.0', type: BranchType.LONG },
{ isMain: false, mergeBranch: 'master', name: 'feature', type: BranchType.SHORT },
- { base: 'master', branch: 'feature', key: '1234', title: 'Feature PR' }
+ { base: 'master', branch: 'feature', key: '1234', title: 'Feature PR' },
+ {
+ isMain: false,
+ mergeBranch: 'foobar',
+ isOrphan: true,
+ name: 'feature',
+ type: BranchType.SHORT
+ }
];
const wrapper = shallow(
<App
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap
index a9d71179c0c..d2e776bbee4 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap
@@ -81,57 +81,99 @@ exports[`renders sorted list of branches 1`] = `
</tr>
</thead>
<tbody>
- <BranchRow
- branchLike={
- Object {
- "isMain": true,
- "name": "master",
- }
- }
- component="foo"
- isOrphan={false}
+ <React.Fragment
key="branch-master"
- onChange={[MockFunction]}
- />
- <BranchRow
- branchLike={
- Object {
- "base": "master",
- "branch": "feature",
- "key": "1234",
- "title": "Feature PR",
+ >
+ <BranchRow
+ branchLike={
+ Object {
+ "isMain": true,
+ "name": "master",
+ }
}
- }
- component="foo"
+ component="foo"
+ isOrphan={false}
+ onChange={[MockFunction]}
+ />
+ </React.Fragment>
+ <React.Fragment
key="pull-request-1234"
- onChange={[MockFunction]}
- />
- <BranchRow
- branchLike={
- Object {
- "isMain": false,
- "mergeBranch": "master",
- "name": "feature",
- "type": "SHORT",
+ >
+ <BranchRow
+ branchLike={
+ Object {
+ "base": "master",
+ "branch": "feature",
+ "key": "1234",
+ "title": "Feature PR",
+ }
}
- }
- component="foo"
+ component="foo"
+ onChange={[MockFunction]}
+ />
+ </React.Fragment>
+ <React.Fragment
key="branch-feature"
- onChange={[MockFunction]}
- />
- <BranchRow
- branchLike={
- Object {
- "isMain": false,
- "name": "branch-1.0",
- "type": "LONG",
+ >
+ <BranchRow
+ branchLike={
+ Object {
+ "isMain": false,
+ "mergeBranch": "master",
+ "name": "feature",
+ "type": "SHORT",
+ }
}
- }
- component="foo"
- isOrphan={false}
+ component="foo"
+ onChange={[MockFunction]}
+ />
+ </React.Fragment>
+ <React.Fragment
key="branch-branch-1.0"
- onChange={[MockFunction]}
- />
+ >
+ <BranchRow
+ branchLike={
+ Object {
+ "isMain": false,
+ "name": "branch-1.0",
+ "type": "LONG",
+ }
+ }
+ component="foo"
+ isOrphan={false}
+ onChange={[MockFunction]}
+ />
+ </React.Fragment>
+ <React.Fragment
+ key="branch-feature"
+ >
+ <li
+ className="dropdown-header"
+ >
+ branches.orphan_branches
+ <Tooltip
+ overlay="branches.orphan_branches.tooltip"
+ >
+ <i
+ className="icon-help spacer-left"
+ />
+ </Tooltip>
+ </li>
+ <BranchRow
+ branchLike={
+ Object {
+ "isMain": false,
+ "isOrphan": true,
+ "mergeBranch": "foobar",
+ "name": "feature",
+ "type": "SHORT",
+ }
+ }
+ component="foo"
+ isOrphan={true}
+ onChange={[MockFunction]}
+ />
+ </React.Fragment>
</tbody>
</table>
</div>