-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-11155. Improve Volumes page UI #7048
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
16 commits
Select commit
Hold shift + click to select a range
e490df6
Initial Volumes commit
devabhishekpal ea01ce6
Addressed review comments
devabhishekpal d935fca
Removed console logs
devabhishekpal 2994f28
Refactored dead code, reverted separate tag row for selection
devabhishekpal 4fb6941
Added simple loader, removed unused imports
devabhishekpal 6937a05
Removed unused totalCount, added search for Admin column
devabhishekpal 1347224
Addressed review comments
devabhishekpal 6923654
Added default value for searchOptions
devabhishekpal 81980f7
Added comments for default props
devabhishekpal 4947f05
Fixed ValueContainer not triggering dropdown
devabhishekpal 40c2588
Added component comments, addressed ACL drawer not closing properly
devabhishekpal 021c6d6
Migrated fix for select dropdown on isSearchable false
devabhishekpal ff742d9
Disable the disable switch
devabhishekpal 5858ec2
Add suspense on routes
devabhishekpal 94c1798
Ignore network cancelled requests
devabhishekpal 837304d
Removed manual search, added debounce to auto search
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
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
119 changes: 119 additions & 0 deletions
119
...rc/main/resources/webapps/recon/ozone-recon-web/src/v2/components/aclDrawer/aclDrawer.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,119 @@ | ||
| /* | ||
| * 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, useState } from 'react'; | ||
| import { Table, Drawer, Tag } from 'antd'; | ||
|
|
||
| import { AclRightsColorMap, AclIdColorMap } from '@/v2/constants/acl.constants'; | ||
| import { Acl, ACLIdentity, ACLIdentityTypeList } from '@/v2/types/acl.types'; | ||
| import { ColumnType } from 'antd/es/table'; | ||
|
|
||
| // ------------- Types -------------- // | ||
| type AclDrawerProps = { | ||
| visible: boolean; | ||
| acls: Acl[] | undefined; | ||
| entityName: string; | ||
| entityType: string; | ||
| onClose: () => void; | ||
| } | ||
|
|
||
|
|
||
| // ------------- Component -------------- // | ||
| const AclPanel: React.FC<AclDrawerProps> = ({ | ||
| visible, | ||
| acls, | ||
| entityType, | ||
| entityName, | ||
| onClose | ||
| }) => { | ||
| const [isVisible, setIsVisible] = useState<boolean>(false); | ||
|
|
||
| useEffect(() => { | ||
| setIsVisible(visible); | ||
| }, [visible]); | ||
|
|
||
| const renderAclList = (_: string, acl: Acl) => { | ||
| return acl.aclList.map(aclRight => ( | ||
| <Tag key={aclRight} color={AclRightsColorMap[aclRight as keyof typeof AclRightsColorMap]}> | ||
| {aclRight} | ||
| </Tag> | ||
| )) | ||
| } | ||
|
|
||
| const renderAclIdentityType = (acl: string) => { | ||
| return ( | ||
| <Tag color={AclIdColorMap[acl as keyof typeof AclIdColorMap]}> | ||
| {acl} | ||
| </Tag> | ||
| ) | ||
| } | ||
|
|
||
| const COLUMNS: ColumnType<Acl>[] = [ | ||
| { | ||
| title: 'Name', | ||
| dataIndex: 'name', | ||
| key: 'name', | ||
| sorter: (a: Acl, b: Acl) => a.name.localeCompare(b.name), | ||
| }, | ||
| { | ||
| title: 'ACL Type', | ||
| dataIndex: 'type', | ||
| key: 'type', | ||
| filterMultiple: true, | ||
| filters: ACLIdentityTypeList.map(state => ({ text: state, value: state })), | ||
| onFilter: (value: ACLIdentity, record: Acl) => (record.type === value), | ||
| sorter: (a: Acl, b: Acl) => a.type.localeCompare(b.type), | ||
| render: renderAclIdentityType | ||
| }, | ||
| { | ||
| title: 'ACL Scope', | ||
| dataIndex: 'scope', | ||
| key: 'scope', | ||
| }, | ||
| { | ||
| title: 'ACLs', | ||
| dataIndex: 'aclList', | ||
| key: 'acls', | ||
| render: renderAclList | ||
| } | ||
| ]; | ||
|
|
||
| return ( | ||
| <div className='site-drawer-render-in-current-wrapper'> | ||
| <Drawer | ||
| title={`ACL for ${entityType} ${entityName}`} | ||
| placement='right' | ||
| width='40%' | ||
| closable={true} | ||
| visible={isVisible} | ||
| getContainer={false} | ||
| style={{ position: 'absolute' }} | ||
| onClose={onClose} | ||
| > | ||
| <Table | ||
| dataSource={acls} | ||
| rowKey='name' | ||
| locale={{ filterTitle: '' }} | ||
| columns={COLUMNS}> | ||
| </Table> | ||
| </Drawer> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AclPanel; |
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
40 changes: 40 additions & 0 deletions
40
...econ/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/loader/loader.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,40 @@ | ||
| /* | ||
| * 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 { Spin } from "antd" | ||
| import { LoadingOutlined } from "@ant-design/icons" | ||
|
|
||
| // ------------- Constants -------------- // | ||
| const loaderStyle: React.CSSProperties = { | ||
| height: '100%', | ||
| width: '100%', | ||
| textAlign: 'center', | ||
| paddingTop: '25%' | ||
| } | ||
|
|
||
| // ------------- Component -------------- // | ||
| const Loader: React.FC = () => { | ||
| return ( | ||
| <div style={loaderStyle}> | ||
| <Spin indicator={<LoadingOutlined style={{ color: '#1AA57A', fontSize: 48}} spin/>}/> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default Loader; |
70 changes: 70 additions & 0 deletions
70
...econ/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/search/search.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,70 @@ | ||
| /* | ||
| * 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 { Input, Select } from 'antd'; | ||
|
|
||
| import { Option } from '@/v2/components/select/singleSelect'; | ||
devabhishekpal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // ------------- Types -------------- // | ||
| type SearchProps = { | ||
| searchColumn?: string; | ||
| searchInput: string; | ||
| searchOptions?: Option[]; | ||
devabhishekpal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| onSearchChange: ( | ||
| arg0: React.ChangeEvent<HTMLInputElement> | ||
| ) => void; | ||
| onChange: ( | ||
| value: string, | ||
| //OptionType, OptionGroupData and OptionData are not | ||
| //currently exported by AntD hence set to any | ||
| option: any | ||
| ) => void; | ||
| } | ||
|
|
||
| // ------------- Component -------------- // | ||
| const Search: React.FC<SearchProps> = ({ | ||
| searchColumn, | ||
| searchInput = '', | ||
| searchOptions = [], | ||
| onSearchChange = () => {}, | ||
| onChange = () => {} // Assign default value as a void function | ||
| }) => { | ||
|
|
||
| const selectFilter = searchColumn | ||
| ? (<Select | ||
| defaultValue={searchColumn} | ||
| options={searchOptions} | ||
| onChange={onChange} />) | ||
| : null | ||
|
|
||
| return ( | ||
| <Input | ||
| placeholder='Enter Search text' | ||
| allowClear={true} | ||
| value={searchInput} | ||
| addonBefore={selectFilter} | ||
| onChange={onSearchChange} | ||
| size='middle' | ||
| style={{ | ||
| maxWidth: 400 | ||
| }}/> | ||
| ) | ||
| } | ||
|
|
||
| export default Search; | ||
67 changes: 67 additions & 0 deletions
67
...n/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/select/columnTag.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,67 @@ | ||
| /* | ||
| * 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 { Tag } from "antd"; | ||
| import { createPortal } from "react-dom"; | ||
|
|
||
|
|
||
| // ------------- Types -------------- // | ||
| /** | ||
| * Due to design decisions we are currently not using the Tags | ||
| * Until we reach a concensus on a better way to display the filter | ||
| * Keeping the code in case we require it in the future | ||
| */ | ||
| export type TagProps = { | ||
| label: string; | ||
| closable: boolean; | ||
| tagRef: React.RefObject<HTMLDivElement>; | ||
| onClose: (arg0: string) => void; | ||
| } | ||
|
|
||
| // ------------- Component -------------- // | ||
| const ColumnTag: React.FC<TagProps> = ({ | ||
| label = '', | ||
| closable = true, | ||
| tagRef = null, | ||
| onClose = () => {} // Assign default value as void funciton | ||
| }) => { | ||
| const onPreventMouseDown = (event: React.MouseEvent<HTMLSpanElement>) => { | ||
| // By default when clickin on the tags the text will get selected | ||
| // which might interfere with user experience as people would want to close tags | ||
| // but accidentally select tag text. Hence we prevent this behaviour. | ||
| event.preventDefault(); | ||
| event.stopPropagation(); | ||
| }; | ||
|
|
||
| if (!tagRef?.current) return null; | ||
|
|
||
| return createPortal( | ||
| <Tag | ||
| key={label} | ||
| onMouseDown={onPreventMouseDown} | ||
| closable={closable} | ||
| onClose={() => (onClose(label))} | ||
| style={{marginRight: 3}}> | ||
| {label} | ||
| </Tag>, | ||
| tagRef.current | ||
| ); | ||
| } | ||
|
|
||
| export default ColumnTag; |
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.