You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ij...@apache.org on 2014/06/18 18:31:34 UTC

svn commit: r1603510 - in /jena/Experimental/jena-fuseki2/src/main/webapp: js/app/models/fuseki-server.js js/app/templates/dataset-management.tpl js/app/views/dataset-management.js manage.html

Author: ijd
Date: Wed Jun 18 16:31:34 2014
New Revision: 1603510

URL: http://svn.apache.org/r1603510
Log:
WIP: adding action to delete a dataset

Modified:
    jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js
    jena/Experimental/jena-fuseki2/src/main/webapp/js/app/templates/dataset-management.tpl
    jena/Experimental/jena-fuseki2/src/main/webapp/js/app/views/dataset-management.js
    jena/Experimental/jena-fuseki2/src/main/webapp/manage.html

Modified: jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js?rev=1603510&r1=1603509&r2=1603510&view=diff
==============================================================================
--- jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js (original)
+++ jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js Wed Jun 18 16:31:34 2014
@@ -14,6 +14,8 @@ define(
         Dataset = require( "app/models/dataset" ),
         PageUtils = require( "app/util/page-utils" );
 
+    var DATASETS_MANAGEMENT_PATH = "/$/datasets";
+
     /**
      * This model represents the core representation of the remote Fuseki
      * server. Individual datasets have their own model.
@@ -84,7 +86,7 @@ define(
         }
 
         var datasets = _.map( serverDesc.datasets, function( d ) {
-          return new Dataset( d, bURL, mgmtURL );
+          return new Dataset( d, bURL, mgmtURL + DATASETS_MANAGEMENT_PATH );
         } );
 
         datasets.sort( function( ds0, ds1 ) {

Modified: jena/Experimental/jena-fuseki2/src/main/webapp/js/app/templates/dataset-management.tpl
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-fuseki2/src/main/webapp/js/app/templates/dataset-management.tpl?rev=1603510&r1=1603509&r2=1603510&view=diff
==============================================================================
--- jena/Experimental/jena-fuseki2/src/main/webapp/js/app/templates/dataset-management.tpl (original)
+++ jena/Experimental/jena-fuseki2/src/main/webapp/js/app/templates/dataset-management.tpl Wed Jun 18 16:31:34 2014
@@ -14,7 +14,7 @@
             </td>
             <td><input type='checkbox' class='checkbox' checked /></td>
             <td>
-              <a class="btn btn-sm action remove btn-primary" data-uri='<%= ds.mgmtURL() %>'><i class='fa fa-times-circle'></i> remove</a>
+              <a class="btn btn-sm action remove btn-primary" data-mgmt-uri='<%= ds.mgmtURL() %>' data-ds-id='<%= ds.name() %>'><i class='fa fa-times-circle'></i> remove</a>
               <a class="btn btn-sm action backup btn-primary" data-uri='<%= ds.mgmtURL() %>'><i class='fa fa-download'></i> backup</a>
               <a class="btn btn-sm action configure btn-primary" href="admin-dataset-details.html#<%= ds.name() %>"><i class='fa fa-wrench'></i> configure</a>
               <a class="btn btn-sm action add-data btn-primary" href="upload.html?ds=<%= ds.name %>'><i class='fa fa-plus-circle'></i> add data</a>

Modified: jena/Experimental/jena-fuseki2/src/main/webapp/js/app/views/dataset-management.js
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-fuseki2/src/main/webapp/js/app/views/dataset-management.js?rev=1603510&r1=1603509&r2=1603510&view=diff
==============================================================================
--- jena/Experimental/jena-fuseki2/src/main/webapp/js/app/views/dataset-management.js (original)
+++ jena/Experimental/jena-fuseki2/src/main/webapp/js/app/views/dataset-management.js Wed Jun 18 16:31:34 2014
@@ -8,6 +8,7 @@ define(
     var DataManagementView = Backbone.Marionette.ItemView.extend( {
 
       initialize: function(){
+        _.bindAll( this, "onRemoveDataset" );
         this.listenTo( this.model, "change", this.onModelChange, this );
       },
 
@@ -19,6 +20,7 @@ define(
       el: "#dataset-management",
 
       events: {
+        "click .action.remove": "onRemoveDataset"
 //        "change #independent-variable-selection": "selectVariable",
 //        "click a.action.filter": "onFilter"
       },
@@ -30,6 +32,29 @@ define(
       /** If the model changes, update the summary */
       onModelChange: function( event ) {
 //        this.ui.summary.html( this.model.independentVar().component.range().summarise() );
+      },
+
+      /** User has requested a dataset be removed */
+      onRemoveDataset: function( e ) {
+        e.preventDefault();
+        var elem = $(e.currentTarget);
+        var dsId = elem.data( "ds-id" );
+        var mgmtURI = elem.data( "mgmt-uri" );
+        var msg = sprintf( "Are you sure you want to delete dataset %s? This action cannot be reversed.", dsId );
+        var deleteConfirmModal = $( "#deleteConfirmModal" );
+
+        deleteConfirmModal.find( ".modal-body p" ).html( msg );
+        deleteConfirmModal.find( ".action.confirm" ).data( "uri", mgmtURI + dsId );
+
+        deleteConfirmModal.modal( 'show' );
+      },
+
+      /** User has confirmed that the dataset can be deleted */
+      onConfirmRemoveDataset: function( e ) {
+        e.preventDefault();
+        var elem = $(e.currentTarget);
+
+
       }
 
     });

Modified: jena/Experimental/jena-fuseki2/src/main/webapp/manage.html
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-fuseki2/src/main/webapp/manage.html?rev=1603510&r1=1603509&r2=1603510&view=diff
==============================================================================
--- jena/Experimental/jena-fuseki2/src/main/webapp/manage.html (original)
+++ jena/Experimental/jena-fuseki2/src/main/webapp/manage.html Wed Jun 18 16:31:34 2014
@@ -101,5 +101,26 @@
         </div> <!-- /.col-md-12 -->
       </div> <!-- /.row -->
     </div> <!--/.container -->
+
+    <!-- Modal dialogs -->
+
+    <div class="modal fade" id="deleteConfirmModal" tabindex="-1" role="dialog" aria-labelledby="deleteConfirmModalLabel" aria-hidden="true">
+      <div class="modal-dialog">
+        <div class="modal-content">
+          <div class="modal-header">
+            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+            <h4 class="modal-title" id="deleteConfirmModalLabel">Confirm delete</h4>
+          </div>
+          <div class="modal-body">
+            <p></p>
+          </div>
+          <div class="modal-footer">
+            <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-icon-remove"></i> Cancel</button>
+            <button type="button" class="btn btn-primary action confirm"><i class="fa fa-icon-confirm"></i> Confirm delete</button>
+          </div>
+        </div><!-- /.modal-content -->
+      </div><!-- /.modal-dialog -->
+    </div><!-- /.modal -->
+
   </body>
 </html>
\ No newline at end of file