]> source.dussan.org Git - sonarqube.git/commitdiff
Limit size of submitter in brackground task
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 19 Jun 2018 13:50:24 +0000 (15:50 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 24 Jul 2018 18:21:18 +0000 (20:21 +0200)
server/sonar-web/src/main/js/app/styles/init/type.css
server/sonar-web/src/main/js/apps/background-tasks/components/Footer.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/TaskDay.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/TaskSubmitter.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.js [deleted file]
server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap

index c150ffb4c7cd07881ab189a5cf8ddf255ba827a1..53721ff4a90f1b3bf47adbfc92fb47547d4fb69e 100644 (file)
@@ -221,6 +221,14 @@ small,
   white-space: nowrap;
 }
 
+.text-limited-small {
+  display: inline-block;
+  max-width: 8vw;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
 .text-limited {
   display: inline-block;
   max-width: 16vw;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.js
deleted file mode 100644 (file)
index 9293e89..0000000
+++ /dev/null
@@ -1,39 +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 type { Task } from '../types'; */
-import { translateWithParameters } from '../../../helpers/l10n';
-
-const LIMIT = 1000;
-
-const Footer = ({ tasks } /*: { tasks: Task[] } */) => {
-  if (tasks.length < LIMIT) {
-    return null;
-  }
-
-  return (
-    <footer className="spacer-top note text-center">
-      {translateWithParameters('max_results_reached', LIMIT)}
-    </footer>
-  );
-};
-
-export default Footer;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx
new file mode 100644 (file)
index 0000000..3d7f0fc
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 { translateWithParameters } from '../../../helpers/l10n';
+import { Task } from '../types';
+
+const LIMIT = 1000;
+
+interface Props {
+  tasks: Task[];
+}
+
+export default function Footer({ tasks }: Props) {
+  if (tasks.length < LIMIT) {
+    return null;
+  }
+
+  return (
+    <footer className="spacer-top note text-center">
+      {translateWithParameters('max_results_reached', LIMIT)}
+    </footer>
+  );
+}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js
deleted file mode 100644 (file)
index b1ca2f3..0000000
+++ /dev/null
@@ -1,52 +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 { STATUSES } from '../constants';
-import Select from '../../../components/controls/Select';
-import { translate } from '../../../helpers/l10n';
-
-const StatusFilter = ({ value, onChange } /*: { value: ?string, onChange: Function } */) => {
-  const options = [
-    { value: STATUSES.ALL, label: translate('background_task.status.ALL') },
-    {
-      value: STATUSES.ALL_EXCEPT_PENDING,
-      label: translate('background_task.status.ALL_EXCEPT_PENDING')
-    },
-    { value: STATUSES.PENDING, label: translate('background_task.status.PENDING') },
-    { value: STATUSES.IN_PROGRESS, label: translate('background_task.status.IN_PROGRESS') },
-    { value: STATUSES.SUCCESS, label: translate('background_task.status.SUCCESS') },
-    { value: STATUSES.FAILED, label: translate('background_task.status.FAILED') },
-    { value: STATUSES.CANCELED, label: translate('background_task.status.CANCELED') }
-  ];
-
-  return (
-    <Select
-      value={value}
-      onChange={option => onChange(option.value)}
-      className="input-medium"
-      options={options}
-      clearable={false}
-      searchable={false}
-    />
-  );
-};
-
-export default StatusFilter;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx
new file mode 100644 (file)
index 0000000..1e2d1ba
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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 { STATUSES } from '../constants';
+import Select from '../../../components/controls/Select';
+import { translate } from '../../../helpers/l10n';
+
+interface Props {
+  value?: string;
+  onChange: (value?: string) => void;
+}
+
+export default class StatusFilter extends React.PureComponent<Props> {
+  handleChange = ({ value }: { value: string }) => {
+    this.props.onChange(value);
+  };
+
+  render() {
+    const options = [
+      { value: STATUSES.ALL, label: translate('background_task.status.ALL') },
+      {
+        value: STATUSES.ALL_EXCEPT_PENDING,
+        label: translate('background_task.status.ALL_EXCEPT_PENDING')
+      },
+      { value: STATUSES.PENDING, label: translate('background_task.status.PENDING') },
+      { value: STATUSES.IN_PROGRESS, label: translate('background_task.status.IN_PROGRESS') },
+      { value: STATUSES.SUCCESS, label: translate('background_task.status.SUCCESS') },
+      { value: STATUSES.FAILED, label: translate('background_task.status.FAILED') },
+      { value: STATUSES.CANCELED, label: translate('background_task.status.CANCELED') }
+    ];
+
+    return (
+      <Select
+        className="input-medium"
+        clearable={false}
+        onChange={this.handleChange}
+        options={options}
+        searchable={false}
+        value={this.props.value}
+      />
+    );
+  }
+}
index 3d93ea040d204a9fc24e2d68dc50e9202ffd7e9d..8854162b38b38ffafc7cb4a01353accd201539bd 100644 (file)
@@ -31,7 +31,7 @@ export default function TaskDay({ submittedAt, prevSubmittedAt }: Props) {
     !prevSubmittedAt || !isSameDay(parseDate(submittedAt), parseDate(prevSubmittedAt));
 
   return (
-    <td className="thin nowrap text-right">
+    <td className="thin nowrap text-right small">
       {shouldDisplay ? <DateFormatter date={submittedAt} long={true} /> : ''}
     </td>
   );
index 378cc1eb22680076bd7c6b04673883a145769837..2cf4fd5f1cbc102628a98dff8d8c0422fcd1a89a 100644 (file)
@@ -25,5 +25,9 @@ interface Props {
 }
 
 export default function TaskSubmitter({ submitter }: Props) {
-  return <td className="thin nowrap note">{submitter || translate('anonymous')}</td>;
+  return (
+    <td className="thin note">
+      <span className="text-limited-small text-bottom">{submitter || translate('anonymous')}</span>
+    </td>
+  );
 }
index 37510fb0c9bf51fc585bc5ce5ab0aeb8cd0d23c8..3d5f6bb7f1b8668175f6a4b03ae6e4cb174f51ef 100644 (file)
@@ -56,7 +56,7 @@ export default class Tasks extends React.PureComponent {
               <th>{translate('background_tasks.table.status')}</th>
               <th>{translate('background_tasks.table.task')}</th>
               <th>{translate('background_tasks.table.id')}</th>
-              <th className="text-right">{translate('background_tasks.table.submitter')}</th>
+              <th>{translate('background_tasks.table.submitter')}</th>
               <th>&nbsp;</th>
               <th className="text-right">{translate('background_tasks.table.submitted')}</th>
               <th className="text-right">{translate('background_tasks.table.started')}</th>
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.js
deleted file mode 100644 (file)
index 3cb819b..0000000
+++ /dev/null
@@ -1,57 +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 { ALL_TYPES } from '../constants';
-import Select from '../../../components/controls/Select';
-import { translate } from '../../../helpers/l10n';
-
-const TypesFilter = (
-  { value, onChange, types } /*: {
-  value: string,
-  onChange: Function,
-  types: string[]
-} */
-) => {
-  const options = types.map(t => {
-    return {
-      value: t,
-      label: translate('background_task.type', t)
-    };
-  });
-
-  const allOptions = [
-    { value: ALL_TYPES, label: translate('background_task.type.ALL') },
-    ...options
-  ];
-
-  return (
-    <Select
-      value={value}
-      onChange={option => onChange(option.value)}
-      className="input-medium"
-      options={allOptions}
-      clearable={false}
-      searchable={false}
-    />
-  );
-};
-
-export default TypesFilter;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx
new file mode 100644 (file)
index 0000000..ca03aca
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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 { ALL_TYPES } from '../constants';
+import Select from '../../../components/controls/Select';
+import { translate } from '../../../helpers/l10n';
+
+interface Props {
+  value: string;
+  onChange: Function;
+  types: string[];
+}
+
+export default class TypesFilter extends React.PureComponent<Props> {
+  handleChange = ({ value }: { value: string }) => {
+    this.props.onChange(value);
+  };
+
+  render() {
+    const { value, types } = this.props;
+    const options = types.map(t => {
+      return {
+        value: t,
+        label: translate('background_task.type', t)
+      };
+    });
+
+    const allOptions = [
+      { value: ALL_TYPES, label: translate('background_task.type.ALL') },
+      ...options
+    ];
+
+    return (
+      <Select
+        className="input-medium"
+        clearable={false}
+        onChange={this.handleChange}
+        options={allOptions}
+        searchable={false}
+        value={value}
+      />
+    );
+  }
+}
index 9a34276c640f7a538d9f523570dd6d768e5e6dcb..064c7b3427f92ca8c0839b071ddd72e17a44f077 100644 (file)
@@ -2,7 +2,7 @@
 
 exports[`renders 1`] = `
 <td
-  className="thin nowrap text-right"
+  className="thin nowrap text-right small"
 >
   <DateFormatter
     date="2017-01-02T00:00:00.000Z"
@@ -13,6 +13,6 @@ exports[`renders 1`] = `
 
 exports[`renders 2`] = `
 <td
-  className="thin nowrap text-right"
+  className="thin nowrap text-right small"
 />
 `;