Mercurial > hg > orthanc-wsi
changeset 567:b596132164b6 annotations
consistency in api routes
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Tue, 01 Sep 2026 18:31:38 +0200 |
| parents | 5bffc731ba48 |
| children | 88cbe7ab5c23 |
| files | ViewerPlugin/Annotations/AnnotationsRestApi.cpp ViewerPlugin/WebApplication/viewer.html ViewerPlugin/WebApplication/viewer.js |
| diffstat | 3 files changed, 27 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/ViewerPlugin/Annotations/AnnotationsRestApi.cpp Tue Sep 01 18:22:12 2026 +0200 +++ b/ViewerPlugin/Annotations/AnnotationsRestApi.cpp Tue Sep 01 18:31:38 2026 +0200 @@ -1350,9 +1350,9 @@ } - void ListLayers(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) + void ListUserLayers(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { if (ProtectPostRequest(output, request)) { @@ -1868,21 +1868,24 @@ { OrthancPlugins::RegisterRestCallback<OrthancWSI::CreateUserLayer>("/wsi/api/create-user-layer", true); OrthancPlugins::RegisterRestCallback<OrthancWSI::DeleteUserLayer>("/wsi/api/delete-user-layer", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::ListLayers>("/wsi/api/list-layers", true); + OrthancPlugins::RegisterRestCallback<OrthancWSI::ListUserLayers>("/wsi/api/list-user-layers", true); OrthancPlugins::RegisterRestCallback<OrthancWSI::SaveUserLayer>("/wsi/api/save-user-layer", true); + OrthancPlugins::RegisterRestCallback<OrthancWSI::LoadUserFeatures>("/wsi/api/load-user-features", true); OrthancPlugins::RegisterRestCallback<OrthancWSI::SaveUserFeatures>("/wsi/api/save-user-features", true); if (OrthancWSI::ViewerConfiguration::GetInstance().IsAnnotationsSharingEnabled()) { + OrthancPlugins::RegisterRestCallback<OrthancWSI::CreateStandardUser>("/wsi/api/create-standard-user", true); OrthancPlugins::RegisterRestCallback<OrthancWSI::SearchActiveUsers>("/wsi/api/search-active-users", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::ListUsersSharingLayers>("/wsi/api/users-sharing-layers", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::ListLayersSharedByUser>("/wsi/api/shared-layers", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::ImportLayer>("/wsi/api/import-shared-layer", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::RemoveImportedLayer>("/wsi/api/remove-shared-layer", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::SaveImportedLayer>("/wsi/api/save-shared-layer", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::CreateStandardUser>("/wsi/api/create-standard-user", true); - OrthancPlugins::RegisterRestCallback<OrthancWSI::LoadImportedFeatures>("/wsi/api/load-shared-features", true); + + OrthancPlugins::RegisterRestCallback<OrthancWSI::ImportLayer>("/wsi/api/import-layer", true); + OrthancPlugins::RegisterRestCallback<OrthancWSI::ListLayersSharedByUser>("/wsi/api/list-shared-layers", true); + OrthancPlugins::RegisterRestCallback<OrthancWSI::ListUsersSharingLayers>("/wsi/api/list-sharing-users", true); + OrthancPlugins::RegisterRestCallback<OrthancWSI::RemoveImportedLayer>("/wsi/api/remove-imported-layer", true); + OrthancPlugins::RegisterRestCallback<OrthancWSI::SaveImportedLayer>("/wsi/api/save-imported-layer", true); + + OrthancPlugins::RegisterRestCallback<OrthancWSI::LoadImportedFeatures>("/wsi/api/load-imported-features", true); } } }
--- a/ViewerPlugin/WebApplication/viewer.html Tue Sep 01 18:22:12 2026 +0200 +++ b/ViewerPlugin/WebApplication/viewer.html Tue Sep 01 18:31:38 2026 +0200 @@ -420,7 +420,7 @@ </tbody> </table> - <button class="btn btn-sm btn-primary w-100 mb-2" v-on:click="ReloadImportedLayersContent()" + <button class="btn btn-sm btn-primary w-100 mb-2" v-on:click="ReloadImportedFeatures()" v-if="workspaceInfo.sharing && importedLayers.length > 0"> <i class="bi bi-arrow-clockwise me-2 align-middle"></i> Reload imported content </button> @@ -529,7 +529,7 @@ <label class="form-check-label" for="share-layer-public">Make this layer public (accessible to any user)</label> </div> - <label class="form-label small mb-1">Share with specific users:</label> + <label class="form-label small mb-1">Shared with specific users:</label> <div class="mb-3 border rounded p-2" style="min-height:2.5em; max-height:8em; overflow-y:auto"> <span v-if="shareLayerUsers.length === 0" class="text-muted small">No users added</span> <span v-for="(user, index) in shareLayerUsers" :key="user.name"
--- a/ViewerPlugin/WebApplication/viewer.js Tue Sep 01 18:22:12 2026 +0200 +++ b/ViewerPlugin/WebApplication/viewer.js Tue Sep 01 18:31:38 2026 +0200 @@ -90,7 +90,7 @@ **/ referenceMagnification: 40, - // Share user layer modal + // Share layer modal modalShareUserLayer: null, shareLayerTarget: {}, shareLayerPublic: false, @@ -98,7 +98,7 @@ shareLayerSearchQuery: '', shareLayerSearchResults: [], - // Import layers modal + // Import layer modal modalImportLayer: null, importAvailableUsers: [], importUserSearchQuery: '', @@ -179,7 +179,7 @@ LoadLayers: function(activeLayerId) { var that = this; - axios.post('../api/list-layers', + axios.post('../api/list-user-layers', this.CreatePostPayload({})) .then(function(response) { that.userLayers = response.data['user-layers']; @@ -194,7 +194,7 @@ } that.LoadUserFeatures(); - that.ReloadImportedLayersContent(); + that.ReloadImportedFeatures(); }) .catch(function() { console.error('Cannot load the saved annotations'); @@ -1163,7 +1163,7 @@ this.modalImportLayer.show(); var that = this; - axios.post('../api/users-sharing-layers', + axios.post('../api/list-sharing-users', this.CreatePostPayload({})) .then(function(response) { that.importAvailableUsers = response.data; @@ -1202,7 +1202,7 @@ this.importAvailableLayers = []; var that = this; - axios.post('../api/shared-layers', + axios.post('../api/list-shared-layers', this.CreatePostPayload({ 'user': this.importSelectedUser })) .then(function(response) { that.importAvailableLayers = response.data; @@ -1218,7 +1218,7 @@ var layerId = this.importSelectedLayer; var that = this; - axios.post('../api/import-shared-layer', + axios.post('../api/import-layer', this.CreatePostPayload({ 'author': userId, 'layer': layerId @@ -1242,7 +1242,7 @@ var layerId = this.pendingDelete; var that = this; - axios.post('../api/remove-shared-layer', + axios.post('../api/remove-imported-layer', this.CreatePostPayload({ 'layer': layerId })) @@ -1256,7 +1256,7 @@ SaveImportedLayer: function(layer) { var that = this; - axios.post('../api/save-shared-layer', + axios.post('../api/save-imported-layer', this.CreatePostPayload({ 'layer': layer })) @@ -1266,7 +1266,7 @@ }, - ReloadImportedLayersContent: function() { + ReloadImportedFeatures: function() { console.assert(this.drawImportedSource !== null); // InitializeAnnotations() must have been invoked console.assert(this.workspaceInfo.enabled !== undefined); // LoadLayers() must have been invoked @@ -1275,7 +1275,7 @@ } var that = this; - axios.post('../api/load-shared-features', + axios.post('../api/load-imported-features', this.CreatePostPayload({})) .then(function(response) { that.drawImportedSource.clear();
