changeset 565:2949bd229f0d annotations

renamed "shared layers" as "imported layers" in js
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Sep 2026 18:12:18 +0200
parents 02b5832f3875
children 5bffc731ba48
files ViewerPlugin/WebApplication/viewer.html ViewerPlugin/WebApplication/viewer.js
diffstat 2 files changed, 56 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/WebApplication/viewer.html	Tue Sep 01 18:04:32 2026 +0200
+++ b/ViewerPlugin/WebApplication/viewer.html	Tue Sep 01 18:12:18 2026 +0200
@@ -373,9 +373,9 @@
           <hr class="my-4">
 
           <div class="d-flex align-items-center mb-1" v-if="workspaceInfo.sharing">
-            <h5>Shared layers</h5>
+            <h5>Imported layers</h5>
             <button type="button" class="btn btn-primary btn-sm ms-auto"
-                    v-on:click="ShowImportSharedLayerModal()">
+                    v-on:click="ShowImportLayerModal()">
               <i class="bi bi-cloud-download"></i>
               Import
             </button>
@@ -391,20 +391,20 @@
               </tr>
             </thead>
             <tbody>
-              <tr v-for="layer in sharedLayers">
+              <tr v-for="layer in importedLayers">
                 <td class="text-center align-middle p-0">
                   <button type="button" class="btn btn-link p-1" style="color:inherit">
                     <i class="bi"
                        :class="layer.visible ? 'bi-eye' : 'bi-eye-slash'"
-                       v-on:click="layer.visible = !layer.visible; drawSharedLayer.changed(); SaveSharedLayer(layer)"
+                       v-on:click="layer.visible = !layer.visible; drawImportedLayer.changed(); SaveImportedLayer(layer)"
                        ></i>
                   </button>
                 </td>
                 <td class="text-center align-middle p-0">
                   <input type="color" style="width:22px;height:22px;padding:1px;border:none;cursor:pointer;border-radius:3px"
                          v-model:value="layer.color"
-                         v-on:input="drawSharedLayer.changed()"
-                         v-on:change="SaveSharedLayer(layer)">
+                         v-on:input="drawImportedLayer.changed()"
+                         v-on:change="SaveImportedLayer(layer)">
                 </td>
                 <td class="align-middle px-1 py-0">
                   <span class="small d-block">{{layer.name}}</span>
@@ -412,7 +412,7 @@
                 </td>
                 <td class="text-center align-middle p-0">
                   <button type="button" class="btn btn-link p-0"
-                          v-on:click="DeleteSharedLayer(layer.id)">
+                          v-on:click="DeleteImportedLayer(layer.id)">
                     <i class="bi bi-trash"></i>
                   </button>
                 </td>
@@ -420,9 +420,9 @@
             </tbody>
           </table>
 
-          <button class="btn btn-sm btn-primary w-100 mb-2" v-on:click="ReloadSharedLayersContent()"
-                  v-if="workspaceInfo.sharing && sharedLayers.length > 0">
-            <i class="bi bi-arrow-clockwise me-2 align-middle"></i> Reload shared content
+          <button class="btn btn-sm btn-primary w-100 mb-2" v-on:click="ReloadImportedLayersContent()"
+                  v-if="workspaceInfo.sharing && importedLayers.length > 0">
+            <i class="bi bi-arrow-clockwise me-2 align-middle"></i> Reload imported content
           </button>
 
           <hr class="my-4" v-if="workspaceInfo.sharing">
@@ -497,8 +497,8 @@
       </div>
 
 
-      <!-- Confirmation modal for shared layer deletion -->
-      <div class="modal fade" id="modal-delete-shared-layer" tabindex="-1">
+      <!-- Confirmation modal for imported layer deletion -->
+      <div class="modal fade" id="modal-delete-imported-layer" tabindex="-1">
         <div class="modal-dialog modal-sm">
           <div class="modal-content">
             <div class="modal-body">
@@ -506,7 +506,7 @@
             </div>
             <div class="modal-footer py-1">
               <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Cancel</button>
-              <button type="button" class="btn btn-sm btn-danger" v-on:click="SharedLayerDeleteConfirmed()">Delete</button>
+              <button type="button" class="btn btn-sm btn-danger" v-on:click="ImportedLayerDeleteConfirmed()">Delete</button>
             </div>
           </div>
         </div>
@@ -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">Shared with specific users:</label>
+              <label class="form-label small mb-1">Share 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"
@@ -572,8 +572,8 @@
       </div>
 
 
-      <!-- Modal to import a shared layer from another user -->
-      <div class="modal fade" id="modal-import-shared-layer" tabindex="-1">
+      <!-- Modal to import a layer from another user -->
+      <div class="modal fade" id="modal-import-layer" tabindex="-1">
         <div class="modal-dialog">
           <div class="modal-content">
             <div class="modal-header py-2">
@@ -614,7 +614,7 @@
               <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Cancel</button>
               <button type="button" class="btn btn-sm btn-primary"
                       :disabled="!importSelectedLayer"
-                      v-on:click="ImportSharedLayerConfirmed()">Import</button>
+                      v-on:click="ImportLayerConfirmed()">Import</button>
             </div>
           </div>
         </div>
--- a/ViewerPlugin/WebApplication/viewer.js	Tue Sep 01 18:04:32 2026 +0200
+++ b/ViewerPlugin/WebApplication/viewer.js	Tue Sep 01 18:12:18 2026 +0200
@@ -41,7 +41,7 @@
       workspaceInfo: {},
       imageDescription: '',
       userLayers: [],
-      sharedLayers: [],
+      importedLayers: [],
       activeUserLayerId: null,
 
       // UI state
@@ -54,7 +54,7 @@
 
       // Bootstrap modals
       modalDeleteUserLayer: null,
-      modalDeleteSharedLayer: null,
+      modalDeleteImportedLayer: null,
       modalDeleteAnnotation: null,
       pendingDelete: null,
 
@@ -71,8 +71,8 @@
       map: null,
       drawSource: null,
       drawLayer: null,  // Used in HTML
-      drawSharedSource: null,
-      drawSharedLayer: null,
+      drawImportedSource: null,
+      drawImportedLayer: null,
       drawLine: null,
       drawPoint: null,
       drawCircle: null,
@@ -100,8 +100,8 @@
       shareLayerSearchQuery: '',
       shareLayerSearchResults: [],
 
-      // Import shared layers modal
-      modalImportSharedLayer: null,
+      // Import layers modal
+      modalImportLayer: null,
       importAvailableUsers: [],
       importUserSearchQuery: '',
       importUserSearchResults: [],
@@ -115,10 +115,10 @@
     this.InitializePanelAnimation();
 
     this.modalDeleteUserLayer = new bootstrap.Modal(document.getElementById('modal-delete-user-layer'));
-    this.modalDeleteSharedLayer = new bootstrap.Modal(document.getElementById('modal-delete-shared-layer'));
+    this.modalDeleteImportedLayer = new bootstrap.Modal(document.getElementById('modal-delete-imported-layer'));
     this.modalDeleteAnnotation = new bootstrap.Modal(document.getElementById('modal-delete-annotation'));
     this.modalShareUserLayer = new bootstrap.Modal(document.getElementById('modal-share-user-layer'));
-    this.modalImportSharedLayer = new bootstrap.Modal(document.getElementById('modal-import-shared-layer'));
+    this.modalImportLayer = new bootstrap.Modal(document.getElementById('modal-import-layer'));
 
     document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(function(el) {
       new bootstrap.Tooltip(el, { trigger: 'hover' });
@@ -174,7 +174,7 @@
                  this.CreatePostPayload({}))
         .then(function(response) {
           that.userLayers = response.data['user-layers'];
-          that.sharedLayers = response.data['imported-layers'];
+          that.importedLayers = response.data['imported-layers'];
 
           if (that.userLayers.length == 0) {
             that.CreateUserLayer();
@@ -185,7 +185,7 @@
           }
 
           that.LoadUserFeatures();
-          that.ReloadSharedLayersContent();
+          that.ReloadImportedLayersContent();
         })
         .catch(function() {
           console.error('Cannot load the saved annotations');
@@ -866,10 +866,10 @@
         return null;
       }
 
-      function GetSharedLayerById(id) {
-        for (var i = 0; i < app.sharedLayers.length; i++) {
-          if (app.sharedLayers[i].id == id) {
-            return app.sharedLayers[i];
+      function GetImportedLayerById(id) {
+        for (var i = 0; i < app.importedLayers.length; i++) {
+          if (app.importedLayers[i].id == id) {
+            return app.importedLayers[i];
           }
         }
         return null;
@@ -904,19 +904,19 @@
 
       this.map.addLayer(this.drawLayer);
 
-      // Shared annotations: a separate read-only source for all imported shared layers
-      this.drawSharedSource = new ol.source.Vector();
-      this.drawSharedLayer = new ol.layer.Vector({
-        source: this.drawSharedSource,
+      // Shared annotations: a separate read-only source for all imported layers
+      this.drawImportedSource = new ol.source.Vector();
+      this.drawImportedLayer = new ol.layer.Vector({
+        source: this.drawImportedSource,
         style: function(feature) {
-          var entry = GetSharedLayerById(feature.get('layer-id'));
+          var entry = GetImportedLayerById(feature.get('layer-id'));
           if (!entry || !entry.visible) {
             return null;
           }
           return CreateLayerStyle(entry.color);
         }
       });
-      this.map.addLayer(this.drawSharedLayer);
+      this.map.addLayer(this.drawImportedLayer);
 
       // Draw interactions (inactive until toggled)
       this.drawLine = new ol.interaction.Draw({
@@ -1058,7 +1058,7 @@
     },
 
     // -----------------------------------------------------------------------
-    // Shared layers
+    // Imported layers
     // -----------------------------------------------------------------------
 
     ShowShareUserLayerModal: function(layer) {
@@ -1136,14 +1136,14 @@
 
 
 
-    ShowImportSharedLayerModal: function() {
+    ShowImportLayerModal: function() {
       this.importUserSearchQuery = '';
       this.importUserSearchResults = [];
       this.importSelectedUser = '';
       this.importSelectedLayer = '';
       this.importAvailableUsers = [];
       this.importAvailableLayers = [];
-      this.modalImportSharedLayer.show();
+      this.modalImportLayer.show();
 
       var that = this;
       axios.post('../api/users-sharing-layers',
@@ -1191,12 +1191,12 @@
           that.importAvailableLayers = response.data;
         })
         .catch(function() {
-          console.error('Cannot load shared layers');
+          console.error('Cannot load imported layers');
         });
     },
 
-    ImportSharedLayerConfirmed: function() {
-      this.modalImportSharedLayer.hide();
+    ImportLayerConfirmed: function() {
+      this.modalImportLayer.hide();
       var userId = this.importSelectedUser;
       var layerId = this.importSelectedLayer;
 
@@ -1210,18 +1210,18 @@
           that.LoadLayers();
         })
         .catch(function() {
-          console.error('Cannot import shared layer');
+          console.error('Cannot import layer');
         });
     },
 
 
-    DeleteSharedLayer: function(layerId) {
+    DeleteImportedLayer: function(layerId) {
       this.pendingDelete = layerId;
-      this.modalDeleteSharedLayer.show();
+      this.modalDeleteImportedLayer.show();
     },
 
-    SharedLayerDeleteConfirmed: function() {
-      this.modalDeleteSharedLayer.hide();
+    ImportedLayerDeleteConfirmed: function() {
+      this.modalDeleteImportedLayer.hide();
       var layerId = this.pendingDelete;
 
       var that = this;
@@ -1233,24 +1233,24 @@
           that.LoadLayers();
         })
         .catch(function() {
-          console.error('Cannot remove shared layer');
+          console.error('Cannot remove imported layer');
         });
     },
 
-    SaveSharedLayer: function(layer) {
+    SaveImportedLayer: function(layer) {
       var that = this;
       axios.post('../api/save-shared-layer',
                  this.CreatePostPayload({
                    'layer': layer
                  }))
         .catch(function() {
-          console.error('Cannot save shared layer');
+          console.error('Cannot save imported layer');
         });
     },
 
 
-    ReloadSharedLayersContent: function() {
-      console.assert(this.drawSharedSource !== null);  // InitializeAnnotations() must have been invoked
+    ReloadImportedLayersContent: function() {
+      console.assert(this.drawImportedSource !== null);  // InitializeAnnotations() must have been invoked
       console.assert(this.workspaceInfo.enabled !== undefined);  // LoadLayers() must have been invoked
 
       if (!this.workspaceInfo.sharing) {
@@ -1261,14 +1261,14 @@
       axios.post('../api/load-shared-features',
                  this.CreatePostPayload({}))
         .then(function(response) {
-          that.drawSharedSource.clear();
+          that.drawImportedSource.clear();
 
           for (let i = 0; i < response.data.features.length; i++) {
-            UnserializeFeatureOntoMap(that.drawSharedSource, response.data.features[i]);
+            UnserializeFeatureOntoMap(that.drawImportedSource, response.data.features[i]);
           }
         })
         .catch(function() {
-          console.error('Cannot load shared features');
+          console.error('Cannot load imported features');
         });
     }
   }