From bd5d4bb648cdbfa37d6637fb7ec2f8bba19fc59e Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 15 Sep 2015 12:13:28 +1000 Subject: [PATCH] Dash fixes. Untag those not selected, tag those that are selected. Return early if there are no endpoints to update or deploy. Return early if there are no lambdas to update or deploy. --- lib/commands/dash.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/commands/dash.js b/lib/commands/dash.js index 4fa1678c0..1a1f84232 100644 --- a/lib/commands/dash.js +++ b/lib/commands/dash.js @@ -71,20 +71,17 @@ CMD.prototype.run = Promise.method(function() { _this._resources = selectedResources; if (!_this._resources.length) { return false; - } else { - - // TODO: Untag all other resources - - return _this._resources; } + return _this._choices; }) .each(function(resource) { + var toggled = (!!resource.toggled || false); if (resource.type === 'lambda') { _this._report.targetLambdas++; - return CMDtag.tag('lambda', resource.value, false); + return CMDtag.tag('lambda', resource.value, !toggled); } else if (resource.type === 'endpoint') { _this._report.targetEndpoints++; - return CMDtag.tag('endpoint', resource.value, false); + return CMDtag.tag('endpoint', resource.value, !toggled); } }); } @@ -97,6 +94,9 @@ CMD.prototype.run = Promise.method(function() { JawsCli.log(chalk.white('-------------------------------------------')); JawsCli.log(chalk.white(' Dashboard: Deploying Lambdas...')); JawsCli.log(chalk.white('-------------------------------------------')); + if (!_this._report.targetLambdas) { + return JawsCli.log(chalk.white('No Selected Lambdas to deploy.')); + } return CMDdeployLambda.run( _this._JAWS, @@ -110,6 +110,9 @@ CMD.prototype.run = Promise.method(function() { JawsCli.log(chalk.white('-------------------------------------------')); JawsCli.log(chalk.white(' Dashboard: Deploying Endpoints...')); JawsCli.log(chalk.white('-------------------------------------------')); + if (!_this._report.targetEndpoints) { + return JawsCli.log(chalk.white('No Selected Endpoints to deploy.')); + } return CMDdeployEndpoint.run( _this._JAWS, @@ -366,4 +369,4 @@ CMD.prototype._promptRegion = Promise.method(function() { _this._regions = [results[0].value]; } }); -}); \ No newline at end of file +});