Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(inputs): show input services status count #1430

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/images/inputs/Tabs_Output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions ui/src/components/table/TableHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import Select from '@splunk/react-ui/Select';
import Paginator from '@splunk/react-ui/Paginator';
import { Typography } from '@splunk/react-ui/Typography';

import styled from 'styled-components';
import { _ } from '@splunk/ui-utils/i18n';

Expand Down Expand Up @@ -71,13 +73,23 @@ function TableHeader({
);
};

const getInputCountStatus = () => {
const enabledRowCount = allFilteredData.filter((item) => !item.disabled).length;
const showCountstatus = `(${enabledRowCount} of ${totalElement} enabled)`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const showCountstatus = `(${enabledRowCount} of ${totalElement} enabled)`;
const showCountStatus = `(${enabledRowCount} of ${totalElement} enabled)`;


return (
<Typography as="span">
{totalElement}
{totalElement > 1 ? _(` ${itemLabel}s`) : _(` ${itemLabel}`)}
&nbsp; {totalElement >= pageSize && showCountstatus}
</Typography>
);
};

return (
<TableHeaderWrapper>
<div>
<span className="inputNumber">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{totalElement}
{totalElement > 1 ? _(` ${itemLabel}s`) : _(` ${itemLabel}`)}
</span>
{getInputCountStatus()}
{page === PAGE_INPUT ? (
<TableSelectBoxWrapper>
<Select
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see if this new functionality is auto-tested somehow. Can you add at least show it off in screenshot testing by adding more inputs there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally, is to cover with unit tests (TableWrapper.test.tsx)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.