-
Notifications
You must be signed in to change notification settings - Fork 21
feat: database storage #3829
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
Merged
Merged
feat: database storage #3829
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
83c5a0d
feat: database storage
astandrik b0067b0
fix: some fixes
astandrik 9e038f9
fix: review fixes
astandrik 25e2668
fix: review fixes
astandrik ff1fad1
fix: data space usage
astandrik d4432e2
fix: design fixes 1
astandrik 985fa47
fix: design review 2
astandrik 2c72d94
fix: tooltip
astandrik 06ddbdb
fix: refactor
astandrik b42b6ad
fix: design fixes
astandrik aa9d615
fix: design fixes
astandrik 1798637
fix: refine new storage layout and tooltips
astandrik 6fe846a
test: update new storage snapshots
astandrik ac47f66
test: update tenant storage screenshots
astandrik 99e79cc
test: add full tenant storage screenshots
astandrik e14c455
test: update tenant storage table screenshots
astandrik 2f78929
test: update tenant storage table snapshots
astandrik ddb1238
fix: address storage review feedback
astandrik 223531b
fix: handle unknown storage top row data
astandrik 5a7afc5
fix: handle tablet type storage fallbacks
astandrik 46077d7
Merge branch 'main' into astandrik.3779-2
astandrik b7f9087
fix: preserve aggregate storage breakdown
astandrik 94cfe86
fix: handle unknown tenant storage media
astandrik 41654b4
fix: classify old system tablet storage
astandrik 48b4528
Merge branch 'main' into astandrik.3779-2
astandrik 66f40d1
fix: handle aggregate tenant storage media
astandrik 7472fdd
fix: some formatting fixes
astandrik 25cb600
fix: display refactoring
astandrik fc4077c
fix: legacy storage
astandrik fa65b4e
fix: handle partial tenant storage breakdown
astandrik cc2acb2
fix: review fixes
astandrik e41d4c5
fix: review fix
astandrik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorageMode.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { | ||
| useCapabilitiesLoaded, | ||
| useNewStorageViewEnabled, | ||
| useStorageStatsAvailable, | ||
| } from '../../../../../store/reducers/capabilities/hooks'; | ||
|
|
||
| import {TenantStorage} from './TenantStorage'; | ||
| import {TenantStorageNew} from './TenantStorageNew'; | ||
| import type {TenantStorageProps} from './types'; | ||
|
|
||
| export function TenantStorageMode(props: TenantStorageProps) { | ||
| const capabilitiesLoaded = useCapabilitiesLoaded(); | ||
| const newStorageViewEnabled = useNewStorageViewEnabled(); | ||
| const storageStatsAvailable = useStorageStatsAvailable(); | ||
|
|
||
| const shouldUseLegacy = | ||
| props.databaseType === 'Serverless' || | ||
| !newStorageViewEnabled || | ||
| !capabilitiesLoaded || | ||
| !storageStatsAvailable; | ||
|
|
||
| if (shouldUseLegacy) { | ||
| return <TenantStorage {...props} />; | ||
| } | ||
|
|
||
| return <TenantStorageNew {...props} />; | ||
| } |
90 changes: 90 additions & 0 deletions
90
src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorageNew.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| .ydb-tenant-storage-new { | ||
| --ydb-storage-segment-row-tables: #5282ff; | ||
| --ydb-storage-segment-column-tables: #ff7112; | ||
| --ydb-storage-segment-topics: #ed2a7a; | ||
| --ydb-storage-segment-system: var(--g-color-base-generic-medium); | ||
| --ydb-storage-segment-unknown: var(--g-color-text-misc); | ||
|
|
||
| &__sections-group { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| &__sections-inner { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--g-spacing-3); | ||
| } | ||
|
|
||
| &__summary-skeleton-card { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--g-spacing-3); | ||
|
|
||
| padding: var(--g-spacing-4); | ||
|
|
||
| border-radius: var(--g-border-radius-xs); | ||
| background: var(--g-color-base-generic); | ||
| } | ||
|
|
||
| &__summary-skeleton-title { | ||
| width: 132px; | ||
| height: 28px; | ||
| } | ||
|
|
||
| &__summary-skeleton-description { | ||
| width: 224px; | ||
| height: 20px; | ||
| } | ||
|
|
||
| &__summary-skeleton-rows { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--g-spacing-3); | ||
| } | ||
|
|
||
| &__summary-skeleton-row { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--g-spacing-3); | ||
| } | ||
|
|
||
| &__summary-skeleton-header { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: flex-start; | ||
| gap: var(--g-spacing-4); | ||
| } | ||
|
|
||
| &__summary-skeleton-label { | ||
| width: 56px; | ||
| height: 24px; | ||
| } | ||
|
|
||
| &__summary-skeleton-metrics { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| justify-content: flex-end; | ||
| gap: var(--g-spacing-3); | ||
| } | ||
|
|
||
| &__summary-skeleton-metric { | ||
| width: 92px; | ||
| height: 42px; | ||
| } | ||
|
|
||
| &__summary-skeleton-progress { | ||
| width: 100%; | ||
| height: 20px; | ||
| } | ||
|
|
||
| &__summary-skeleton-footer { | ||
| display: flex; | ||
| justify-content: flex-end; | ||
| } | ||
|
|
||
| &__summary-skeleton-percent { | ||
| width: 76px; | ||
| height: 18px; | ||
| } | ||
| } |
140 changes: 140 additions & 0 deletions
140
src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorageNew.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| import React from 'react'; | ||
|
|
||
| import {Flex} from '@gravity-ui/uikit'; | ||
|
|
||
| import {ResponseError} from '../../../../../components/Errors/ResponseError'; | ||
| import {Skeleton} from '../../../../../components/Skeleton/Skeleton'; | ||
| import {cn} from '../../../../../utils/cn'; | ||
|
|
||
| import { | ||
| TenantStorageGroupedMediaSectionsView, | ||
| TenantStorageMediaSectionView, | ||
| } from './TenantStorageSummarySections'; | ||
| import {TenantStorageTopUsageTable} from './TenantStorageTopUsageTable'; | ||
| import type {TenantStorageProps} from './types'; | ||
| import {useTenantStorageNewData} from './useTenantStorageNewData'; | ||
| import {buildTenantStorageMediaSections} from './utils'; | ||
|
|
||
| import './TenantStorageNew.scss'; | ||
|
|
||
| const b = cn('ydb-tenant-storage-new'); | ||
|
|
||
| function TenantStorageSummarySkeleton({grouped}: {grouped: boolean}) { | ||
| const cardRowsCount = grouped ? 2 : 1; | ||
|
|
||
| return ( | ||
| <div className={b('sections-group')}> | ||
| <div className={b('sections-inner')}> | ||
| {[0, 1].map((cardIndex) => ( | ||
| <div key={cardIndex} className={b('summary-skeleton-card')}> | ||
| <Skeleton className={b('summary-skeleton-title')} delay={0} /> | ||
| <Skeleton className={b('summary-skeleton-description')} delay={0} /> | ||
| <div className={b('summary-skeleton-rows')}> | ||
| {Array.from({length: cardRowsCount}).map((_, rowIndex) => ( | ||
| <div key={rowIndex} className={b('summary-skeleton-row')}> | ||
| <div className={b('summary-skeleton-header')}> | ||
| {grouped ? ( | ||
| <Skeleton | ||
| className={b('summary-skeleton-label')} | ||
| delay={0} | ||
| /> | ||
| ) : ( | ||
| <div /> | ||
| )} | ||
| <div className={b('summary-skeleton-metrics')}> | ||
| {[0, 1, 2].map((metricIndex) => ( | ||
| <Skeleton | ||
| key={metricIndex} | ||
| className={b('summary-skeleton-metric')} | ||
| delay={0} | ||
| /> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| <Skeleton | ||
| className={b('summary-skeleton-progress')} | ||
| delay={0} | ||
| /> | ||
| <div className={b('summary-skeleton-footer')}> | ||
| <Skeleton | ||
| className={b('summary-skeleton-percent')} | ||
| delay={0} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export function TenantStorageNew({ | ||
| database, | ||
| databaseFullPath, | ||
| metrics, | ||
| blobStorageStats, | ||
| tabletStorageStats, | ||
| }: TenantStorageProps) { | ||
| const {currentData, data, error, isFetching} = useTenantStorageNewData({ | ||
| database, | ||
| databaseFullPath, | ||
| metrics, | ||
| }); | ||
| const loading = isFetching && currentData === undefined; | ||
| const mediaSections = React.useMemo(() => { | ||
| return buildTenantStorageMediaSections({ | ||
| blobStorageStats, | ||
| metrics, | ||
| tabletStorageStats, | ||
| }); | ||
| }, [blobStorageStats, metrics, tabletStorageStats]); | ||
|
|
||
| if (error && !currentData) { | ||
| return <ResponseError error={error} />; | ||
| } | ||
|
|
||
| const topRowsError = data.topRowsError ?? error; | ||
| const grouped = mediaSections.length > 1; | ||
|
|
||
| if (loading) { | ||
| return ( | ||
| <Flex direction="column" gap={4} className={b()}> | ||
| <TenantStorageSummarySkeleton grouped={grouped} /> | ||
| <TenantStorageTopUsageTable loading error={undefined} rows={[]} withData={false} /> | ||
| </Flex> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Flex direction="column" gap={4} className={b()}> | ||
| <div className={b('sections-group')}> | ||
| <div className={b('sections-inner')}> | ||
| {grouped ? ( | ||
| <TenantStorageGroupedMediaSectionsView | ||
| sections={mediaSections} | ||
| data={data} | ||
| /> | ||
| ) : ( | ||
| mediaSections.map((section, index) => ( | ||
| <TenantStorageMediaSectionView | ||
| key={`${section.mediaType}-${index}`} | ||
| section={section} | ||
| showMediaTypeLabel={false} | ||
| data={data} | ||
| /> | ||
| )) | ||
| )} | ||
| </div> | ||
| </div> | ||
| <TenantStorageTopUsageTable | ||
| loading={false} | ||
| error={topRowsError} | ||
| rows={data.topRows} | ||
| withData={Boolean(currentData)} | ||
| /> | ||
| </Flex> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.