ivandika3 commented on code in PR #4585: URL: https://github.com/apache/ozone/pull/4585#discussion_r1337963918
########## hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/volumes/volumes.tsx: ########## @@ -0,0 +1,422 @@ +/* + * 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 {Table} from 'antd'; +import {PaginationConfig} from 'antd/lib/pagination'; +import moment from 'moment'; +import './volumes.less'; +import {AutoReloadHelper} from 'utils/autoReloadHelper'; +import AutoReloadPanel from 'components/autoReloadPanel/autoReloadPanel'; +import {MultiSelect, IOption} from 'components/multiSelect/multiSelect'; +import {ActionMeta, ValueType} from 'react-select'; +import {byteToSize, showDataFetchError} from 'utils/common'; +import {ColumnSearch} from 'utils/columnSearch'; +import {IAcl, IBucket, IVolume} from 'types/om.types'; +import {AclPanel} from '../../components/aclDrawer/aclDrawer'; +import {ColumnProps} from 'antd/es/table'; +import QuotaBar from '../../components/quotaBar/quotaBar'; +import {Link} from 'react-router-dom'; +import CreatableSelect from 'react-select/creatable'; +import {AxiosGetHelper} from "../../utils/axiosRequestHelper"; + +interface IVolumeResponse { + volume: string; + owner: string; + admin: string; + creationTime: number; + modificationTime: number; + quotaInBytes: number; + quotaInNamespace: number; + usedNamespace: number; + acls: IAcl[]; +} + +type VolumnTableColumn = ColumnProps<any> & any; + +interface IVolumesResponse { + totalCount: number; + volumes: IVolumeResponse[]; +} + +interface IVolumesState { + loading: boolean; + dataSource: IVolume[]; + totalCount: number; + lastUpdated: number; + selectedColumns: IOption[]; + columnOptions: IOption[]; + currentRow?: IVolume; + showPanel: boolean; + selectedLimit: IOption; +} + +const COLUMNS: VolumnTableColumn[] = [ + { + title: 'Volume', + dataIndex: 'volume', + key: 'volume', + isVisible: true, + isSearchable: true, + sorter: (a: IVolume, b: IVolume) => a.volume.localeCompare(b.volume), + defaultSortOrder: 'ascend' as const, + fixed: 'left' + }, + { + title: 'Owner', + dataIndex: 'owner', + key: 'owner', + isVisible: true, + isSearchable: true, + sorter: (a: IVolume, b: IVolume) => a.owner.localeCompare(b.owner) + }, + { + title: 'Admin', + dataIndex: 'admin', + key: 'admin', + isVisible: true, + isSearchable: true, + sorter: (a: IVolume, b: IVolume) => a.admin.localeCompare(b.admin) + }, + { + title: 'Creation Time', + dataIndex: 'creationTime', + key: 'creationTime', + isVisible: true, + sorter: (a: IVolume, b: IVolume) => a.creationTime - b.creationTime, + render: (creationTime: number) => { + return creationTime > 0 ? moment(creationTime).format('ll LTS') : 'NA'; + } + }, + { + title: 'Modification Time', + dataIndex: 'modificationTime', + key: 'modificationTime', + isVisible: true, + sorter: (a: IVolume, b: IVolume) => a.modificationTime - b.modificationTime, + render: (modificationTime: number) => { + return modificationTime > 0 ? moment(modificationTime).format('ll LTS') : 'NA'; + } + }, + { + title: 'Quota (Size)', + dataIndex: 'quotaInBytes', + key: 'quotaInBytes', + isVisible: true, + render: (quotaInBytes: number) => { + return quotaInBytes && quotaInBytes !== -1 ? byteToSize(quotaInBytes, 3) : 'NA'; + } + }, + { + title: 'Namespace Capacity', + key: 'namespaceCapacity', + isVisible: true, + sorter: (a: IVolume, b: IVolume) => a.usedNamespace - b.usedNamespace, + render: (text: string, record: IBucket) => ( + <QuotaBar + quota={record.quotaInNamespace} + used={record.usedNamespace} + quotaType='namespace' + /> + ) + }, + { + title: 'Buckets', + key: 'listBuckets', + isVisible: true, + render: (_: any, record: IVolume) => { + const searchParams = new URLSearchParams(); + searchParams.append('volume', record.volume); + + return ( + <Link to={`/Buckets?${searchParams.toString()}`}> Review Comment: Thanks for the review. Yes, you are right. Updated as suggested. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
