Skip to content

Commit

Permalink
Fixed #465
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Apr 18, 2017
1 parent 06f3fd3 commit c81dff7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
25 changes: 11 additions & 14 deletions src/controllers/document-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ DocController.controller("DocumentModalController", ['$scope', '$routeParams', '
}


$scope.onReload = function(){
$scope.onReload = function () {

}

Expand Down Expand Up @@ -172,8 +172,12 @@ DocController.controller("DocumentModalController", ['$scope', '$routeParams', '
$scope.headers = Database.getPropertyFromDoc($scope.doc);
$scope.selectClass = false;

}

$scope.fillClasses = function (classes) {
return SchemaService.vertexClasses(classes).map((c) => c.name);
}

$scope.deleteField = function (name) {
delete $scope.doc[name];
var idx = $scope.headers.indexOf(name);
Expand All @@ -183,34 +187,27 @@ DocController.controller("DocumentModalController", ['$scope', '$routeParams', '
$scope.selectClass = false;
$scope.reload();
} else {

$scope.selectClass = true;
Database.refreshMetadata($scope.db, () => {
$scope.listClasses = SchemaService.vertexClasses(Database.listClasses()).map((c) => c.name);
$scope.listClasses = $scope.fillClasses(Database.listClasses());
if ($scope.listClasses.length == 1) {
$scope.selectedClass = $scope.listClasses[0];
}
});

}

}]);




DocController.controller("DocumentModalEdgeController", ['$scope', '$routeParams', '$location', 'CommandApi', 'DocumentApi', 'Database', 'Notification', '$controller', 'SchemaService', function ($scope, $routeParams, $location, CommandApi, DocumentApi, Database, Notification, $controller, SchemaService) {

$controller('DocumentModalController', {$scope: $scope});


Database.refreshMetadata($routeParams.database, () => {
$scope.listClasses = SchemaService.edgeClasses(Database.listClasses()).map((c) => c.name);

if ($scope.listClasses.length == 1) {
$scope.selectedClass = $scope.listClasses[0];
}
})

$scope.fillClasses = function (classes) {
return SchemaService.edgeClasses(classes).map((c) => c.name);
}

$scope.lightweight = false;
$scope.save = function (cls) {
Expand Down Expand Up @@ -251,7 +248,6 @@ DocController.controller("DocumentModalEdgeController", ['$scope', '$routeParams
$scope.setSelectClass = function (cls) {
$scope.doc = DocumentApi.createNewDoc(cls);


delete $scope.doc["in"];
delete $scope.doc["out"];

Expand All @@ -263,6 +259,7 @@ DocController.controller("DocumentModalEdgeController", ['$scope', '$routeParams

}


$scope.createLightEdge = function (cls) {
$scope.save(cls);
$scope.$hide();
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/graph-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ GraphModule.controller("GraphController", ['$scope', '$routeParams', '$location'
}
}
var modalPromise = $modal({
template: 'views/database/modalNewEdge.html',
templateUrl: 'views/database/modalNewEdge.html',
persist: false,
show: false,
scope: modalScope,
Expand Down Expand Up @@ -1228,7 +1228,7 @@ GraphModule.controller("GraphController", ['$scope', '$routeParams', '$location'
}, 100)
}
$modal({
template: 'views/database/modalNew.html',
templateUrl: 'views/database/modalNew.html',
persist: false,
show: true,
scope: modalScope,
Expand Down

0 comments on commit c81dff7

Please sign in to comment.