Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #35

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ _cgo_gotypes.go
_cgo_export.*

_testmain.go

Dockerfile
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep these in git repository 😃

*.exe
*.test
*.prof
run
run.sh
1 change: 0 additions & 1 deletion static/html/containers.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<!-- The containers page, refer to static/js/controller -->
<div ng-controller="ContainersController">

Expand Down
1 change: 0 additions & 1 deletion static/html/home.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<!-- The home page -->
<div ng-controller="HomeController">

Expand Down
31 changes: 23 additions & 8 deletions static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,26 @@ seagull.controller('IndexController', function ($scope, $rootScope, $translate,

/* The default server is local */
$scope.currentServer = "Local"; // TODO: Use cookies or something to store them
$scope.servers = ["Local"];


if(localStorage.servers){
$scope.servers = JSON.parse(localStorage.servers);

}
else{
$scope.servers = ["Local"];

}

$scope.json_servers;
$rootScope.canonicalServer = canonicalizeServer($scope.currentServer);
$scope.notCurrentServers = [];
$scope.notCurrentServers = $scope.servers;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should remove the $scope.currentServer.


/* Change the server */
$scope.changeServer = function (server) { // TODO: Remove duplicated code
$scope.currentServer = server;
$rootScope.canonicalServer = canonicalizeServer($scope.currentServer);
$scope.notCurrentServers = unique($scope.servers.slice(0).remove($scope.currentServer)); // Deep copy
$scope.notCurrentServers = unique($scope.servers); // Deep copy

$route.reload();
};
Expand All @@ -201,18 +212,21 @@ seagull.controller('IndexController', function ($scope, $rootScope, $translate,
$scope.addServer = function (newServer) {

/* Check if we can access the new server */
$http.get(canonicalizeServer(newServer) + '/_ping').success(function(data) {
if (data === "OK") {
//$http.get(canonicalizeServer(newServer) + '/_ping').success(function(data) {
//if (data === "OK") {
alert_success("Add server " + newServer);

$scope.servers.push(newServer)
$scope.json_servers = JSON.stringify($scope.servers);
localStorage.setItem("servers", $scope.json_servers);
console.log(JSON.parse(localStorage.servers));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the debug code when it's finished.

$scope.currentServer = newServer;
$rootScope.canonicalServer = canonicalizeServer($scope.currentServer);
$scope.notCurrentServers = unique($scope.servers.slice(0).remove($scope.currentServer)); // Deep copy

$route.reload();
}
}).error(function(data){alert_error('Can\'t add this server')});
//}
//}).error(function(data){alert_error('Can\'t add this server')});

};

Expand All @@ -224,6 +238,7 @@ seagull.controller('IndexController', function ($scope, $rootScope, $translate,
$scope.servers = ["Local"];
$rootScope.canonicalServer = canonicalizeServer($scope.currentServer);
$scope.notCurrentServers = [];
localStorage.removeItem("servers")

$route.reload();
}
Expand Down
1 change: 1 addition & 0 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<li class="dropdown">
<a class="dropdown-toggle animate-nav" data-toggle="dropdown" href="">{{currentServer}} <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">

<li ng-repeat-start="server in notCurrentServers track by $index" class="animate-nav"><a href="" ng-click="changeServer(server)">{{server}}</a></li>
<li ng-repeat-end></li>
<li class="animate-nav"><a href="" data-toggle="modal" data-target="#addServerModal">{{'Add Server'}}</a></li>
Expand Down