Add more debugging metadata to support tickets

pull/1/head
yflory 3 years ago
parent 1352a6d8fd
commit 1b50efe7ac

@ -2040,9 +2040,16 @@ define([
if (['drive', 'teams', 'settings'].indexOf(app) !== -1) { safe = true; } if (['drive', 'teams', 'settings'].indexOf(app) !== -1) { safe = true; }
Object.keys(teams).forEach(function (id) { Object.keys(teams).forEach(function (id) {
if (!ctx.teams[id]) { return; } if (!ctx.teams[id]) { return; }
var proxy = ctx.teams[id].proxy || {};
var nPads = proxy.drive && Object.keys(proxy.drive.filesData || {}).length;
var nSf = proxy.drive && Object.keys(proxy.drive.sharedFolders || {}).length;
t[id] = { t[id] = {
owner: teams[id].owner, owner: teams[id].owner,
name: teams[id].metadata.name, name: teams[id].metadata.name,
channel: teams[id].channel,
numberPads: nPads,
numberSf: nSf,
roster: Util.find(teams[id], ['keys', 'roster', 'channel']),
edPublic: Util.find(teams[id], ['keys', 'drive', 'edPublic']), edPublic: Util.find(teams[id], ['keys', 'drive', 'edPublic']),
avatar: Util.find(teams[id], ['metadata', 'avatar']), avatar: Util.find(teams[id], ['metadata', 'avatar']),
viewer: !Util.find(teams[id], ['keys', 'drive', 'edPrivate']), viewer: !Util.find(teams[id], ['keys', 'drive', 'edPrivate']),

@ -272,19 +272,27 @@ define([
APP.$rightside = $('<div>', {id: 'cp-sidebarlayout-rightside'}).appendTo(APP.$container); APP.$rightside = $('<div>', {id: 'cp-sidebarlayout-rightside'}).appendTo(APP.$container);
var sFrameChan = common.getSframeChannel(); var sFrameChan = common.getSframeChannel();
sFrameChan.onReady(waitFor()); sFrameChan.onReady(waitFor());
}).nThen(function (waitFor) {
metadataMgr = common.getMetadataMgr();
privateData = metadataMgr.getPrivateData();
common.getPinUsage(null, waitFor(function (err, data) { common.getPinUsage(null, waitFor(function (err, data) {
if (err) { return void console.error(err); } if (err) { return void console.error(err); }
APP.pinUsage = data; APP.pinUsage = data;
})); }));
APP.teamsUsage = {};
Object.keys(privateData.teams).forEach(function (teamId) {
common.getPinUsage(teamId, waitFor(function (err, data) {
if (err) { return void console.error(err); }
APP.teamsUsage[teamId] = data;
}));
});
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/) {
createToolbar(); createToolbar();
metadataMgr = common.getMetadataMgr();
privateData = metadataMgr.getPrivateData();
common.setTabTitle(Messages.supportPage); common.setTabTitle(Messages.supportPage);
APP.origin = privateData.origin; APP.origin = privateData.origin;
APP.readOnly = privateData.readOnly; APP.readOnly = privateData.readOnly;
APP.support = Support.create(common, false, APP.pinUsage); APP.support = Support.create(common, false, APP.pinUsage, APP.teamsUsage);
// Content // Content
var $rightside = APP.$rightside; var $rightside = APP.$rightside;

@ -31,9 +31,7 @@ define([
if (typeof(ctx.pinUsage) === 'object') { if (typeof(ctx.pinUsage) === 'object') {
// pass pin.usage, pin.limit, and pin.plan if supplied // pass pin.usage, pin.limit, and pin.plan if supplied
Object.keys(ctx.pinUsage).forEach(function (k) { data.sender.quota = ctx.pinUsage;
data.sender[k] = ctx.pinUsage[k];
});
} }
data.id = id; data.id = id;
@ -45,11 +43,14 @@ define([
data.sender.blockLocation = privateData.blockLocation || ''; data.sender.blockLocation = privateData.blockLocation || '';
data.sender.teams = Object.keys(teams).map(function (key) { data.sender.teams = Object.keys(teams).map(function (key) {
var team = teams[key]; var team = teams[key];
if (!teams) { return; } if (!team) { return; }
var ret = {}; var ret = {};
['edPublic', 'owner', 'viewer', 'hasSecondaryKey', 'validKeys'].forEach(function (k) { ['channel', 'roster', 'numberPads', 'numberSf', 'edPublic', 'curvePublic', 'owner', 'viewer', 'hasSecondaryKey', 'validKeys'].forEach(function (k) {
ret[k] = team[k]; ret[k] = team[k];
}); });
if (ctx.teamsUsage && ctx.teamsUsage[key]) {
ret.quota = ctx.teamsUsage[key];
}
return ret; return ret;
}).filter(Boolean); }).filter(Boolean);
@ -430,12 +431,13 @@ define([
]); ]);
}; };
var create = function (common, isAdmin, pinUsage) { var create = function (common, isAdmin, pinUsage, teamsUsage) {
var ui = {}; var ui = {};
var ctx = { var ctx = {
common: common, common: common,
isAdmin: isAdmin, isAdmin: isAdmin,
pinUsage: pinUsage || false, pinUsage: pinUsage || false,
teamsUsage: teamsUsage || false,
adminKeys: Array.isArray(ApiConfig.adminKeys)? ApiConfig.adminKeys.slice(): [], adminKeys: Array.isArray(ApiConfig.adminKeys)? ApiConfig.adminKeys.slice(): [],
}; };

Loading…
Cancel
Save