forked from apache/ozone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HDDS-11157. Improve Datanodes page UI (apache#7168)
- Loading branch information
1 parent
151709a
commit 70b8dd5
Showing
10 changed files
with
1,064 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
139 changes: 139 additions & 0 deletions
139
...recon/ozone-recon-web/src/v2/components/decommissioningSummary/decommissioningSummary.tsx
This file contains 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,139 @@ | ||
/* | ||
* 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, { useEffect } from 'react'; | ||
import { AxiosError } from 'axios'; | ||
import { Descriptions, Popover, Result } from 'antd'; | ||
import { SummaryData } from '@/v2/types/datanode.types'; | ||
import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper'; | ||
import { showDataFetchError } from '@/utils/common'; | ||
import Spin from 'antd/es/spin'; | ||
|
||
type DecommisioningSummaryProps = { | ||
uuid: string; | ||
} | ||
|
||
type DecommisioningSummaryState = { | ||
loading: boolean; | ||
summaryData: SummaryData | Record<string, unknown>; | ||
}; | ||
|
||
function getDescriptions(summaryData: SummaryData): React.ReactElement { | ||
const { | ||
datanodeDetails: { | ||
uuid, | ||
networkLocation, | ||
ipAddress, | ||
hostName | ||
}, | ||
containers: { UnderReplicated, UnClosed }, | ||
metrics: { | ||
decommissionStartTime, | ||
numOfUnclosedPipelines, | ||
numOfUnclosedContainers, | ||
numOfUnderReplicatedContainers | ||
} | ||
} = summaryData; | ||
return ( | ||
<Descriptions size="small" bordered column={1} title={`Decommission Status: DECOMMISSIONING`}> | ||
<Descriptions.Item label="Datanode"> <b>{uuid}</b></Descriptions.Item> | ||
<Descriptions.Item label="Location">({networkLocation}/{ipAddress}/{hostName})</Descriptions.Item> | ||
<Descriptions.Item label="Decommissioning Started at">{decommissionStartTime}</Descriptions.Item> | ||
<Descriptions.Item label="No. of Unclosed Pipelines">{numOfUnclosedPipelines}</Descriptions.Item> | ||
<Descriptions.Item label="No. of Unclosed Containers">{numOfUnclosedContainers}</Descriptions.Item> | ||
<Descriptions.Item label="No. of Under-Replicated Containers">{numOfUnderReplicatedContainers}</Descriptions.Item> | ||
<Descriptions.Item label="Under-Replicated">{UnderReplicated}</Descriptions.Item> | ||
<Descriptions.Item label="Unclosed">{UnClosed}</Descriptions.Item> | ||
</Descriptions> | ||
); | ||
} | ||
|
||
|
||
const DecommissionSummary: React.FC<DecommisioningSummaryProps> = ({ | ||
uuid = '' | ||
}) => { | ||
const [state, setState] = React.useState<DecommisioningSummaryState>({ | ||
summaryData: {}, | ||
loading: false | ||
}); | ||
const cancelSignal = React.useRef<AbortController>(); | ||
let content = ( | ||
<Spin | ||
size='large' | ||
style={{ margin: '15px 15px 10px 15px' }} /> | ||
); | ||
|
||
async function fetchDecommissionSummary(selectedUuid: string) { | ||
setState({ | ||
...state, | ||
loading: true | ||
}); | ||
try { | ||
const { request, controller } = AxiosGetHelper( | ||
`/api/v1/datanodes/decommission/info/datanode?uuid=${selectedUuid}`, | ||
cancelSignal.current | ||
); | ||
cancelSignal.current = controller; | ||
const datanodesInfoResponse = await request; | ||
setState({ | ||
...state, | ||
loading: false, | ||
summaryData: datanodesInfoResponse?.data?.DatanodesDecommissionInfo[0] ?? {} | ||
}); | ||
} catch (error) { | ||
setState({ | ||
...state, | ||
loading: false, | ||
summaryData: {} | ||
}); | ||
showDataFetchError((error as AxiosError).toString()); | ||
content = ( | ||
<Result | ||
status='error' | ||
title='Unable to fetch Decommission Summary data' | ||
className='decommission-summary-result' /> | ||
) | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
fetchDecommissionSummary(uuid); | ||
return (() => { | ||
cancelRequests([cancelSignal.current!]); | ||
}) | ||
}, []); | ||
|
||
const { summaryData } = state; | ||
if (summaryData?.datanodeDetails | ||
&& summaryData?.metrics | ||
&& summaryData?.containers | ||
) { | ||
content = getDescriptions(summaryData as SummaryData); | ||
} | ||
|
||
return ( | ||
<Popover | ||
content={content} | ||
placement="rightTop" trigger="hover"> | ||
{uuid} | ||
</Popover> | ||
); | ||
|
||
} | ||
|
||
export default DecommissionSummary; |
45 changes: 45 additions & 0 deletions
45
...main/resources/webapps/recon/ozone-recon-web/src/v2/components/storageBar/storageBar.less
This file contains 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,45 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
@progress-gray: #d0d0d0; | ||
@progress-light-blue: rgb(230, 235, 248); | ||
@progress-blue: #1890ff; | ||
@progress-green: #52c41a; | ||
@progress-red: #FFA39E; | ||
|
||
.storage-cell-container-v2 { | ||
.capacity-bar-v2 { | ||
font-size: 1em; | ||
} | ||
} | ||
|
||
.ozone-used-bg-v2 { | ||
color: @progress-green !important; | ||
} | ||
|
||
.non-ozone-used-bg-v2 { | ||
color: @progress-blue !important; | ||
} | ||
|
||
.remaining-bg-v2 { | ||
color: @progress-light-blue !important; | ||
} | ||
|
||
.committed-bg-v2 { | ||
color: @progress-red !important; | ||
} |
This file contains 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
Oops, something went wrong.