Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Support display clusterId from master ui
### What changes are proposed in this pull request?

Display cluster Id in the master UI overview page, so that we can make
sure the the cluster identify.


![image](https://user-images.githubusercontent.com/17329931/124920057-7ff55e80-e029-11eb-8233-ffad24e7b799.png)


### Why are the changes needed?

Display the cluster id.

### Does this PR introduce any user facing changes?

Display the cluster id.

pr-link: #13765
change-id: cid-11c55b115ebf0d8728fcf5572a0abbe9eafe6410
  • Loading branch information
maobaolong committed Jul 12, 2021
1 parent 9d44081 commit af54be3
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 1 deletion.
22 changes: 22 additions & 0 deletions core/common/src/main/java/alluxio/wire/MasterWebUIOverview.java
Expand Up @@ -38,6 +38,7 @@ public final class MasterWebUIOverview implements Serializable {
private Map<Scope, List<InconsistentProperty>> mConfigCheckErrors;
private Map<Scope, List<InconsistentProperty>> mConfigCheckWarns;
private String mCapacity;
private String mClusterId;
private String mDiskCapacity;
private String mDiskFreeCapacity;
private String mDiskUsedCapacity;
Expand Down Expand Up @@ -66,6 +67,15 @@ public String getCapacity() {
return mCapacity;
}

/**
* Gets cluster id.
*
* @return the cluster id
*/
public String getClusterId() {
return mClusterId;
}

/**
* Gets config check error num.
*
Expand Down Expand Up @@ -244,6 +254,17 @@ public MasterWebUIOverview setCapacity(String capacity) {
return this;
}

/**
* Sets cluster id.
*
* @param clusterId the cluster id
* @return the updated {@link MasterWebUIOverview} instance
*/
public MasterWebUIOverview setClusterId(String clusterId) {
mClusterId = clusterId;
return this;
}

/**
* Sets config check error num.
*
Expand Down Expand Up @@ -455,6 +476,7 @@ public MasterWebUIOverview setConfigCheckWarnNum(int configCheckWarnNum) {
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("capacity", mCapacity)
.add("clusterId", mClusterId)
.add("configCheckErrorNum", mConfigCheckErrorNum)
.add("configCheckErrors", mConfigCheckErrors).add("configCheckStatus", mConfigCheckStatus)
.add("configCheckWarnNum", mConfigCheckWarnNum)
Expand Down
Expand Up @@ -260,10 +260,10 @@ public Response getWebUIOverview() {
.setVersion(RuntimeConstants.VERSION)
.setLiveWorkerNodes(Integer.toString(mBlockMaster.getWorkerCount()))
.setCapacity(FormatUtils.getSizeFromBytes(mBlockMaster.getCapacityBytes()))
.setClusterId(mMetaMaster.getClusterID())
.setUsedCapacity(FormatUtils.getSizeFromBytes(mBlockMaster.getUsedBytes()))
.setFreeCapacity(FormatUtils
.getSizeFromBytes(mBlockMaster.getCapacityBytes() - mBlockMaster.getUsedBytes()));

ConfigCheckReport report = mMetaMaster.getConfigCheckReport();
response.setConfigCheckStatus(report.getConfigStatus())
.setConfigCheckErrors(report.getConfigErrors())
Expand Down
4 changes: 4 additions & 0 deletions webui/master/src/containers/pages/Overview/Overview.tsx
Expand Up @@ -45,6 +45,10 @@ export class OverviewPresenter extends React.Component<AllProps> {
<th scope="row">Master Address</th>
<td>{data.masterNodeAddress}</td>
</tr>
<tr>
<th scope="row">Cluster Id</th>
<td>{data.clusterId}</td>
</tr>
<tr>
<th scope="row">Started</th>
<td>{data.startTime}</td>
Expand Down
Expand Up @@ -22,6 +22,14 @@ exports[`Overview Shallow component Matches snapshot 1`] = `
</th>
<td />
</tr>
<tr>
<th
scope="row"
>
Cluster Id
</th>
<td />
</tr>
<tr>
<th
scope="row"
Expand Down
1 change: 1 addition & 0 deletions webui/master/src/store/overview/reducer.tsx
Expand Up @@ -16,6 +16,7 @@ import { IOverviewState, OverviewActionTypes } from './types';
export const initialOverviewState: IOverviewState = {
data: {
capacity: '',
clusterId: '',
configCheckErrors: [],
configCheckStatus: '',
configCheckWarns: [],
Expand Down
1 change: 1 addition & 0 deletions webui/master/src/store/overview/types.tsx
Expand Up @@ -16,6 +16,7 @@ import { IScopedPropertyInfo, IStorageTierInfo } from '../../constants';
export interface IOverview {
debug: boolean;
capacity: string;
clusterId: string;
configCheckErrors: IScopedPropertyInfo[];
configCheckStatus: string;
configCheckWarns: IScopedPropertyInfo[];
Expand Down

0 comments on commit af54be3

Please sign in to comment.