diff --git a/js/apps/system/aardvark/frontend/js/templates/newCollectionView.ejs b/js/apps/system/aardvark/frontend/js/templates/newCollectionView.ejs
deleted file mode 100644
index c7b7538832..0000000000
--- a/js/apps/system/aardvark/frontend/js/templates/newCollectionView.ejs
+++ /dev/null
@@ -1,78 +0,0 @@
-
diff --git a/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js b/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js
index dfaf773632..3531b257c0 100644
--- a/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js
+++ b/js/apps/system/aardvark/frontend/js/views/collectionsItemView.js
@@ -171,7 +171,12 @@
journalSize = journalSize/(1024*1024);
tableContent.push(
window.modalView.createTextEntry(
- "change-collection-size", "Journal size", journalSize, false, "", true
+ "change-collection-size",
+ "Journal size",
+ journalSize,
+ "The maximal size of a journal or datafile (in MB). Must be at least 1.",
+ "",
+ true
)
);
diff --git a/js/apps/system/aardvark/frontend/js/views/collectionsView.js b/js/apps/system/aardvark/frontend/js/views/collectionsView.js
index 5d48b5a6df..b69ab65c2b 100644
--- a/js/apps/system/aardvark/frontend/js/views/collectionsView.js
+++ b/js/apps/system/aardvark/frontend/js/views/collectionsView.js
@@ -258,7 +258,13 @@
shardBy.push("_key");
}
}
- var isSystem = (collName.substr(0, 1) === '_');
+ //no new system collections via webinterface
+ //var isSystem = (collName.substr(0, 1) === '_');
+ if (collName.substr(0, 1) === '_') {
+ arangoHelper.arangoError('No "_" allowed as first character!');
+ return 0;
+ }
+ var isSystem = false;
var wfs = (collSync === "true");
if (collSize > 0) {
try {
diff --git a/js/apps/system/aardvark/frontend/js/views/newCollectionView.js b/js/apps/system/aardvark/frontend/js/views/newCollectionView.js
deleted file mode 100644
index 1b7d08c284..0000000000
--- a/js/apps/system/aardvark/frontend/js/views/newCollectionView.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */
-/*global require, exports, Backbone, EJS, $, window, arangoHelper, templateEngine, _*/
-
-(function (){
- "use strict";
- window.newCollectionView = Backbone.View.extend({
- el: '#modalPlaceholder',
- initialize: function () {
- var self = this;
- $.ajax("cluster/amICoordinator", {
- async: false
- }).done(function(d) {
- self.isCoordinator = d;
- });
- },
-
- template: templateEngine.createTemplate("newCollectionView.ejs"),
-
- render: function() {
- var self = this;
- $(this.el).html(this.template.render({
- isCoordinator: this.isCoordinator
- }));
- if (this.isCoordinator) {
- $("#new-collection-shardBy").select2({
- tags: [],
- showSearchBox: false,
- minimumResultsForSearch: -1,
- width: "336px",
- maximumSelectionSize: 8
- });
- }
- $('#add-collection').modal('show');
- $('#add-collection').on('hidden', function () {
- self.hidden();
- });
- $('#add-collection').on('shown', function () {
- $('#new-collection-name').focus();
- });
-
- $('#edgeFrom').hide();
- $('#edgeTo').hide();
- $('.modalTooltips').tooltip({
- placement: "left"
- });
-
- return this;
- },
-
- events: {
- "click #save-new-collection" : "saveNewCollection",
- "keydown #new-collection-name": "listenKey",
- "keydown #new-collection-size": "listenKey"
- },
-
- listenKey: function(e) {
- if (e.keyCode === 13) {
- this.saveNewCollection();
- }
- },
-
- hidden: function () {
- window.App.navigate("#collections", {trigger: true});
- },
-
- saveNewCollection: function(a) {
- var self = this;
-
- var collName = $('#new-collection-name').val();
- var collSize = $('#new-collection-size').val();
- var collType = $('#new-collection-type').val();
- var collSync = $('#new-collection-sync').val();
- var shards = 1;
- var shardBy = [];
- if (this.isCoordinator) {
- shards = $('#new-collection-shards').val();
- if (shards === "") {
- shards = 1;
- }
- shards = parseInt(shards, 10);
- if (shards < 1) {
- arangoHelper.arangoError(
- "Number of shards has to be an integer value greater or equal 1"
- );
- return 0;
- }
- shardBy = _.pluck($('#new-collection-shardBy').select2("data"), "text");
- if (shardBy.length === 0) {
- shardBy.push("_key");
- }
- }
- var isSystem = (collName.substr(0, 1) === '_');
- var wfs = (collSync === "true");
- if (collSize > 0) {
- try {
- collSize = JSON.parse(collSize) * 1024 * 1024;
- }
- catch (e) {
- arangoHelper.arangoError('Please enter a valid number');
- return 0;
- }
- }
- if (collName === '') {
- arangoHelper.arangoError('No collection name entered!');
- return 0;
- }
-
- var returnobj = window.arangoCollectionsStore.newCollection(
- collName, wfs, isSystem, collSize, collType, shards, shardBy
- );
- if (returnobj.status === true) {
- self.hidden();
- $("#add-collection").modal('hide');
-
- window.App.navigate("collection/" + collName + "/documents/1", {trigger: true});
- }
- else {
- arangoHelper.arangoError(returnobj.errorMessage);
- }
- }
-
- });
-}());
diff --git a/js/apps/system/aardvark/frontend/scss/_modals.scss b/js/apps/system/aardvark/frontend/scss/_modals.scss
index 9d7180dfec..6728c590cd 100644
--- a/js/apps/system/aardvark/frontend/scss/_modals.scss
+++ b/js/apps/system/aardvark/frontend/scss/_modals.scss
@@ -56,7 +56,8 @@
}
.collapse {
- position: inherit;
+ margin-right: -14px;
+ position: relative;
}
.accordion-inner {
@@ -66,6 +67,30 @@
padding-right: 0;
}
+ .accordion-toggle {
+
+ span {
+
+ b.caret {
+ border-top-color: $c-black;
+ float: right;
+ margin-top: 5px;
+ }
+ }
+
+ &.collapsed {
+ span {
+
+ b.caret {
+ -ms-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ }
+ }
+
+ }
+ }
+
input {
width: 384px;
}
diff --git a/js/apps/system/aardvark/frontend/scss/generated.css b/js/apps/system/aardvark/frontend/scss/generated.css
index e5ccb2aac6..b5d5e2cfc2 100644
--- a/js/apps/system/aardvark/frontend/scss/generated.css
+++ b/js/apps/system/aardvark/frontend/scss/generated.css
@@ -2580,12 +2580,21 @@ div.breadcrumb a.disabledBread {
.modal-body .icon-info-sign:hover {
opacity: 1; }
.modal-body .collapse {
- position: inherit; }
+ margin-right: -14px;
+ position: relative; }
.modal-body .accordion-inner {
border-top: 0;
margin-left: 0;
padding-left: 0;
padding-right: 0; }
+ .modal-body .accordion-toggle span b.caret {
+ border-top-color: black;
+ float: right;
+ margin-top: 5px; }
+ .modal-body .accordion-toggle.collapsed span b.caret {
+ -ms-transform: rotate(90deg);
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg); }
.modal-body input {
width: 384px; }
.modal-body select {
diff --git a/js/apps/system/aardvark/test/dummy.html b/js/apps/system/aardvark/test/dummy.html
index ea6fc78112..b49869f4fe 100644
--- a/js/apps/system/aardvark/test/dummy.html
+++ b/js/apps/system/aardvark/test/dummy.html
@@ -25,7 +25,6 @@
-
diff --git a/js/apps/system/aardvark/test/karma/files.json b/js/apps/system/aardvark/test/karma/files.json
index 4c466b2376..0e5918bdcb 100755
--- a/js/apps/system/aardvark/test/karma/files.json
+++ b/js/apps/system/aardvark/test/karma/files.json
@@ -147,7 +147,6 @@
"frontend/js/views/collectionsView.js",
"frontend/js/views/collectionView.js",
"frontend/js/views/collectionInfoView.js",
- "frontend/js/views/newCollectionView.js",
"frontend/js/views/collectionsItemView.js",
"frontend/js/views/documentsView.js",
"frontend/js/views/documentView.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 114a367a81..5b79c96b83 100644
--- a/js/apps/system/aardvark/test/karma/karma_planner.conf.js
+++ b/js/apps/system/aardvark/test/karma/karma_planner.conf.js
@@ -119,7 +119,7 @@ module.exports = function(karma) {
// Models
'frontend/js/models/currentDatabase.js',
- 'frontend/js/models/arangoCollection.js',
+ '../../frontend/js/models/arangoCollectionModel.js',
'frontend/js/models/arangoDatabase.js',
'frontend/js/models/arangoDocument.js',
'frontend/js/models/arangoLog.js',
@@ -160,7 +160,6 @@ module.exports = function(karma) {
'frontend/js/views/collectionsView.js',
'frontend/js/views/collectionView.js',
'frontend/js/views/collectionInfoView.js',
- 'frontend/js/views/newCollectionView.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 a8fcad3716..92ee81d081 100644
--- a/js/apps/system/aardvark/test/runnerAll.html
+++ b/js/apps/system/aardvark/test/runnerAll.html
@@ -97,7 +97,6 @@
-
diff --git a/js/apps/system/aardvark/test/runnerJSLint.html b/js/apps/system/aardvark/test/runnerJSLint.html
index 0d1f727459..0765ce6add 100644
--- a/js/apps/system/aardvark/test/runnerJSLint.html
+++ b/js/apps/system/aardvark/test/runnerJSLint.html
@@ -25,7 +25,6 @@
-
@@ -34,7 +33,7 @@
-
+
diff --git a/js/apps/system/aardvark/test/specs/router/routerSpec.js b/js/apps/system/aardvark/test/specs/router/routerSpec.js
index 67e6417e12..2b3167ecd7 100644
--- a/js/apps/system/aardvark/test/specs/router/routerSpec.js
+++ b/js/apps/system/aardvark/test/specs/router/routerSpec.js
@@ -731,15 +731,6 @@
);
});
- it("should route to the new collection creation", function () {
- simpleNavigationCheck(
- "new",
- "newCollectionView",
- "collections-menu",
- {}
- );
- });
-
it("should route to the api tab", function () {
simpleNavigationCheck(
"api",
@@ -773,40 +764,6 @@
);
});
- it("should offer the add new graph view", function () {
- simpleNavigationCheck(
- "graphManagement/add",
- "AddNewGraphView",
- "graphviewer-menu",
- {
- collection: storeDummy,
- graphs: graphsDummy
- }
- );
- });
-
- /*
-
- it("should offer the delete graph view", function () {
- var name = "testGraph";
- simpleNavigationCheck(
- {
- url: "graphManagement/delete/:name",
- params: [name]
- },
- "DeleteGraphView",
- "graphviewer-menu",
- {
- collection: graphsDummy
- },
- {
- render: name
- }
- );
- });
-
- */
-
it("should route to the applications tab", function () {
simpleNavigationCheck(
"applications",
diff --git a/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js b/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js
index e67db95185..b33ccc5d6c 100644
--- a/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js
+++ b/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js
@@ -1,7 +1,7 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach, afterEach, it, */
/*global spyOn, runs, expect, waitsFor*/
-/*global GraphManagementView, _, $*/
+/*global GraphManagementView, _, jasmine$*/
(function() {
"use strict";
@@ -10,11 +10,16 @@
var view,
div,
+ modalDiv,
graphs,
collections,
v1, v2, e1, e2, sys1, cols;
beforeEach(function() {
+ modalDiv = document.createElement("div");
+ modalDiv.id = "modalPlaceholder";
+ document.body.appendChild(modalDiv);
+ window.modalView = new window.ModalView();
collections = new window.arangoCollections(cols);
graphs = new window.GraphCollection();
div = document.createElement("div");
@@ -30,6 +35,7 @@
afterEach(function() {
document.body.removeChild(div);
+ document.body.removeChild(modalDiv);
});
it("should fetch the graphs on render", function () {
@@ -82,32 +88,35 @@
describe("creating a new graph", function() {
- it("should navigate to the graph adding view", function() {
- spyOn(window.App, "navigate");
- $("#createGraph").click();
- expect(window.App.navigate).toHaveBeenCalledWith(
- "graphManagement/add",
- {
- trigger: true
- }
- );
+ it("should create a new graph", function() {
+ runs(function() {
+ $("#createGraph").click();
+ });
+ waitsFor(function() {
+ return $("#modal-dialog").css("display") === "block";
+ });
+ runs (function() {
+ $("#createNewGraphName").val("newGraph");
+ $("#newGraphVertices").val("newVertices");
+ $("#newGraphEdges").val("newEdges");
+ spyOn($, "ajax").andCallFake(function(opts) {
+ expect(opts.type).toEqual("POST");
+ expect(opts.url).toEqual("/_api/graph");
+ expect(opts.data).toEqual(JSON.stringify({
+ _key: "newGraph",
+ vertices: "newVertices",
+ edges: "newEdges",
+ _id: "",
+ _rev: ""
+ }));
+ });
+ $("#modalButton1").click();
+ expect($.ajax).toHaveBeenCalled()
+ });
});
});
- it("should navigate to graph delete view", function() {
- spyOn(window.App, "navigate");
- var lg = graphs.get("g3");
- $("#" + g3._key + "_settings").click();
- $("#deleteGraph").click();
- expect(window.App.navigate).toHaveBeenCalledWith(
- "graphManagement/delete/" + g3._key,
- {
- trigger: true
- }
- );
- });
-
});
});