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

bugfix: fix display of volume usage on newly created volumes #3651

Merged
merged 1 commit into from
Jan 3, 2022
Merged
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
21 changes: 8 additions & 13 deletions ui/src/components/VolumeListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
import {
allSizeUnitsToBytes,
compareHealth,
formatSizeForDisplay,
useTableSortURLSync,
} from '../services/utils';
import {
Expand Down Expand Up @@ -227,10 +226,12 @@ function Table({
);

// Synchronizes the params query with the Table sort state
const sorted = headerGroups[0].headers.find((item) => item.isSorted === true)
?.id;
const desc = headerGroups[0].headers.find((item) => item.isSorted === true)
?.isSortedDesc;
const sorted = headerGroups[0].headers.find(
(item) => item.isSorted === true,
)?.id;
const desc = headerGroups[0].headers.find(
(item) => item.isSorted === true,
)?.isSortedDesc;
useTableSortURLSync(sorted, desc, data, DEFAULT_SORTING_KEY);

const RenderRow = React.useCallback(
Expand Down Expand Up @@ -351,13 +352,8 @@ function Table({
}

const VolumeListTable = (props) => {
const {
nodeName,
volumeListData,
volumeName,
isNodeColumn,
isSearchBar,
} = props;
const { nodeName, volumeListData, volumeName, isNodeColumn, isSearchBar } =
props;
const history = useHistory();
const location = useLocation();
const intl = useIntl();
Expand Down Expand Up @@ -416,7 +412,6 @@ const VolumeListTable = (props) => {
paddingRight: '5px',
},
sortType: 'size',
Cell: ({ value }) => formatSizeForDisplay(value),
},
{
Header: 'Status',
Expand Down
27 changes: 10 additions & 17 deletions ui/src/components/VolumeOverviewTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
STATUS_WARNING,
LVM_LOGICAL_VOLUME,
} from '../constants';
import { Button, Modal, ProgressBar, Loader } from '@scality/core-ui';
import { Button, Modal, ProgressBar } from '@scality/core-ui';
import { useIntl } from 'react-intl';
import { VolumeTab } from './style/CommonLayoutStyle';
import { formatSizeForDisplay } from '../services/utils';
Expand Down Expand Up @@ -113,9 +113,6 @@ const ModalBody = styled.div`
const CancelButton = styled(Button)`
margin-right: ${padding.small};
`;
const LoaderContainer = styled(Loader)`
padding-left: ${padding.small};
`;

const LabelName = styled.span`
font-size: ${fontSize.small};
Expand Down Expand Up @@ -246,7 +243,7 @@ const VolumeDetailCard = (props) => {
{intl.formatMessage({ id: 'size' })}
</InformationLabel>
<InformationValue data-cy="volume_size_value">
{storageCapacity || intl.formatMessage({id: 'unknown'})}
{storageCapacity || intl.formatMessage({ id: 'unknown' })}
</InformationValue>
</InformationSpan>
<InformationSpan>
Expand Down Expand Up @@ -360,13 +357,12 @@ const VolumeDetailCard = (props) => {
/>
</AlertsCounterContainer>
)}
{condition === VOLUME_CONDITION_LINK && (
<VolumeUsage>
<VolumeSectionTitle>
{intl.formatMessage({ id: 'usage' })}
</VolumeSectionTitle>
{volumeUsagePercentage !==
intl.formatMessage({ id: 'unknown' }) ? (
{volumeUsagePercentage !== undefined &&
condition === VOLUME_CONDITION_LINK && (
<VolumeUsage>
<VolumeSectionTitle>
{intl.formatMessage({ id: 'usage' })}
</VolumeSectionTitle>
<ProgressBarContainer>
<ProgressBar
size="large"
Expand All @@ -380,11 +376,8 @@ const VolumeDetailCard = (props) => {
backgroundColor={theme.buttonSecondary}
/>
</ProgressBarContainer>
) : (
<LoaderContainer size="small" />
)}
</VolumeUsage>
)}
</VolumeUsage>
)}
</VolumeGraph>
<Modal
close={() => setisDeleteConfirmationModalOpen(false)}
Expand Down