Add team usage bar

This commit is contained in:
yflory
2019-09-23 15:45:24 +02:00
parent 17fbaea5d0
commit b1dab8e75a
8 changed files with 43 additions and 36 deletions

View File

@@ -223,8 +223,8 @@ define([
});
};
common.getPinnedUsage = function (cb) {
postMessage("GET_PINNED_USAGE", null, function (obj) {
common.getPinnedUsage = function (data, cb) {
postMessage("GET_PINNED_USAGE", data, function (obj) {
if (obj.error) { return void cb(obj.error); }
cb(null, obj.bytes);
});
@@ -237,14 +237,14 @@ define([
});
};
common.getPinLimit = function (cb) {
postMessage("GET_PIN_LIMIT", null, function (obj) {
common.getPinLimit = function (data, cb) {
postMessage("GET_PIN_LIMIT", data, function (obj) {
if (obj.error) { return void cb(obj.error); }
cb(undefined, obj.limit, obj.plan, obj.note);
});
};
common.isOverPinLimit = function (cb) {
common.isOverPinLimit = function (teamId, cb) {
if (!LocalStore.isLoggedIn()) { return void cb(null, false); }
var usage;
var andThen = function (e, limit, plan) {
@@ -258,9 +258,13 @@ define([
var todo = function (e, used) {
if (e) { return void cb(e); }
usage = used;
common.getPinLimit(andThen);
common.getPinLimit({
teamId: teamId
}, andThen);
};
common.getPinnedUsage(todo);
common.getPinnedUsage({
teamId: teamId
}, todo);
};
common.clearOwnedChannel = function (channel, cb) {