Skip to content

Commit

Permalink
Wrong positioning of users list inside share plugin (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidQuartz authored Nov 12, 2021
1 parent e9f9e7b commit 3b6d4fd
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 47 deletions.
11 changes: 9 additions & 2 deletions geonode_mapstore_client/client/devServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = (devServerDefault, projectConfig) => {
const proxyTargetHost = devServerOptions.proxyTargetHost || envJson.DEV_SERVER_PROXY_TARGET_HOST || 'localhost:8000';
const protocol = devServerOptions.protocol || envJson.DEV_SERVER_HOST_PROTOCOL || 'http';

const proxyTargetURL = `${protocol}://${proxyTargetHost}`;

return {
clientLogLevel: 'debug',
https: protocol === 'https' ? true : false,
Expand All @@ -36,6 +38,11 @@ module.exports = (devServerDefault, projectConfig) => {
req.path = req.path.replace(hashRegex, '.js');
req.originalUrl = req.originalUrl.replace(hashRegex, '.js');
}
if (req.url.matches(proxyTargetURL)) {
req.url = req.url.replace(proxyTargetURL, '');
req.path = req.path.replace(proxyTargetURL, '');
req.originalUrl = req.originalUrl.replace(proxyTargetURL, '');
}
next();
});
},
Expand All @@ -47,10 +54,10 @@ module.exports = (devServerDefault, projectConfig) => {
'!**/MapStore2/**',
'!**/node_modules/**'
],
target: `${protocol}://${proxyTargetHost}`,
target: proxyTargetURL,
headers: {
Host: proxyTargetHost,
Referer: `${protocol}://${proxyTargetHost}/`
Referer: `${proxyTargetURL}/`
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,50 +196,6 @@ function Permissions({
);
})}
</li>

{filteredEntries
.filter((item) => item.permissions !== 'owner' )
.map((entry, idx) => {
return (
<li
key={entry.id + '-' + idx}
>
<PermissionsRow
{...entry}
onChange={handleUpdateEntry.bind(null, entry.id)}
options={options}
>
{entry.permissions !== 'owner' &&
<>
{enableGeoLimits && <Popover
placement="left"
onOpen={(open) => {
if (open && !entry.features) {
handleRequestGeoLimits(entry);
}
}}
content={
<GeoLimits
key={entry.geoLimitsLoading}
layers={layers}
features={entry.features}
loading={entry.geoLimitsLoading}
onChange={(changes) => handleUpdateEntry(entry.id, { ...changes, isGeoLimitsChanged: true })}
onRefresh={handleRequestGeoLimits.bind(null, entry)}
/>
}>
<Button>
<FaIcon name="globe" />
</Button>
</Popover>}
<Button onClick={handleRemoveEntry.bind(null, entry)}>
<FaIcon name="trash" />
</Button>
</>}
</PermissionsRow>
</li>
);
})}
</ul>
<div className="gn-share-permissions-list-head">
<Popover
Expand Down Expand Up @@ -296,7 +252,6 @@ function Permissions({
<FaIcon name="times"/>
</Button>}
</div>

<div className="gn-share-permissions-head">
<div className="gn-share-permissions-row">
<div className="gn-share-permissions-name">
Expand All @@ -314,6 +269,50 @@ function Permissions({
</div>
</div>
</div>
<ul className="gn-share-permissions-list">
{filteredEntries
.filter((item) => item.permissions !== 'owner' )
.map((entry, idx) => {
return (
<li
key={entry.id + '-' + idx}>
<PermissionsRow
{...entry}
onChange={handleUpdateEntry.bind(null, entry.id)}
options={options}
>
{entry.permissions !== 'owner' &&
<>
{enableGeoLimits && <Popover
placement="left"
onOpen={(open) => {
if (open && !entry.features) {
handleRequestGeoLimits(entry);
}
}}
content={
<GeoLimits
key={entry.geoLimitsLoading}
layers={layers}
features={entry.features}
loading={entry.geoLimitsLoading}
onChange={(changes) => handleUpdateEntry(entry.id, { ...changes, isGeoLimitsChanged: true })}
onRefresh={handleRequestGeoLimits.bind(null, entry)}
/>
}>
<Button>
<FaIcon name="globe" />
</Button>
</Popover>}
<Button onClick={handleRemoveEntry.bind(null, entry)}>
<FaIcon name="trash" />
</Button>
</>}
</PermissionsRow>
</li>
);
})}
</ul>
{(filteredEntries.length === 0) &&
<div className="gn-permissions-alert">
<Message msgId="gnviewer.permissionsEntriesNoResults" />
Expand Down
8 changes: 8 additions & 0 deletions geonode_mapstore_client/client/js/utils/AppUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import url from 'url';
import axios from '@mapstore/framework/libs/ajax';

let actionListeners = {};
// Add a taget url here to fix proxy issue
const targetURL = '';

export function getVersion() {
if (!__DEVTOOLS__) {
Expand Down Expand Up @@ -60,6 +62,12 @@ export function initializeApp() {
}
};
}
if (__DEVTOOLS__ && targetURL && config.url?.match(targetURL)?.[0]) {
return {
...config,
url: config.url.replace(targetURL, '')
};
}
return config;
}
);
Expand Down

0 comments on commit 3b6d4fd

Please sign in to comment.