aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-07-10 14:19:36 +0200
committerSonarTech <sonartech@sonarsource.com>2018-07-11 20:21:23 +0200
commitc05f7c7de9d840249ba684209667fd4a8014f367 (patch)
tree1905e4f5f96708bbb4ef5ff4c9aeef3c9aa8aa71
parent3bf2e0779d83edc09f674ddf7bfa963f312a0036 (diff)
downloadsonarqube-c05f7c7de9d840249ba684209667fd4a8014f367.tar.gz
sonarqube-c05f7c7de9d840249ba684209667fd4a8014f367.zip
SONAR-10948 Update warning message when changing visibility of project
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js72
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx47
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties6
3 files changed, 50 insertions, 75 deletions
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js b/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js
deleted file mode 100644
index a62f07d30f5..00000000000
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js
+++ /dev/null
@@ -1,72 +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.
- */
-// @flow
-import React from 'react';
-import Modal from '../../../../components/controls/Modal';
-import { translate, translateWithParameters } from '../../../../helpers/l10n';
-import { Button, ResetButtonLink } from '../../../../components/ui/buttons';
-
-/*::
-type Props = {
- component: {
- name: string,
- qualifier: string
- },
- onClose: () => void,
- onConfirm: () => void
-};
-*/
-
-export default class PublicProjectDisclaimer extends React.PureComponent {
- /*:: props: Props; */
-
- handleConfirmClick = () => {
- this.props.onConfirm();
- this.props.onClose();
- };
-
- render() {
- const { qualifier } = this.props.component;
-
- return (
- <Modal contentLabel="modal form" onRequestClose={this.props.onClose}>
- <header className="modal-head">
- <h2>
- {translateWithParameters('projects_role.turn_x_to_public', this.props.component.name)}
- </h2>
- </header>
-
- <div className="modal-body">
- <p>{translate('projects_role.are_you_sure_to_turn_project_to_public', qualifier)}</p>
- <p className="spacer-top">
- {translate('projects_role.are_you_sure_to_turn_project_to_public.2', qualifier)}
- </p>
- </div>
-
- <footer className="modal-foot">
- <Button id="confirm-turn-to-public" onClick={this.handleConfirmClick}>
- {translate('projects_role.turn_project_to_public', qualifier)}
- </Button>
- <ResetButtonLink onClick={this.props.onClose}>{translate('cancel')}</ResetButtonLink>
- </footer>
- </Modal>
- );
- }
-}
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx
new file mode 100644
index 00000000000..51557cb7a67
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx
@@ -0,0 +1,47 @@
+/*
+ * 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 * as React from 'react';
+import ConfirmModal from '../../../../components/controls/ConfirmModal';
+import { translate, translateWithParameters } from '../../../../helpers/l10n';
+
+interface Props {
+ component: {
+ name: string;
+ qualifier: string;
+ };
+ onClose: () => void;
+ onConfirm: () => void;
+}
+
+export default function PublicProjectDisclaimer({ component, onClose, onConfirm }: Props) {
+ const { qualifier } = component;
+ return (
+ <ConfirmModal
+ confirmButtonText={translate('projects_role.turn_project_to_public', qualifier)}
+ header={translateWithParameters('projects_role.turn_x_to_public', component.name)}
+ onClose={onClose}
+ onConfirm={onConfirm}>
+ <div className="alert alert-warning modal-alert">
+ {translate('projects_role.are_you_sure_to_turn_project_to_public.warning', qualifier)}
+ </div>
+ <p>{translate('projects_role.are_you_sure_to_turn_project_to_public', qualifier)}</p>
+ </ConfirmModal>
+ );
+}
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 96bf8b0b98c..dffc57e27be 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2045,11 +2045,11 @@ projects_role.turn_project_to_public.TRK=Turn Project to Public
projects_role.turn_project_to_public.VW=Turn Portfolio to Public
projects_role.turn_project_to_public.APP=Turn Application to Public
projects_role.are_you_sure_to_turn_project_to_public.TRK=Are you sure you want to turn your project to public?
-projects_role.are_you_sure_to_turn_project_to_public.2.TRK=Everybody will be able to browse and see the source code of your project.
+projects_role.are_you_sure_to_turn_project_to_public.warning.TRK=Everybody will be able to browse and see the source code of your project.
projects_role.are_you_sure_to_turn_project_to_public.VW=Are you sure you want to turn your portfolio to public?
-projects_role.are_you_sure_to_turn_project_to_public.2.VW=Everybody will be able to browse it.
+projects_role.are_you_sure_to_turn_project_to_public.warning.VW=Everybody will be able to browse it.
projects_role.are_you_sure_to_turn_project_to_public.APP=Are you sure you want to turn your application to public?
-projects_role.are_you_sure_to_turn_project_to_public.2.APP=Everybody will be able to browse it.
+projects_role.are_you_sure_to_turn_project_to_public.warning.APP=Everybody will be able to browse it.
projects_role.public_projects_warning=This permission is always granted by default to everybody (anonymous and authenticated users) for public projects. Therefore, the selection made on this page will be applied to private projects only.