]> source.dussan.org Git - sonarqube.git/commitdiff
Apply feedback
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 24 Nov 2017 16:00:35 +0000 (17:00 +0100)
committerEric Hartmann <hartmann.eric@gmail.Com>
Mon, 4 Dec 2017 12:44:55 +0000 (13:44 +0100)
server/sonar-web/src/main/js/apps/projectQualityGate/Form.tsx
server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/Form-test.tsx.snap
server/sonar-web/src/main/js/apps/quality-gates/components/BuiltInBadge.tsx [deleted file]
server/sonar-web/src/main/js/apps/quality-gates/components/BuiltInQualityGateBadge.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js
server/sonar-web/src/main/js/apps/quality-gates/components/List.js
server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.tsx [deleted file]
server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInQualityProfileBadge.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx
server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx

index a2bcf4111cfb4430bf52d834a54fb21c867ad783..909767bfed937ff5860f281c8d2fac5be69a8b35 100644 (file)
@@ -18,7 +18,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import { some } from 'lodash';
 import { QualityGate } from '../../api/quality-gates';
 import Select from '../../components/controls/Select';
 import { translate } from '../../helpers/l10n';
@@ -96,11 +95,6 @@ export default class Form extends React.PureComponent<Props, State> {
       isDefault: gate.isDefault
     }));
 
-    const hasDefault = some(allGates, gate => gate.isDefault);
-    if (!hasDefault) {
-      options.unshift({ value: '', label: translate('none') });
-    }
-
     return (
       <Select
         clearable={false}
@@ -108,7 +102,6 @@ export default class Form extends React.PureComponent<Props, State> {
         onChange={this.handleChange}
         optionRenderer={this.renderGateName}
         options={options}
-        placeholder={translate('none')}
         style={{ width: 300 }}
         value={gate && String(gate.id)}
         valueRenderer={this.renderGateName}
index 3e5a39759b885452581c2456ec7b77306ffb70c0..e7620afb1a2148c6730b6877f3e126ea709e2f90 100644 (file)
@@ -9,10 +9,6 @@ exports[`renders 1`] = `
     optionRenderer={[Function]}
     options={
       Array [
-        Object {
-          "label": "none",
-          "value": "",
-        },
         Object {
           "isDefault": undefined,
           "label": "name-1",
@@ -25,7 +21,6 @@ exports[`renders 1`] = `
         },
       ]
     }
-    placeholder="none"
     style={
       Object {
         "width": 300,
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/BuiltInBadge.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/BuiltInBadge.tsx
deleted file mode 100644 (file)
index 6d5ad23..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 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 * as classNames from 'classnames';
-import Tooltip from '../../../components/controls/Tooltip';
-import { translate } from '../../../helpers/l10n';
-
-interface Props {
-  className?: string;
-  tooltip?: boolean;
-}
-
-export default function BuiltInBadge({ className, tooltip = true }: Props) {
-  const badge = (
-    <div className={classNames('outline-badge', className)}>
-      {translate('quality_gates.built_in')}
-    </div>
-  );
-
-  const overlay = (
-    <div>
-      <p>{translate('quality_gates.built_in.description.1')}</p>
-      <p>{translate('quality_gates.built_in.description.2')}</p>
-    </div>
-  );
-
-  return tooltip ? <Tooltip overlay={overlay}>{badge}</Tooltip> : badge;
-}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/BuiltInQualityGateBadge.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/BuiltInQualityGateBadge.tsx
new file mode 100644 (file)
index 0000000..5907e9d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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 * as classNames from 'classnames';
+import Tooltip from '../../../components/controls/Tooltip';
+import { translate } from '../../../helpers/l10n';
+
+interface Props {
+  className?: string;
+  tooltip?: boolean;
+}
+
+export default function BuiltInQualityGateBadge({ className, tooltip = true }: Props) {
+  const badge = (
+    <div className={classNames('outline-badge', className)}>
+      {translate('quality_gates.built_in')}
+    </div>
+  );
+
+  const overlay = (
+    <div>
+      <p>{translate('quality_gates.built_in.description.1')}</p>
+      <p>{translate('quality_gates.built_in.description.2')}</p>
+    </div>
+  );
+
+  return tooltip ? <Tooltip overlay={overlay}>{badge}</Tooltip> : badge;
+}
index 2ac134c52751c9f106a37869576fa0f92c6653bd..b86e89a41b8b05841389951da17afda1c7c84043 100644 (file)
@@ -18,7 +18,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import React from 'react';
-import BuiltInBadge from './BuiltInBadge';
+import BuiltInQualityGateBadge from './BuiltInQualityGateBadge';
 import { translate } from '../../../helpers/l10n';
 
 export default class DetailsHeader extends React.PureComponent {
@@ -51,7 +51,7 @@ export default class DetailsHeader extends React.PureComponent {
           <div className="layout-page-main-inner">
             <h2 className="pull-left">
               {qualityGate.name}
-              {qualityGate.isBuiltIn && <BuiltInBadge className="spacer-left" tooltip={true} />}
+              {qualityGate.isBuiltIn && <BuiltInQualityGateBadge className="spacer-left" />}
             </h2>
 
             <div className="pull-right">
index f99de57f40036543cc7e66c8cdd63e2e61dc03aa..d29633c5102af443b03a7c27f0d1e40bb952e45d 100644 (file)
@@ -19,7 +19,7 @@
  */
 import React from 'react';
 import { Link } from 'react-router';
-import BuiltInBadge from './BuiltInBadge';
+import BuiltInQualityGateBadge from './BuiltInQualityGateBadge';
 import { translate } from '../../../helpers/l10n';
 import { getQualityGateUrl } from '../../../helpers/urls';
 
@@ -42,7 +42,7 @@ export default function List({ organization, qualityGates }) {
                     <span className="text-middle badge">{translate('default')}</span>
                   )}
                   {qualityGate.isBuiltIn && (
-                    <BuiltInBadge className="little-spacer-left" tooltip={false} />
+                    <BuiltInQualityGateBadge className="little-spacer-left" tooltip={false} />
                   )}
                 </td>
               </tr>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.tsx
deleted file mode 100644 (file)
index c011321..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 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 * as classNames from 'classnames';
-import Tooltip from '../../../components/controls/Tooltip';
-import { translate } from '../../../helpers/l10n';
-
-interface Props {
-  className?: string;
-  tooltip?: boolean;
-}
-
-export default function BuiltInBadge({ className, tooltip = true }: Props) {
-  const badge = (
-    <div className={classNames('outline-badge', className)}>
-      {translate('quality_profiles.built_in')}
-    </div>
-  );
-
-  const overlay = (
-    <span>
-      {translate('quality_profiles.built_in.description.1')}{' '}
-      {translate('quality_profiles.built_in.description.2')}
-    </span>
-  );
-
-  return tooltip ? <Tooltip overlay={overlay}>{badge}</Tooltip> : badge;
-}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInQualityProfileBadge.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInQualityProfileBadge.tsx
new file mode 100644 (file)
index 0000000..f7e7d5f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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 * as classNames from 'classnames';
+import Tooltip from '../../../components/controls/Tooltip';
+import { translate } from '../../../helpers/l10n';
+
+interface Props {
+  className?: string;
+  tooltip?: boolean;
+}
+
+export default function BuiltInQualityProfileBadge({ className, tooltip = true }: Props) {
+  const badge = (
+    <div className={classNames('outline-badge', className)}>
+      {translate('quality_profiles.built_in')}
+    </div>
+  );
+
+  const overlay = (
+    <span>
+      {translate('quality_profiles.built_in.description.1')}{' '}
+      {translate('quality_profiles.built_in.description.2')}
+    </span>
+  );
+
+  return tooltip ? <Tooltip overlay={overlay}>{badge}</Tooltip> : badge;
+}
index b131bb089ded48d9eb84d9ee81ae3924cc33880a..72e6bd8ef4b1404b8e9504c9a4ab269b978faedf 100644 (file)
@@ -22,7 +22,7 @@ import { Link, IndexLink } from 'react-router';
 import ProfileLink from '../components/ProfileLink';
 import ProfileActions from '../components/ProfileActions';
 import ProfileDate from '../components/ProfileDate';
-import BuiltInBadge from '../components/BuiltInBadge';
+import BuiltInQualityProfileBadge from '../components/BuiltInQualityProfileBadge';
 import { translate } from '../../../helpers/l10n';
 import {
   isStagnant,
@@ -92,7 +92,9 @@ export default class ProfileHeader extends React.PureComponent<Props> {
             organization={organization}>
             <span>{profile.name}</span>
           </ProfileLink>
-          {profile.isBuiltIn && <BuiltInBadge className="spacer-left" tooltip={false} />}
+          {profile.isBuiltIn && (
+            <BuiltInQualityProfileBadge className="spacer-left" tooltip={false} />
+          )}
         </h1>
 
         <div className="pull-right">
index 12e27f5759487c90baa5d55060aba999f8b1862c..4e357b8c1c8d5cc5360af48c4ec21ef800d7c157 100644 (file)
@@ -19,7 +19,7 @@
  */
 import * as React from 'react';
 import ProfileLink from '../components/ProfileLink';
-import BuiltInBadge from '../components/BuiltInBadge';
+import BuiltInQualityProfileBadge from '../components/BuiltInQualityProfileBadge';
 import Tooltip from '../../../components/controls/Tooltip';
 import { translate, translateWithParameters } from '../../../helpers/l10n';
 
@@ -58,7 +58,7 @@ export default function ProfileInheritanceBox({ displayLink = true, ...props }:
           ) : (
             profile.name
           )}
-          {profile.isBuiltIn && <BuiltInBadge className="spacer-left" />}
+          {profile.isBuiltIn && <BuiltInQualityProfileBadge className="spacer-left" />}
           {extendsBuiltIn && (
             <Tooltip overlay={translate('quality_profiles.extends_built_in')}>
               <i className="icon-help spacer-left" />
index ff75c1cef3beba4fcf5ce645054b4ade316ef285..20b2073a37fa56b1ebcc5db6e589fd2fe5638428 100644 (file)
@@ -22,7 +22,7 @@ import { Link } from 'react-router';
 import ProfileLink from '../components/ProfileLink';
 import ProfileDate from '../components/ProfileDate';
 import ProfileActions from '../components/ProfileActions';
-import BuiltInBadge from '../components/BuiltInBadge';
+import BuiltInQualityProfileBadge from '../components/BuiltInQualityProfileBadge';
 import { translate } from '../../../helpers/l10n';
 import { getRulesUrl } from '../../../helpers/urls';
 import { isStagnant } from '../utils';
@@ -48,7 +48,7 @@ export default class ProfilesListRow extends React.PureComponent<Props> {
           organization={this.props.organization}>
           {profile.name}
         </ProfileLink>
-        {profile.isBuiltIn && <BuiltInBadge className="spacer-left" />}
+        {profile.isBuiltIn && <BuiltInQualityProfileBadge className="spacer-left" />}
       </div>
     );
   }