Permalink
Browse files

ajaxy interface

  • Loading branch information...
1 parent de27d76 commit bc3276987682540f086eb4d643718a9a7a9dd370 Gatlin C Johnson committed Jan 4, 2013
Showing with 24 additions and 16 deletions.
  1. +10 −4 lib/Deployrable.pm
  2. +14 −12 templates/branch.html.ep
View
@@ -20,10 +20,10 @@ sub startup {
$self->plugin('database', {
dsn => "DBI:mysql:database=$config->{dbname};
host=$config->{dbhost};port=$config->{port}",
- username => $config->{dbuser},
- password => $config->{dbpass},
- options => { AutoCommit => 1 },
- helper => 'db',
+ username => $config->{dbuser},
+ password => $config->{dbpass},
+ options => { AutoCommit => 1 },
+ helper => 'db',
});
#novacertname: "gatlin"
@@ -209,6 +209,7 @@ sub startup {
$self->render(json => {
success => $success,
+ instance => $compute->get_server($iid),
});
});
@@ -227,6 +228,7 @@ sub startup {
};
$self->render(json => {
success => $success,
+ instance => $compute->get_server($iid),
});
});
@@ -244,6 +246,7 @@ sub startup {
};
$self->render(json => {
success => $success,
+ instance => $compute->get_server($iid),
});
});
@@ -261,6 +264,7 @@ sub startup {
};
$self->render(json => {
success => $success,
+ instance => $compute->get_server($iid),
});
});
@@ -278,6 +282,7 @@ sub startup {
};
$self->render(json => {
success => $success,
+ instance => $compute->get_server($iid),
});
});
@@ -301,6 +306,7 @@ sub startup {
my $ret = $sth->execute unless $success;
$self->render(json => {
success => $success,
+ instance => $compute->get_server($iid),
});
});
View
@@ -2,10 +2,6 @@
% title $title;
<div class="row" ng-app ng-controller="InstanceCtrl">
<div class="span8">
- <div class="alert alert-info">
- <button type="button" class="close" data-dismiss="alert">x</button>
- <p><em>If you don't see what you expected, refresh again!</em></p>
- </div>
<h2>Instances for this branch</h2>
<table class="table table-striped">
<thead>
@@ -81,22 +77,28 @@
</div><!-- .row -->
<script src="/js/angular.min.js"></script>
<script>
- function InstanceCtrl($scope, $http) {
+ function InstanceCtrl($scope, $http, $browser, $timeout) {
$scope.branchId = '<%= $branchId %>';
$scope.projectId = '<%= $pid %>';
$scope.updateInstances = function() {
- $http({method: 'GET', url: '/instances/<%= $branchId %>'},function(d) {
- $scope.instances = d;
- });
+ $http.get('/instances/<%= $branchId %>').
+ success(function(data) {
+ $scope.instances = data;
+ });
};
+ $scope.updateInstances();
+
$scope.doWithInstance = function(i,verb) {
- return $http.get(
+ $http.get(
"/instance/"+$scope.projectId+
- "/"+$scope.branchId+"/"+i.id+"/"+verb;
- );
- $scope.updateInstances();
+ "/"+$scope.branchId+"/"+i.id+"/"+verb
+ ).
+ success(function(data) {
+ i.status = "Loading ...";
+ $timeout($scope.updateInstances,5000);
+ });
};
$scope.stopInstance = function(i) {

0 comments on commit bc32769

Please sign in to comment.