@@ -21,7 +21,7 @@ | |||
"react-dom": "16.8.6", | |||
"react-helmet": "5.2.0", | |||
"react-typography": "0.16.19", | |||
"sonar-ui-common": "0.0.36", | |||
"sonar-ui-common": "0.0.40", | |||
"typography": "0.16.19" | |||
}, | |||
"devDependencies": { |
@@ -11158,10 +11158,10 @@ sockjs@0.3.19: | |||
faye-websocket "^0.10.0" | |||
uuid "^3.0.1" | |||
sonar-ui-common@0.0.36: | |||
version "0.0.36" | |||
resolved "https://repox.jfrog.io/repox/api/npm/npm/sonar-ui-common/-/sonar-ui-common-0.0.36.tgz#30c4705d907f2453ce9a113af660bf4ff536af67" | |||
integrity sha1-MMRwXZB/JFPOmhE69mC/T/U2r2c= | |||
sonar-ui-common@0.0.40: | |||
version "0.0.40" | |||
resolved "https://repox.jfrog.io/repox/api/npm/npm/sonar-ui-common/-/sonar-ui-common-0.0.40.tgz#1b6ec48e74c74b84254669d0798216073b368cec" | |||
integrity sha1-G27EjnTHS4QlRmnQeYIWBzs2jOw= | |||
dependencies: | |||
"@types/react-select" "1.2.6" | |||
classnames "2.2.6" |
@@ -38,7 +38,7 @@ | |||
"regenerator-runtime": "0.13.2", | |||
"remark-custom-blocks": "2.3.0", | |||
"remark-slug": "5.1.0", | |||
"sonar-ui-common": "0.0.36", | |||
"sonar-ui-common": "0.0.40", | |||
"unist-util-visit": "1.4.0", | |||
"valid-url": "1.0.9", | |||
"whatwg-fetch": "2.0.4" |
@@ -42,3 +42,11 @@ export function deletePullRequest(data: { project: string; pullRequest: string } | |||
export function renameBranch(project: string, name: string) { | |||
return post('/api/project_branches/rename', { project, name }).catch(throwGlobalError); | |||
} | |||
export function excludeBranchFromPurge(projectKey: string, branchName: string, excluded: boolean) { | |||
return post('/api/project_branches/set_automatic_deletion_protection', { | |||
project: projectKey, | |||
branch: branchName, | |||
value: excluded | |||
}).catch(throwGlobalError); | |||
} |
@@ -79,7 +79,7 @@ jest.mock('../nav/component/ComponentNav', () => ({ | |||
const Inner = () => <div />; | |||
const mainBranch: T.MainBranch = { isMain: true, name: 'master' }; | |||
const mainBranch: T.MainBranch = mockMainBranch(); | |||
beforeEach(() => { | |||
jest.clearAllMocks(); | |||
@@ -88,7 +88,7 @@ beforeEach(() => { | |||
it('changes component', () => { | |||
const wrapper = shallowRender(); | |||
wrapper.setState({ | |||
branchLikes: [{ isMain: true, name: 'master' }], | |||
branchLikes: [mockMainBranch()], | |||
component: { qualifier: 'TRK', visibility: 'public' } as T.Component, | |||
loading: false | |||
}); |
@@ -19,9 +19,10 @@ | |||
*/ | |||
import { shallow } from 'enzyme'; | |||
import * as React from 'react'; | |||
import { mockMainBranch } from '../../../../../helpers/testMocks'; | |||
import { ComponentNavMenu } from '../ComponentNavMenu'; | |||
const mainBranch: T.MainBranch = { isMain: true, name: 'master' }; | |||
const mainBranch: T.MainBranch = mockMainBranch(); | |||
const baseComponent = { | |||
breadcrumbs: [], | |||
@@ -97,6 +98,7 @@ it('should render correctly for security extensions', () => { | |||
it('should work for short-living branches', () => { | |||
const branch: T.ShortLivingBranch = { | |||
isMain: false, | |||
excludedFromPurge: true, | |||
mergeBranch: 'master', | |||
name: 'feature', | |||
type: 'SHORT' | |||
@@ -118,7 +120,12 @@ it('should work for short-living branches', () => { | |||
}); | |||
it('should work for long-living branches', () => { | |||
const branch: T.LongLivingBranch = { isMain: false, name: 'release', type: 'LONG' }; | |||
const branch: T.LongLivingBranch = { | |||
excludedFromPurge: true, | |||
isMain: false, | |||
name: 'release', | |||
type: 'LONG' | |||
}; | |||
[true, false].forEach(showSettings => | |||
expect( | |||
shallow( |
@@ -37,6 +37,7 @@ exports[`should render correctly 1`] = ` | |||
currentBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -49,6 +50,7 @@ exports[`should render correctly 1`] = ` | |||
Array [ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -56,12 +58,14 @@ exports[`should render correctly 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
}, | |||
@@ -75,6 +79,7 @@ exports[`should render correctly 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
@@ -90,12 +95,14 @@ exports[`should render correctly 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
@@ -137,6 +144,7 @@ exports[`should render correctly 1`] = ` | |||
currentBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -148,6 +156,7 @@ exports[`should render correctly 1`] = ` | |||
currentBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", |
@@ -102,6 +102,7 @@ exports[`#ComponentNavMeta renders status of short-living branch 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", |
@@ -32,6 +32,7 @@ exports[`should render correctly 1`] = ` | |||
currentBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -56,6 +57,7 @@ exports[`should render the menu trigger if branches are enabled 1`] = ` | |||
Array [ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -63,12 +65,14 @@ exports[`should render the menu trigger if branches are enabled 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
}, | |||
@@ -82,6 +86,7 @@ exports[`should render the menu trigger if branches are enabled 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
@@ -97,12 +102,14 @@ exports[`should render the menu trigger if branches are enabled 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
@@ -144,6 +151,7 @@ exports[`should render the menu trigger if branches are enabled 1`] = ` | |||
currentBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -187,6 +195,7 @@ exports[`should render the menu trigger if branches are enabled 1`] = ` | |||
currentBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", |
@@ -8,6 +8,7 @@ exports[`CurrentBranchLikeRenderer should render correctly for application when | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -31,6 +32,7 @@ exports[`CurrentBranchLikeRenderer should render correctly for application when | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -53,6 +55,7 @@ exports[`CurrentBranchLikeRenderer should render correctly for application when | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -107,6 +110,7 @@ exports[`CurrentBranchLikeRenderer should render correctly for project when bran | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -138,6 +142,7 @@ exports[`CurrentBranchLikeRenderer should render correctly for project when ther | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -161,6 +166,7 @@ exports[`CurrentBranchLikeRenderer should render correctly for project when ther | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -26,6 +26,7 @@ exports[`should render correctly 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
@@ -35,6 +36,7 @@ exports[`should render correctly 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
@@ -44,6 +46,7 @@ exports[`should render correctly 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
@@ -53,6 +56,7 @@ exports[`should render correctly 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -63,6 +67,7 @@ exports[`should render correctly 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
@@ -74,6 +79,7 @@ exports[`should render correctly 1`] = ` | |||
"mainBranchTree": Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
}, | |||
@@ -138,6 +144,7 @@ exports[`should render correctly 1`] = ` | |||
selectedBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -192,6 +199,7 @@ exports[`should render correctly with no current branch like 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
@@ -201,6 +209,7 @@ exports[`should render correctly with no current branch like 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
@@ -210,6 +219,7 @@ exports[`should render correctly with no current branch like 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
@@ -219,6 +229,7 @@ exports[`should render correctly with no current branch like 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -229,6 +240,7 @@ exports[`should render correctly with no current branch like 1`] = ` | |||
Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
@@ -240,6 +252,7 @@ exports[`should render correctly with no current branch like 1`] = ` | |||
"mainBranchTree": Object { | |||
"branch": Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
}, | |||
@@ -304,6 +317,7 @@ exports[`should render correctly with no current branch like 1`] = ` | |||
selectedBranchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", |
@@ -16,6 +16,7 @@ exports[`should render a main branch correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -39,6 +40,7 @@ exports[`should render a main branch correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -17,6 +17,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -143,6 +144,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
@@ -181,6 +183,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
@@ -219,6 +222,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
@@ -257,6 +261,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -296,6 +301,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", |
@@ -24,8 +24,9 @@ import { Components } from '../Components'; | |||
const COMPONENT = { key: 'foo', name: 'Foo', qualifier: 'TRK' }; | |||
const PORTFOLIO = { key: 'bar', name: 'Bar', qualifier: 'VW' }; | |||
const METRICS = { coverage: { id: '1', key: 'coverage', type: 'PERCENT', name: 'Coverage' } }; | |||
const BRANCH = { | |||
const BRANCH: T.ShortLivingBranch = { | |||
isMain: false, | |||
excludedFromPurge: true, | |||
name: 'feature', | |||
mergeBranch: 'master', | |||
type: 'SHORT' |
@@ -178,6 +178,7 @@ exports[`renders correctly for leak 1`] = ` | |||
<withScrollTo(Component) | |||
branchLike={ | |||
Object { | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature", | |||
@@ -221,6 +222,7 @@ exports[`renders correctly for leak 1`] = ` | |||
<withScrollTo(Component) | |||
branchLike={ | |||
Object { | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature", |
@@ -65,14 +65,25 @@ it('should render correctly for leak', () => { | |||
}); | |||
it('should render with long living branch', () => { | |||
const longBranch = { isMain: false, name: 'branch-6.7', type: 'LONG' }; | |||
const longBranch: T.LongLivingBranch = { | |||
isMain: false, | |||
excludedFromPurge: true, | |||
name: 'branch-6.7', | |||
type: 'LONG' | |||
}; | |||
expect( | |||
shallow(<MeasureHeader branchLike={longBranch} {...PROPS} />).find('Link') | |||
).toMatchSnapshot(); | |||
}); | |||
it('should render with short living branch', () => { | |||
const shortBranch = { isMain: false, name: 'feature', mergeBranch: 'master', type: 'SHORT' }; | |||
const shortBranch: T.ShortLivingBranch = { | |||
isMain: false, | |||
excludedFromPurge: true, | |||
name: 'feature', | |||
mergeBranch: 'master', | |||
type: 'SHORT' | |||
}; | |||
expect( | |||
shallow( | |||
<MeasureHeader |
@@ -77,6 +77,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -6,6 +6,7 @@ exports[`should render CrossComponentSourceViewer correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -273,6 +274,7 @@ exports[`should render SourceViewer correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -8,6 +8,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -24,6 +24,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -72,6 +73,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -133,6 +135,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -231,6 +234,7 @@ exports[`should render correctly when at the bottom of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -279,6 +283,7 @@ exports[`should render correctly when at the bottom of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -340,6 +345,7 @@ exports[`should render correctly when at the bottom of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -401,6 +407,7 @@ exports[`should render correctly when at the bottom of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -488,6 +495,7 @@ exports[`should render correctly when at the top of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -536,6 +544,7 @@ exports[`should render correctly when at the top of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -597,6 +606,7 @@ exports[`should render correctly when at the top of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -658,6 +668,7 @@ exports[`should render correctly when at the top of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -719,6 +730,7 @@ exports[`should render correctly when at the top of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -780,6 +792,7 @@ exports[`should render correctly when at the top of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -841,6 +854,7 @@ exports[`should render correctly when at the top of the file 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -36,6 +36,7 @@ jest.mock('../../../../helpers/urls', () => ({ | |||
jest.mock('../../../../helpers/system', () => ({ isSonarCloud: jest.fn() })); | |||
const shortBranch: T.ShortLivingBranch = { | |||
excludedFromPurge: true, | |||
isMain: false, | |||
mergeBranch: '', | |||
name: 'branch-6.6', |
@@ -53,6 +53,7 @@ exports[`renders correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -105,6 +106,7 @@ exports[`should not render the tutorial 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -154,6 +156,7 @@ exports[`should render another message when there are branches 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -168,6 +171,7 @@ exports[`should render another message when there are branches 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -217,6 +221,7 @@ exports[`should render another message when there are branches 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -231,6 +236,7 @@ exports[`should render another message when there are branches 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -27,6 +27,7 @@ exports[`should render correctly 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -100,6 +101,7 @@ exports[`should render correctly 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -211,6 +213,7 @@ exports[`should render correctly 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -322,6 +325,7 @@ exports[`should render correctly 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -433,6 +437,7 @@ exports[`should render correctly 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -544,6 +549,7 @@ exports[`should render correctly 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -660,6 +666,7 @@ exports[`should render correctly 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -19,10 +19,11 @@ | |||
*/ | |||
import { shallow } from 'enzyme'; | |||
import * as React from 'react'; | |||
import { mockMainBranch } from '../../../../helpers/testMocks'; | |||
import AnalysesList from '../AnalysesList'; | |||
it('should render show more link', () => { | |||
const branchLike = { analysisDate: '2018-03-08T09:49:22+0100', isMain: true, name: 'master' }; | |||
const branchLike: T.MainBranch = mockMainBranch(); | |||
const component = { | |||
breadcrumbs: [{ key: 'foo', name: 'foo', qualifier: 'TRK' }], | |||
key: 'foo', |
@@ -76,6 +76,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -189,6 +190,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -54,6 +54,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -74,6 +75,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -203,6 +205,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -223,6 +226,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -61,6 +61,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -136,6 +137,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -199,6 +201,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -223,6 +226,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -61,6 +61,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -112,6 +113,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -175,6 +177,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -199,6 +202,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -76,6 +76,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
@@ -232,6 +233,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -14,6 +14,7 @@ exports[`should render correctly for coverage 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
@@ -47,6 +48,7 @@ exports[`should render correctly for coverage 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
@@ -70,6 +72,7 @@ exports[`should render correctly for coverage 2`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
@@ -102,6 +105,7 @@ exports[`should render correctly for duplications 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", |
@@ -19,6 +19,7 @@ | |||
*/ | |||
import { shallow } from 'enzyme'; | |||
import * as React from 'react'; | |||
import { mockLongLivingBranch } from '../../../../helpers/testMocks'; | |||
import QualityGateCondition from '../QualityGateCondition'; | |||
const mockRatingCondition = (metric: string): T.QualityGateStatusConditionEnhanced => ({ | |||
@@ -136,7 +137,7 @@ it('should work with branch', () => { | |||
expect( | |||
shallow( | |||
<QualityGateCondition | |||
branchLike={{ isMain: false, name: 'feature' }} | |||
branchLike={mockLongLivingBranch()} | |||
component={{ key: 'abcd-key' }} | |||
condition={condition} | |||
/> |
@@ -348,6 +348,7 @@ exports[`should work with branch 1`] = ` | |||
Object { | |||
"pathname": "/project/issues", | |||
"query": Object { | |||
"branch": "branch-6.7", | |||
"id": "abcd-key", | |||
"resolved": "false", | |||
"sinceLeakPeriod": "true", |
@@ -43,7 +43,12 @@ it('should render', () => { | |||
}); | |||
it('should render for a branch', () => { | |||
const branch: T.LongLivingBranch = { name: 'feature-x', isMain: false, type: 'LONG' }; | |||
const branch: T.LongLivingBranch = { | |||
excludedFromPurge: true, | |||
name: 'feature-x', | |||
isMain: false, | |||
type: 'LONG' | |||
}; | |||
const event: DefinitionChangeEvent = { | |||
category: 'DEFINITION_CHANGE', | |||
key: 'foo1234', |
@@ -88,6 +88,7 @@ it('should toggle popup', async () => { | |||
expect(wrapper.find('BranchBaselineSettingModal')).toHaveLength(0); | |||
expect(wrapper.state().branches.find(b => b.name === 'master')).toEqual({ | |||
analysisDate: '2018-01-01', | |||
excludedFromPurge: true, | |||
isMain: true, | |||
name: 'master', | |||
newCodePeriod: { |
@@ -33,6 +33,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
"newCodePeriod": Object { | |||
@@ -83,6 +84,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "branch-6.7", | |||
"type": "LONG", | |||
@@ -119,6 +121,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", |
@@ -26,35 +26,50 @@ import { translate } from 'sonar-ui-common/helpers/l10n'; | |||
import BranchStatus from '../../../components/common/BranchStatus'; | |||
import BranchLikeIcon from '../../../components/icons/BranchLikeIcon'; | |||
import DateFromNow from '../../../components/intl/DateFromNow'; | |||
import { getBranchLikeDisplayName, isMainBranch, isPullRequest } from '../../../helpers/branches'; | |||
import { | |||
getBranchLikeDisplayName, | |||
isBranch, | |||
isMainBranch, | |||
isPullRequest | |||
} from '../../../helpers/branches'; | |||
import BranchPurgeSetting from './BranchPurgeSetting'; | |||
export interface BranchLikeRowRendererProps { | |||
export interface BranchLikeRowProps { | |||
branchLike: T.BranchLike; | |||
component: T.Component; | |||
displayPurgeSetting?: boolean; | |||
onDelete: () => void; | |||
onRename: () => void; | |||
} | |||
export function BranchLikeRowRenderer(props: BranchLikeRowRendererProps) { | |||
const { branchLike, component, onDelete, onRename } = props; | |||
export function BranchLikeRow(props: BranchLikeRowProps) { | |||
const { branchLike, component, displayPurgeSetting, onDelete, onRename } = props; | |||
const branchLikeDisplayName = getBranchLikeDisplayName(branchLike); | |||
return ( | |||
<tr> | |||
<td> | |||
<td className="nowrap hide-overflow"> | |||
<BranchLikeIcon branchLike={branchLike} className="little-spacer-right" /> | |||
{getBranchLikeDisplayName(branchLike)} | |||
{isMainBranch(branchLike) && ( | |||
<div className="badge spacer-left">{translate('branches.main_branch')}</div> | |||
)} | |||
<span title={branchLikeDisplayName}>{branchLikeDisplayName}</span> | |||
<span> | |||
{isMainBranch(branchLike) && ( | |||
<div className="badge spacer-left">{translate('branches.main_branch')}</div> | |||
)} | |||
</span> | |||
</td> | |||
<td className="thin nowrap"> | |||
<td className="nowrap"> | |||
<BranchStatus branchLike={branchLike} component={component.key} /> | |||
</td> | |||
<td className="thin nowrap text-right big-spacer-left"> | |||
<td className="nowrap"> | |||
{branchLike.analysisDate && <DateFromNow date={branchLike.analysisDate} />} | |||
</td> | |||
<td className="thin nowrap text-right"> | |||
<ActionsDropdown className="big-spacer-left"> | |||
{displayPurgeSetting && isBranch(branchLike) && ( | |||
<td className="nowrap"> | |||
<BranchPurgeSetting branch={branchLike} component={component} /> | |||
</td> | |||
)} | |||
<td className="nowrap"> | |||
<ActionsDropdown> | |||
{isMainBranch(branchLike) ? ( | |||
<ActionsDropdownItem className="js-rename" onClick={onRename}> | |||
{translate('project_branch_pull_request.branch.rename')} | |||
@@ -74,4 +89,4 @@ export function BranchLikeRowRenderer(props: BranchLikeRowRendererProps) { | |||
); | |||
} | |||
export default React.memo(BranchLikeRowRenderer); | |||
export default React.memo(BranchLikeRow); |
@@ -19,39 +19,63 @@ | |||
*/ | |||
import * as React from 'react'; | |||
import HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip'; | |||
import { translate } from 'sonar-ui-common/helpers/l10n'; | |||
import { getBranchLikeKey } from '../../../helpers/branches'; | |||
import BranchLikeRowRenderer from './BranchLikeRowRenderer'; | |||
import BranchLikeRow from './BranchLikeRow'; | |||
export interface BranchLikeTableRendererProps { | |||
component: T.Component; | |||
tableTitle: string; | |||
export interface BranchLikeTableProps { | |||
branchLikes: T.BranchLike[]; | |||
component: T.Component; | |||
displayPurgeSetting?: boolean; | |||
onDelete: (branchLike: T.BranchLike) => void; | |||
onRename: (branchLike: T.BranchLike) => void; | |||
title: string; | |||
} | |||
export function BranchLikeTableRenderer(props: BranchLikeTableRendererProps) { | |||
const { branchLikes, component, onDelete, onRename, tableTitle } = props; | |||
export function BranchLikeTable(props: BranchLikeTableProps) { | |||
const { branchLikes, component, displayPurgeSetting, onDelete, onRename, title } = props; | |||
return ( | |||
<div className="boxed-group boxed-group-inner"> | |||
<table className="data zebra zebra-hover"> | |||
<table className="data zebra zebra-hover fixed"> | |||
<thead> | |||
<tr> | |||
<th>{tableTitle}</th> | |||
<th className="thin nowrap">{translate('status')}</th> | |||
<th className="thin nowrap text-right big-spacer-left"> | |||
<th className="nowrap">{title}</th> | |||
<th className="nowrap" style={{ width: '80px' }}> | |||
{translate('status')} | |||
</th> | |||
<th className="nowrap" style={{ width: '140px' }}> | |||
{translate('project_branch_pull_request.last_analysis_date')} | |||
</th> | |||
<th className="thin nowrap text-right">{translate('actions')}</th> | |||
{displayPurgeSetting && ( | |||
<th className="nowrap" style={{ width: '150px' }}> | |||
<div className="display-flex-center"> | |||
<span> | |||
{translate( | |||
'project_branch_pull_request.branch.auto_deletion.keep_when_inactive' | |||
)} | |||
</span> | |||
<HelpTooltip | |||
className="little-spacer-left" | |||
overlay={translate( | |||
'project_branch_pull_request.branch.auto_deletion.keep_when_inactive.tooltip' | |||
)} | |||
/> | |||
</div> | |||
</th> | |||
)} | |||
<th className="nowrap" style={{ width: '50px' }}> | |||
{translate('actions')} | |||
</th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
{branchLikes.map(branchLike => ( | |||
<BranchLikeRowRenderer | |||
<BranchLikeRow | |||
branchLike={branchLike} | |||
component={component} | |||
displayPurgeSetting={displayPurgeSetting} | |||
key={getBranchLikeKey(branchLike)} | |||
onDelete={() => onDelete(branchLike)} | |||
onRename={() => onRename(branchLike)} | |||
@@ -63,4 +87,4 @@ export function BranchLikeTableRenderer(props: BranchLikeTableRendererProps) { | |||
); | |||
} | |||
export default React.memo(BranchLikeTableRenderer); | |||
export default React.memo(BranchLikeTable); |
@@ -23,8 +23,14 @@ import BoxedTabs from 'sonar-ui-common/components/controls/BoxedTabs'; | |||
import PullRequestIcon from 'sonar-ui-common/components/icons/PullRequestIcon'; | |||
import ShortLivingBranchIcon from 'sonar-ui-common/components/icons/ShortLivingBranchIcon'; | |||
import { translate } from 'sonar-ui-common/helpers/l10n'; | |||
import { isBranch, isMainBranch, isPullRequest, sortBranches } from '../../../helpers/branches'; | |||
import BranchLikeTableRenderer from './BranchLikeTableRenderer'; | |||
import { | |||
isBranch, | |||
isMainBranch, | |||
isPullRequest, | |||
sortBranches, | |||
sortPullRequests | |||
} from '../../../helpers/branches'; | |||
import BranchLikeTable from './BranchLikeTable'; | |||
import DeleteBranchModal from './DeleteBranchModal'; | |||
import RenameBranchModal from './RenameBranchModal'; | |||
@@ -92,27 +98,27 @@ export default class BranchLikeTabs extends React.PureComponent<Props, State> { | |||
const { branchLikes, component } = this.props; | |||
const { currentTab, deleting, renaming } = this.state; | |||
let tableTitle = ''; | |||
let branchLikesToDisplay: T.BranchLike[] = []; | |||
if (currentTab === Tabs.Branch) { | |||
tableTitle = translate('project_branch_pull_request.table.branch'); | |||
branchLikesToDisplay = sortBranches(branchLikes.filter(isBranch)); | |||
} else if (currentTab === Tabs.PullRequest) { | |||
tableTitle = translate('project_branch_pull_request.table.pull_request'); | |||
branchLikesToDisplay = branchLikes.filter(isPullRequest); | |||
} | |||
const isBranchMode = currentTab === Tabs.Branch; | |||
const branchLikesToDisplay: T.BranchLike[] = isBranchMode | |||
? sortBranches(branchLikes.filter(isBranch)) | |||
: sortPullRequests(branchLikes.filter(isPullRequest)); | |||
const title = translate( | |||
isBranchMode | |||
? 'project_branch_pull_request.table.branch' | |||
: 'project_branch_pull_request.table.pull_request' | |||
); | |||
return ( | |||
<> | |||
<BoxedTabs onSelect={this.onTabSelect} selected={currentTab} tabs={TABS} /> | |||
<BranchLikeTableRenderer | |||
<BranchLikeTable | |||
branchLikes={branchLikesToDisplay} | |||
component={component} | |||
displayPurgeSetting={isBranchMode} | |||
onDelete={this.onDeleteBranchLike} | |||
onRename={this.onRenameBranchLike} | |||
tableTitle={tableTitle} | |||
title={title} | |||
/> | |||
{deleting && ( |
@@ -0,0 +1,102 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2019 SonarSource SA | |||
* mailto:info AT sonarsource DOT com | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 3 of the License, or (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import * as React from 'react'; | |||
import HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip'; | |||
import Toggle from 'sonar-ui-common/components/controls/Toggle'; | |||
import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner'; | |||
import { translate } from 'sonar-ui-common/helpers/l10n'; | |||
import { excludeBranchFromPurge } from '../../../api/branches'; | |||
import { isMainBranch } from '../../../helpers/branches'; | |||
interface Props { | |||
branch: T.Branch; | |||
component: T.Component; | |||
} | |||
interface State { | |||
excludedFromPurge: boolean; | |||
loading: boolean; | |||
} | |||
export default class BranchPurgeSetting extends React.PureComponent<Props, State> { | |||
mounted = false; | |||
constructor(props: Props) { | |||
super(props); | |||
this.state = { excludedFromPurge: props.branch.excludedFromPurge, loading: false }; | |||
} | |||
componentDidMount() { | |||
this.mounted = true; | |||
} | |||
componentWillUnmount() { | |||
this.mounted = false; | |||
} | |||
handleOnChange = () => { | |||
const { branch, component } = this.props; | |||
const { excludedFromPurge } = this.state; | |||
const newValue = !excludedFromPurge; | |||
this.setState({ loading: true }); | |||
excludeBranchFromPurge(component.key, branch.name, newValue) | |||
.then(() => { | |||
if (this.mounted) { | |||
this.setState({ | |||
excludedFromPurge: newValue, | |||
loading: false | |||
}); | |||
} | |||
}) | |||
.catch(() => { | |||
if (this.mounted) { | |||
this.setState({ loading: false }); | |||
} | |||
}); | |||
}; | |||
render() { | |||
const { branch } = this.props; | |||
const { excludedFromPurge, loading } = this.state; | |||
const isTheMainBranch = isMainBranch(branch); | |||
const disabled = isTheMainBranch || loading; | |||
return ( | |||
<> | |||
<Toggle disabled={disabled} onChange={this.handleOnChange} value={excludedFromPurge} /> | |||
<span className="spacer-left"> | |||
<DeferredSpinner loading={loading} /> | |||
</span> | |||
{isTheMainBranch && ( | |||
<HelpTooltip | |||
overlay={translate( | |||
'project_branch_pull_request.branch.auto_deletion.main_branch_tooltip' | |||
)} | |||
/> | |||
)} | |||
</> | |||
); | |||
} | |||
} |
@@ -27,7 +27,7 @@ import { | |||
mockPullRequest, | |||
mockShortLivingBranch | |||
} from '../../../../helpers/testMocks'; | |||
import { BranchLikeRowRenderer, BranchLikeRowRendererProps } from '../BranchLikeRowRenderer'; | |||
import { BranchLikeRow, BranchLikeRowProps } from '../BranchLikeRow'; | |||
it('should render correctly for pull request', () => { | |||
const wrapper = shallowRender(); | |||
@@ -35,23 +35,23 @@ it('should render correctly for pull request', () => { | |||
}); | |||
it('should render correctly for short lived branch', () => { | |||
const wrapper = shallowRender({ branchLike: mockShortLivingBranch() }); | |||
const wrapper = shallowRender({ branchLike: mockShortLivingBranch(), displayPurgeSetting: true }); | |||
expect(wrapper).toMatchSnapshot(); | |||
}); | |||
it('should render correctly for long lived branch', () => { | |||
const wrapper = shallowRender({ branchLike: mockLongLivingBranch() }); | |||
const wrapper = shallowRender({ branchLike: mockLongLivingBranch(), displayPurgeSetting: true }); | |||
expect(wrapper).toMatchSnapshot(); | |||
}); | |||
it('should render correctly for mai branch', () => { | |||
const wrapper = shallowRender({ branchLike: mockMainBranch() }); | |||
it('should render correctly for main branch', () => { | |||
const wrapper = shallowRender({ branchLike: mockMainBranch(), displayPurgeSetting: true }); | |||
expect(wrapper).toMatchSnapshot(); | |||
}); | |||
function shallowRender(props?: Partial<BranchLikeRowRendererProps>) { | |||
function shallowRender(props?: Partial<BranchLikeRowProps>) { | |||
return shallow( | |||
<BranchLikeRowRenderer | |||
<BranchLikeRow | |||
branchLike={mockPullRequest()} | |||
component={mockComponent()} | |||
onDelete={jest.fn()} |
@@ -22,20 +22,25 @@ import { shallow } from 'enzyme'; | |||
import * as React from 'react'; | |||
import { mockSetOfBranchAndPullRequest } from '../../../../helpers/mocks/branch-pull-request'; | |||
import { mockComponent } from '../../../../helpers/testMocks'; | |||
import { BranchLikeRowRenderer } from '../BranchLikeRowRenderer'; | |||
import { BranchLikeTableRenderer, BranchLikeTableRendererProps } from '../BranchLikeTableRenderer'; | |||
import { BranchLikeRow } from '../BranchLikeRow'; | |||
import { BranchLikeTable, BranchLikeTableProps } from '../BranchLikeTable'; | |||
it('should render correctly', () => { | |||
const wrapper = shallowRender(); | |||
expect(wrapper).toMatchSnapshot(); | |||
}); | |||
it('should render purge setting correctly', () => { | |||
const wrapper = shallowRender({ displayPurgeSetting: true }); | |||
expect(wrapper).toMatchSnapshot(); | |||
}); | |||
it('should properly propagate delete event', () => { | |||
const onDelete = jest.fn(); | |||
const wrapper = shallowRender({ onDelete }); | |||
wrapper | |||
.find(BranchLikeRowRenderer) | |||
.find(BranchLikeRow) | |||
.first() | |||
.props() | |||
.onDelete(); | |||
@@ -49,7 +54,7 @@ it('should properly propagate rename event', () => { | |||
const wrapper = shallowRender({ onDelete, onRename }); | |||
wrapper | |||
.find(BranchLikeRowRenderer) | |||
.find(BranchLikeRow) | |||
.first() | |||
.props() | |||
.onRename(); | |||
@@ -57,14 +62,14 @@ it('should properly propagate rename event', () => { | |||
expect(onRename).toHaveBeenCalled(); | |||
}); | |||
function shallowRender(props?: Partial<BranchLikeTableRendererProps>) { | |||
function shallowRender(props?: Partial<BranchLikeTableProps>) { | |||
return shallow( | |||
<BranchLikeTableRenderer | |||
<BranchLikeTable | |||
branchLikes={mockSetOfBranchAndPullRequest()} | |||
component={mockComponent()} | |||
onDelete={jest.fn()} | |||
onRename={jest.fn()} | |||
tableTitle="tableTitle" | |||
title="title" | |||
{...props} | |||
/> | |||
); |
@@ -23,7 +23,7 @@ import * as React from 'react'; | |||
import BoxedTabs from 'sonar-ui-common/components/controls/BoxedTabs'; | |||
import { mockSetOfBranchAndPullRequest } from '../../../../helpers/mocks/branch-pull-request'; | |||
import { mockComponent, mockMainBranch, mockPullRequest } from '../../../../helpers/testMocks'; | |||
import { BranchLikeTableRenderer } from '../BranchLikeTableRenderer'; | |||
import { BranchLikeTable } from '../BranchLikeTable'; | |||
import BranchLikeTabs, { Tabs } from '../BranchLikeTabs'; | |||
import DeleteBranchModal from '../DeleteBranchModal'; | |||
import RenameBranchModal from '../RenameBranchModal'; | |||
@@ -46,7 +46,7 @@ it('should render deletion modal correctly', () => { | |||
const wrapper = shallowRender({ onBranchesChange }); | |||
wrapper | |||
.find(BranchLikeTableRenderer) | |||
.find(BranchLikeTable) | |||
.props() | |||
.onDelete(mockPullRequest()); | |||
expect(wrapper.state().deleting).toBeDefined(); | |||
@@ -60,7 +60,7 @@ it('should render deletion modal correctly', () => { | |||
expect(wrapper.find(DeleteBranchModal).exists()).toBeFalsy(); | |||
wrapper | |||
.find(BranchLikeTableRenderer) | |||
.find(BranchLikeTable) | |||
.props() | |||
.onDelete(mockPullRequest()); | |||
wrapper | |||
@@ -77,7 +77,7 @@ it('should render renaming modal correctly', () => { | |||
const wrapper = shallowRender({ onBranchesChange }); | |||
wrapper | |||
.find(BranchLikeTableRenderer) | |||
.find(BranchLikeTable) | |||
.props() | |||
.onRename(mockMainBranch()); | |||
expect(wrapper.state().renaming).toBeDefined(); | |||
@@ -91,7 +91,7 @@ it('should render renaming modal correctly', () => { | |||
expect(wrapper.find(RenameBranchModal).exists()).toBeFalsy(); | |||
wrapper | |||
.find(BranchLikeTableRenderer) | |||
.find(BranchLikeTable) | |||
.props() | |||
.onRename(mockMainBranch()); | |||
wrapper | |||
@@ -107,7 +107,7 @@ it('should NOT render renaming modal for non-main branch', () => { | |||
const wrapper = shallowRender(); | |||
wrapper | |||
.find(BranchLikeTableRenderer) | |||
.find(BranchLikeTable) | |||
.props() | |||
.onRename(mockPullRequest()); | |||
expect(wrapper.state().renaming).toBeDefined(); |
@@ -0,0 +1,69 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2019 SonarSource SA | |||
* mailto:info AT sonarsource DOT com | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 3 of the License, or (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import { shallow } from 'enzyme'; | |||
import * as React from 'react'; | |||
import Toggle from 'sonar-ui-common/components/controls/Toggle'; | |||
import { excludeBranchFromPurge } from '../../../../api/branches'; | |||
import { mockComponent, mockLongLivingBranch, mockMainBranch } from '../../../../helpers/testMocks'; | |||
import BranchPurgeSetting from '../BranchPurgeSetting'; | |||
jest.mock('../../../../api/branches', () => ({ | |||
excludeBranchFromPurge: jest.fn().mockResolvedValue({}) | |||
})); | |||
beforeEach(() => jest.clearAllMocks()); | |||
it('should render correctly for a non-main branch', () => { | |||
const wrapper = shallowRender(); | |||
expect(wrapper).toMatchSnapshot(); | |||
expect(wrapper.state().excludedFromPurge).toBe(true); | |||
}); | |||
it('should render correctly for a main branch', () => { | |||
const wrapper = shallowRender({ branch: mockMainBranch({ excludedFromPurge: true }) }); | |||
expect(wrapper).toMatchSnapshot(); | |||
expect(wrapper.state().excludedFromPurge).toBe(true); | |||
}); | |||
it('should correctly call the webservice if the user changes the value', () => { | |||
const wrapper = shallowRender(); | |||
expect(wrapper.state().excludedFromPurge).toBe(true); | |||
const { onChange } = wrapper.find(Toggle).props(); | |||
if (!onChange) { | |||
fail(); | |||
} else { | |||
onChange(false); | |||
expect(excludeBranchFromPurge).toHaveBeenCalled(); | |||
expect(wrapper.state().excludedFromPurge).toBe(true); | |||
} | |||
}); | |||
function shallowRender(props?: Partial<BranchPurgeSetting['props']>) { | |||
return shallow<BranchPurgeSetting>( | |||
<BranchPurgeSetting | |||
branch={mockLongLivingBranch({ excludedFromPurge: true })} | |||
component={mockComponent()} | |||
{...props} | |||
/> | |||
); | |||
} |
@@ -22,7 +22,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; | |||
import * as React from 'react'; | |||
import { change, click, doAsync, submit, waitAndUpdate } from 'sonar-ui-common/helpers/testUtils'; | |||
import { renameBranch } from '../../../../api/branches'; | |||
import { mockComponent } from '../../../../helpers/testMocks'; | |||
import { mockComponent, mockMainBranch } from '../../../../helpers/testMocks'; | |||
import RenameBranchModal from '../RenameBranchModal'; | |||
jest.mock('../../../../api/branches', () => ({ renameBranch: jest.fn() })); | |||
@@ -77,7 +77,7 @@ it('stops loading on WS error', async () => { | |||
}); | |||
function shallowRender(onRename: () => void = jest.fn(), onClose: () => void = jest.fn()) { | |||
const branch: T.MainBranch = { isMain: true, name: 'master' }; | |||
const branch = mockMainBranch(); | |||
const wrapper = shallow<RenameBranchModal>( | |||
<RenameBranchModal | |||
branch={branch} |
@@ -17,6 +17,7 @@ exports[`should render correctly 1`] = ` | |||
Array [ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -24,12 +25,14 @@ exports[`should render correctly 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
}, | |||
@@ -43,6 +46,7 @@ exports[`should render correctly 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
@@ -58,12 +62,14 @@ exports[`should render correctly 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", |
@@ -0,0 +1,374 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should render correctly for long lived branch 1`] = ` | |||
<tr> | |||
<td | |||
className="nowrap hide-overflow" | |||
> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "branch-6.7", | |||
"type": "LONG", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
<span | |||
title="branch-6.7" | |||
> | |||
branch-6.7 | |||
</span> | |||
<span /> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "branch-6.7", | |||
"type": "LONG", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<BranchPurgeSetting | |||
branch={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "branch-6.7", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<ActionsDropdown> | |||
<ActionsDropdownItem | |||
className="js-delete" | |||
destructive={true} | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.branch.delete | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; | |||
exports[`should render correctly for main branch 1`] = ` | |||
<tr> | |||
<td | |||
className="nowrap hide-overflow" | |||
> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
<span | |||
title="master" | |||
> | |||
master | |||
</span> | |||
<span> | |||
<div | |||
className="badge spacer-left" | |||
> | |||
branches.main_branch | |||
</div> | |||
</span> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<BranchPurgeSetting | |||
branch={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<ActionsDropdown> | |||
<ActionsDropdownItem | |||
className="js-rename" | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.branch.rename | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; | |||
exports[`should render correctly for pull request 1`] = ` | |||
<tr> | |||
<td | |||
className="nowrap hide-overflow" | |||
> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "1001", | |||
"target": "master", | |||
"title": "Foo Bar feature", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
<span | |||
title="1001 – Foo Bar feature" | |||
> | |||
1001 – Foo Bar feature | |||
</span> | |||
<span /> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "1001", | |||
"target": "master", | |||
"title": "Foo Bar feature", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<ActionsDropdown> | |||
<ActionsDropdownItem | |||
className="js-delete" | |||
destructive={true} | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.pull_request.delete | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; | |||
exports[`should render correctly for short lived branch 1`] = ` | |||
<tr> | |||
<td | |||
className="nowrap hide-overflow" | |||
> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
"type": "SHORT", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
<span | |||
title="feature/foo" | |||
> | |||
feature/foo | |||
</span> | |||
<span /> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
"type": "SHORT", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<BranchPurgeSetting | |||
branch={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
"type": "SHORT", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
/> | |||
</td> | |||
<td | |||
className="nowrap" | |||
> | |||
<ActionsDropdown> | |||
<ActionsDropdownItem | |||
className="js-delete" | |||
destructive={true} | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.branch.delete | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; |
@@ -1,233 +0,0 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should render correctly for long lived branch 1`] = ` | |||
<tr> | |||
<td> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"name": "branch-6.7", | |||
"type": "LONG", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
branch-6.7 | |||
</td> | |||
<td | |||
className="thin nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"name": "branch-6.7", | |||
"type": "LONG", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right big-spacer-left" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right" | |||
> | |||
<ActionsDropdown | |||
className="big-spacer-left" | |||
> | |||
<ActionsDropdownItem | |||
className="js-delete" | |||
destructive={true} | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.branch.delete | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; | |||
exports[`should render correctly for mai branch 1`] = ` | |||
<tr> | |||
<td> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
master | |||
<div | |||
className="badge spacer-left" | |||
> | |||
branches.main_branch | |||
</div> | |||
</td> | |||
<td | |||
className="thin nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right big-spacer-left" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right" | |||
> | |||
<ActionsDropdown | |||
className="big-spacer-left" | |||
> | |||
<ActionsDropdownItem | |||
className="js-rename" | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.branch.rename | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; | |||
exports[`should render correctly for pull request 1`] = ` | |||
<tr> | |||
<td> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "1001", | |||
"target": "master", | |||
"title": "Foo Bar feature", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
1001 – Foo Bar feature | |||
</td> | |||
<td | |||
className="thin nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "1001", | |||
"target": "master", | |||
"title": "Foo Bar feature", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right big-spacer-left" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right" | |||
> | |||
<ActionsDropdown | |||
className="big-spacer-left" | |||
> | |||
<ActionsDropdownItem | |||
className="js-delete" | |||
destructive={true} | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.pull_request.delete | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; | |||
exports[`should render correctly for short lived branch 1`] = ` | |||
<tr> | |||
<td> | |||
<BranchLikeIcon | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
"type": "SHORT", | |||
} | |||
} | |||
className="little-spacer-right" | |||
/> | |||
feature/foo | |||
</td> | |||
<td | |||
className="thin nowrap" | |||
> | |||
<Connect(BranchStatus) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", | |||
"type": "SHORT", | |||
} | |||
} | |||
component="my-project" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right big-spacer-left" | |||
> | |||
<DateFromNow | |||
date="2018-01-01" | |||
/> | |||
</td> | |||
<td | |||
className="thin nowrap text-right" | |||
> | |||
<ActionsDropdown | |||
className="big-spacer-left" | |||
> | |||
<ActionsDropdownItem | |||
className="js-delete" | |||
destructive={true} | |||
onClick={[MockFunction]} | |||
> | |||
project_branch_pull_request.branch.delete | |||
</ActionsDropdownItem> | |||
</ActionsDropdown> | |||
</td> | |||
</tr> | |||
`; |
@@ -0,0 +1,810 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should render correctly 1`] = ` | |||
<div | |||
className="boxed-group boxed-group-inner" | |||
> | |||
<table | |||
className="data zebra zebra-hover fixed" | |||
> | |||
<thead> | |||
<tr> | |||
<th | |||
className="nowrap" | |||
> | |||
title | |||
</th> | |||
<th | |||
className="nowrap" | |||
style={ | |||
Object { | |||
"width": "80px", | |||
} | |||
} | |||
> | |||
status | |||
</th> | |||
<th | |||
className="nowrap" | |||
style={ | |||
Object { | |||
"width": "140px", | |||
} | |||
} | |||
> | |||
project_branch_pull_request.last_analysis_date | |||
</th> | |||
<th | |||
className="nowrap" | |||
style={ | |||
Object { | |||
"width": "50px", | |||
} | |||
} | |||
> | |||
actions | |||
</th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
"type": "SHORT", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-slb-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-llb-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-master" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "1", | |||
"target": "master", | |||
"title": "PR-1", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="pull-request-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
"type": "SHORT", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-slb-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "2", | |||
"target": "master", | |||
"title": "PR-2", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="pull-request-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-llb-3" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-llb-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"isOrphan": true, | |||
"key": "2", | |||
"target": "llb-100", | |||
"title": "PR-2", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="pull-request-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
</tbody> | |||
</table> | |||
</div> | |||
`; | |||
exports[`should render purge setting correctly 1`] = ` | |||
<div | |||
className="boxed-group boxed-group-inner" | |||
> | |||
<table | |||
className="data zebra zebra-hover fixed" | |||
> | |||
<thead> | |||
<tr> | |||
<th | |||
className="nowrap" | |||
> | |||
title | |||
</th> | |||
<th | |||
className="nowrap" | |||
style={ | |||
Object { | |||
"width": "80px", | |||
} | |||
} | |||
> | |||
status | |||
</th> | |||
<th | |||
className="nowrap" | |||
style={ | |||
Object { | |||
"width": "140px", | |||
} | |||
} | |||
> | |||
project_branch_pull_request.last_analysis_date | |||
</th> | |||
<th | |||
className="nowrap" | |||
style={ | |||
Object { | |||
"width": "150px", | |||
} | |||
} | |||
> | |||
<div | |||
className="display-flex-center" | |||
> | |||
<span> | |||
project_branch_pull_request.branch.auto_deletion.keep_when_inactive | |||
</span> | |||
<HelpTooltip | |||
className="little-spacer-left" | |||
overlay="project_branch_pull_request.branch.auto_deletion.keep_when_inactive.tooltip" | |||
/> | |||
</div> | |||
</th> | |||
<th | |||
className="nowrap" | |||
style={ | |||
Object { | |||
"width": "50px", | |||
} | |||
} | |||
> | |||
actions | |||
</th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
"type": "SHORT", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="branch-slb-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="branch-llb-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="branch-master" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "1", | |||
"target": "master", | |||
"title": "PR-1", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="pull-request-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
"type": "SHORT", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="branch-slb-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "2", | |||
"target": "master", | |||
"title": "PR-2", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="pull-request-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="branch-llb-3" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="branch-llb-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRow) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"isOrphan": true, | |||
"key": "2", | |||
"target": "llb-100", | |||
"title": "PR-2", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
key="pull-request-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
</tbody> | |||
</table> | |||
</div> | |||
`; |
@@ -1,368 +0,0 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should render correctly 1`] = ` | |||
<div | |||
className="boxed-group boxed-group-inner" | |||
> | |||
<table | |||
className="data zebra zebra-hover" | |||
> | |||
<thead> | |||
<tr> | |||
<th> | |||
tableTitle | |||
</th> | |||
<th | |||
className="thin nowrap" | |||
> | |||
status | |||
</th> | |||
<th | |||
className="thin nowrap text-right big-spacer-left" | |||
> | |||
project_branch_pull_request.last_analysis_date | |||
</th> | |||
<th | |||
className="thin nowrap text-right" | |||
> | |||
actions | |||
</th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
"type": "SHORT", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-slb-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-llb-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": true, | |||
"name": "master", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-master" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "1", | |||
"target": "master", | |||
"title": "PR-1", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="pull-request-1" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
"type": "SHORT", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-slb-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"key": "2", | |||
"target": "master", | |||
"title": "PR-2", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="pull-request-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-llb-3" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="branch-llb-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
<Memo(BranchLikeRowRenderer) | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"base": "master", | |||
"branch": "feature/foo/bar", | |||
"isOrphan": true, | |||
"key": "2", | |||
"target": "llb-100", | |||
"title": "PR-2", | |||
} | |||
} | |||
component={ | |||
Object { | |||
"breadcrumbs": Array [], | |||
"key": "my-project", | |||
"name": "MyProject", | |||
"organization": "foo", | |||
"qualifier": "TRK", | |||
"qualityGate": Object { | |||
"isDefault": true, | |||
"key": "30", | |||
"name": "Sonar way", | |||
}, | |||
"qualityProfiles": Array [ | |||
Object { | |||
"deleted": false, | |||
"key": "my-qp", | |||
"language": "ts", | |||
"name": "Sonar way", | |||
}, | |||
], | |||
"tags": Array [], | |||
} | |||
} | |||
key="pull-request-2" | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
/> | |||
</tbody> | |||
</table> | |||
</div> | |||
`; |
@@ -32,34 +32,39 @@ exports[`should render all tabs correctly 1`] = ` | |||
] | |||
} | |||
/> | |||
<Memo(BranchLikeTableRenderer) | |||
<Memo(BranchLikeTable) | |||
branchLikes={ | |||
Array [ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-1", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-2", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"name": "llb-3", | |||
"type": "LONG", | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "slb-1", | |||
@@ -67,6 +72,7 @@ exports[`should render all tabs correctly 1`] = ` | |||
}, | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "llb-1", | |||
"name": "slb-2", | |||
@@ -97,9 +103,10 @@ exports[`should render all tabs correctly 1`] = ` | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={true} | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
tableTitle="project_branch_pull_request.table.branch" | |||
title="project_branch_pull_request.table.branch" | |||
/> | |||
</Fragment> | |||
`; | |||
@@ -136,7 +143,7 @@ exports[`should render all tabs correctly 2`] = ` | |||
] | |||
} | |||
/> | |||
<Memo(BranchLikeTableRenderer) | |||
<Memo(BranchLikeTable) | |||
branchLikes={ | |||
Array [ | |||
Object { | |||
@@ -189,9 +196,10 @@ exports[`should render all tabs correctly 2`] = ` | |||
"tags": Array [], | |||
} | |||
} | |||
displayPurgeSetting={false} | |||
onDelete={[Function]} | |||
onRename={[Function]} | |||
tableTitle="project_branch_pull_request.table.pull_request" | |||
title="project_branch_pull_request.table.pull_request" | |||
/> | |||
</Fragment> | |||
`; | |||
@@ -241,6 +249,7 @@ exports[`should render renaming modal correctly 1`] = ` | |||
branch={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -0,0 +1,40 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should render correctly for a main branch 1`] = ` | |||
<Fragment> | |||
<Toggle | |||
disabled={true} | |||
onChange={[Function]} | |||
value={true} | |||
/> | |||
<span | |||
className="spacer-left" | |||
> | |||
<DeferredSpinner | |||
loading={false} | |||
timeout={100} | |||
/> | |||
</span> | |||
<HelpTooltip | |||
overlay="project_branch_pull_request.branch.auto_deletion.main_branch_tooltip" | |||
/> | |||
</Fragment> | |||
`; | |||
exports[`should render correctly for a non-main branch 1`] = ` | |||
<Fragment> | |||
<Toggle | |||
disabled={false} | |||
onChange={[Function]} | |||
value={true} | |||
/> | |||
<span | |||
className="spacer-left" | |||
> | |||
<DeferredSpinner | |||
loading={false} | |||
timeout={100} | |||
/> | |||
</span> | |||
</Fragment> | |||
`; |
@@ -5,6 +5,7 @@ exports[`should render correctly 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": true, | |||
"name": "master", | |||
} |
@@ -151,6 +151,7 @@ const sourceViewerFile: T.SourceViewerFile = { | |||
const branchLike: T.ShortLivingBranch = { | |||
isMain: false, | |||
excludedFromPurge: true, | |||
mergeBranch: 'master', | |||
name: 'feature', | |||
type: 'SHORT' |
@@ -45,6 +45,7 @@ exports[`render code 1`] = ` | |||
branchLike={ | |||
Object { | |||
"analysisDate": "2018-01-01", | |||
"excludedFromPurge": true, | |||
"isMain": false, | |||
"mergeBranch": "master", | |||
"name": "feature/foo", |
@@ -28,6 +28,7 @@ const issueWithLocations: T.Issue = mockIssue(true); | |||
it('should render the titlebar correctly', () => { | |||
const branch: T.ShortLivingBranch = { | |||
isMain: false, | |||
excludedFromPurge: true, | |||
mergeBranch: 'master', | |||
name: 'feature-1.0', | |||
type: 'SHORT' |
@@ -50,6 +50,10 @@ export function isPullRequest(branchLike?: T.BranchLike): branchLike is T.PullRe | |||
return branchLike !== undefined && (branchLike as T.PullRequest).key !== undefined; | |||
} | |||
export function sortPullRequests(pullRequests: T.PullRequest[]) { | |||
return orderBy(pullRequests, pr => getPullRequestDisplayName(pr)); | |||
} | |||
export function getPullRequestDisplayName(pullRequest: T.PullRequest) { | |||
return `${pullRequest.key} – ${pullRequest.title}`; | |||
} |
@@ -743,6 +743,7 @@ export function mockShortLivingBranch( | |||
): T.ShortLivingBranch { | |||
return { | |||
analysisDate: '2018-01-01', | |||
excludedFromPurge: true, | |||
isMain: false, | |||
name: 'feature/foo', | |||
mergeBranch: 'master', | |||
@@ -826,6 +827,7 @@ export function mockLongLivingBranch( | |||
): T.LongLivingBranch { | |||
return { | |||
analysisDate: '2018-01-01', | |||
excludedFromPurge: true, | |||
isMain: false, | |||
name: 'branch-6.7', | |||
type: 'LONG', | |||
@@ -886,6 +888,7 @@ export function mockDocumentationEntry( | |||
export function mockMainBranch(overrides: Partial<T.MainBranch> = {}): T.MainBranch { | |||
return { | |||
analysisDate: '2018-01-01', | |||
excludedFromPurge: true, | |||
isMain: true, | |||
name: 'master', | |||
...overrides |
@@ -23,6 +23,7 @@ declare namespace T { | |||
export interface Branch { | |||
analysisDate?: string; | |||
excludedFromPurge: boolean; | |||
isMain: boolean; | |||
name: string; | |||
status?: { qualityGateStatus: Status }; |
@@ -9457,10 +9457,10 @@ sockjs@0.3.19: | |||
faye-websocket "^0.10.0" | |||
uuid "^3.0.1" | |||
sonar-ui-common@0.0.36: | |||
version "0.0.36" | |||
resolved "https://repox.jfrog.io/repox/api/npm/npm/sonar-ui-common/-/sonar-ui-common-0.0.36.tgz#30c4705d907f2453ce9a113af660bf4ff536af67" | |||
integrity sha1-MMRwXZB/JFPOmhE69mC/T/U2r2c= | |||
sonar-ui-common@0.0.40: | |||
version "0.0.40" | |||
resolved "https://repox.jfrog.io/repox/api/npm/npm/sonar-ui-common/-/sonar-ui-common-0.0.40.tgz#1b6ec48e74c74b84254669d0798216073b368cec" | |||
integrity sha1-G27EjnTHS4QlRmnQeYIWBzs2jOw= | |||
dependencies: | |||
"@types/react-select" "1.2.6" | |||
classnames "2.2.6" |
@@ -540,6 +540,9 @@ project_branch_pull_request.lifetime_information.admin=You can adjust this value | |||
project_branch_pull_request.branch.rename=Rename branch | |||
project_branch_pull_request.branch.delete=Delete branch | |||
project_branch_pull_request.branch.delete.are_you_sure=Are you sure you want to delete branch "{0}"? | |||
project_branch_pull_request.branch.auto_deletion.keep_when_inactive=Keep when inactive | |||
project_branch_pull_request.branch.auto_deletion.keep_when_inactive.tooltip=When turned on, the branch will not be automatically deleted when inactive. | |||
project_branch_pull_request.branch.auto_deletion.main_branch_tooltip=The main branch is always excluded from automatic deletion. | |||
project_branch_pull_request.pull_request.delete=Delete Pull Request | |||
project_branch_pull_request.pull_request.delete.are_you_sure=Are you sure you want to delete Pull Request "{0}"? | |||
project_branch_pull_request.tabs.branches=Branches |