From: GrĂ©goire Aubert Date: Tue, 19 Jun 2018 13:50:24 +0000 (+0200) Subject: Limit size of submitter in brackground task X-Git-Tag: 7.5~741 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f71a067e751c5eee50138a1e0f01af00623f1739;p=sonarqube.git Limit size of submitter in brackground task --- diff --git a/server/sonar-web/src/main/js/app/styles/init/type.css b/server/sonar-web/src/main/js/app/styles/init/type.css index c150ffb4c7c..53721ff4a90 100644 --- a/server/sonar-web/src/main/js/app/styles/init/type.css +++ b/server/sonar-web/src/main/js/app/styles/init/type.css @@ -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 index 9293e893a0b..00000000000 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.js +++ /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 ( - - ); -}; - -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 index 00000000000..3d7f0fc682d --- /dev/null +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Footer.tsx @@ -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 ( + + ); +} 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 index b1ca2f34515..00000000000 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js +++ /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 ( - + ); + } +} diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskDay.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskDay.tsx index 3d93ea040d2..8854162b38b 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskDay.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskDay.tsx @@ -31,7 +31,7 @@ export default function TaskDay({ submittedAt, prevSubmittedAt }: Props) { !prevSubmittedAt || !isSameDay(parseDate(submittedAt), parseDate(prevSubmittedAt)); return ( - + {shouldDisplay ? : ''} ); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskSubmitter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskSubmitter.tsx index 378cc1eb226..2cf4fd5f1cb 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskSubmitter.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskSubmitter.tsx @@ -25,5 +25,9 @@ interface Props { } export default function TaskSubmitter({ submitter }: Props) { - return {submitter || translate('anonymous')}; + return ( + + {submitter || translate('anonymous')} + + ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js index 37510fb0c9b..3d5f6bb7f1b 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js @@ -56,7 +56,7 @@ export default class Tasks extends React.PureComponent { {translate('background_tasks.table.status')} {translate('background_tasks.table.task')} {translate('background_tasks.table.id')} - {translate('background_tasks.table.submitter')} + {translate('background_tasks.table.submitter')}   {translate('background_tasks.table.submitted')} {translate('background_tasks.table.started')} 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 index 3cb819b3145..00000000000 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.js +++ /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 ( - + ); + } +} diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap index 9a34276c640..064c7b3427f 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap @@ -2,7 +2,7 @@ exports[`renders 1`] = ` `;