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

Fix "Stats are disabled by default" color on IndexSet page #17201

Merged
merged 5 commits into from
Nov 15, 2023
Merged
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,37 @@ import useSendTelemetry from 'logic/telemetry/useSendTelemetry';
import useLocation from 'routing/useLocation';
import { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants';

const Toolbar = styled(Row)(({ theme }) => css`
border-bottom: 1px solid ${theme.colors.gray[90]};
padding-bottom: 15px;
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to replace the value with theme spacing?

`);

const GlobalStatsCol = styled(Col)`
display: flex;
align-items: center;
gap: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

here too?

`;

const GlobalStats = styled.p`
margin-bottom: 0;
`;

const StatsInfoText = styled.span`
font-style: italic;
`;

const formatStatsString = (stats: IndexSetStats) => {
if (!stats) {
return 'N/A';
}

const indices = `${NumberUtils.formatNumber(stats.indices)} ${StringUtils.pluralize(stats.indices, 'index', 'indices')}`;
const documents = `${NumberUtils.formatNumber(stats.documents)} ${StringUtils.pluralize(stats.documents, 'document', 'documents')}`;
const size = NumberUtils.formatBytes(stats.size);

return `${indices}, ${documents}, ${size}`;
};

const IndexSetsComponent = () => {
const DEFAULT_PAGE_NUMBER = 1;
const DEFAULT_PAGE_SIZE = 10;
Expand Down Expand Up @@ -112,38 +143,6 @@ const IndexSetsComponent = () => {
});
};

const formatStatsString = (stats: IndexSetStats) => {
if (!stats) {
return 'N/A';
}

const indices = `${NumberUtils.formatNumber(stats.indices)} ${StringUtils.pluralize(stats.indices, 'index', 'indices')}`;
const documents = `${NumberUtils.formatNumber(stats.documents)} ${StringUtils.pluralize(stats.documents, 'document', 'documents')}`;
const size = NumberUtils.formatBytes(stats.size);

return `${indices}, ${documents}, ${size}`;
};

const Toolbar = styled(Row)(({ theme }) => css`
border-bottom: 1px solid ${theme.colors.gray[90]};
padding-bottom: 15px;
`);

const GlobalStatsCol = styled(Col)`
display: flex;
align-items: center;
gap: 10px;
`;

const GlobalStats = styled.p`
margin-bottom: 0;
`;

const StatsInfoText = styled.span(({ theme }) => css`
color: ${theme.colors.global.textAlt};
font-style: italic;
`);

const statsDisabledText = 'Stats are disabled by default';

const formatIndexSet = (indexSet: IndexSet) => {
Expand Down
Loading