jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/389776 )
Change subject: Add ancillary message for cached results to gadget
......................................................................
Add ancillary message for cached results to gadget
If the API response indicates that a result is potentially outdated,
communicate this to the user in an ancillary message on the
ConstraintReportPanel.
Bug: T179844
Change-Id: I819e108d36786df85167c2696be2bc66bce368f8
Depends-On: Ic194c64470487391b2f81c58bc332c8268f1e0c8
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/gadget.js
4 files changed, 26 insertions(+), 3 deletions(-)
Approvals:
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, approved
diff --git a/extension.json b/extension.json
index 709dafb..48a173b 100644
--- a/extension.json
+++ b/extension.json
@@ -73,7 +73,9 @@
"wbqc-parameterissues-short",
"wbqc-parameterissues-long",
"wbqc-constrainttypehelp-short",
- "wbqc-constrainttypehelp-long"
+ "wbqc-constrainttypehelp-long",
+ "wbqc-cached-generic",
+ "wbqc-cached-minutes"
],
"scripts": [
"modules/ui/module.js",
diff --git a/i18n/en.json b/i18n/en.json
index 93254cb..2d9a5db 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -42,6 +42,8 @@
"wbqc-parameterissues-long": "These issues are problems with the
constraint definition on the property, not with this statement.",
"wbqc-constrainttypehelp-short": "Help",
"wbqc-constrainttypehelp-long": "Help page for this constraint type",
+ "wbqc-cached-generic": "This result is cached and might be out of
date.",
+ "wbqc-cached-minutes": "This result is cached and might be out of date
by up to {{PLURAL:$1|1=one minute|$1 minutes}}.",
"apihelp-wbcheckconstraints-description": "Performs constraint checks
on any entity you want and returns the result.",
"apihelp-wbcheckconstraints-summary": "Performs constraint checks on
any entity you want and returns the result.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 2948cf0..72576d4 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -44,6 +44,8 @@
"wbqc-parameterissues-long": "Longer explanation of the section of the
constraint parameter report popup that contains problems about the constraint
parameters.\n{{Related|wbqc-parameterissues-short}}",
"wbqc-constrainttypehelp-short": "Text for the help link shown next to
the constraint type in a constraint violation report. The link leads to a help
page on Wikidata about the constraint type.\n{{Identical|Help}}",
"wbqc-constrainttypehelp-long": "Title for the help link shown next to
the constraint type in a constraint violation report. The link leads to a help
page on Wikidata about the constraint
type.\n{{Related|wbqc-constrainttypehelp-short}}",
+ "wbqc-cached-generic": "Generic message informing the user that a
constraint check result might be outdated. There is no information on how old
the cached result is; if more information is available, a more specific message
is used.",
+ "wbqc-cached-minutes": "Message informing the user that a constraint
check result might be updated by up to ''n''
minutes.\n{{Related|wbqc-cached-generic}}",
"apihelp-wbcheckconstraints-description":
"{{doc-apihelp-description|wbcheckconstraints}}",
"apihelp-wbcheckconstraints-summary":
"{{doc-apihelp-summary|wbcheckconstraints}}",
"apihelp-wbcheckconstraints-param-id":
"{{doc-apihelp-param|wbcheckconstraints|id}}",
diff --git a/modules/gadget.js b/modules/gadget.js
index 85b3a60..8974419 100644
--- a/modules/gadget.js
+++ b/modules/gadget.js
@@ -24,12 +24,29 @@
$container.append( widget.$element );
}
+ function getCachedMessage( cached ) {
+ var maximumAgeInMinutes;
+ if ( typeof cached === 'object' && cached.maximumAgeInSeconds )
{
+ maximumAgeInMinutes = Math.ceil(
cached.maximumAgeInSeconds / 60 );
+ return mw.message( 'wbqc-cached-minutes' )
+ .params( [ maximumAgeInMinutes ] )
+ .escaped();
+ } else {
+ return mw.message( 'wbqc-cached-generic' )
+ .escaped();
+ }
+ }
+
function buildReport( result ) {
- return new wb.quality.constraints.ui.ConstraintReportPanel( {
+ var config = {
status: result.status,
constraint: result.constraint,
message: result[ 'message-html' ]
- } );
+ };
+ if ( result.cached ) {
+ config.ancillaryMessages = [ getCachedMessage(
result.cached ) ];
+ }
+ return new wb.quality.constraints.ui.ConstraintReportPanel(
config );
}
function buildParameterReport( problem ) {
--
To view, visit https://gerrit.wikimedia.org/r/389776
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I819e108d36786df85167c2696be2bc66bce368f8
Gerrit-PatchSet: 12
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits