Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record view / Lineage & Quality section improvements #7180

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,21 @@ public Map<String, String> getPack(
);
} else if (config[0].equals(TranslationType.standards.name())
&& config.length == 4) {
// standards/iso19115-3.2018/codelists/cit:CI_DateTypeCode+...
String[] codelistKeys = config[3].split(LIST_SEPARATOR);
translations.putAll(
self.getStandardCodelist(
language, config[1], Arrays.asList(codelistKeys), context)
);

if ("labels".equals(config[2])) {
// standards/iso19139/labels/gmd:DQ_AbsoluteExternalPositionalAccuracy+gmd
translations.putAll(
self.getStandardLabel(
language, config[1], Arrays.asList(codelistKeys), context)
);
} else {
// standards/iso19115-3.2018/codelists/cit:CI_DateTypeCode+...
translations.putAll(
self.getStandardCodelist(
language, config[1], Arrays.asList(codelistKeys), context)
);
}
} else {
throw new IllegalArgumentException(
String.format(
Expand Down Expand Up @@ -193,6 +202,28 @@ public Map<String, String> getStandardCodelist(
return translations;
}

@Cacheable(value = "translations",
cacheManager = "cacheManager",
key = "{#schema, #language, #label}")
public Map<String, String> getStandardLabel(
String language, String schema, List<String> label,
ServiceContext context) {
Map<String, String> translations = new HashMap<>();
context.setLanguage(language);

for (String c : label) {
Element e = null;
try {
e = StandardsUtils.getLabel(c, schemaManager,
schema, null, null, null, null, context);
translations.put(c.split(":")[1], e.getChildText("label"));
} catch (Exception exception) {
exception.printStackTrace();
}
}
return translations;
}

@Cacheable(value = "translations", cacheManager = "cacheManager")
public Map<String, String> getDbTranslation(String language, List<String> type) {
Map<String, String> translations = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,11 @@ private void checkIndexResponse(BulkResponse bulkItemResponses,
.add("orderingInstructionsObject")
.add("contact")
.add("contactForResource")
.add("contactForProcessing")
.add("contactForDistribution")
.add("OrgForResource")
.add("specificationConformance")
.add("processSteps")
.add("measure")
.add("resourceProviderOrgForResource")
.add("resourceVerticalRange")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,15 +1101,73 @@
<xsl:copy-of select="gn-fn-index:build-record-link(@uuidref, $xlink, @xlink:title, 'sources')"/>
</xsl:for-each>

<xsl:for-each select=".//mrl:source/*/mrl:description[gco:CharacterString != '']">
<xsl:for-each select="mrl:source/*/mrl:description[gco:CharacterString != '']">
<xsl:copy-of select="gn-fn-index:add-multilingual-field('sourceDescription', ., $allLanguages)"/>
</xsl:for-each>



<xsl:variable name="processSteps"
select="mrl:processStep/*[mrl:description/gco:CharacterString != '']"/>
<xsl:for-each select="$processSteps">
<processSteps type="object">{
"descriptionObject": <xsl:value-of select="gn-fn-index:add-multilingual-field(
'description', mrl:description, $allLanguages)"/>
<xsl:if test="normalize-space(mrl:stepDateTime) != ''">
,"date": "<xsl:value-of select="mrl:stepDateTime//gml:timePosition/text()"/>"
</xsl:if>
<xsl:if test="normalize-space(mrl:source) != ''">
,"source": [
<xsl:for-each select="mrl:source/*[mrl:description/gco:CharacterString != '']">
{
"descriptionObject": <xsl:value-of
select="gn-fn-index:add-multilingual-field(
'description', mrl:description, $allLanguages)"/>
}
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
</xsl:if>

<xsl:variable name="processor"
select="mrl:processor/*[.//cit:CI_Organisation/cit:name != '']"/>
<xsl:if test="count($processor) > 0">
,"processor": [
<xsl:for-each select="$processor">
<xsl:variable name="individualName"
select="(.//cit:CI_Individual/cit:name/gco:CharacterString/text())[1]"/>
{
"organisationObject": <xsl:value-of
select="gn-fn-index:add-multilingual-field(
'description', .//cit:CI_Organisation/cit:name,
$allLanguages)"/>
<xsl:if test="$individualName != ''">
,"individual":"<xsl:value-of select="gn-fn-index:json-escape($individualName)"/>"
</xsl:if>
}
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
</xsl:if>
}</processSteps>
</xsl:for-each>

<xsl:for-each-group select="mrl:processStep//mrl:processor[.//cit:CI_Organisation/cit:name != '']"
group-by=".//cit:CI_Organisation/cit:name/gco:CharacterString">
<xsl:apply-templates mode="index-contact"
select=".">
<xsl:with-param name="fieldSuffix" select="'ForProcessing'"/>
<xsl:with-param name="languages" select="$allLanguages"/>
</xsl:apply-templates>
</xsl:for-each-group>
</xsl:for-each>


<xsl:for-each select="mdb:dataQualityInfo/*">
<xsl:for-each select="mdq:report/*[
normalize-space(mdq:measure/*/mdq:nameOfMeasure/gco:CharacterString) != '']">
normalize-space(mdq:measure/*/mdq:nameOfMeasure/gco:CharacterString) != ''
or normalize-space(mdq:measure/*/mdq:measureDescription/gco:CharacterString) != ''
]">

<xsl:variable name="name"
select="(mdq:measure/*/mdq:nameOfMeasure/gco:CharacterString)[1]"/>
Expand Down
59 changes: 57 additions & 2 deletions schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -966,13 +966,14 @@
gmd:statement, $allLanguages)"/>


<xsl:for-each select="gmd:report/*[gmd:nameOfMeasure/gco:CharacterString != '']">
<xsl:for-each select="gmd:report/*[gmd:nameOfMeasure/gco:CharacterString != ''
or gmd:measureDescription/gco:CharacterString != '']">
<xsl:variable name="name"
select="(gmd:nameOfMeasure/gco:CharacterString)[1]"/>
<xsl:variable name="value"
select="(gmd:result/gmd:DQ_QuantitativeResult/gmd:value)[1]"/>
<xsl:variable name="unit"
select="(gmd:result/gmd:DQ_QuantitativeResult/gmd:valueUnit//gml:identifier)[1]"/>
select="(gmd:result/gmd:DQ_QuantitativeResult/gmd:valueUnit//(gml:identifier|gml320:identifier))[1]"/>
<xsl:variable name="description"
select="(gmd:measureDescription/gco:CharacterString)[1]"/>
<measure type="object">{
Expand All @@ -995,6 +996,60 @@
</xsl:element>
</xsl:for-each>
</xsl:for-each>

<xsl:variable name="processSteps"
select="gmd:lineage/*/gmd:processStep/*[gmd:description/gco:CharacterString != '']"/>
<xsl:for-each select="$processSteps">
<processSteps type="object">{
"descriptionObject": <xsl:value-of select="gn-fn-index:add-multilingual-field(
'description', gmd:description, $allLanguages)"/>
<xsl:if test="normalize-space(gmd:dateTime) != ''">
,"date": "<xsl:value-of select="gmd:dateTime/gco:*/text()"/>"
</xsl:if>
<xsl:if test="normalize-space(gmd:source) != ''">
,"source": [
<xsl:for-each select="gmd:source/*[gmd:description/gco:CharacterString != '']">
{
"descriptionObject": <xsl:value-of
select="gn-fn-index:add-multilingual-field(
'description', gmd:description, $allLanguages)"/>
}
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
</xsl:if>

<xsl:variable name="processors"
select="gmd:processor/*[gmd:organisationName/gco:CharacterString != '']"/>

<xsl:if test="count($processors) > 0">
,"processor": [
<xsl:for-each select="$processors">
{
"organisationObject": <xsl:value-of
select="gn-fn-index:add-multilingual-field(
'description', gmd:organisationName, $allLanguages)"/>
<xsl:if test="gmd:individualName/gco:CharacterString/text()">
,"individual":"<xsl:value-of select="gn-fn-index:json-escape(gmd:individualName/gco:CharacterString/text())"/>"
</xsl:if>
}
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
</xsl:if>
}</processSteps>
</xsl:for-each>

<xsl:for-each-group select="gmd:lineage/*/gmd:processStep/*/gmd:processor[
*/gmd:organisationName/gco:CharacterString != '']"
group-by="*/gmd:organisationName/gco:CharacterString">
<xsl:apply-templates mode="index-contact"
select=".">
<xsl:with-param name="fieldSuffix" select="'ForProcessing'"/>
<xsl:with-param name="languages" select="$allLanguages"/>
</xsl:apply-templates>
</xsl:for-each-group>

</xsl:for-each>

<xsl:variable name="atomProtocol" select="util:getSettingValue('system/inspire/atomProtocol')" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
"$filter",
function ($http, $filter) {
return {
templateUrl: "../../catalog/components/search/mdview/partials/" + "contact.html",
templateUrl: "../../catalog/components/search/mdview/partials/contact.html",
restrict: "A",
scope: {
mdContacts: "=gnMetadataContacts",
Expand Down Expand Up @@ -561,4 +561,32 @@
};
}
]);

module.directive("gnQualityMeasuresTable", [
"gnGlobalSettings",
function (gnGlobalSettings) {
return {
templateUrl:
"../../catalog/components/search/mdview/partials/qualitymeasures.html",
scope: {
measures: "=gnQualityMeasuresTable"
},
link: function (scope, element, attrs) {
scope.columnVisibility = {
name: false,
description: false,
value: false,
type: false
};
for (idx in scope.measures) {
angular.forEach(Object.keys(scope.columnVisibility), function (p) {
if (scope.measures[idx][p]) {
scope.columnVisibility[p] = true;
}
});
}
}
};
}
]);
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<table class="table table-striped table-bordered gn-margin-left-lg gn-margin-top-lg">
<thead>
<tr>
<td data-ng-if="columnVisibility['type']" data-translate="">measureType</td>
<td data-ng-if="columnVisibility['name']" data-translate="">measureName</td>
<td data-ng-if="columnVisibility['description']">
{{(columnVisibility['name'] ? 'measureDescription' : 'measureName') | translate}}
</td>
<td data-ng-if="columnVisibility['value']" data-translate="">measureValue</td>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="m in measures">
<td data-ng-if="columnVisibility['type']">{{m.type | translate}}</td>
<td data-ng-if="columnVisibility['name']">{{m.name}}</td>
<td data-ng-if="columnVisibility['description']">{{m.description}}</td>
<td data-ng-if="columnVisibility['value']">
{{m.value}} <span data-ng-if="m.unit"> {{m.unit}}</span>
</td>
</tr>
</tbody>
</table>
6 changes: 6 additions & 0 deletions web-ui/src/main/resources/catalog/locales/en-v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
"createCollectionFromSelectionAs": "Create collection from selection as",
"supplementalInformation": "Supplemental Information",
"sourceDescription": "Source description",
"processSteps": "Process steps",
"orderingInstructions": "Ordering instructions",
"siblingsReverseLinks": "Other resources (other record links)",
"focusOnFrom": "Focus on resources from ",
Expand Down Expand Up @@ -383,6 +384,11 @@
"setServiceConnectPoint": "Add service connect point",
"mimeType": "Format",
"uploadedResourceAlreadyExistException": "File {{file}} already exist in this record data store. Remove it first.",
"qualityMeasures": "Quality",
"measureType": "Type",
"measureName": "Measure",
"measureDescription": "Description",
"measureValue": "Value",
"switchPortals": "Switch to another Portal",
"dataPreview": "Discover data",
"tableOfContents": "Table of Contents",
Expand Down
7 changes: 7 additions & 0 deletions web-ui/src/main/resources/catalog/style/gn_metadata.less
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,13 @@ ul.container-list {
}
}

.gn-process-steps {
[data-gn-metadata-contacts] ul,
[gn-metadata-contacts] ul {
grid-template-columns: 1fr;
}
}

@media only screen and (min-width: 550px) {
.gallery {
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions web-ui/src/main/resources/catalog/style/timeline.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

.timeline-1-col {
:before {
left: 2%;
left: 1%;
}

li > .timeline-badge {
left: 2%;
left: 1%;
}
li > .timeline-panel {
width: 92%;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="gn-record gn-quality-measures" data-ng-if="mdView.current.record.measure">
<h2 data-translate="">qualityMeasures</h2>
<div gn-quality-measures-table="mdView.current.record.measure" />
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<div class="gn-record gn-process-steps" data-ng-if="mdView.current.record.processSteps">
<h2 data-translate="">processSteps</h2>

<div class="row">
<div class="col-md-8">
<ul class="timeline timeline-1-col">
<li
class="timeline-inverted"
data-ng-repeat="p in mdView.current.record.processSteps"
>
<div class="timeline-badge timeline-badge-small">
<i class="fa fa-fw fa-cog"></i>
</div>
<div class="timeline-panel">
<div class="timeline-heading">
<strong data-gn-humanize-time="{{p.date}}">{{p.date}}</strong>
<strong data-ng-if="p.processor" title="{{'processor' | translate}}">
<span data-ng-if="p.date"> - </span><i class="fa fa-fw fa-user-gear"></i>
<span data-ng-repeat="o in p.processor track by $index">
<span data-ng-if="o.individual"
>{{o.individual}} ({{o.organisation}})<span data-ng-if="!$last"
>,
</span></span
>
<span data-ng-if="!o.individual"
>{{o.organisation}}<span data-ng-if="!$last">, </span></span
>
</span>
</strong>
<br data-ng-if="p.date || p.processor" />
{{p.description}}
</div>
<div class="timeline-body" data-ng-if="p.source">
<span data-translate="">sourceDescription</span>
<p data-ng-repeat="s in p.source">{{s.description}}</p>
</div>
</div>
</li>
</ul>
</div>
<div
class="col-md-4"
data-ng-if="mdView.current.record.contactForProcessing"
data-gn-metadata-contacts="mdView.current.record.contactForProcessing"
data-gn-mode="default"
data-layout="icon"
/>
</div>
</div>
Loading