Skip to content

Commit

Permalink
Modifies workers feature to use my-start-stop-button to start/stop a …
Browse files Browse the repository at this point in the history
…woker
  • Loading branch information
ajainarayanan committed May 11, 2015
1 parent 761eb54 commit a9f5a2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 45 deletions.
27 changes: 1 addition & 26 deletions cdap-ui/app/features/workers/controllers/detail-ctrl.js
@@ -1,29 +1,4 @@
angular.module(PKG.name + '.feature.worker')
.controller('WorkersDetailController', function($scope, MyDataSource, $state, MY_CONFIG) {
var dataSrc = new MyDataSource($scope),
path = '/apps/' +
$state.params.appId + '/workers/' +
$state.params.programId;
.controller('WorkersDetailController', function($scope) {

$scope.start = function() {
$scope.status = 'STARTING';
dataSrc.request({
_cdapNsPath: path + '/start',
method: 'POST'
});
};

$scope.stop = function() {
$scope.status = 'STOPPING';
dataSrc.request({
_cdapNsPath: path + '/stop',
method: 'POST'
});
};

dataSrc.poll({
_cdapNsPath: path + '/status'
}, function(res) {
$scope.status = res.status;
});
});
24 changes: 5 additions & 19 deletions cdap-ui/app/features/workers/templates/detail.html
Expand Up @@ -10,25 +10,11 @@ <h2 class="programTitle">
</div>
</div>
<div class="col-sm-6 text-right">
<div ng-show="status == 'RUNNING'"
class="btn btn-danger btn-md"
ng-click="stop()">
<span class="fa fa-stop"> </span>
<span>Stop</span>
</div>

<div ng-show="status == 'STOPPED'"
class="btn btn-success btn-md"
ng-click="start()">
<span class="fa fa-play"> </span>
<span>Start</span>
</div>
<div ng-show="status == 'STARTING' || status == 'STOPPING'"
class="btn btn-md"
ng-class="{'btn-success': status === 'STARTING', 'btn-danger': status === 'STOPPING'}">
<span class="fa fa-refresh fa-spin"></span>
<span>{{status | caskCapitalizeFilter}}</span>
</div>
<my-start-stop-button
type="workers"
is-preferences="false"
is-stoppable="true">
</my-start-stop-button>
</div>
</div>

Expand Down

0 comments on commit a9f5a2c

Please sign in to comment.