Skip to content

Commit 5244a2c

Browse files
Merge pull request #359 from EOEPCA/new-catalog-structure
Migration to new catalog structure phase 1
2 parents ef2839b + a295515 commit 5244a2c

File tree

174 files changed

+1387
-1368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+1387
-1368
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/*.min.*
2+
static/stac-browser

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ module.exports = {
33
env: {
44
jest: true,
55
},
6+
rules: {
7+
"vue/multi-word-component-names": "off",
8+
},
69
};

.prettierignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
**/*.min.*
1+
**/*.min.*
2+
static/stac-browser
3+
.nuxt
4+
coverage
5+
.github

assets/variables.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ $heading-font-family: "NotesESABold";
2828
.v-toolbar__title,
2929
.v-card__title,
3030
.v-tab,
31-
.v-chip {
31+
.v-chip,
32+
eox-itemfilter::part(details-filter) {
3233
font-family: $heading-font-family, sans-serif;
3334
}

components/Coverage.vue

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
</v-icon>
2626
<span
2727
>{{
28-
products.length === 1
29-
? products[0].properties.title
30-
: variable && variable.name
28+
products.length === 1 ? products[0].name : variable && variable.name
3129
}}
3230
Coverage</span
3331
>
@@ -47,31 +45,33 @@
4745
<v-subheader class="px-0"> Products </v-subheader>
4846
<v-divider />
4947
<v-list-item
50-
v-for="product in products"
48+
v-for="product in [...products].sort((a, b) => {
49+
return a.name.localeCompare(b.name, 'en', {
50+
sensitivity: 'base',
51+
});
52+
})"
5153
:key="product.id"
5254
class="px-0"
5355
style="cursor: pointer"
5456
@mouseover="currentHighlight = product"
5557
@mouseleave="currentHighlight = null"
5658
>
5759
<v-list-item-content>
58-
<v-list-item-title>{{
59-
product.properties.title
60-
}}</v-list-item-title>
60+
<v-list-item-title>{{ product.name }}</v-list-item-title>
6161
</v-list-item-content>
6262
<v-list-item-action class="flex-row">
6363
<v-btn
6464
v-if="variable"
6565
icon
6666
color="primary"
67-
:disabled="!product.geometry"
67+
:disabled="!product.coverage"
6868
>
6969
<v-icon>mdi-map-marker</v-icon>
7070
</v-btn>
7171
<v-btn
7272
icon
7373
color="primary"
74-
:to="`/products/${$extractSlug(product)}`"
74+
:to="`/products/${product.id}/collection`"
7575
target="_blank"
7676
>
7777
<v-icon>mdi-open-in-new</v-icon>
@@ -82,19 +82,19 @@
8282
<template v-else-if="products[0]">
8383
<div><strong>Name</strong></div>
8484
<div class="mb-2">
85-
{{ products[0].properties.title }}
85+
{{ products[0].name }}
8686
</div>
8787
<div><strong>Region</strong></div>
8888
<div class="mb-2">
89-
{{ products[0].properties["osc:region"] }}
89+
{{ products[0].region }}
9090
</div>
9191
<div><strong>Satellite missions</strong></div>
9292
<div class="mb-2">
93-
{{ products[0].properties["osc:missions"].join(", ") }}
93+
{{ products[0].missions.join(", ") }}
9494
</div>
9595
<div><strong>BBOX</strong></div>
9696
<div class="mb-2">
97-
{{ products[0].bbox }}
97+
{{ products[0].coverage }}
9898
</div>
9999
</template>
100100
</v-col>
@@ -103,8 +103,10 @@
103103
<CoverageMap
104104
v-if="products"
105105
ref="map"
106-
:features="products"
107-
:highlight="currentHighlight"
106+
:features="products.map((product) => createGeometry(product))"
107+
:highlight="
108+
currentHighlight ? createGeometry(currentHighlight) : null
109+
"
108110
/>
109111
</client-only>
110112
</v-col>
@@ -160,5 +162,26 @@ export default {
160162
}
161163
},
162164
},
165+
methods: {
166+
createGeometry(product) {
167+
return {
168+
...product,
169+
geometry: {
170+
bbox: product.coverage[0],
171+
coordinates: [
172+
[
173+
[product.coverage[0][0], product.coverage[0][1]],
174+
[product.coverage[0][2], product.coverage[0][1]],
175+
[product.coverage[0][2], product.coverage[0][3]],
176+
[product.coverage[0][0], product.coverage[0][3]],
177+
[product.coverage[0][0], product.coverage[0][1]],
178+
],
179+
],
180+
type: "Polygon",
181+
},
182+
type: "Feature",
183+
};
184+
},
185+
},
163186
};
164187
</script>

components/CoverageMap.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export default {
9090
if (this.map && feature && feature.geometry) {
9191
const highlightFeature = this.vectorSource.getFeatureById(feature.id);
9292
highlightFeature.setStyle(this.highlightStyle);
93-
console.log(highlightFeature.getGeometry().getExtent());
9493
this.map.getView().fit(highlightFeature.getGeometry().getExtent(), {
9594
padding: this.defaultPadding,
9695
duration: 500,

components/EditButton.vue

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div class="editButton">
33
<v-speed-dial
44
v-model="fab"
55
fixed
@@ -14,7 +14,7 @@
1414
Suggest changes
1515
</v-btn>
1616
</template>
17-
<v-btn
17+
<!-- <v-btn
1818
v-if="true"
1919
dark
2020
rounded
@@ -44,14 +44,12 @@
4444
>
4545
<v-icon left> mdi-delete </v-icon>
4646
Request deletion
47-
</v-btn>
47+
</v-btn> -->
4848
<v-btn
4949
dark
5050
rounded
5151
color="black"
52-
:href="`${$config.githubDataRoot}/${Object.keys($route.params)[0]}s/${
53-
itemId || Object.values($route.params)[0]
54-
}.json`"
52+
:href="`${$config.githubDataRoot}${currentPath}.json`"
5553
target="_blank"
5654
>
5755
<v-icon left> mdi-github </v-icon>
@@ -91,7 +89,15 @@ export default {
9189
fab: false,
9290
deleteDialog: false,
9391
loading: false,
92+
currentPath: null,
9493
}),
94+
watch: {
95+
fab(on) {
96+
if (on) {
97+
this.currentPath = window.location.pathname;
98+
}
99+
},
100+
},
95101
methods: {
96102
async deleteItem() {
97103
this.loading = true;
@@ -112,4 +118,11 @@ export default {
112118
::v-deep .v-speed-dial__list {
113119
align-items: flex-end;
114120
}
121+
.editButton {
122+
position: relative;
123+
float: right;
124+
right: 10px;
125+
bottom: 35px;
126+
transition: 0.5s;
127+
}
115128
</style>

components/ItemGrid.vue

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
md="4"
99
lg="3"
1010
>
11-
<v-card
11+
<!-- <v-card
1212
:to="`/${getType(item)}s/${
1313
getType(item) === 'variable' ? slugify(item.name) : $extractSlug(item)
1414
}`"
1515
outlined
16-
>
16+
> -->
17+
<v-card :to="`/${getType(item)}s/${item.id}/collection`" outlined>
1718
<v-card-title>
1819
<v-chip
1920
small
@@ -28,31 +29,28 @@
2829
<template v-if="getType(item) === 'project'">
2930
<div class="projectDate">
3031
<v-icon small> mdi-calendar-today </v-icon>
31-
<small>{{ item.properties.start_datetime.split(" ")[0] }}</small>
32+
<small>{{ item.start_datetime.split(" ")[0] }}</small>
3233
-
3334
</div>
3435
<div class="projectDate">
3536
<v-icon small> mdi-calendar </v-icon>
36-
<small>{{ item.properties.end_datetime.split(" ")[0] }}</small>
37+
<small>{{ item.end_datetime.split(" ")[0] }}</small>
3738
</div>
3839
</template>
3940
</v-card-title>
4041
<v-card-title class="text-subtitle-2 text-uppercase">
41-
{{ getType(item) === "variable" ? item.name : item.properties.title }}
42+
{{ getType(item) === "variable" ? item.name : item.title }}
4243
</v-card-title>
4344
<v-card-subtitle v-if="getType(item) === 'project'">
44-
<span
45-
v-for="consort in item.properties['osc:consortium']"
46-
:key="consort"
47-
>
45+
<span v-for="consort in item['osc:consortium']" :key="consort">
4846
{{ consort }}
4947
</span>
5048
</v-card-subtitle>
5149
<v-card-text>
5250
<p v-if="getType(item) === 'project' || getType(item) === 'product'">
5351
{{
54-
item.properties.description
55-
? `${item.properties.description.substring(0, 100)}...`
52+
item.description
53+
? `${item.description.substring(0, 100)}...`
5654
: "No description"
5755
}}
5856
</p>
@@ -75,12 +73,12 @@
7573
<div
7674
v-if="
7775
getType(item) === 'product' &&
78-
item.properties.keywords.find((el) => el.includes('theme:'))
76+
item.keywords.find((el) => el.includes('theme:'))
7977
"
8078
class="mt-2"
8179
>
8280
<v-chip
83-
v-for="theme in item.properties.keywords.filter((el) =>
81+
v-for="theme in item.keywords.filter((el) =>
8482
el.includes('theme:')
8583
)"
8684
:key="theme"
@@ -129,15 +127,16 @@ export default {
129127
},
130128
methods: {
131129
getType(item) {
132-
let type;
133-
if (item.properties?.["osc:type"]) {
134-
type = item.properties["osc:type"].toLowerCase();
135-
} else if (item.properties?.type) {
136-
type = item.properties.type === "dataset" ? "product" : "project";
137-
} else {
138-
type = "variable";
139-
}
140-
return type;
130+
// let type;
131+
// if (item.properties?.["osc:type"]) {
132+
// type = item.properties["osc:type"].toLowerCase();
133+
// } else if (item.properties?.type) {
134+
// type = item.properties.type === "dataset" ? "product" : "project";
135+
// } else {
136+
// type = "variable";
137+
// }
138+
// return type;
139+
return item["osc:type"].toLowerCase();
141140
},
142141
},
143142
};

0 commit comments

Comments
 (0)