From 44d9d83279ea1b8326548300f71e531be7fbfed0 Mon Sep 17 00:00:00 2001 From: Jan Vrobel Date: Thu, 26 Jun 2025 16:36:55 +0200 Subject: [PATCH] Update map thumbnail requests to use UUID instead of workspace/name. --- components/UuidParams.js | 22 +++++++++++++++++++ package.json | 2 +- pages/index.js | 47 ++++++++++++++++++++++++---------------- 3 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 components/UuidParams.js diff --git a/components/UuidParams.js b/components/UuidParams.js new file mode 100644 index 0000000..fa491fe --- /dev/null +++ b/components/UuidParams.js @@ -0,0 +1,22 @@ +import React from 'react' +import {Form} from 'semantic-ui-react' + +class UuidParams extends React.PureComponent { + + render() { + return ( +
+ +
+ ); + } +} + +export default UuidParams; \ No newline at end of file diff --git a/package.json b/package.json index 04ef125..9f185b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "layman-test-client", - "version": "2.1.0-dev", + "version": "3.0.0-dev", "description": "", "main": "index.js", "scripts": { diff --git a/pages/index.js b/pages/index.js index eb44645..656054e 100644 --- a/pages/index.js +++ b/pages/index.js @@ -11,6 +11,7 @@ import PatchWorkspaceMapParams from "../components/PatchWorkspaceMapParams"; import WorkspacePathParams from "../components/WorkspacePathParams"; import WorkspaceLayerPathParams from "../components/WorkspaceLayerPathParams"; import WorkspaceMapPathParams from "../components/WorkspaceMapPathParams"; +import UuidParams from "../components/UuidParams"; import PatchCurrentuserParams from "../components/PatchCurrentuserParams"; import GetPublicationsParams from "../components/GetPublicationsParams"; import DeleteUserParams from "../components/DeleteUserParams"; @@ -72,7 +73,7 @@ const endpointToUrlPartGetter = { 'workspace-maps': ({workspace}) => `/workspaces/${workspace}/maps`, 'workspace-map': ({workspace, mapname}) => `/workspaces/${workspace}/maps/${mapname}`, 'workspace-map-file': ({workspace, mapname}) => `/workspaces/${workspace}/maps/${mapname}/file`, - 'workspace-map-thumbnail': ({workspace, mapname}) => `/workspaces/${workspace}/maps/${mapname}/thumbnail`, + 'map-thumbnail': ({uuid}) => `/maps/${uuid}/thumbnail`, 'workspace-map-metadata-comparison': ({workspace, mapname}) => `/workspaces/${workspace}/maps/${mapname}/metadata-comparison`, 'users': () => `/users`, 'user': ({username}) => `/users/${username}`, @@ -93,7 +94,7 @@ const endpointToPathParams = { 'workspace-maps': ['workspace'], 'workspace-map': ['workspace', 'name'], 'workspace-map-file': ['workspace', 'name'], - 'workspace-map-thumbnail': ['workspace', 'name'], + 'workspace-map-thumbnail': ['uuid'], 'workspace-map-metadata-comparison': ['workspace', 'name'], 'users': [], 'user': ['username'], @@ -111,7 +112,7 @@ const endpointToPathParamsClass = { 'workspace-maps': WorkspacePathParams, 'workspace-map': WorkspaceMapPathParams, 'workspace-map-file': WorkspaceMapPathParams, - 'workspace-map-thumbnail': WorkspaceMapPathParams, + 'map-thumbnail': UuidParams, 'workspace-map-metadata-comparison': WorkspaceMapPathParams, } @@ -143,7 +144,7 @@ const getEndpointDefaultParamsState = (endpoint, state) => { 'workspace-maps': () => ({mapname: ''}), 'workspace-map': ({mapname}) => ({mapname}), 'workspace-map-file': ({mapname}) => ({mapname}), - 'workspace-map-thumbnail': ({mapname}) => ({mapname}), + 'map-thumbnail': ({uuid}) => ({uuid}), 'workspace-map-metadata-comparison': ({mapname}) => ({mapname}), } const getter = getters[endpoint]; @@ -165,6 +166,10 @@ const getEndpointParamsProps = (endpoint, component) => { mapname: component.state.mapname, handleMapnameChange: component.handleMapnameChange.bind(component), }; + const uuid_props = { + uuid: component.state.uuid, + handleUuidChange: component.handleUuidChange.bind(component), + }; const user_props = { username: component.state.username, handleUsernameChange: component.handleUsernameChange.bind(component), @@ -181,7 +186,7 @@ const getEndpointParamsProps = (endpoint, component) => { 'workspace-maps': workspace_props, 'workspace-map': map_props, 'workspace-map-file': map_props, - 'workspace-map-thumbnail': map_props, + 'map-thumbnail': uuid_props, 'workspace-map-metadata-comparison': map_props, 'users': {}, 'user': user_props, @@ -219,6 +224,7 @@ class IndexPage extends React.PureComponent { request: 'get-layers', layername: '', mapname: '', + uuid: '', username: '', publication_type: 'layer', response: null, @@ -238,6 +244,9 @@ class IndexPage extends React.PureComponent { handleMapnameChange(event) { this.setState({mapname: event.target.value}); } + handleUuidChange(event) { + this.setState({uuid: event.target.value}); + } handleUsernameChange(event) { this.setState({username: event.target.value}); } @@ -712,6 +721,20 @@ class IndexPage extends React.PureComponent { x x + + Map Thumbnail + /rest/maps/<uuid>/thumbnail + + + + x + x + x + Workspace Maps /rest/workspaces/<workspace_name>/maps @@ -778,20 +801,6 @@ class IndexPage extends React.PureComponent { x x - - Workspace Map Thumbnail - /rest/workspaces/<workspace_name>/maps/<mapname>/thumbnail - - - - x - x - x - Workspace Map Metadata Comparison /rest/workspaces/<workspace_name>/maps/<mapname>/metadata-comparison