Skip to content

Commit

Permalink
Only show explore tab for surface-weather-observation/synop (#74)
Browse files Browse the repository at this point in the history
Fix link detection for OAFeat and OARec

Records with observations, display button for "explore observations", "OAFeat observation collection", and "OARec discovery metadata". Records without observations, display button for "OARec discovery metadata"
  • Loading branch information
webb-ben authored Mar 28, 2024
1 parent 5cdee89 commit 7e7b1c1
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/views/Datasets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@
<v-col sm="12" md="3">
<v-container>
<v-row justify="center" fill-height>
<v-card class="pa-0 ma-0" @click="loadMap(item.id)">
<v-overlay open-on-hover contained activator="parent" class="align-center justify-center">
<v-btn flat>
{{ $t("datasets.map") }}
</v-btn>
</v-overlay>
<dataset-map :dataset="item" />
</v-card>
<template v-if="item.hasObs">
<v-card class="pa-0 ma-0" @click="loadMap(item.id)">
<v-overlay open-on-hover contained activator="parent" class="align-center justify-center">
<v-btn flat>
{{ $t("datasets.map") }}
</v-btn>
</v-overlay>
<dataset-map :dataset="item" />
</v-card>
</template>
<template v-else>
<v-card class="pa-0 ma-0">
<dataset-map :dataset="item" />
</v-card>
</template>
</v-row>
</v-container>
</v-col>
Expand Down Expand Up @@ -107,25 +114,27 @@ export default {
.then(function (response) {
// handle success
for (var c of response.data.features) {
const links = [
{
const links = [];
c.hasObs = c.properties["wmo:topicHierarchy"].includes("surface-based-observations/synop");
if (c.hasObs) {
links.push({
href: undefined,
target: `/${c.id}`,
type: "Map",
msg: "explore",
icon: "mdi-map-marker-circle",
},
];
})
}
for (var link of c.links) {
if (link.type === "OARec") {
if (link.rel === "canonical") {
links.push({
href: link.href,
target: undefined,
type: "OARec",
msg: "oarec",
icon: "mdi-open-in-new",
});
} else if (link.type === "OAFeat") {
} else if (link.rel === "collection" && c.hasObs) {
links.push({
href: link.href,
target: undefined,
Expand Down

0 comments on commit 7e7b1c1

Please sign in to comment.