Skip to content

Commit e13c93b

Browse files
josegar74fxprunayre
authored andcommitted
Status dashboard / Don't include indexing warnings as errors
1 parent 0d52537 commit e13c93b

File tree

5 files changed

+75
-15
lines changed

5 files changed

+75
-15
lines changed

healthmonitor/src/main/java/org/fao/geonet/monitor/health/NoIndexErrorsHealthCheck.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2001-2023 Food and Agriculture Organization of the
2+
* Copyright (C) 2001-2024 Food and Agriculture Organization of the
33
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
44
* and United Nations Environment Programme (UNEP)
55
*
@@ -44,7 +44,8 @@ protected Result check() throws Exception {
4444
GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
4545

4646
EsSearchManager searchMan = gc.getBean(EsSearchManager.class);
47-
long numDocs = searchMan.getNumDocs("+" + IndexFields.INDEXING_ERROR_FIELD + ":true");
47+
long numDocs = searchMan.getNumDocs("-" + IndexFields.INDEXING_ERROR_MSG + ".type:warning +" +
48+
IndexFields.INDEXING_ERROR_FIELD + ":true");
4849

4950
if (numDocs > 0) {
5051
return Result.unhealthy(String.format("Found %d metadata that had errors during indexing", numDocs));

web-ui/src/main/resources/catalog/js/admin/DashboardStatusController.js

+65-8
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
$scope.threadSortReverse = false;
6868
$scope.threadInfoLoading = false;
6969
$scope.hasIndexingError = false;
70+
$scope.hasIndexingWarning = false;
7071

7172
$scope.indexStatus = null;
7273
function getIndexStatus() {
@@ -76,21 +77,77 @@
7677
}
7778
getIndexStatus();
7879

79-
function getRecordsWithIndexingErrors() {
80+
function getRecords(queryFilter) {
8081
return $http.post("../api/search/records/_search?bucket=ie", {
81-
query: {
82-
bool: {
83-
must: { terms: { indexingError: [true] } }
84-
}
85-
},
82+
query: queryFilter,
8683
from: 0,
8784
size: 0
8885
});
8986
}
90-
getRecordsWithIndexingErrors().then(function (r) {
87+
88+
/**
89+
* Get the metadata that have indexing errors (including warnings).
90+
*
91+
* @returns {*}
92+
*/
93+
function getRecordsWithIndexingErrors() {
94+
return getRecords({
95+
bool: {
96+
must: { terms: { indexingError: [true] } }
97+
}
98+
});
99+
}
100+
101+
/**
102+
* Get the metadata that have indexing errors (excluding warnings)
103+
*
104+
* @returns {*}
105+
*/
106+
function getRecordsWithIndexingErrorsNoWarnings() {
107+
return getRecords({
108+
bool: {
109+
must: [
110+
{
111+
query_string: {
112+
query: "(-indexingErrorMsg.type:warning)",
113+
default_operator: "AND"
114+
}
115+
},
116+
{ terms: { indexingError: [true] } }
117+
]
118+
}
119+
});
120+
}
121+
122+
getRecordsWithIndexingErrorsNoWarnings().then(function (r) {
91123
$scope.hasIndexingError = r.data.hits.total.value > 0;
92124
});
93125

126+
/**
127+
* Get the metadata that have indexing warnings.
128+
*
129+
* @returns {*}
130+
*/
131+
function getRecordsWithIndexingWarnings() {
132+
return getRecords({
133+
bool: {
134+
must: [
135+
{
136+
query_string: {
137+
query: "(+indexingErrorMsg.type:warning)",
138+
default_operator: "AND"
139+
}
140+
},
141+
{ terms: { indexingError: [true] } }
142+
]
143+
}
144+
});
145+
}
146+
147+
getRecordsWithIndexingWarnings().then(function (r) {
148+
$scope.hasIndexingWarning = r.data.hits.total.value > 0;
149+
});
150+
94151
$scope.setThreadSortField = function (field) {
95152
if (field === $scope.threadSortField) {
96153
$scope.threadSortReverse = !$scope.threadSortReverse;
@@ -270,7 +327,7 @@
270327
configId: "recordsWithErrors",
271328
selectionBucket: "ies",
272329
defaultParams: {
273-
"indexingErrorMsg.type": "warning",
330+
"indexingErrorMsg.type": ["warning", "error"],
274331
sortBy: "changeDate",
275332
sortOrder: "desc"
276333
}

web-ui/src/main/resources/catalog/locales/en-admin.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@
445445
"metadataIdentifierTemplateDeletedError": "An error occurred deleting the Metadata identifier template",
446446
"metadataInternalId": "Choose a metadata internal identifier",
447447
"metadataStatus": "Metadata information",
448-
"metadataWithIndexingErrors": "Metadata with indexing errors",
449-
"indexRecordsWithErrors": "Index records with errors",
448+
"metadataWithIndexingErrors": "Metadata with indexing errors / warnings",
450449
"top10IndexingErrors": "Top 10 indexing errors:",
451450
"metadataErrorReport": "Error report",
452451
"moreExamples": "More examples",

web-ui/src/main/resources/catalog/locales/en-v4.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"isPublishedToAll-false": "Restricted records",
151151
"dateTypeForStatus": "Date type",
152152
"dateValueForStatus": "Date",
153-
"indexRecordsWithErrors": "Index records with errors",
153+
"indexRecordsWithErrors": "Index records with errors / warnings",
154154
"top10IndexingErrors": "Top 10 indexing errors:",
155155
"facet-indexingErrorMsg": "Indexing errors",
156156
"facet-indexingWarningMsg": "Indexing warnings",

web-ui/src/main/resources/catalog/templates/admin/dashboard/status.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,13 @@ <h4 class="list-group-item-heading" translate>{{info.name}}</h4>
148148
class="form-horizontal"
149149
role="form"
150150
data-ng-search-form=""
151-
data-ng-if="hasIndexingError"
151+
data-ng-if="hasIndexingError || hasIndexingWarning"
152152
data-runSearch="true"
153153
>
154-
<div class="panel panel-default panel-danger">
154+
<div
155+
class="panel panel-default"
156+
data-ng-class="hasIndexingError ? 'panel-danger' : 'panel-warning'"
157+
>
155158
<div class="panel-heading">
156159
<span data-translate="">metadataWithIndexingErrors</span>
157160

0 commit comments

Comments
 (0)