Skip to content

Commit 6dcf9b2

Browse files
authored
#2109: Add Edit Permissions to resource menu (#2111)
1 parent e58dda4 commit 6dcf9b2

File tree

15 files changed

+66
-3
lines changed

15 files changed

+66
-3
lines changed

geonode_mapstore_client/client/js/plugins/ResourceDetails/ResourceDetails.jsx

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ import ResourcesPanelWrapper from '@mapstore/framework/plugins/ResourcesCatalog/
2727
import TargetSelectorPortal from '@mapstore/framework/plugins/ResourcesCatalog/components/TargetSelectorPortal';
2828
import useResourcePanelWrapper from '@mapstore/framework/plugins/ResourcesCatalog/hooks/useResourcePanelWrapper';
2929
import { getShowDetails } from '@mapstore/framework/plugins/ResourcesCatalog/selectors/resources';
30-
import { setShowDetails, setSelectedResource } from '@mapstore/framework/plugins/ResourcesCatalog/actions/resources';
30+
import { setShowDetails, setSelectedResource, setDetailPanelTab } from '@mapstore/framework/plugins/ResourcesCatalog/actions/resources';
3131
import PendingStatePrompt from '@mapstore/framework/plugins/ResourcesCatalog/containers/PendingStatePrompt';
3232
import DetailsPanel from './containers/DetailsPanel';
3333
import useDetectClickOut from '@js/hooks/useDetectClickOut';
34+
import Button from '@mapstore/framework/components/layout/Button';
35+
import Message from '@mapstore/framework/components/I18N/Message';
3436

3537
/**
3638
* @module ResourceDetails
@@ -388,7 +390,7 @@ const ResourceDetailsPlugin = connect(
388390
export default createPlugin('ResourceDetails', {
389391
component: ResourceDetailsPlugin,
390392
containers: {
391-
ActionNavbar: {
393+
ActionNavbar: [{
392394
name: 'ResourceDetailsButton',
393395
Component: connect((state) => ({resource: getResourceData(state)}), { onShow: setShowDetails })(({ component, resourcesGridId, onShow, resource }) => {
394396
if (!resource?.pk) return null;
@@ -409,7 +411,31 @@ export default createPlugin('ResourceDetails', {
409411
}),
410412
priority: 1,
411413
doNotHide: true
412-
},
414+
}, {
415+
name: 'ResourceEditPermissions',
416+
Component: connect((state) => ({resource: getResourceData(state)}), { onShow: setShowDetails, onSelectTab: setDetailPanelTab })(
417+
({ resourcesGridId, onShow, resource, onSelectTab }) => {
418+
if (!resource?.pk) return null;
419+
420+
function handleClick() {
421+
onShow(true, resourcesGridId);
422+
onSelectTab('settings');
423+
}
424+
return (
425+
<Button
426+
variant="default"
427+
size="md"
428+
onClick={handleClick}
429+
labelId="gnviewer.editPermissions"
430+
>
431+
<Message msgId="gnviewer.editPermissions" />
432+
</Button>
433+
);
434+
}
435+
),
436+
priority: 1,
437+
doNotHide: true
438+
}],
413439
ResourcesGrid: {
414440
priority: 2,
415441
target: 'card-buttons',

geonode_mapstore_client/static/mapstore/configs/localConfig.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@
607607
"labelId": "gnviewer.layerSettings.title",
608608
"disableIf": "{!context.resourceHasPermission(state('gnResourceData'), 'change_dataset_style')}"
609609
},
610+
{
611+
"type": "plugin",
612+
"name": "ResourceEditPermissions"
613+
},
610614
{
611615
"type": "link",
612616
"href": "{context.getMetadataUrl(state('gnResourceData'))}",
@@ -1517,6 +1521,10 @@
15171521
"type": "dropdown",
15181522
"disableIf": "{state('isNewResource') || !context.resourceHasPermission(state('gnResourceData'), 'change_resourcebase')}",
15191523
"items": [
1524+
{
1525+
"type": "plugin",
1526+
"name": "ResourceEditPermissions"
1527+
},
15201528
{
15211529
"type": "link",
15221530
"href": "{context.getMetadataUrl(state('gnResourceData'))}",
@@ -2252,6 +2260,10 @@
22522260
"type": "dropdown",
22532261
"disableIf": "{state('isNewResource') || !context.resourceHasPermission(state('gnResourceData'), 'change_resourcebase')}",
22542262
"items": [
2263+
{
2264+
"type": "plugin",
2265+
"name": "ResourceEditPermissions"
2266+
},
22552267
{
22562268
"type": "link",
22572269
"href": "{context.getMetadataUrl(state('gnResourceData'))}",
@@ -2438,6 +2450,10 @@
24382450
"type": "dropdown",
24392451
"disableIf": "{!context.resourceHasPermission(state('gnResourceData'), 'change_resourcebase')}",
24402452
"items": [
2453+
{
2454+
"type": "plugin",
2455+
"name": "ResourceEditPermissions"
2456+
},
24412457
{
24422458
"type": "link",
24432459
"href": "{context.getMetadataUrl(state('gnResourceData'))}",
@@ -2583,6 +2599,10 @@
25832599
"type": "dropdown",
25842600
"disableIf": "{state('isNewResource') || !context.resourceHasPermission(state('gnResourceData'), 'change_resourcebase')}",
25852601
"items": [
2602+
{
2603+
"type": "plugin",
2604+
"name": "ResourceEditPermissions"
2605+
},
25862606
{
25872607
"type": "link",
25882608
"href": "{context.getMetadataUrl(state('gnResourceData'))}",
@@ -3524,6 +3544,10 @@
35243544
"type": "dropdown",
35253545
"disableIf": "{state('isNewResource') || !context.resourceHasPermission(state('gnResourceData'), 'change_resourcebase')}",
35263546
"items": [
3547+
{
3548+
"type": "plugin",
3549+
"name": "ResourceEditPermissions"
3550+
},
35273551
{
35283552
"type": "link",
35293553
"href": "{context.getMetadataUrl(state('gnResourceData'))}",

geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
"viewMetadata": "Metadaten anzeigen",
181181
"viewData": "Daten anzeigen",
182182
"viewInfo": "Informationen anzeigen",
183+
"editPermissions": "Berechtigungen bearbeiten",
183184
"backToDataset": "< Zurück zum Datensatz",
184185
"goBackTo": "< Geh zurück zu { resourceName }",
185186
"uploadImage": "Klicken Sie hier, um ein Bild hochzuladen",

geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
"viewMetadata": "View Metadata",
181181
"viewData": "View Data",
182182
"viewInfo": "View information",
183+
"editPermissions": "Edit Permissions",
183184
"backToDataset": "< Go back to the dataset",
184185
"goBackTo": "< Go back to { resourceName }",
185186
"uploadImage": "Click to upload an image",

geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
"viewMetadata": "Ver metadatos",
181181
"viewData": "Ver datos",
182182
"viewInfo": "Ver información",
183+
"editPermissions": "Editar permisos",
183184
"backToDataset": "< Regrese al conjunto de datos",
184185
"goBackTo": "< Volver a { resourceName }",
185186
"uploadImage": "Haz clic para subir una imagen",

geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"viewMetadata": "View Metadata",
179179
"viewData": "View Data",
180180
"viewInfo": "View information",
181+
"editPermissions": "Edit Permissions",
181182
"backToDataset": "< Go back to the dataset",
182183
"goBackTo": "< Go back to { resourceName }",
183184
"uploadImage": "Click to upload an image",

geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"viewData": "Afficher les données",
179179
"viewInfo": "Afficher les informations",
180180
"editInfo": "Modifier les informations",
181+
"editPermissions": "Modifier les permissions",
181182
"editStyle": "Modifier le Style",
182183
"editData": "Modifier les Données",
183184
"backToDataset": "< Retourner au jeu de données",

geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"viewMetadata": "View Metadata",
179179
"viewData": "View Data",
180180
"viewInfo": "View information",
181+
"editPermissions": "Edit Permissions",
181182
"backToDataset": "< Go back to the dataset",
182183
"goBackTo": "< Go back to { resourceName }",
183184
"uploadImage": "Click to upload an image",

geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
"viewData": "Visualizza i dati",
181181
"viewInfo": "Visualizza informazioni",
182182
"editInfo": "Modifica informazioni",
183+
"editPermissions": "Modifica permessi",
183184
"editStyle": "Modifica Stile",
184185
"editData": "Modifica Dati",
185186
"backToDataset": "< Torna al dataset",

geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
"view": "View",
178178
"viewMetadata": "View Metadata",
179179
"viewInfo": "View information",
180+
"editPermissions": "Edit Permissions",
180181
"viewData": "View Data",
181182
"backToDataset": "< Go back to the dataset",
182183
"goBackTo": "< Go back to { resourceName }",

0 commit comments

Comments
 (0)