Skip to content

Commit

Permalink
fixed bug #117 and #70
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Aug 26, 2014
1 parent 6f5a715 commit a1be9de
Show file tree
Hide file tree
Showing 11 changed files with 463 additions and 213 deletions.
Binary file added app/img/orient_home_bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 58 additions & 25 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<link rel="stylesheet" href="components/codemirror/theme/ambiance.css">
<link rel="stylesheet" href="components/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="components/codemirror/addon/hint/show-hint.css">
<link rel="stylesheet" href="components/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="components/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="components/bootstrap-datepicker/css/datepicker.css"/>
Expand All @@ -44,7 +45,7 @@

<!-- endbuild -->
</head>
<body ng-app="OrientDBStudioApp" class="antialiased">
<body ng-app="OrientDBStudioApp" class="antialiased" ng-class="bodyClass">
<!--[if lt IE 7]>
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser
today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better
Expand All @@ -55,39 +56,68 @@
<script src="components/es5-shim/es5-shim.js"></script>
<script src="components/json3/lib/json3.min.js"></script>
<![endif]-->
<div ng-controller="HeaderController">
<div ng-include src="'views/header.html'"></div>
</div>
<div id="wrap">
<div ng-controller="HeaderController">
<div ng-include src="'views/header.html'"></div>
</div>

<div id="spinner-container" class="">
<div id="spinner">
<div id="spinner-container" class="">
<div id="spinner">
</div>
</div>
</div>
<div id="spinner-circle" class="circle-stop">
<div class="circle-container">
<div class="circle"></div>
<div class="circle1"></div>
<div id="spinner-circle" class="circle-stop">
<div class="circle-container">
<div class="circle"></div>
<div class="circle1"></div>

</div>
</div>
</div>
<div id="interrupter-container" class="circle-interrupt-stop">
<a id="interrupter" class="btn btn-danger" href="javascript:void(0)" data-placement="bottom"
bs-tooltip="'Interrupt request'"></i>Interrupt</a>
</div>
<div class="container-fluid container-notification">
<div class="row-fluid">
<div ng-controller="NotificationController">
<div ng-include src="'views/notification.html'"></div>
<div id="interrupter-container" class="circle-interrupt-stop">
<a id="interrupter" class="btn btn-danger" href="javascript:void(0)" data-placement="bottom"
bs-tooltip="'Interrupt request'"></i>Interrupt</a>
</div>
<div class="container-fluid container-notification">
<div class="row-fluid">
<div ng-controller="NotificationController">
<div ng-include src="'views/notification.html'"></div>
</div>
</div>
</div>
</div>
<!-- Add your site or application content here -->
<div ng-include="'views/widget/aside.html'"></div>
<div class="container-fluid container-studio">
<div class="container-fluid" ng-view>
<!-- Add your site or application content here -->
<div ng-include="'views/widget/aside.html'"></div>
<div class="container-fluid container-studio">
<div class="container-fluid" ng-view>
</div>
</div>
</div>
<div id="footer">
<div class="container">
<div class="row">
<div class="col-md-12">
<hr/>
</div>
<div class="col-md-6">
<p>© 2014 Orient Technologies LTD</p>
</div>
<div class="col-md-6">
<div class="pull-right">
<div class="btn-group">
<a href="" class="icon-container"><i class="fa fa-twitter"></i></a>
</div>
<div class="btn-group" class="icon-container">
<a href="" class="icon-container"><i class="fa fa-facebook"></i></a>
</div>
<div class="btn-group">
<a href="" class="icon-container"><i class="fa fa-google-plus"></i></a>
</div>
</div>
</div>
</div>
<!--/row-->

</div>
<!--/container-->
</div>

<!-- <script type="text/javascript" src="components/select2/select2.js"></script>
<script type="text/javascript" src="components/angular-ui-select2/src/select2.js"></script> -->
Expand Down Expand Up @@ -121,6 +151,9 @@
<script type="text/javascript" src="components/codemirror/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="components/codemirror/mode/sql/sql.js"></script>
<script type="text/javascript" src="components/codemirror/addon/hint/show-hint.js"></script>
<script type="text/javascript" src="components/codemirror/addon/search/search.js"></script>
<script type="text/javascript" src="components/codemirror/addon/search/searchcursor.js"></script>
<script type="text/javascript" src="components/codemirror/addon/dialog/dialog.js"></script>
<script src="scripts/util/orientdb-hint.js"></script>
<script type="text/javascript" src="scripts/widgets/patch/ui-codemirror.js"></script>
<script src="components/angular-scroll/angular-scroll.min.js"></script>
Expand Down
12 changes: 12 additions & 0 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,15 @@ App.config(function ($routeProvider) {
redirectTo: '/'
});
});
App.run(function ($rootScope) {
$rootScope.$on('$routeChangeSuccess', function (event, currentRoute) {
switch (currentRoute.templateUrl) {
case 'views/login.html':
$rootScope.bodyClass = 'landing-page';
break;
default:
$rootScope.bodyClass = 'normal-page';
break;
}
});
})
3 changes: 3 additions & 0 deletions app/scripts/controllers/header-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ angular.module('header.controller', ['database.services']).controller("HeaderCon
modalEl.modal('show');
});
}
$scope.manageServer = function () {
$location.path("/server");
}
$scope.logout = function () {
Database.disconnect(function () {
$scope.menus = [];
Expand Down
45 changes: 33 additions & 12 deletions app/scripts/controllers/login-controller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
angular.module('login.controller', ['database.services']).controller("LoginController", ['$scope', '$routeParams', '$location', '$modal', '$q', 'Database', 'DatabaseApi', 'Notification', function ($scope, $routeParams, $location, $modal, $q, Database, DatabaseApi, Notification) {
var login = angular.module('login.controller', ['database.services']);
login.controller("LoginController", ['$scope', '$routeParams', '$location', '$modal', '$q', 'Database', 'DatabaseApi', 'Notification', function ($scope, $routeParams, $location, $modal, $q, Database, DatabaseApi, Notification) {

$scope.server = "http://localhost:2480"

if (Database.isConnected()) {
//$location.path("/database/" + Database.getName() + "/browse");
}
DatabaseApi.listDatabases(function (data) {
$scope.databases = data.databases;
if ($scope.databases.length > 0) {
Expand All @@ -23,28 +21,51 @@ angular.module('login.controller', ['database.services']).controller("LoginContr
}
$scope.createNew = function () {
modalScope = $scope.$new(true);
modalScope.name = null;
modalScope.creating = false;
modalScope.stype = "plocal";
modalScope.type = "graph";
modalScope.username = "root";
modalScope.types = ['document', 'graph']
modalScope.stypes = ['local', 'plocal', 'memory']
var modalPromise = $modal({template: 'views/database/newDatabase.html', scope: modalScope, show: false});
modalScope.createNew = function () {
modalScope.creating = true;
DatabaseApi.createDatabase(modalScope.name, modalScope.type, modalScope.stype, modalScope.username, modalScope.password, function (data) {
$scope.databases.push(modalScope.name);
DatabaseApi.createDatabase(modalPromise.$scope.name, modalPromise.$scope.type, modalPromise.$scope.stype, modalPromise.$scope.username, modalPromise.$scope.password, function (data) {
$scope.databases.push(modalPromise.$scope.name);
modalScope.creating = false;
modalScope.hide();
var noti = "Database " + modalScope.name + " created.";
modalPromise.hide();
var noti = "Database " + modalPromise.$scope.name + " created.";
Notification.push({content: noti});
}, function (data) {
modalScope.creating = false;
modalScope.error = data;
});
}
var modalPromise = $modal({template: 'views/database/newDatabase.html', scope: modalScope});
$q.when(modalPromise).then(function (modalEl) {
modalEl.modal('show');
});

modalPromise.$promise.then(modalPromise.show);
}
$scope.deleteDb = function () {
modalScope = $scope.$new(true);
modalScope.name = $scope.database;
var modalPromise = $modal({template: 'views/database/deleteDatabase.html', scope: modalScope, show: false});
modalScope.delete = function () {
modalScope.creating = true;
DatabaseApi.deleteDatabase(modalPromise.$scope.name, modalPromise.$scope.username, modalPromise.$scope.password).then(function (data) {
var noti = "Database " + modalPromise.$scope.name + " dropped.";
var idx = $scope.databases.indexOf(modalPromise.$scope.name);
$scope.databases.splice(idx, 1);
if ($scope.databases.length > 0) {
$scope.database = $scope.databases[0];
}
Notification.push({content: noti});
modalPromise.hide();
}, function (data) {
modalScope.creating = false;
modalScope.error = data;
})
}

modalPromise.$promise.then(modalPromise.show);
}
}]);
14 changes: 12 additions & 2 deletions app/scripts/services/database-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ database.factory('Database', function (DatabaseApi, localStorageService) {
};
});

database.factory('DatabaseApi', function ($http, $resource) {
database.factory('DatabaseApi', function ($http, $resource, $q) {


var urlWiki = "https://github.com/orientechnologies/orientdb-studio/wiki/Functions";
Expand Down Expand Up @@ -489,7 +489,17 @@ database.factory('DatabaseApi', function ($http, $resource) {
error(data);
});
}

resource.deleteDatabase = function (name, username, password) {
var deferred = $q.defer();
delete $http.defaults.headers.common['Authorization'];
$http.defaults.headers.common['Authorization'] = 'Basic ' + Base64.encode(username + ':' + password);
$http.delete(API + 'database/' + name).success(function (data) {
deferred.resolve(data);
}).error(function (data) {
deferred.reject(data);
})
return deferred.promise;
}
resource.exportDatabase = function (database) {
window.open(API + 'export/' + database);
}
Expand Down
53 changes: 52 additions & 1 deletion app/styles/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,28 @@ a.navbar-brand > img {
padding: 0px;
}

body {
.normal-page {
background: url("../img/bg-texture-light.gif") repeat scroll 0 0 #f6f6f6;

}

html,
body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
}
body {

}
.landing-page {
background: url("../img/orient_home_bg.jpg") no-repeat 0 0 #f6f6f6;
background-size: cover;
}

.ologin {
margin-top: 50px;
border-color: #c5c5c5 #c5c5c5 #c5c5c5;
box-shadow: 0px 0px 1px 1px #c5c5c5;
}

body div.container-notification {
Expand Down Expand Up @@ -264,4 +284,35 @@ text.vicon {

.btn {
border-radius: 0;
}
#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
/* Negative indent footer by its height */
margin: 0 auto -40px;
/* Pad bottom by footer height */
padding: 0 0 40px;
}
#footer {
height: 40px;
}
#footer hr {
margin: 5px;
}
#footer {
background-color: transparent;
}
.icon-container i {
vertical-align: middle;
}
.icon-container {
display: block;
height: 25px;
width: 25px;
border-width: 1px;
border-style: solid;
border-radius: 50%;
text-align: center;
vertical-align: middle;
}
48 changes: 48 additions & 0 deletions app/views/database/deleteDatabase.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<div class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ng-click="$hide()" aria-hidden="true">×
</button>
<h3>Drop database {{name}} ? </h3>
</div>
<div class="modal-body edge">
<form id="signin" name="newDB" class="form-horizontal" novalidate="">
<fieldset>
<div class="form-group">
<label class="control-label col-md-2">Server User</label>

<div class="col-md-10">
<input id="user" class="form-control" type="text" required ng-model="username"
value=""/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">Password</label>

<div class="col-md-10">
<input id="password" type="password" class="form-control" required ng-model="password"
value=""/>
</div>

</div>
</fieldset>
</form>
<div class="progress progress-striped active" ng-show="creating">
<div class="bar" style="width: 100%;">Deleting database {{ name }}</div>
</div>
<div class="alert alert-error" ng-show="error">
<button type="button" class="close" ng-click="error = null">×</button>
{{error}}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn" ng-click="$hide()">Close</button>
<button class="btn btn-primary" ng-disabled="newDB.$invalid" ng-click="delete()">Drop database
</button>
</div>
</div>
</div>
</div>


Loading

0 comments on commit a1be9de

Please sign in to comment.