- {isLoading ?
Loading... : (
-
-
-
-
-
-
-
-
Path
-
-
-
-
-
-
-
-
-
-
-
-
+ {isLoading
+ ?
Loading...
+ : (
+
+
+
+
+
+
+
+
Path
+
+
+
+
+
-
-
-
- {(duResponse.size > 0) ?
-
-
this.clickPieSection(e, returnPath)}/>
+
+
+
+
+
+
+
+
+
+
+
+ {(duResponse.size > 0) ?
+
+ this.clickPieSection(e, returnPath)
+ } />
+
:
-
- This object is empty. Add files to it to see a visualization on disk usage.{' '}
+
+ This object is empty. Add files to it to see a visualization on disk usage.{' '}
You can also view its metadata details by clicking the top right button.
-
}
-
-
- )}
+
}
+
+
+
)}
);
diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/constants/heatmapConstants.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/constants/heatmapConstants.tsx
index 2bb3d15b3500..c34bc0110fd4 100644
--- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/constants/heatmapConstants.tsx
+++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/constants/heatmapConstants.tsx
@@ -18,4 +18,4 @@
export const TIME_PERIODS: string[] = ['24H', '7D', '90D']
export const ENTITY_TYPES: string[] = ['key', 'bucket', 'volume']
-export const ROOT_PATH:string = '/'
+export const ROOT_PATH: string = '/'
diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatMapConfiguration.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatMapConfiguration.tsx
index ba184a42a894..67dd6be6bc0e 100644
--- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatMapConfiguration.tsx
+++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatMapConfiguration.tsx
@@ -18,7 +18,8 @@
import React from 'react';
import { AgChartsReact } from 'ag-charts-react';
-import { byteToSize } from 'utils/common';
+
+import { byteToSize } from '@/utils/common';
interface ITreeResponse {
label: string;
@@ -37,7 +38,7 @@ interface IChildren {
}
interface IHeatmapConfigurationProps {
- data: ITreeResponse[];
+ data: ITreeResponse | ITreeResponse[];
onClick: Function;
colorScheme: string[];
}
@@ -124,7 +125,7 @@ export default class HeatMapConfiguration extends React.Component
Entity Name:
${params.datum.label ? params.datum.label.split("/").slice(-1) : ""}
diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.less b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.less
index b16d1ed20ff4..25bddb1625ed 100644
--- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.less
+++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.less
@@ -19,12 +19,15 @@
.heatmap-container {
.heatmap-header-container {
- height: 7vh;
display: flex;
justify-content: space-between;
align-items: stretch;
margin: 10px 15px 20px 15px;
+ @media (max-width: 1680px) {
+ flex-direction: column;
+ }
+
.go-back-button {
display: inline-block;
}
diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.tsx
index 3d9280a11767..9a80864be1d1 100644
--- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.tsx
+++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/heatMap/heatmap.tsx
@@ -16,16 +16,32 @@
* limitations under the License.
*/
import React from 'react';
-import { Row, Icon, Button, Input, Dropdown, Menu, DatePicker, Form, Result } from 'antd';
-import { DownOutlined } from '@ant-design/icons';
import moment from 'moment';
-import { showDataFetchError } from 'utils/common';
-import './heatmap.less';
+import {
+ Row,
+ Button,
+ Input,
+ Dropdown,
+ Menu,
+ DatePicker,
+ Form,
+ Result
+} from 'antd';
+import {
+ DownOutlined,
+ LoadingOutlined,
+ UndoOutlined
+} from '@ant-design/icons';
+import { MenuProps } from 'antd/es/menu';
+
+import { showDataFetchError } from '@/utils/common';
+import { AxiosGetHelper } from '@/utils/axiosRequestHelper';
import HeatMapConfiguration from './heatMapConfiguration';
import * as CONSTANTS from './constants/heatmapConstants';
-import { AxiosGetHelper } from 'utils/axiosRequestHelper';
-type inputPathValidity = "" | "error" | "success" | "warning" | "validating" | undefined
+import './heatmap.less';
+
+type inputPathValidity = '' | 'error' | 'success' | 'warning' | 'validating' | undefined
interface ITreeResponse {
label: string;
@@ -45,18 +61,18 @@ interface IChildren {
interface ITreeState {
isLoading: boolean;
- treeResponse: ITreeResponse[];
+ treeResponse: ITreeResponse | ITreeResponse[];
inputRadio: number;
inputPath: string;
entityType: string;
- date: string;
+ date: string | number;
treeEndpointFailed: boolean;
inputPathValid: inputPathValidity;
helpMessage: string;
isHeatmapEnabled: boolean;
}
-interface ResponseError extends Error {
+interface IResponseError extends Error {
status?: number;
}
@@ -64,7 +80,7 @@ let minSize = Infinity;
let maxSize = 0;
const colourScheme = {
- amber_alert: [
+ amberAlert: [
'#FFCF88',
'#FFCA87',
'#FFC586',
@@ -102,37 +118,11 @@ export class Heatmap extends React.Component
, ITreeState>
date: CONSTANTS.TIME_PERIODS[0],
treeEndpointFailed: false,
inputPathValid: undefined,
- helpMessage: "",
+ helpMessage: '',
isHeatmapEnabled: this.props.location.state ? this.props.location.state.isHeatmapEnabled : false
};
}
- handleCalendarChange = (e: any) => {
- if (CONSTANTS.TIME_PERIODS.includes(e.key)) {
- this.setState((prevState, _newState) => ({
- date: e.key,
- inputPath: prevState.inputPath,
- entityType: prevState.entityType
- }), () => {
- this.updateTreeMap(this.state.inputPath, this.state.entityType, this.state.date);
- });
- }
- };
-
- handleMenuChange = (e: any) => {
- if (CONSTANTS.ENTITY_TYPES.includes(e.key)) {
- minSize = Infinity;
- maxSize = 0;
- this.setState((prevState, _newState) => ({
- entityType: e.key,
- date: prevState.date,
- inputPath: prevState.inputPath
- }), () => {
- this.updateTreeMap(this.state.inputPath, this.state.entityType, this.state.date);
- });
- }
- };
-
handleChange = (e: any) => {
const value = e.target.value;
let inputValid = "";
@@ -166,12 +156,11 @@ export class Heatmap extends React.Component, ITreeState>
const { request, controller } = AxiosGetHelper(treeEndpoint, cancelHeatmapSignal)
cancelHeatmapSignal = controller;
request.then(response => {
- if (response && response.status === 200)
- {
+ if (response && response.status === 200) {
minSize = this.minmax(response.data)[0];
maxSize = this.minmax(response.data)[1];
- let treeResponse: ITreeResponse = this.updateSize(response.data);
- console.log("Final treeResponse--", treeResponse);
+ const treeResponse: ITreeResponse = this.updateSize(response.data);
+ console.log('Final treeResponse--', treeResponse);
this.setState({
isLoading: false,
isHeatmapEnabled: true,
@@ -179,7 +168,7 @@ export class Heatmap extends React.Component, ITreeState>
});
}
else {
- let error = new Error((response.status).toString()) as ResponseError;
+ const error = new Error((response.status).toString()) as IResponseError;
error.status = response.status;
error.message = `Failed to fetch Heatmap Response with status ${error.status}`
throw error;
@@ -205,7 +194,7 @@ export class Heatmap extends React.Component, ITreeState>
}
};
- updateTreemapParent = (path: any) => {
+ updateTreemapParent = (path: string) => {
this.setState({
isLoading: true,
inputPath: path
@@ -215,7 +204,7 @@ export class Heatmap extends React.Component, ITreeState>
};
componentDidMount(): void {
-
+
this.setState({
isLoading: true
});
@@ -227,16 +216,6 @@ export class Heatmap extends React.Component, ITreeState>
cancelHeatmapSignal && cancelHeatmapSignal.abort()
}
- onChange = (date: any[]) => {
- this.setState(prevState => ({
- date: moment(date).unix(),
- entityType: prevState.entityType,
- inputPath: prevState.inputPath
- }), () => {
- this.updateTreeMap(this.state.inputPath, this.state.entityType, this.state.date);
- });
- };
-
disabledDate(current: any) {
return current > moment() || current < moment().subtract(90, 'day');
}
@@ -252,7 +231,7 @@ export class Heatmap extends React.Component, ITreeState>
}
};
- minmax = (obj :any) => {
+ minmax = (obj: any) => {
//min max property will get applied to only for leaf level which we are showing on UI.
if (obj.hasOwnProperty('children')) {
obj.children.forEach((child: any) => this.minmax(child))
@@ -275,13 +254,12 @@ export class Heatmap extends React.Component, ITreeState>
} else if (obj && obj.size === 0 && obj.maxAccessCount === 0) {
obj['normalizedSize'] = 0;
}
- else if (obj && obj.size === 0 && (obj.accessCount >= 0 || obj.maxAccessCount >= 0))
- {
+ else if (obj && obj.size === 0 && (obj.accessCount >= 0 || obj.maxAccessCount >= 0)) {
obj['normalizedSize'] = 1;
obj.size = 0;
}
else {
- let newSize = this.normalize(minSize, maxSize, obj.size);
+ const newSize = this.normalize(minSize, maxSize, obj.size);
obj['normalizedSize'] = newSize;
}
}
@@ -323,10 +301,51 @@ export class Heatmap extends React.Component, ITreeState>
treeEndpointFailed,
inputPathValid,
helpMessage } = this.state;
+
+ const handleDatePickerChange = (date: moment.MomentInput) => {
+ this.setState(prevState => ({
+ date: moment(date).unix(),
+ entityType: prevState.entityType,
+ inputPath: prevState.inputPath
+ }), () => {
+ this.updateTreeMap(
+ this.state.inputPath,
+ this.state.entityType,
+ this.state.date as string);
+ });
+ };
+
+ const handleMenuChange: MenuProps["onClick"] = (e: any) => {
+ if (CONSTANTS.ENTITY_TYPES.includes(e.key as string)) {
+ minSize = Infinity;
+ maxSize = 0;
+ this.setState((prevState, _newState) => ({
+ entityType: e.key as string,
+ date: prevState.date,
+ inputPath: prevState.inputPath
+ }), () => {
+ this.updateTreeMap(this.state.inputPath, this.state.entityType, this.state.date);
+ });
+ }
+ };
+
+ const handleCalendarChange: MenuProps["onClick"] = (e: any) => {
+ if (CONSTANTS.TIME_PERIODS.includes(e.key)) {
+ this.setState((prevState, _newState) => ({
+ date: e.key,
+ inputPath: prevState.inputPath,
+ entityType: prevState.entityType
+ }), () => {
+ this.updateTreeMap(this.state.inputPath, this.state.entityType, this.state.date);
+ });
+ }
+ };
+
const menuCalendar = (