Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

Commit

Permalink
linting on wsk and corrected package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
jsloyer committed Jun 10, 2016
1 parent 1a36cd6 commit 3518763
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 67 deletions.
26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"onCommand:extension.wsk.activation.logs",
"onCommand:extension.wsk.activation.result"
],
"main": "./extension",
"main": "./static-src/extension",
"contributes": {
"commands": [
{
Expand All @@ -65,8 +65,6 @@
"command": "extension.wsk.help",
"title": "wsk help"
},


{
"command": "extension.wsk.action",
"title": "wsk action"
Expand Down Expand Up @@ -107,8 +105,8 @@
"command": "extension.wsk.action.rest",
"title": "wsk action REST"
},


{
"command": "extension.wsk.util.bluemix",
"title": "wsk bluemix"
Expand All @@ -117,8 +115,8 @@
"command": "extension.wsk.util.docs",
"title": "wsk docs"
},


{
"command": "extension.wsk.property.get",
"title": "wsk property get"
Expand All @@ -131,8 +129,8 @@
"command": "extension.wsk.property.unset",
"title": "wsk property unset"
},


{
"command": "extension.wsk.trigger",
"title": "wsk trigger"
Expand Down Expand Up @@ -161,8 +159,8 @@
"command": "extension.wsk.trigger.fire",
"title": "wsk trigger fire"
},


{
"command": "extension.wsk.rule",
"title": "wsk rule"
Expand Down Expand Up @@ -199,8 +197,8 @@
"command": "extension.wsk.rule.get",
"title": "wsk rule get"
},


{
"command": "extension.wsk.activation",
"title": "wsk activation"
Expand All @@ -221,7 +219,7 @@
"command": "extension.wsk.activation.result",
"title": "wsk activation result"
}

]
},
"scripts": {
Expand Down
97 changes: 44 additions & 53 deletions static-src/commands/wsk.activation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function register(_ow, context, _log, _props) {
var getDisposable = vscode.commands.registerCommand('extension.wsk.activation.get', getAction);
var logsDisposable = vscode.commands.registerCommand('extension.wsk.activation.logs', logsAction);
var resultDisposable = vscode.commands.registerCommand('extension.wsk.activation.result', resultAction);


context.subscriptions.push(defaultDisposable, listDisposable, getDisposable, logsDisposable,resultDisposable );
}

Expand Down Expand Up @@ -58,7 +58,7 @@ function list() {
return getList().then(function (activations) {
util.appendHeading('activations');
for (var x=0; x<activations.length; x ++){
util.appendActivation(activations[x]);
util.appendActivation(activations[x]);
}
}).catch(function(error) {
log.appendLine(error.toString())
Expand All @@ -69,11 +69,11 @@ function list() {
function getList() {
return new Promise(function (fulfill, reject){
return ow.activations.list({
"docs":false,
"skip":0,
"limit":30,
"namespace":"_"
}).then(function (activations) {
"docs":false,
"skip":0,
"limit":30,
"namespace":"_"
}).then(function (activations) {
fulfill(activations);
}).catch(function(error) {
log.appendLine(error.toString())
Expand All @@ -98,13 +98,13 @@ function getAction(params) {
if (!props.validate()){
return;
}

var startTime = new Date().getTime();
var callback = function(result) {
var totalTime = startTime - (new Date().getTime());
log.appendLine("\n"+JSON.stringify(result, null, 4))
log.appendLine('>> completed in ' + (-totalTime) + 'ms');
};
var callback = function(result) {
var totalTime = startTime - (new Date().getTime());
log.appendLine("\n"+JSON.stringify(result, null, 4))
log.appendLine('>> completed in ' + (-totalTime) + 'ms');
};

getActionImpl(params, "get", callback);
}
Expand All @@ -115,19 +115,19 @@ function logsAction(params) {
if (!props.validate()){
return;
}

var startTime = new Date().getTime();
var callback = function(result) {
var totalTime = startTime - (new Date().getTime());
var logs = result.logs;
log.appendLine("");
if (result.logs) {
for (var x =0; x <logs.length; x++) {
log.appendLine(logs[x]);
}
}
log.appendLine('>> completed in ' + (-totalTime) + 'ms');
};
var callback = function(result) {
var totalTime = startTime - (new Date().getTime());
var logs = result.logs;
log.appendLine("");
if (result.logs) {
for (var x =0; x <logs.length; x++) {
log.appendLine(logs[x]);
}
}
log.appendLine('>> completed in ' + (-totalTime) + 'ms');
};

getActionImpl(params, "logs", callback);
}
Expand All @@ -138,13 +138,13 @@ function resultAction(params) {
if (!props.validate()){
return;
}

var startTime = new Date().getTime();
var callback = function(result) {
var totalTime = startTime - (new Date().getTime());
log.appendLine("\n"+JSON.stringify(result.response.result, null, 4))
log.appendLine('>> completed in ' + (-totalTime) + 'ms');
};
var callback = function(result) {
var totalTime = startTime - (new Date().getTime());
log.appendLine("\n"+JSON.stringify(result.response.result, null, 4))
log.appendLine('>> completed in ' + (-totalTime) + 'ms');
};

getActionImpl(params, "result", callback);
}
Expand All @@ -158,26 +158,26 @@ function getActionImpl(params, command, callback) {

vscode.window.showInputBox({placeHolder:'Enter an activation id:'})
.then(function(activationId){

if (activationId == undefined) {
return;
}

log.appendLine('\n$ wsk activation ' + command + ' ' + activationId);
var activityInterval = setInterval(function() {
log.append('.');
},300);

var activityInterval = setInterval(function() {
log.append('.');
},300);

var invocationParams = {
"activation": activationId,
"namespace": "_"
"namespace": "_"
}
ow.activations.get(invocationParams)
.then(function(result) {
clearInterval(activityInterval);
callback(result)
})
clearInterval(activityInterval);
callback(result)
})
.catch(function(error) {
clearInterval(activityInterval);
util.printOpenWhiskError(error);
Expand All @@ -190,13 +190,4 @@ function getActionImpl(params, command, callback) {
module.exports = {
register: register,
list:list
};









};

0 comments on commit 3518763

Please sign in to comment.