|
|
@ -230,16 +230,45 @@ module.exports = { |
|
|
return [ |
|
|
return [ |
|
|
"Timeboard:", |
|
|
"Timeboard:", |
|
|
" Subcommands:", |
|
|
" Subcommands:", |
|
|
" get <dash-id>", |
|
|
|
|
|
" getall", |
|
|
|
|
|
" remove <dash-id>", |
|
|
|
|
|
" create <title> <description> <graphs>", |
|
|
|
|
|
" update <dash-id> <title> <description> <graphs>", |
|
|
|
|
|
|
|
|
" get <dash-id> get an existing timeboard", |
|
|
|
|
|
" getall get all existing timeboards", |
|
|
|
|
|
" remove <dash-id> remove an existing timeboard", |
|
|
|
|
|
" create <title> <description> <graphs> create a new timeboard, <graphs> is a json of the graphs definition", |
|
|
|
|
|
" update <dash-id> <title> <description> <graphs> update an existing timeboard, <graphs> is a json of the graphs definition", |
|
|
" Options:", |
|
|
" Options:", |
|
|
" --tmpvars <templateVariables>" |
|
|
|
|
|
|
|
|
" --tmpvars <templateVariables> a json representation of the template variables definition" |
|
|
]; |
|
|
]; |
|
|
}, |
|
|
}, |
|
|
handleCli: function(subcommand, args, callback){ |
|
|
handleCli: function(subcommand, args, callback){ |
|
|
|
|
|
if(subcommand === "get"){ |
|
|
|
|
|
get(args._[4], callback); |
|
|
|
|
|
} else if(subcommand === "getall"){ |
|
|
|
|
|
getAll(callback); |
|
|
|
|
|
} else if(subcommand === "remove"){ |
|
|
|
|
|
remove(args._[4], callback); |
|
|
|
|
|
} else if(subcommand === "create"){ |
|
|
|
|
|
var title = args._[4]; |
|
|
|
|
|
var description = args._[5]; |
|
|
|
|
|
var graphs = JSON.parse(args._[6]); |
|
|
|
|
|
var templateVariables = []; |
|
|
|
|
|
if(args["tmpvars"]){ |
|
|
|
|
|
templateVariables = JSON.parse(args["tmpvars"]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
create(title, description, graphs, templateVariables, callback); |
|
|
|
|
|
} else if(subcommand === "update"){ |
|
|
|
|
|
var dashId = parseInt(args._[4]); |
|
|
|
|
|
var title = args._[5]; |
|
|
|
|
|
var description = args._[6]; |
|
|
|
|
|
var graphs = JSON.parse(args._[7]); |
|
|
|
|
|
var templateVariables = []; |
|
|
|
|
|
if(args["tmpvars"]){ |
|
|
|
|
|
templateVariables = JSON.parse(args["tmpvars"]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
update(dashId, title, description, graphs, templateVariables, callback); |
|
|
|
|
|
} else { |
|
|
|
|
|
callback("unknown subcommand or arguments try `dogapi timeboard --help` for help", false); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |