diff --git a/js/apps/system/aardvark/frontend/js/routers/router.js b/js/apps/system/aardvark/frontend/js/routers/router.js index 1555cdc941..dfeab7b0eb 100644 --- a/js/apps/system/aardvark/frontend/js/routers/router.js +++ b/js/apps/system/aardvark/frontend/js/routers/router.js @@ -9,7 +9,6 @@ routes: { "": "dashboard", "dashboard": "dashboard", - "collection/:colid": "collection", "collections": "collections", "new": "newCollection", "login": "login", @@ -151,15 +150,6 @@ }); }, - collection: function (colid) { - if (!this.collectionView) { - this.collectionView = new window.CollectionView(); - } - this.collectionView.setColId(colid); - this.collectionView.render(); - this.naviView.selectMenuItem('collections-menu'); - }, - documents: function (colid, pageid) { if (!window.documentsView) { window.documentsView = new window.DocumentsView({ diff --git a/js/apps/system/aardvark/frontend/js/templates/collectionView.ejs b/js/apps/system/aardvark/frontend/js/templates/collectionView.ejs deleted file mode 100644 index b2351d2a1b..0000000000 --- a/js/apps/system/aardvark/frontend/js/templates/collectionView.ejs +++ /dev/null @@ -1,93 +0,0 @@ - diff --git a/js/apps/system/aardvark/frontend/js/views/collectionView.js b/js/apps/system/aardvark/frontend/js/views/collectionView.js deleted file mode 100644 index fa8aff69c8..0000000000 --- a/js/apps/system/aardvark/frontend/js/views/collectionView.js +++ /dev/null @@ -1,217 +0,0 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true, stupid: true */ -/*global require, window, exports, Backbone, $, arangoHelper, templateEngine */ -(function() { - "use strict"; - window.CollectionView = Backbone.View.extend({ - el: '#modalPlaceholder', - initialize: function () { - var self = this; - }, - - template: templateEngine.createTemplate("collectionView.ejs"), - - render: function() { - var self = this; - $(this.el).html(this.template.render({ - isCoordinator: window.isCoordinator() - })); - $('#change-collection').modal('show'); - $('#change-collection').on('hidden', function () { - }); - $('#change-collection').on('shown', function () { - if (! window.isCoordinator()) { - $('#change-collection-name').focus(); - } - }); - this.fillModal(); - - $("[data-toggle=tooltip]").tooltip(); - - return this; - }, - events: { - "click #save-modified-collection" : "saveModifiedCollection", - "hidden #change-collection" : "hidden", - "click #delete-modified-collection" : "deleteCollection", - "click #load-modified-collection" : "loadCollection", - "click #unload-modified-collection" : "unloadCollection", - "click #confirmDeleteCollection" : "confirmDeleteCollection", - "click #abortDeleteCollection" : "abortDeleteCollection", - "keydown #change-collection-name" : "listenKey", - "keydown #change-collection-size" : "listenKey" - }, - listenKey: function(e) { - if (e.keyCode === 13) { - this.saveModifiedCollection(); - } - }, - hidden: function () { - window.App.navigate("#collections", {trigger: true}); - }, - - setColId: function(colId) { - this.options.colId = colId; - }, - - fillModal: function() { - try { - this.myCollection = window.arangoCollectionsStore.get(this.options.colId).attributes; - } - catch (e) { - // in case the collection cannot be found or something is not present (e.g. after a reload) - window.App.navigate("#"); - return; - } - - $('#change-collection-name').val(this.myCollection.name); - $('#change-collection-id').text(this.myCollection.id); - $('#change-collection-type').text(this.myCollection.type); - $('#change-collection-status').text(this.myCollection.status); - - if (this.myCollection.status === 'unloaded') { - $('#colFooter').prepend( - '' - ); - $('#collectionSizeBox').hide(); - $('#collectionSyncBox').hide(); - $('#tab-content-collection-edit tab-pane').css("border-top",0); - } - else if (this.myCollection.status === 'loaded') { - $('#colFooter').prepend( - '' - ); - var data = window.arangoCollectionsStore.getProperties(this.options.colId, true); - this.fillLoadedModal(data); - } - }, - - fillLoadedModal: function (data) { - - //show tabs & render figures tab-view - $('#change-collection .nav-tabs').css("visibility","visible"); - - $('#collectionSizeBox').show(); - $('#collectionSyncBox').show(); - if (data.waitForSync === false) { - $('#change-collection-sync').val('false'); - } - else { - $('#change-collection-sync').val('true'); - } - var calculatedSize = data.journalSize / 1024 / 1024; - $('#change-collection-size').val(calculatedSize); - $('#change-collection').modal('show'); - }, - saveModifiedCollection: function() { - var newname; - if (window.isCoordinator()) { - newname = this.myCollection.name; - } - else { - newname = $('#change-collection-name').val(); - if (newname === '') { - arangoHelper.arangoError('No collection name entered!'); - return 0; - } - } - - var collid = this.getCollectionId(); - var status = this.getCollectionStatus(); - - if (status === 'loaded') { - var result; - if (this.myCollection.name !== newname) { - result = window.arangoCollectionsStore.renameCollection(collid, newname); - } - - var wfs = $('#change-collection-sync').val(); - var journalSize; - try { - journalSize = JSON.parse($('#change-collection-size').val() * 1024 * 1024); - } - catch (e) { - arangoHelper.arangoError('Please enter a valid number'); - return 0; - } - var changeResult = window.arangoCollectionsStore.changeCollection(collid, wfs, journalSize); - - if (result !== true) { - if (result !== undefined) { - arangoHelper.arangoError("Collection error: " + result); - return 0; - } - } - - if (changeResult !== true) { - arangoHelper.arangoNotification("Collection error", changeResult); - return 0; - } - - if (changeResult === true) { - window.arangoCollectionsStore.fetch({ - success: function () { - window.collectionsView.render(); - } - }); - this.hideModal(); - } - } - else if (status === 'unloaded') { - if (this.myCollection.name !== newname) { - var result2 = window.arangoCollectionsStore.renameCollection(collid, newname); - if (result2 === true) { - - window.arangoCollectionsStore.fetch({ - success: function () { - window.collectionsView.render(); - } - }); - this.hideModal(); - } - else { - arangoHelper.arangoError("Collection error: " + result2); - } - } - else { - this.hideModal(); - } - } - }, - getCollectionId: function () { - return this.myCollection.id; - }, - getCollectionStatus: function () { - return this.myCollection.status; - }, - unloadCollection: function () { - var collid = this.getCollectionId(); - window.arangoCollectionsStore.unloadCollection(collid); - this.hideModal(); - }, - loadCollection: function () { - var collid = this.getCollectionId(); - window.arangoCollectionsStore.loadCollection(collid); - this.hideModal(); - }, - hideModal: function () { - $('#change-collection').modal('hide'); - }, - deleteCollection: function () { - $('#reallyDeleteColDiv').show(); - }, - abortDeleteCollection: function() { - $('#reallyDeleteColDiv').hide(); - }, - confirmDeleteCollection: function () { - var self = this; - var collName = self.myCollection.name; - var returnval = window.arangoCollectionsStore.deleteCollection(collName); - if (returnval === false) { - arangoHelper.arangoError('Could not delete collection.'); - } - self.hideModal(); - } - - }); -}()); diff --git a/js/apps/system/aardvark/test/dummy.html b/js/apps/system/aardvark/test/dummy.html index b49869f4fe..cd991c0d38 100644 --- a/js/apps/system/aardvark/test/dummy.html +++ b/js/apps/system/aardvark/test/dummy.html @@ -15,7 +15,6 @@ - diff --git a/js/apps/system/aardvark/test/karma/files.json b/js/apps/system/aardvark/test/karma/files.json index 3211d9cf48..36d4972abb 100755 --- a/js/apps/system/aardvark/test/karma/files.json +++ b/js/apps/system/aardvark/test/karma/files.json @@ -146,7 +146,6 @@ "frontend/js/views/dashboardView.js", "frontend/js/views/newDashboardView.js", "frontend/js/views/collectionsView.js", - "frontend/js/views/collectionView.js", "frontend/js/views/collectionsItemView.js", "frontend/js/views/documentsView.js", "frontend/js/views/documentView.js", @@ -250,7 +249,6 @@ "test/specs/views/appDocumentationViewSpec.js", "test/specs/views/modalViewSpec.js", "test/specs/views/editListEntryViewSpec.js", - "test/specs/views/collectionViewSpec.js", "test/specs/views/collectionsViewSpec.js", "test/specs/views/dbSelectionViewSpec.js", "test/specs/views/navigationViewSpec.js", diff --git a/js/apps/system/aardvark/test/karma/karma_planner.conf.js b/js/apps/system/aardvark/test/karma/karma_planner.conf.js index 7ff88c9ea8..036bd62280 100644 --- a/js/apps/system/aardvark/test/karma/karma_planner.conf.js +++ b/js/apps/system/aardvark/test/karma/karma_planner.conf.js @@ -156,7 +156,6 @@ module.exports = function(karma) { 'frontend/js/views/shellView.js', 'frontend/js/views/dashboardView.js', 'frontend/js/views/collectionsView.js', - 'frontend/js/views/collectionView.js', 'frontend/js/views/collectionsItemView.js', 'frontend/js/views/documentsView.js', 'frontend/js/views/documentView.js', diff --git a/js/apps/system/aardvark/test/runnerAll.html b/js/apps/system/aardvark/test/runnerAll.html index df57981e67..1efc1d8795 100644 --- a/js/apps/system/aardvark/test/runnerAll.html +++ b/js/apps/system/aardvark/test/runnerAll.html @@ -96,7 +96,6 @@ - @@ -117,7 +116,6 @@ - diff --git a/js/apps/system/aardvark/test/runnerJSLint.html b/js/apps/system/aardvark/test/runnerJSLint.html index 0765ce6add..f67ff986cd 100644 --- a/js/apps/system/aardvark/test/runnerJSLint.html +++ b/js/apps/system/aardvark/test/runnerJSLint.html @@ -15,7 +15,6 @@ - diff --git a/js/apps/system/aardvark/test/specs/router/routerSpec.js b/js/apps/system/aardvark/test/specs/router/routerSpec.js index a4dede323c..8b9af2ac0e 100644 --- a/js/apps/system/aardvark/test/specs/router/routerSpec.js +++ b/js/apps/system/aardvark/test/specs/router/routerSpec.js @@ -377,7 +377,6 @@ expected = [ "", "dashboard", - "collection/:colid", "collections", "new", "login", @@ -425,22 +424,6 @@ expect(available).toDefineTheRoutes(expected); }); - it("should route to a collection", function () { - var colid = 5; - simpleNavigationCheck( - { - url: "collection/:colid", - params: [colid] - }, - "CollectionView", - "collections-menu", - undefined, - { - setColId: colid - } - ); - }); - it("should route to documents", function () { var colid = 5, pageid = 6; diff --git a/js/apps/system/aardvark/test/specs/views/collectionViewSpec.js b/js/apps/system/aardvark/test/specs/views/collectionViewSpec.js deleted file mode 100644 index 01fcd596ff..0000000000 --- a/js/apps/system/aardvark/test/specs/views/collectionViewSpec.js +++ /dev/null @@ -1,53 +0,0 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/ -/*global describe, beforeEach, afterEach, it, spyOn, expect*/ -/*global runs, waitsFor, jasmine*/ -/*global $, arangoCollectionModel*/ -(function() { - "use strict"; - - describe("Collection View", function() { - - var myView, isCoordinator; - - - beforeEach(function() { - isCoordinator = false; - window.App = { - navigate: function() { - throw "This should be a spy"; - } - }; - spyOn(window.App, "navigate"); - spyOn(window, "isCoordinator").andReturn(isCoordinator); - $('body').append('
'); - - myView = new window.CollectionView({ - model: arangoCollectionModel - }); - - }); - - afterEach(function() { - $('.removeMe').remove(); - delete window.App; - }); - - - describe("Collection Changes", function() { - it("Check if changes were submitted", function() { - - var pressedEnter = false; - myView.render(); - - spyOn(myView, 'saveModifiedCollection').andCallFake(function(request) { - pressedEnter = true; - }); - - myView.saveModifiedCollection(); - expect(pressedEnter).toBeTruthy(); - }); - - - }); - }); -}());