From 288bdf83ad724aecc02bfb03012c3a80c3a9e9d4 Mon Sep 17 00:00:00 2001 From: Jan Vrobel Date: Thu, 10 Jul 2025 15:50:50 +0200 Subject: [PATCH] Update layer thumbnail requests to use UUID instead of workspace/name. --- components/UuidParams.js | 4 ++-- pages/index.js | 52 +++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/components/UuidParams.js b/components/UuidParams.js index fa491fe..ce329e3 100644 --- a/components/UuidParams.js +++ b/components/UuidParams.js @@ -10,8 +10,8 @@ class UuidParams extends React.PureComponent { inline className="mandatory" name="uuid" - label='Map uuid' - placeholder='Map uuid' + label={this.props.label} + placeholder={this.props.placeholder} value={this.props.uuid} onChange={this.props.handleUuidChange}/> diff --git a/pages/index.js b/pages/index.js index 656054e..6aac6a8 100644 --- a/pages/index.js +++ b/pages/index.js @@ -66,7 +66,7 @@ const endpointToUrlPartGetter = { 'layers': () => `/layers`, 'workspace-layers': ({workspace}) => `/workspaces/${workspace}/layers`, 'workspace-layer': ({workspace, layername}) => `/workspaces/${workspace}/layers/${layername}`, - 'workspace-layer-thumbnail': ({workspace, layername}) => `/workspaces/${workspace}/layers/${layername}/thumbnail`, + 'layer-thumbnail': ({uuid}) => `/layers/${uuid}/thumbnail`, 'workspace-layer-style': ({workspace, layername}) => `/workspaces/${workspace}/layers/${layername}/style`, 'workspace-layer-metadata-comparison': ({workspace, layername}) => `/workspaces/${workspace}/layers/${layername}/metadata-comparison`, 'maps': () => `/maps`, @@ -87,14 +87,14 @@ const endpointToPathParams = { 'layers': [], 'workspace-layers': ['workspace'], 'workspace-layer': ['workspace', 'name'], - 'workspace-layer-thumbnail': ['workspace', 'name'], + 'layer-thumbnail': ['uuid'], 'workspace-layer-style': ['workspace', 'name'], 'workspace-layer-metadata-comparison': ['workspace', 'name'], 'maps': [], 'workspace-maps': ['workspace'], 'workspace-map': ['workspace', 'name'], 'workspace-map-file': ['workspace', 'name'], - 'workspace-map-thumbnail': ['uuid'], + 'map-thumbnail': ['uuid'], 'workspace-map-metadata-comparison': ['workspace', 'name'], 'users': [], 'user': ['username'], @@ -106,7 +106,7 @@ const endpointToPathParams = { const endpointToPathParamsClass = { 'workspace-layers': WorkspacePathParams, 'workspace-layer': WorkspaceLayerPathParams, - 'workspace-layer-thumbnail': WorkspaceLayerPathParams, + 'layer-thumbnail': UuidParams, 'workspace-layer-style': WorkspaceLayerPathParams, 'workspace-layer-metadata-comparison': WorkspaceLayerPathParams, 'workspace-maps': WorkspacePathParams, @@ -138,7 +138,7 @@ const getEndpointDefaultParamsState = (endpoint, state) => { const getters = { 'workspace-layers': () => ({layername: ''}), 'workspace-layer': ({layername}) => ({layername}), - 'workspace-layer-thumbnail': ({layername}) => ({layername}), + 'layer-thumbnail': ({uuid}) => ({uuid}), 'workspace-layer-style': ({layername}) => ({layername}), 'workspace-layer-metadata-comparison': ({layername}) => ({layername}), 'workspace-maps': () => ({mapname: ''}), @@ -166,9 +166,17 @@ const getEndpointParamsProps = (endpoint, component) => { mapname: component.state.mapname, handleMapnameChange: component.handleMapnameChange.bind(component), }; - const uuid_props = { + const layer_uuid_props = { uuid: component.state.uuid, handleUuidChange: component.handleUuidChange.bind(component), + label: 'Layer uuid', + placeholder: 'Layer uuid', + }; + const map_uuid_props = { + uuid: component.state.uuid, + handleUuidChange: component.handleUuidChange.bind(component), + label: 'Map uuid', + placeholder: 'Map uuid', }; const user_props = { username: component.state.username, @@ -179,14 +187,14 @@ const getEndpointParamsProps = (endpoint, component) => { 'layers': {}, 'workspace-layers': workspace_props, 'workspace-layer': layer_props, - 'workspace-layer-thumbnail': layer_props, + 'layer-thumbnail': layer_uuid_props, 'workspace-layer-style': layer_props, 'workspace-layer-metadata-comparison': layer_props, 'maps': {}, 'workspace-maps': workspace_props, 'workspace-map': map_props, 'workspace-map-file': map_props, - 'map-thumbnail': uuid_props, + 'map-thumbnail': map_uuid_props, 'workspace-map-metadata-comparison': map_props, 'users': {}, 'user': user_props, @@ -590,6 +598,20 @@ class IndexPage extends React.PureComponent { x x + + Layer Thumbnail + /rest/layers/<uuid>/thumbnail + + + + x + x + x + Workspace Layers /rest/workspaces/<workspace_name>/layers @@ -642,20 +664,6 @@ class IndexPage extends React.PureComponent { >DELETE - - Workspace Layer Thumbnail - /rest/workspaces/<workspace_name>/layers/<layername>/thumbnail - - - - x - x - x - Workspace Layer Style /rest/workspaces/<workspace_name>/layers/<layername>/style