From 941859bc3c245ce5c88780a3caed226f98abe0ff Mon Sep 17 00:00:00 2001 From: Jimmy Berry Date: Fri, 16 Aug 2019 14:44:27 -0500 Subject: [PATCH 1/3] userscript/origin: update request card column xpath. --- userscript/origin.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userscript/origin.user.js b/userscript/origin.user.js index 37f9199c..276bbf2d 100644 --- a/userscript/origin.user.js +++ b/userscript/origin.user.js @@ -38,7 +38,7 @@ function request_actions_handle() { // Select the side column containing build results. var column = document.evaluate( - '//div[@class="row"][2]/div[@class="col-md-4"]', + 'div[@class="row"][2]//div[@class="card" and div[@data-buildresult-url]]', action, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; // Select the text represtation of action. All other sources are From 249a35efe6be9ebbf516fc4c5969cdc33e9cb767 Mon Sep 17 00:00:00 2001 From: Jimmy Berry Date: Fri, 16 Aug 2019 14:45:27 -0500 Subject: [PATCH 2/3] userscript/origin: hide request card when no OSRT:OriginConfig. --- userscript/origin.user.js | 1 + 1 file changed, 1 insertion(+) diff --git a/userscript/origin.user.js b/userscript/origin.user.js index 276bbf2d..a7152ac3 100644 --- a/userscript/origin.user.js +++ b/userscript/origin.user.js @@ -87,6 +87,7 @@ function origin_load(element, project, package) { if (origin.endsWith('failed')) { if (origin.startsWith('OSRT:OriginConfig attribute missing')) { item.innerHTML = ''; + $(element).hide(); } else { item.innerHTML = ' Origin: failed to load'; } From 45d065b027867b9c67097e3e1458b005b3bd83cf Mon Sep 17 00:00:00 2001 From: Jimmy Berry Date: Fri, 16 Aug 2019 14:46:05 -0500 Subject: [PATCH 3/3] userscript/origin: update release request handling. --- userscript/origin.user.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/userscript/origin.user.js b/userscript/origin.user.js index a7152ac3..61265b24 100644 --- a/userscript/origin.user.js +++ b/userscript/origin.user.js @@ -43,25 +43,22 @@ function request_actions_handle() { // Select the text represtation of action. All other sources are // inconsistent and do not always have the right values depending on - // request type or state. + // request type or state. Still suffers from shortening with ellipses. var summary = document.evaluate( 'div[1]/div[1]', action, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; var parts = $(summary).text().trim().split(' '); - // Maintenance incidents are so special. - var release_project = document.evaluate( - 'i[1]', - action, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; - var project, package; - if (release_project) { - parts = parts.splice(4, 3); - project = $(release_project).text().trim().split(' ').splice(-1)[0]; - } else { - parts = parts.splice(-3); - project = parts[0]; + var request_type = parts[0].toLowerCase(); + + parts = parts.splice(-3); + var project = parts[0]; + var package = parts[2]; + + if (request_type == 'release') { + // Maintenance release requests special (strip target package incident suffix). + package = package.split('.').slice(0, -1).join('.'); } - package = parts[2]; var card = document.createElement('div'); card.classList.add('card');