Skip to content

Commit

Permalink
Rename layer to dataset master (#343)
Browse files Browse the repository at this point in the history
* Upgrade library to Django3

* Renaming layer to dataset

* Renaming layer to dataset

* Renaming layer to dataset

* Renaming layer to dataset

* Renaming layer to dataset

* Renaming layer to dataset

* Restore unwanted changes

* Rename Layer to Dataset

* Rename Layer to Dataset
  • Loading branch information
mattiagiupponi authored Jul 22, 2021
1 parent 5a1b920 commit c4197bb
Show file tree
Hide file tree
Showing 30 changed files with 159 additions and 159 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ geonode_mapstore_client/
| |-- app_list.html
| |-- app_new.html
| |-- app_view.html
| |-- layer_data_edit.html
| |-- layer_detail.html
| |-- layer_embed.html
| |-- layer_style_edit.html
| |-- layer_view.html
| |-- dataset_data_edit.html
| |-- dataset_detail.html
| |-- dataset_embed.html
| |-- dataset_style_edit.html
| |-- dataset_view.html
| |-- map_detail.html
| |-- map_edit.html
| |-- map_embed.html
Expand Down
6 changes: 3 additions & 3 deletions geonode_mapstore_client/client/js/actions/gnresource.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const EDIT_ABSTRACT_RESOURCE = 'GEONODE:EDIT_ABSTRACT_RESOURCE';
export const EDIT_THUMBNAIL_RESOURCE = 'GEONODE:EDIT_THUMBNAIL_RESOURCE';
export const SET_FAVORITE_RESOURCE = 'GEONODE:SET_FAVORITE_RESOURCE';

export const SET_SELECTED_LAYER_PERMISSIONS = "GEONODE:SET_SELECTED_LAYER_PERMISSIONS";
export const SET_SELECTED_DATASET_PERMISSIONS = "GEONODE:SET_SELECTED_DATASET_PERMISSIONS";


/**
Expand Down Expand Up @@ -170,9 +170,9 @@ export function setResourcePermissions(permissions) {
* @param {bool} permissions.canView can view permission
*/

export function setSelectedLayerPermissions(permissions) {
export function setSelectedDatasetPermissions(permissions) {
return {
type: SET_SELECTED_LAYER_PERMISSIONS,
type: SET_SELECTED_DATASET_PERMISSIONS,
permissions
};
}
Expand Down
6 changes: 3 additions & 3 deletions geonode_mapstore_client/client/js/actions/gnviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
* LICENSE file in the root directory of this source tree.
*/

export const REQUEST_LAYER_CONFIG = 'GEONODE_VIEWER:REQUEST_LAYER_CONFIG';
export const REQUEST_DATASET_CONFIG = 'GEONODE_VIEWER:REQUEST_DATASET_CONFIG';
export const REQUEST_MAP_CONFIG = 'GEONODE_VIEWER:REQUEST_MAP_CONFIG';
export const REQUEST_NEW_MAP_CONFIG = 'GEONODE_VIEWER:REQUEST_NEW_MAP_CONFIG';
export const REQUEST_GEOSTORY_CONFIG = 'GEONODE_VIEWER:REQUEST_GEOSTORY_CONFIG';
export const REQUEST_DOCUMENT_CONFIG = 'GEONODE_VIEWER:REQUEST_DOCUMENT_CONFIG';
export const REQUEST_NEW_GEOSTORY_CONFIG = "GEONODE:VIEWER:REQUEST_NEW_GEOSTORY_CONFIG";


export function requestLayerConfig(pk, page) {
export function requestDatasetConfig(pk, page) {
return {
type: REQUEST_LAYER_CONFIG,
type: REQUEST_DATASET_CONFIG,
pk,
page
};
Expand Down
38 changes: 19 additions & 19 deletions geonode_mapstore_client/client/js/api/geonode/v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let endpoints = {
// default values
'resources': '/api/v2/resources',
'documents': '/api/v2/documents',
'layers': '/api/v2/datasets',
'datasets': '/api/v2/datasets',
'maps': '/api/v2/maps',
'geoapps': '/api/v2/geoapps',
'geostories': '/api/v2/geostories',
Expand All @@ -40,7 +40,7 @@ let endpoints = {

const RESOURCES = 'resources';
const DOCUMENTS = 'documents';
const LAYERS = 'layers';
const DATASETS = 'datasets';
const MAPS = 'maps';
const GEOAPPS = 'geoapps';
const GEOSTORIES = 'geostories';
Expand Down Expand Up @@ -255,9 +255,9 @@ export const getResourceByPk = (pk) => {
.then(({ data }) => data.resource);
};

export const getLayerByPk = (pk) => {
return axios.get(parseDevHostname(`${endpoints[LAYERS]}/${pk}`))
.then(({ data }) => data.layer);
export const getDatasetByPk = (pk) => {
return axios.get(parseDevHostname(`${endpoints[DATASETS]}/${pk}`))
.then(({ data }) => data.dataset);
};

export const getDocumentByPk = (pk) => {
Expand Down Expand Up @@ -311,9 +311,9 @@ export const updateGeoStory = (pk, body) => {
};


export const updateLayer = (pk, body) => {
return axios.patch(parseDevHostname(`${endpoints[LAYERS]}/${pk}`), body)
.then(({ data }) => (data.layer));
export const updateDataset = (pk, body) => {
return axios.patch(parseDevHostname(`${endpoints[DATASETS]}/${pk}`), body)
.then(({ data }) => (data.dataset));
};

export const updateDocument = (pk, body) => {
Expand Down Expand Up @@ -403,21 +403,21 @@ export const getResourceTypes = ({}, filterKey = 'resource-types') => {
});
};

export const getLayerByName = name => {
const url = parseDevHostname(`${endpoints[LAYERS]}/?filter{alternate}=${name}`);
export const getDatasetByName = name => {
const url = parseDevHostname(`${endpoints[DATASETS]}/?filter{alternate}=${name}`);
return axios.get(url)
.then(({data}) => data?.layers[0]);
.then(({data}) => data?.datasets[0]);
};

export const getLayersByName = names => {
const url = parseDevHostname(endpoints[LAYERS]);
export const getDatasetsByName = names => {
const url = parseDevHostname(endpoints[DATASETS]);
return axios.get(url, {
params: {
page_size: names.length,
'filter{alternate.in}': names
}
})
.then(({data}) => data?.layers);
.then(({data}) => data?.datasets);
};

export const getResourcesTotalCount = () => {
Expand All @@ -426,7 +426,7 @@ export const getResourcesTotalCount = () => {
};
const types = [
DOCUMENTS,
LAYERS,
DATASETS,
MAPS,
GEOSTORIES,
GEOAPPS
Expand All @@ -440,14 +440,14 @@ export const getResourcesTotalCount = () => {
)
.then(([
documentsTotalCount,
layersTotalCount,
datasetsTotalCount,
mapsTotalCount,
geostoriesTotalCount,
geoappsTotalCount
]) => {
return {
documentsTotalCount,
layersTotalCount,
datasetsTotalCount,
mapsTotalCount,
geostoriesTotalCount,
geoappsTotalCount
Expand Down Expand Up @@ -631,15 +631,15 @@ export default {
createGeoStory,
getGeoStoryByPk,
updateGeoStory,
updateLayer,
updateDataset,
getMaps,
getDocumentsByDocType,
getUserByPk,
getAccountInfo,
getConfiguration,
getResourceTypes,
getResourcesTotalCount,
getLayerByPk,
getDatasetByPk,
getDocumentByPk,
createMap,
updateMap,
Expand Down
28 changes: 14 additions & 14 deletions geonode_mapstore_client/client/js/apps/gn-catalogue.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import widgets from '@mapstore/framework/reducers/widgets';

import SearchRoute from '@js/routes/Search';
import DetailRoute from '@js/routes/Detail';
import LayerViewerRoute from '@js/routes/LayerViewer';
import DatasetViewerRoute from '@js/routes/DatasetViewer';
import MapViewerRoute from '@js/routes/MapViewer';
import GeoStoryViewerRoute from '@js/routes/GeoStoryViewer';
import DocumentViewerRoute from '@js/routes/DocumentViewer';
Expand All @@ -62,8 +62,8 @@ import {
import { updateGeoNodeSettings } from '@js/actions/gnsettings';

import {
gnCheckSelectedLayerPermissions,
gnSetLayersPermissions
gnCheckSelectedDatasetPermissions,
gnSetDatasetsPermissions
} from '@js/epics';
import gnviewerEpics from '@js/epics/gnviewer';
import gnsearchEpics from '@js/epics/gnsearch';
Expand All @@ -90,25 +90,25 @@ const ConnectedRouter = connect((state) => ({

const routes = [
{
name: 'layer_viewer',
name: 'dataset_viewer',
path: [
'/layer/:pk'
'/dataset/:pk'
],
component: LayerViewerRoute
component: DatasetViewerRoute
},
{
name: 'layer_edit_data_viewer',
name: 'dataset_edit_data_viewer',
path: [
'/layer/:pk/edit/data'
'/dataset/:pk/edit/data'
],
component: LayerViewerRoute
component: DatasetViewerRoute
},
{
name: 'layer_edit_style_viewer',
name: 'dataset_edit_style_viewer',
path: [
'/layer/:pk/edit/style'
'/dataset/:pk/edit/style'
],
component: LayerViewerRoute
component: DatasetViewerRoute
},
{
name: 'map_viewer',
Expand Down Expand Up @@ -231,8 +231,8 @@ Promise.all([
appEpics: {
...standardEpics,
...configEpics,
gnCheckSelectedLayerPermissions,
gnSetLayersPermissions,
gnCheckSelectedDatasetPermissions,
gnSetDatasetsPermissions,
...pluginsDefinition.epics,
...gnviewerEpics,
...gnsearchEpics,
Expand Down
8 changes: 4 additions & 4 deletions geonode_mapstore_client/client/js/apps/gn-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ import { updateGeoNodeSettings } from '@js/actions/gnsettings';

import {
updateMapLayoutEpic,
gnCheckSelectedLayerPermissions,
gnSetLayersPermissions
gnCheckSelectedDatasetPermissions,
gnSetDatasetsPermissions
} from '@js/epics';
import maplayout from '@mapstore/framework/reducers/maplayout';
import 'react-widgets/dist/css/react-widgets.css';
Expand Down Expand Up @@ -174,8 +174,8 @@ Promise.all([
...standardEpics,
...configEpics,
updateMapLayoutEpic,
gnCheckSelectedLayerPermissions,
gnSetLayersPermissions,
gnCheckSelectedDatasetPermissions,
gnSetDatasetsPermissions,
...pluginsDefinition.epics
},
geoNodeConfiguration,
Expand Down
22 changes: 11 additions & 11 deletions geonode_mapstore_client/client/js/epics/__tests__/gnsave-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import {
RESOURCE_LOADING,
SET_RESOURCE,
RESOURCE_ERROR,
SET_SELECTED_LAYER_PERMISSIONS
SET_SELECTED_DATASET_PERMISSIONS
} from '@js/actions/gnresource';
import {
gnSaveContent,
gnUpdateResource,
gnSaveDirectContent
} from '@js/epics/gnsave';
import {gnCheckSelectedLayerPermissions, gnSetLayersPermissions} from '@js/epics';
import {gnCheckSelectedDatasetPermissions, gnSetDatasetsPermissions} from '@js/epics';
import { SET_PERMISSION } from '@mapstore/framework/actions/featuregrid';
import { SET_EDIT_PERMISSION } from '@mapstore/framework/actions/styleeditor';
import { configureMap } from '@mapstore/framework/actions/config';
Expand Down Expand Up @@ -180,13 +180,13 @@ describe('gnsave epics', () => {
);
});

it("gnCheckSelectedLayerPermissions should trigger permission actions for style and edit", (done) => {
it("gnCheckSelectedDatasetPermissions should trigger permission actions for style and edit", (done) => {

const NUM_ACTIONS = 3;
testEpic(gnCheckSelectedLayerPermissions,
testEpic(gnCheckSelectedDatasetPermissions,
NUM_ACTIONS, selectNode(1, "layer"), (actions) => {
try {
expect(actions.map(({type}) => type)).toEqual([SET_PERMISSION, SET_EDIT_PERMISSION, SET_SELECTED_LAYER_PERMISSIONS]);
expect(actions.map(({type}) => type)).toEqual([SET_PERMISSION, SET_EDIT_PERMISSION, SET_SELECTED_DATASET_PERMISSIONS]);
done();
} catch (error) {
done(error);
Expand All @@ -195,11 +195,11 @@ describe('gnsave epics', () => {

});

it('test gnSetLayersPermissions trigger updateNode for MAP_CONFIG_LOADED', (done) => {
it('test gnSetDatasetsPermissions trigger updateNode for MAP_CONFIG_LOADED', (done) => {
mockAxios.onGet().reply(() => [200,
{layers: [{perms: ['change_layer_style', 'change_layer_data'], alternate: "testLayer"}]}]);
{datasets: [{perms: ['change_dataset_style', 'change_dataset_data'], alternate: "testLayer"}]}]);
const NUM_ACTIONS = 1;
testEpic(gnSetLayersPermissions, NUM_ACTIONS, configureMap({map: {layers: [{name: "testLayer", id: "test_id"}]}}), (actions) => {
testEpic(gnSetDatasetsPermissions, NUM_ACTIONS, configureMap({map: {layers: [{name: "testLayer", id: "test_id"}]}}), (actions) => {
try {
expect(actions.map(({type}) => type)).toEqual(["UPDATE_NODE"]);
done();
Expand All @@ -210,11 +210,11 @@ describe('gnsave epics', () => {
{layers: {flat: [{name: "testLayer", id: "test_id", perms: ['download_resourcebase']}], selected: ["test_id"]}});
});

it('test gnSetLayersPermissions trigger updateNode for ADD_LAYER', (done) => {
it('test gnSetDatasetsPermissions trigger updateNode for ADD_LAYER', (done) => {
mockAxios.onGet().reply(() => [200,
{layers: [{perms: ['change_layer_style', 'change_layer_data'], alternate: "testLayer"}]}]);
{datasets: [{perms: ['change_dataset_style', 'change_dataset_data'], alternate: "testLayer"}]}]);
const NUM_ACTIONS = 1;
testEpic(gnSetLayersPermissions, NUM_ACTIONS, addLayer({name: "testLayer"}), (actions) => {
testEpic(gnSetDatasetsPermissions, NUM_ACTIONS, addLayer({name: "testLayer"}), (actions) => {
try {
expect(actions.map(({type}) => type)).toEqual(["UPDATE_NODE"]);
done();
Expand Down
8 changes: 4 additions & 4 deletions geonode_mapstore_client/client/js/epics/gnsave.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
getResourceByPk,
createGeoStory,
updateGeoStory,
updateLayer,
updateDataset,
createMap,
updateMap,
updateDocument
Expand Down Expand Up @@ -81,7 +81,7 @@ const SaveAPI = {
: createMap(body)
.then((response) => {
if (reload) {
window.location.href = parseDevHostname(`${getConfigProp('geonodeUrl')}viewer/#/map/${response.pk}`);
window.location.href = parseDevHostname(`${getConfigProp('geonodeUrl')}catalogue/#/map/${response.pk}`);
window.location.reload();
}
return response.data;
Expand All @@ -104,7 +104,7 @@ const SaveAPI = {
...body
}).then((response) => {
if (reload) {
window.location.href = parseDevHostname(`${getConfigProp('geonodeUrl')}viewer/#/geostory/${response.pk}`);
window.location.href = parseDevHostname(`${getConfigProp('geonodeUrl')}catalogue/#/geostory/${response.pk}`);
window.location.reload();
}
return response.data;
Expand All @@ -126,7 +126,7 @@ const SaveAPI = {
'abstract': metadata.description,
'thumbnail_url': metadata.thumbnail
};
return id ? updateLayer(id, body) : false;
return id ? updateDataset(id, body) : false;
}
};

Expand Down
Loading

0 comments on commit c4197bb

Please sign in to comment.