-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-11160. Improve Insights page UI #7327
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3db1f3d
HDDS-11160. Improve Insights page UI
devabhishekpal 01cefcb
Added new type and updated db.json with accurate open keys response
devabhishekpal 71fd58f
Add search filter
devabhishekpal c81c344
addressed review comments
devabhishekpal 8add6c2
Fixed review comments
devabhishekpal 3158153
Fixed data duplication issue
devabhishekpal 1230f55
Added info tooltip to the Exist at column
devabhishekpal 313cf4c
Fixed sorting for the plot
devabhishekpal 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
643 changes: 261 additions & 382 deletions
643
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
55 changes: 55 additions & 0 deletions
55
...ain/resources/webapps/recon/ozone-recon-web/src/v2/components/breadcrumbs/breadcrumbs.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,55 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { Breadcrumb } from 'antd'; | ||
| import { HomeOutlined } from '@ant-design/icons'; | ||
| import { Link, useLocation } from 'react-router-dom'; | ||
|
|
||
| import { breadcrumbNameMap } from '@/v2/constants/breadcrumbs.constants'; | ||
|
|
||
| const Breadcrumbs: React.FC<{}> = () => { | ||
| const location = useLocation(); | ||
| //Split and filter to remove empty strings | ||
| const pathSnippets = location.pathname.split('/').filter(i => i); | ||
|
|
||
| const extraBreadcrumbItems = pathSnippets.map((_: string, index: number) => { | ||
| const url = `/${pathSnippets.slice(0, index + 1).join('/')}`; | ||
| return ( | ||
| <Breadcrumb.Item key={url}> | ||
| <Link to={url}> | ||
| {breadcrumbNameMap[url]} | ||
| </Link> | ||
| </Breadcrumb.Item> | ||
| ) | ||
| }); | ||
|
|
||
| const breadcrumbItems = [( | ||
| <Breadcrumb.Item key='home'> | ||
| <Link to='/'><HomeOutlined /></Link> | ||
| </Breadcrumb.Item> | ||
| )].concat(extraBreadcrumbItems); | ||
|
|
||
| return ( | ||
| <Breadcrumb> | ||
| {breadcrumbItems} | ||
| </Breadcrumb> | ||
| ); | ||
| } | ||
|
|
||
| export default Breadcrumbs; |
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
File renamed without changes.
149 changes: 149 additions & 0 deletions
149
...resources/webapps/recon/ozone-recon-web/src/v2/components/plots/insightsContainerPlot.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,149 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import filesize from 'filesize'; | ||
| import { EChartsOption } from 'echarts'; | ||
|
|
||
| import EChart from '@/v2/components/eChart/eChart'; | ||
| import { ContainerCountResponse, ContainerPlotData } from '@/v2/types/insights.types'; | ||
|
|
||
| type ContainerSizeDistributionProps = { | ||
| containerCountResponse: ContainerCountResponse[]; | ||
| containerSizeError: string | undefined; | ||
| } | ||
|
|
||
| const size = filesize.partial({ standard: 'iec', round: 0 }); | ||
|
|
||
| const ContainerSizeDistribution: React.FC<ContainerSizeDistributionProps> = ({ | ||
| containerCountResponse, | ||
| containerSizeError | ||
| }) => { | ||
|
|
||
| const [containerPlotData, setContainerPlotData] = React.useState<ContainerPlotData>({ | ||
| containerCountValues: [], | ||
| containerCountMap: new Map<number, number>() | ||
| }); | ||
|
|
||
| function updatePlotData() { | ||
| const containerCountMap: Map<number, number> = containerCountResponse.reduce( | ||
| (map: Map<number, number>, current) => { | ||
| const containerSize = current.containerSize; | ||
| const oldCount = map.get(containerSize) ?? 0; | ||
| map.set(containerSize, oldCount + current.count); | ||
| return map; | ||
| }, | ||
| new Map<number, number>() | ||
| ); | ||
|
|
||
| const containerCountValues = Array.from(containerCountMap.keys()).map(value => { | ||
| const upperbound = size(value); | ||
| const upperboundPwr = Math.log2(value); | ||
|
|
||
| const lowerbound = upperboundPwr > 10 ? size(2 ** (upperboundPwr - 1)) : size(0); | ||
| return `${lowerbound} - ${upperbound}`; | ||
| }); | ||
|
|
||
| setContainerPlotData({ | ||
| containerCountValues: containerCountValues, | ||
| containerCountMap: containerCountMap | ||
| }); | ||
| } | ||
|
|
||
| React.useEffect(() => { | ||
| updatePlotData(); | ||
| }, []); | ||
|
|
||
| const { containerCountMap, containerCountValues } = containerPlotData; | ||
|
|
||
| const containerPlotOptions: EChartsOption = { | ||
| tooltip: { | ||
| trigger: 'item', | ||
| formatter: ({ data }) => { | ||
| return `Size Range: <strong>${data.name}</strong><br>Count: <strong>${data.value}</strong>` | ||
| } | ||
| }, | ||
| legend: { | ||
| orient: 'vertical', | ||
| left: 'right' | ||
| }, | ||
| series: { | ||
| type: 'pie', | ||
| radius: '50%', | ||
| data: Array.from(containerCountMap?.values() ?? []).map((value, idx) => { | ||
| return { | ||
| value: value, | ||
| name: containerCountValues[idx] ?? '' | ||
| } | ||
| }), | ||
| }, | ||
| graphic: (containerSizeError) ? { | ||
| type: 'group', | ||
| left: 'center', | ||
| top: 'middle', | ||
| z: 100, | ||
| children: [ | ||
| { | ||
| type: 'rect', | ||
| left: 'center', | ||
| top: 'middle', | ||
| z: 100, | ||
| shape: { | ||
| width: 500, | ||
| height: 500 | ||
| }, | ||
| style: { | ||
| fill: 'rgba(256, 256, 256, 0.5)' | ||
| } | ||
| }, | ||
| { | ||
| type: 'rect', | ||
| left: 'center', | ||
| top: 'middle', | ||
| z: 100, | ||
| shape: { | ||
| width: 500, | ||
| height: 40 | ||
| }, | ||
| style: { | ||
| fill: '#FC909B' | ||
| } | ||
| }, | ||
| { | ||
| type: 'text', | ||
| left: 'center', | ||
| top: 'middle', | ||
| z: 100, | ||
| style: { | ||
| text: `No data available. ${containerSizeError}`, | ||
| font: '20px sans-serif' | ||
| } | ||
| } | ||
| ] | ||
| } : undefined | ||
| } | ||
|
|
||
| return (<> | ||
| <EChart option={containerPlotOptions} style={{ | ||
| width: '30vw', | ||
| height: '65vh' | ||
| }} /> | ||
| </>) | ||
| } | ||
|
|
||
| export default ContainerSizeDistribution; |
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.