]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10948 Update warning message when changing visibility of project
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 10 Jul 2018 12:19:36 +0000 (14:19 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 11 Jul 2018 18:21:23 +0000 (20:21 +0200)
server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.js [deleted file]
server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx [new file with mode: 0644]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

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 (file)
index a62f07d..0000000
+++ /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 (file)
index 0000000..51557cb
--- /dev/null
@@ -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>
+  );
+}
index 96bf8b0b98cbc2ae73f1261130a78332dab362a5..dffc57e27bec79aa97e52fda2fc17e6c68ddc5df 100644 (file)
@@ -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.