Disconnect log: user and product/feature only, no match reason
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
09e29f6975
commit
23a9fdb788
6 files changed
+11
-49
No files matched your search
+3
-22
@@ -37,31 +37,13 @@
|
||||
return { user: user, product: product, feature: feature, machine: machine };
|
||||
}
|
||||
|
||||
function firstMatchingKeyword(feature) {
|
||||
for (var i = 0; i < TARGET_KEYWORDS.length; i++) {
|
||||
var k = TARGET_KEYWORDS[i];
|
||||
if (feature.indexOf(k) !== -1) return k;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function disconnectReason(pf, keywordMatch, idMatch) {
|
||||
var parts = [];
|
||||
if (idMatch) parts.push('PTW70 feature module ' + pf.feature);
|
||||
if (keywordMatch) {
|
||||
var kw = firstMatchingKeyword(pf.feature);
|
||||
if (kw) parts.push('feature contains ' + kw);
|
||||
}
|
||||
return parts.length ? parts.join('; ') : 'matched';
|
||||
}
|
||||
|
||||
function formatDisconnectLog(sess, reason) {
|
||||
function formatDisconnectLog(sess) {
|
||||
var who = sess.user ? sess.user.trim() : '(unknown user)';
|
||||
var where = [sess.product, sess.feature].filter(function (x) { return x && String(x).trim(); }).join(' · ');
|
||||
if (!where) where = '(no product/feature)';
|
||||
var machine = sess.machine ? sess.machine.trim() : '';
|
||||
var hostPart = machine ? ' @ ' + machine : '';
|
||||
return 'OUT: ' + who + hostPart + ' — ' + where + ' — ' + reason;
|
||||
return 'OUT: ' + who + hostPart + ' — ' + where;
|
||||
}
|
||||
|
||||
function isPtw70Product(product) {
|
||||
@@ -88,8 +70,7 @@
|
||||
const disconnectLink = row.querySelector('a.sbutton');
|
||||
if (disconnectLink && disconnectLink.textContent.indexOf('Disconnect') !== -1) {
|
||||
var sess = rowSessionFields(row);
|
||||
var reason = disconnectReason(pf, keywordMatch, idMatch);
|
||||
addLog(formatDisconnectLog(sess, reason));
|
||||
addLog(formatDisconnectLog(sess));
|
||||
disconnectLink.click();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user