Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[ui] show drone usage and max drones on `apps view`.

  • Loading branch information...
commit fb146d8de5f8e6ff3a55129dcf50a024b13a768d 1 parent 4bc96f9
@chjj chjj authored
Showing with 18 additions and 18 deletions.
  1. +18 −18 lib/jitsu/common/index.js
View
36 lib/jitsu/common/index.js
@@ -4,7 +4,7 @@
* (C) 2010, Nodejitsu Inc.
*
*/
-
+
var fs = require('fs'),
path = require('path'),
util = require('util'),
@@ -14,11 +14,11 @@ var fs = require('fs'),
request = require('request'),
semver = require('semver'),
jitsu = require('../../jitsu');
-
+
var common = module.exports = flatiron.common.clone(flatiron.common);
//
-// ### function formatApp (app, exclude)
+// ### function formatApp (app, exclude)
// #### @app {Object} Application document to format
// #### @exclude {Array} **Optional** List of additional properties to exclude
// Formats the specified `app` by removing unnecessary properties combined with
@@ -26,7 +26,7 @@ var common = module.exports = flatiron.common.clone(flatiron.common);
//
common.formatApp = function (app, exclude) {
var snapshots = app.snapshots,
- remove = ['_id', '_rev', 'drones', 'id', 'maxDrones', 'resource'];
+ remove = ['_id', '_rev', 'id', 'resource'];
app.snapshots = !snapshots ? [] : snapshots.map(function (snap) {
var created = new Date(snap.ctime);
@@ -86,7 +86,7 @@ common.formatAppState = function (state) {
};
//
-// ### function missingKeys (source, target)
+// ### function missingKeys (source, target)
// #### @source {Array} List of keys for the current object
// #### @target {Array} List of keys for the new object
// Returns the complement of the intersection of the two arrays.
@@ -101,16 +101,16 @@ common.missingKeys = function (source, target) {
missing.push(key);
}
});
-
+
return missing;
};
//
-// ### function objectDiff (current, update, level)
+// ### function objectDiff (current, update, level)
// #### @current {Object} Current representation of the object.
// #### @update {Object} Updated representation of the object.
// #### @level {Number} Level in the object we are diffing.
-// Returns an incremental diff of the `current` object
+// Returns an incremental diff of the `current` object
// against the updated representation `update`
//
// e.g. { foo: 1, bar: 2 }, { foo: 2, bar: 2 } => { foo: 2 }
@@ -119,7 +119,7 @@ common.objectDiff = function (current, update, level) {
var ckeys = Object.keys(current),
ukeys = Object.keys(update),
diff = {};
-
+
//
// Ignore changes on the first level of the object.
//
@@ -129,10 +129,10 @@ common.objectDiff = function (current, update, level) {
diff[key] = undefined;
});
}
-
+
ukeys.forEach(function (key) {
var nested, i;
-
+
if (!current[key]) {
diff[key] = update[key];
}
@@ -160,13 +160,13 @@ common.objectDiff = function (current, update, level) {
}
}
});
-
+
return Object.keys(diff).length > 0 ? diff : null;
};
common.checkVersion = function (callback) {
var responded = false
-
+
//
// Check the GitHub tags for `jitsu` to see if the current
// version is outdated. If it is not make sure to message the user at the end.
@@ -177,7 +177,7 @@ common.checkVersion = function (callback) {
}, function (err, res, body) {
if (!responded) {
responded = true;
-
+
try {
var pkg = JSON.parse(body);
@@ -185,14 +185,14 @@ common.checkVersion = function (callback) {
jitsu.log.warn('A newer version of ' + 'jitsu'.magenta + ' is available. ' + 'please update immediately');
jitsu.log.help('To install the latest ' + 'jitsu'.magenta + ' type `[sudo] npm install jitsu -g`');
jitsu.log.warn('To ' + 'continue'.bold + ' without an update ' + 'type'.cyan + ' ' + '\'yes\''.magenta);
-
+
jitsu.prompt.confirm('Continue without updating? Bad things might happen (no)', function (err, result) {
return err ? callback() : callback(!result);
});
-
+
return;
- }
-
+ }
+
callback();
}
catch (ex) {
Please sign in to comment.
Something went wrong with that request. Please try again.