aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
diff options
context:
space:
mode:
authorPascal Mugnier <pascal.mugnier@sonarsource.com>2018-07-09 13:45:36 +0200
committerSonarTech <sonartech@sonarsource.com>2018-07-10 20:21:19 +0200
commit4e9feaddc45af56194e90e941d591bc465add571 (patch)
treedac4b7128dcab6ef8b904bd88503dc9bbb68fa0a /server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
parente42753f017f998e46aa1c9c9689d428a0b81d065 (diff)
downloadsonarqube-4e9feaddc45af56194e90e941d591bc465add571.tar.gz
sonarqube-4e9feaddc45af56194e90e941d591bc465add571.zip
SONAR-10808 Add the ability fo filter projects by visibility
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectsManagement/App.tsx')
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/App.tsx24
1 files changed, 21 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
index 978feca7bba..34d6db3ebae 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
@@ -28,7 +28,7 @@ import { PAGE_SIZE, Project } from './utils';
import ListFooter from '../../components/controls/ListFooter';
import Suggestions from '../../app/components/embed-docs-modal/Suggestions';
import { getComponents } from '../../api/components';
-import { Organization } from '../../app/types';
+import { Organization, Visibility } from '../../app/types';
import { toNotSoISOString } from '../../helpers/dates';
import { translate } from '../../helpers/l10n';
@@ -51,6 +51,7 @@ interface State {
ready: boolean;
selection: string[];
total: number;
+ visibility?: Visibility;
}
export default class App extends React.PureComponent<Props, State> {
@@ -90,7 +91,8 @@ export default class App extends React.PureComponent<Props, State> {
p: this.state.page !== 1 ? this.state.page : undefined,
ps: PAGE_SIZE,
q: this.state.query || undefined,
- qualifiers: this.state.qualifiers
+ qualifiers: this.state.qualifiers,
+ visibility: this.state.visibility
};
getComponents(parameters).then(r => {
if (this.mounted) {
@@ -132,6 +134,20 @@ export default class App extends React.PureComponent<Props, State> {
);
};
+ onVisibilityChanged = (newVisibility: Visibility | 'all') => {
+ this.setState(
+ {
+ ready: false,
+ page: 1,
+ provisioned: false,
+ query: '',
+ visibility: newVisibility === 'all' ? undefined : newVisibility,
+ selection: []
+ },
+ this.requestProjects
+ );
+ };
+
handleDateChanged = (analyzedBefore: Date | undefined) =>
this.setState({ ready: false, page: 1, analyzedBefore }, this.requestProjects);
@@ -177,13 +193,14 @@ export default class App extends React.PureComponent<Props, State> {
<Search
analyzedBefore={this.state.analyzedBefore}
- onAllSelected={this.onAllSelected}
onAllDeselected={this.onAllDeselected}
+ onAllSelected={this.onAllSelected}
onDateChanged={this.handleDateChanged}
onDeleteProjects={this.requestProjects}
onProvisionedChanged={this.onProvisionedChanged}
onQualifierChanged={this.onQualifierChanged}
onSearch={this.onSearch}
+ onVisibilityChanged={this.onVisibilityChanged}
organization={this.props.organization}
projects={this.state.projects}
provisioned={this.state.provisioned}
@@ -193,6 +210,7 @@ export default class App extends React.PureComponent<Props, State> {
selection={this.state.selection}
topLevelQualifiers={this.props.topLevelQualifiers}
total={this.state.total}
+ visibility={this.state.visibility}
/>
<Projects