aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projectsManagement
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-07-20 16:57:23 +0200
committerSonarTech <sonartech@sonarsource.com>2018-08-10 20:21:28 +0200
commitb08814f7807c1443592af65cd68c2a51dfd4ee37 (patch)
treed7bbaf30c5c0633cd212a30e52db073945ba61ea /server/sonar-web/src/main/js/apps/projectsManagement
parent3a39b4fa08b15912c928af35fb7b77cd4b85ab64 (diff)
downloadsonarqube-b08814f7807c1443592af65cd68c2a51dfd4ee37.tar.gz
sonarqube-b08814f7807c1443592af65cd68c2a51dfd4ee37.zip
SONAR-11036 Install integration with GitHub or BitBucket Cloud
* SONAR-11040 Update tutorial choices modal * SONAR-11041 Migrate manual installation tab * SONAR-11041 Rename button to start new project tutorial * SONAR-11041 Rework sonarcloud tabbed page styling * SONAR-11042 Add alm app install buttons in create project page * Make start script compatible with ALM integration
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectsManagement')
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/App.tsx35
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/utils.ts26
7 files changed, 27 insertions, 51 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 2a5bdbeee27..4df65fc78df 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/App.tsx
@@ -24,10 +24,9 @@ import Header from './Header';
import Search from './Search';
import Projects from './Projects';
import CreateProjectForm from './CreateProjectForm';
-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 { getComponents, Project } from '../../api/components';
import { Organization, Visibility } from '../../app/types';
import { toNotSoISOString } from '../../helpers/dates';
import { translate } from '../../helpers/l10n';
@@ -54,6 +53,8 @@ interface State {
visibility?: Visibility;
}
+const PAGE_SIZE = 50;
+
export default class App extends React.PureComponent<Props, State> {
mounted = false;
@@ -94,19 +95,22 @@ export default class App extends React.PureComponent<Props, State> {
qualifiers: this.state.qualifiers,
visibility: this.state.visibility
};
- getComponents(parameters).then(r => {
- if (this.mounted) {
- let projects: Project[] = r.components;
- if (this.state.page > 1) {
- projects = [...this.state.projects, ...projects];
+ getComponents(parameters).then(
+ r => {
+ if (this.mounted) {
+ let projects: Project[] = r.components;
+ if (this.state.page > 1) {
+ projects = [...this.state.projects, ...projects];
+ }
+ this.setState({ ready: true, projects, selection: [], total: r.paging.total });
}
- this.setState({ ready: true, projects, selection: [], total: r.paging.total });
- }
- });
+ },
+ () => {}
+ );
};
loadMore = () => {
- this.setState({ ready: false, page: this.state.page + 1 }, this.requestProjects);
+ this.setState(({ page }) => ({ ready: false, page: page + 1 }), this.requestProjects);
};
onSearch = (query: string) => {
@@ -152,18 +156,15 @@ export default class App extends React.PureComponent<Props, State> {
this.setState({ ready: false, page: 1, analyzedBefore }, this.requestProjects);
onProjectSelected = (project: string) => {
- const newSelection = uniq([...this.state.selection, project]);
- this.setState({ selection: newSelection });
+ this.setState(({ selection }) => ({ selection: uniq([...selection, project]) }));
};
onProjectDeselected = (project: string) => {
- const newSelection = without(this.state.selection, project);
- this.setState({ selection: newSelection });
+ this.setState(({ selection }) => ({ selection: without(selection, project) }));
};
onAllSelected = () => {
- const newSelection = this.state.projects.map(project => project.key);
- this.setState({ selection: newSelection });
+ this.setState(({ projects }) => ({ selection: projects.map(project => project.key) }));
};
onAllDeselected = () => {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
index 8853af4a079..7f1b12c3e4d 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
@@ -20,11 +20,11 @@
import * as React from 'react';
import { Link } from 'react-router';
import ProjectRowActions from './ProjectRowActions';
-import { Project } from './utils';
import PrivacyBadgeContainer from '../../components/common/PrivacyBadgeContainer';
import Checkbox from '../../components/controls/Checkbox';
import QualifierIcon from '../../components/icons-components/QualifierIcon';
import DateTooltipFormatter from '../../components/intl/DateTooltipFormatter';
+import { Project } from '../../api/components';
interface Props {
currentUser: { login: string };
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx
index 438db5c8a77..5932a17e570 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx
@@ -19,9 +19,8 @@
*/
import * as React from 'react';
import RestoreAccessModal from './RestoreAccessModal';
-import { Project } from './utils';
import ApplyTemplate from '../permissions/project/components/ApplyTemplate';
-import { getComponentShow } from '../../api/components';
+import { getComponentShow, Project } from '../../api/components';
import { getComponentNavigation } from '../../api/nav';
import ActionsDropdown, { ActionsDropdownItem } from '../../components/controls/ActionsDropdown';
import { translate } from '../../helpers/l10n';
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
index 7e72fb9b057..09add750d94 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
@@ -20,9 +20,9 @@
import * as React from 'react';
import * as classNames from 'classnames';
import ProjectRow from './ProjectRow';
-import { Project } from './utils';
import { Organization } from '../../app/types';
import { translate } from '../../helpers/l10n';
+import { Project } from '../../api/components';
interface Props {
currentUser: { login: string };
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx
index 57183554451..7c402913a25 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx
@@ -19,11 +19,11 @@
*/
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { Project } from './utils';
import { grantPermissionToUser } from '../../api/permissions';
import Modal from '../../components/controls/Modal';
import { SubmitButton, ResetButtonLink } from '../../components/ui/buttons';
import { translate } from '../../helpers/l10n';
+import { Project } from '../../api/components';
interface Props {
currentUser: { login: string };
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
index 205526b58aa..f336153d976 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
@@ -21,16 +21,16 @@ import * as React from 'react';
import { sortBy } from 'lodash';
import BulkApplyTemplateModal from './BulkApplyTemplateModal';
import DeleteModal from './DeleteModal';
-import { QUALIFIERS_ORDER, Project } from './utils';
-import { Organization, Visibility } from '../../app/types';
import Checkbox from '../../components/controls/Checkbox';
-import { translate } from '../../helpers/l10n';
import QualifierIcon from '../../components/icons-components/QualifierIcon';
import HelpTooltip from '../../components/controls/HelpTooltip';
import DateInput from '../../components/controls/DateInput';
import Select from '../../components/controls/Select';
import SearchBox from '../../components/controls/SearchBox';
import { Button } from '../../components/ui/buttons';
+import { Project } from '../../api/components';
+import { Organization, Visibility } from '../../app/types';
+import { translate } from '../../helpers/l10n';
export interface Props {
analyzedBefore: Date | undefined;
@@ -59,6 +59,8 @@ interface State {
deleteModal: boolean;
}
+const QUALIFIERS_ORDER = ['TRK', 'VW', 'APP'];
+
export default class Search extends React.PureComponent<Props, State> {
mounted = false;
state: State = { bulkApplyTemplateModal: false, deleteModal: false };
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/utils.ts b/server/sonar-web/src/main/js/apps/projectsManagement/utils.ts
deleted file mode 100644
index 183b47bc732..00000000000
--- a/server/sonar-web/src/main/js/apps/projectsManagement/utils.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 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 { SearchProjectsResponseComponent } from '../../api/components';
-
-export const PAGE_SIZE = 50;
-
-export const QUALIFIERS_ORDER = ['TRK', 'VW', 'APP'];
-
-export type Project = SearchProjectsResponseComponent;