forked from allyoucanmap/geonode-mapstore-client
-
Notifications
You must be signed in to change notification settings - Fork 132
Fix: #2227 Added Documents Catalog Plugin. #2263
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
22 commits
Select commit
Hold shift + click to select a range
f509cb4
Fix: #2227 Added Documents Catalog
df1f9f7
Merge branch 'master' of github.com:GeoNode/geonode-mapstore-client i…
5319622
Update mapstore submodule to have support for template format in vect…
f77db44
Fix linting issues
6cf3bc0
Added filters for documents catalog
bc87cf3
Updated infinite scroll
67da213
Fixes infinite scroll
fcd6235
added sandbox in iframe and removed unused selector
358ddc2
fix:build error
bdc8722
UI update and refactor
a654507
removed debug message
c13e976
Fix linting issues
9c6e2d9
Refactored hook for querying documents
b0529f4
Linting issues
5e437f3
Added translations
990b40c
Added test cases
4f2ec0f
Testcase lint issues
971cd42
Merge branch 'master' of github.com:GeoNode/geonode-mapstore-client i…
c1054e7
requested changes
allyoucanmap 194b0e7
persist documents layers in map
allyoucanmap 2522fdf
Merge branch 'master' of github.com:GeoNode/geonode-mapstore-client i…
allyoucanmap 1b6a9d1
review identify
allyoucanmap 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
148 changes: 148 additions & 0 deletions
148
geonode_mapstore_client/client/js/plugins/DocumentsCatalog/components/ResourcesMenu.jsx
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,148 @@ | ||
| /* | ||
| * Copyright 2025, GeoSolutions Sas. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import React, { forwardRef } from 'react'; | ||
| import { Dropdown, MenuItem } from 'react-bootstrap'; | ||
|
|
||
| import Message from '@mapstore/framework/components/I18N/Message'; | ||
| import Spinner from '@mapstore/framework/components/layout/Spinner'; | ||
| import FlexBox from '@mapstore/framework/components/layout/FlexBox'; | ||
| import Text from '@mapstore/framework/components/layout/Text'; | ||
| import Menu from '@mapstore/framework/plugins/ResourcesCatalog/components/Menu'; | ||
|
|
||
| const ResourcesMenu = forwardRef(({ | ||
| menuItems, | ||
| style, | ||
| totalResources, | ||
| loading, | ||
| orderConfig, | ||
| query, | ||
| titleId, | ||
| theme = 'main', | ||
| menuItemsLeft = [], | ||
| target, | ||
| resourcesFoundMsgId, | ||
| onSortChange | ||
| }, ref) => { | ||
|
|
||
|
|
||
| const { | ||
| defaultLabelId, | ||
| options: orderOptions = [], | ||
| variant: orderVariant, | ||
| align: orderAlign = 'right' | ||
| } = orderConfig || {}; | ||
|
|
||
| const selectedSort = orderOptions.find(({ value }) => query?.sort === value); | ||
|
|
||
| const orderButtonNode = orderOptions.length > 0 && | ||
| <Dropdown pullRight={orderAlign === 'right'} id="sort-dropdown"> | ||
| <Dropdown.Toggle | ||
| bsStyle={orderVariant || 'default'} | ||
| bsSize="sm" | ||
| noCaret | ||
| > | ||
| <Message msgId={selectedSort?.labelId || defaultLabelId} /> | ||
| </Dropdown.Toggle> | ||
| <Dropdown.Menu> | ||
| {orderOptions.map(({ labelId, value }) => { | ||
| return ( | ||
| <MenuItem | ||
| key={value} | ||
| active={value === selectedSort?.value} | ||
| onClick={(e) => { | ||
| if (onSortChange) { | ||
| e.preventDefault(); | ||
| onSortChange(value); | ||
| } | ||
| }} | ||
| > | ||
| <Message msgId={labelId} /> | ||
| </MenuItem> | ||
| ); | ||
| })} | ||
| </Dropdown.Menu> | ||
| </Dropdown>; | ||
|
|
||
| return ( | ||
| <FlexBox | ||
| ref={ref} | ||
| classNames={[ | ||
| 'ms-resources-menu', | ||
| '_sticky', | ||
| '_corner-tl', | ||
| `ms-${theme}-colors`, | ||
| '_padding-tb-sm' | ||
| ]} | ||
| column | ||
| gap="sm" | ||
| style={style} | ||
| > | ||
| {titleId | ||
| ? <Text fontSize="lg"> | ||
| <Message msgId={titleId} /> | ||
| </Text> | ||
| : null} | ||
| <FlexBox centerChildrenVertically gap="xs"> | ||
| <FlexBox.Fill flexBox centerChildrenVertically gap="sm"> | ||
| {menuItemsLeft.map(({ Component, name }) => { | ||
| return (<Component key={name} query={query} />); | ||
| })} | ||
| {orderAlign === 'left' ? orderButtonNode : null} | ||
| <Text fontSize="sm" ellipsis> | ||
| {loading | ||
| ? <Spinner /> | ||
| : <span><span>{totalResources}</span>{" "}<Message msgId={resourcesFoundMsgId} msgParams={{ count: totalResources }} /></span> | ||
| } | ||
| </Text> | ||
| </FlexBox.Fill> | ||
| <Menu | ||
| items={menuItems} | ||
| containerClass={`ms-menu-list`} | ||
| size="md" | ||
| alignRight | ||
| target={target} | ||
| /> | ||
| {orderAlign === 'right' ? orderButtonNode : null} | ||
| </FlexBox> | ||
| </FlexBox> | ||
| ); | ||
| }); | ||
|
|
||
| ResourcesMenu.defaultProps = { | ||
| orderOptions: [ | ||
| { | ||
| label: 'Most recent', | ||
| labelId: 'resourcesCatalog.mostRecent', | ||
| value: '-date' | ||
| }, | ||
| { | ||
| label: 'Less recent', | ||
| labelId: 'resourcesCatalog.lessRecent', | ||
| value: 'date' | ||
| }, | ||
| { | ||
| label: 'A Z', | ||
| labelId: 'resourcesCatalog.aZ', | ||
| value: 'title' | ||
| }, | ||
| { | ||
| label: 'Z A', | ||
| labelId: 'resourcesCatalog.zA', | ||
| value: '-title' | ||
| }, | ||
| { | ||
| label: 'Most popular', | ||
| labelId: 'resourcesCatalog.mostPopular', | ||
| value: 'popular_count' | ||
| } | ||
| ], | ||
| defaultLabelId: 'resourcesCatalog.orderBy' | ||
| }; | ||
|
|
||
| export default ResourcesMenu; |
9 changes: 9 additions & 0 deletions
9
geonode_mapstore_client/client/js/plugins/DocumentsCatalog/constants.js
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,9 @@ | ||
| /* | ||
| * Copyright 2026, GeoSolutions Sas. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| export const GEONODE_DOCUMENTS_ROW_VIEWER = 'GEONODE_DOCUMENTS_ROW_VIEWER'; |
21 changes: 21 additions & 0 deletions
21
geonode_mapstore_client/client/js/plugins/DocumentsCatalog/containers/DocumentInfoViewer.jsx
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,21 @@ | ||
| /* | ||
| * Copyright 2026, GeoSolutions Sas. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import MediaViewer from '@js/components/MediaViewer'; | ||
| import Text from '@mapstore/framework/components/layout/Text'; | ||
| import FlexBox from '@mapstore/framework/components/layout/FlexBox'; | ||
|
|
||
| const DocumentInfoViewer = (resource) => { | ||
| return (<FlexBox className="gn-document-info-viewer" column gap="sm"> | ||
| <Text fontSize="md">{resource?.title}</Text> | ||
| <MediaViewer resource={resource} /> | ||
| </FlexBox>); | ||
| }; | ||
|
|
||
| export default DocumentInfoViewer; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
oneOfTheOtherfunction contains several repetitiveifblocks. This can be refactored to be more concise and easier to maintain, especially if more panels are added in the future.