Skip to content

Commit

Permalink
ajaxy interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Gatlin C Johnson committed Jan 4, 2013
1 parent de27d76 commit bc32769
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
14 changes: 10 additions & 4 deletions lib/Deployrable.pm
Expand Up @@ -20,10 +20,10 @@ sub startup {
$self->plugin('database', { $self->plugin('database', {
dsn => "DBI:mysql:database=$config->{dbname}; dsn => "DBI:mysql:database=$config->{dbname};
host=$config->{dbhost};port=$config->{port}", host=$config->{dbhost};port=$config->{port}",
username => $config->{dbuser}, username => $config->{dbuser},
password => $config->{dbpass}, password => $config->{dbpass},
options => { AutoCommit => 1 }, options => { AutoCommit => 1 },
helper => 'db', helper => 'db',
}); });


#novacertname: "gatlin" #novacertname: "gatlin"
Expand Down Expand Up @@ -209,6 +209,7 @@ sub startup {


$self->render(json => { $self->render(json => {
success => $success, success => $success,
instance => $compute->get_server($iid),
}); });
}); });


Expand All @@ -227,6 +228,7 @@ sub startup {
}; };
$self->render(json => { $self->render(json => {
success => $success, success => $success,
instance => $compute->get_server($iid),
}); });
}); });


Expand All @@ -244,6 +246,7 @@ sub startup {
}; };
$self->render(json => { $self->render(json => {
success => $success, success => $success,
instance => $compute->get_server($iid),
}); });
}); });


Expand All @@ -261,6 +264,7 @@ sub startup {
}; };
$self->render(json => { $self->render(json => {
success => $success, success => $success,
instance => $compute->get_server($iid),
}); });
}); });


Expand All @@ -278,6 +282,7 @@ sub startup {
}; };
$self->render(json => { $self->render(json => {
success => $success, success => $success,
instance => $compute->get_server($iid),
}); });
}); });


Expand All @@ -301,6 +306,7 @@ sub startup {
my $ret = $sth->execute unless $success; my $ret = $sth->execute unless $success;
$self->render(json => { $self->render(json => {
success => $success, success => $success,
instance => $compute->get_server($iid),
}); });
}); });


Expand Down
26 changes: 14 additions & 12 deletions templates/branch.html.ep
Expand Up @@ -2,10 +2,6 @@
% title $title; % title $title;
<div class="row" ng-app ng-controller="InstanceCtrl"> <div class="row" ng-app ng-controller="InstanceCtrl">
<div class="span8"> <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> <h2>Instances for this branch</h2>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
Expand Down Expand Up @@ -81,22 +77,28 @@
</div><!-- .row --> </div><!-- .row -->
<script src="/js/angular.min.js"></script> <script src="/js/angular.min.js"></script>
<script> <script>
function InstanceCtrl($scope, $http) { function InstanceCtrl($scope, $http, $browser, $timeout) {
$scope.branchId = '<%= $branchId %>'; $scope.branchId = '<%= $branchId %>';
$scope.projectId = '<%= $pid %>'; $scope.projectId = '<%= $pid %>';


$scope.updateInstances = function() { $scope.updateInstances = function() {
$http({method: 'GET', url: '/instances/<%= $branchId %>'},function(d) { $http.get('/instances/<%= $branchId %>').
$scope.instances = d; success(function(data) {
}); $scope.instances = data;
});
}; };


$scope.updateInstances();

$scope.doWithInstance = function(i,verb) { $scope.doWithInstance = function(i,verb) {
return $http.get( $http.get(
"/instance/"+$scope.projectId+ "/instance/"+$scope.projectId+
"/"+$scope.branchId+"/"+i.id+"/"+verb; "/"+$scope.branchId+"/"+i.id+"/"+verb
); ).
$scope.updateInstances(); success(function(data) {
i.status = "Loading ...";
$timeout($scope.updateInstances,5000);
});
}; };


$scope.stopInstance = function(i) { $scope.stopInstance = function(i) {
Expand Down

0 comments on commit bc32769

Please sign in to comment.