Skip to content

Commit 775359e

Browse files
authored
Merge pull request #710 from inab/preprod
Fixes
2 parents eebd444 + 6794956 commit 775359e

10 files changed

Lines changed: 49 additions & 77 deletions

File tree

components/Landing/HeroNumbers.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const factory = (propsData) => {
1414
const propsData = {
1515
toolsCount: 10,
1616
communityCount: 5,
17-
resourcesCount: 20,
1817
projectsCount: 8,
1918
};
2019

components/Landing/HeroNumbers.vue

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="hero-numbers__item">
2020
<span class="hero-numbers__icon ion-ios-lightbulb-outline" />
2121
<div class="hero-numbers__text">
22-
<h4 class="hero-numbers__count text-h3">
22+
<h4 class="hero-numbers__count text-h3 font-weight-normal">
2323
<animated-number :value="toolsCount" />
2424
</h4>
2525
<h6 class="hero-numbers__title">
@@ -28,19 +28,6 @@
2828
</div>
2929
</div>
3030
</v-col>
31-
<v-col align="center" cols="12" sm="3">
32-
<div class="hero-numbers__item">
33-
<span class="hero-numbers__icon ion-ios-world-outline" />
34-
<div class="hero-numbers__text">
35-
<h4 class="hero-numbers__count text-h3 font-weight-normal">
36-
<animated-number :value="resourcesCount" />
37-
</h4>
38-
<h6 class="hero-numbers__title">
39-
{{ 'Resource' | pluralize(resourcesCount) }}
40-
</h6>
41-
</div>
42-
</div>
43-
</v-col>
4431
<v-col align="center" cols="12" sm="3">
4532
<div class="hero-numbers__item">
4633
<span class="hero-numbers__icon ion-ios-world-outline" />
@@ -77,10 +64,6 @@ export default {
7764
type: Number,
7865
required: true,
7966
},
80-
resourcesCount: {
81-
type: Number,
82-
required: true,
83-
},
8467
projectsCount: {
8568
type: Number,
8669
required: true,

components/Landing/HeroSearchbar.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ describe('HeroSearchbar', () => {
2929
submitBtn.trigger('click');
3030

3131
expect(wrapper.vm.$router.push).toHaveBeenCalledWith({
32-
path: '/tool',
33-
query: { search: '' },
32+
path: '/tool/search',
33+
query: { q: '' },
3434
});
3535
});
3636

@@ -43,8 +43,8 @@ describe('HeroSearchbar', () => {
4343
await searchInput.trigger('keyup.enter');
4444

4545
expect(wrapper.vm.$router.push).toHaveBeenCalledWith({
46-
path: '/tool',
47-
query: { search: '' },
46+
path: '/tool/search',
47+
query: { q: '' },
4848
});
4949
});
5050

@@ -61,8 +61,8 @@ describe('HeroSearchbar', () => {
6161
submitBtn.trigger('click');
6262

6363
expect(wrapper.vm.$router.push).toHaveBeenCalledWith({
64-
path: '/tool',
65-
query: { search: 'Random Tool Name' },
64+
path: '/tool/search',
65+
query: { q: 'Random Tool Name' },
6666
});
6767
});
6868
});

components/Landing/HeroSearchbar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export default {
2525
methods: {
2626
handleSubmit() {
2727
this.$router.push({
28-
path: '/tool',
29-
query: { search: this.input },
28+
path: '/tool/search',
29+
query: { q: this.input },
3030
});
3131
},
3232
},

components/Landing/__snapshots__/HeroNumbers.spec.js.snap

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports[`HeroNumbers should match snapshot 1`] = `
1919
<v-col-stub cols=\\"12\\" sm=\\"3\\" tag=\\"div\\" align=\\"center\\">
2020
<div class=\\"hero-numbers__item\\"><span class=\\"hero-numbers__icon ion-ios-lightbulb-outline\\"></span>
2121
<div class=\\"hero-numbers__text\\">
22-
<h4 class=\\"hero-numbers__count text-h3\\">
22+
<h4 class=\\"hero-numbers__count text-h3 font-weight-normal\\">
2323
<animated-number-stub value=\\"10\\"></animated-number-stub>
2424
</h4>
2525
<h6 class=\\"hero-numbers__title\\">
@@ -28,18 +28,6 @@ exports[`HeroNumbers should match snapshot 1`] = `
2828
</div>
2929
</div>
3030
</v-col-stub>
31-
<v-col-stub cols=\\"12\\" sm=\\"3\\" tag=\\"div\\" align=\\"center\\">
32-
<div class=\\"hero-numbers__item\\"><span class=\\"hero-numbers__icon ion-ios-world-outline\\"></span>
33-
<div class=\\"hero-numbers__text\\">
34-
<h4 class=\\"hero-numbers__count text-h3 font-weight-normal\\">
35-
<animated-number-stub value=\\"20\\"></animated-number-stub>
36-
</h4>
37-
<h6 class=\\"hero-numbers__title\\">
38-
Resource
39-
</h6>
40-
</div>
41-
</div>
42-
</v-col-stub>
4331
<v-col-stub cols=\\"12\\" sm=\\"3\\" tag=\\"div\\" align=\\"center\\">
4432
<div class=\\"hero-numbers__item\\"><span class=\\"hero-numbers__icon ion-ios-world-outline\\"></span>
4533
<div class=\\"hero-numbers__text\\">

components/Tools/ToolEntry/Documentation/DocumentationContent.vue

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<v-container class="mt-0 pt-0 pl-8">
33
<!-- Documents -->
44
<v-row
5-
v-if="tool.documentation && tool.documentation.length"
5+
v-if="documents.length"
66
class="mt-0 pt-0 mb-0 section-row"
77
align="center"
88
>
@@ -11,9 +11,7 @@
1111
</v-col>
1212
<v-col cols="9" class="pt-3 pb-3 d-flex flex-wrap" style="gap: 14px">
1313
<v-chip
14-
v-for="(item, i) in tool.documentation.filter(
15-
(d) => d.term && d.term.url
16-
)"
14+
v-for="(item, i) in documents"
1715
:key="i"
1816
label
1917
color="grey lighten-3"
@@ -28,12 +26,12 @@
2826
</v-col>
2927
</v-row>
3028

31-
<v-divider v-if="tool.documentation && tool.documentation.length" />
29+
<v-divider v-if="documents.length" />
3230

3331
<!-- Related topics -->
3432
<!-- Vocabulary EDAM si lleva los 3 puntitos sino no. -->
3533
<v-row
36-
v-if="tool.topics && tool.topics.length"
34+
v-if="topics.length"
3735
class="mt-0 pt-0 mb-0 section-row"
3836
align="center"
3937
>
@@ -42,7 +40,7 @@
4240
</v-col>
4341
<v-col cols="9" class="pt-3 pb-3 d-flex flex-wrap" style="gap: 14px">
4442
<ItemChipMenu
45-
v-for="item in tool.topics.filter((t) => t.term && t.term.term)"
43+
v-for="item in topics"
4644
:key="item.id"
4745
:text="item.term.term"
4846
:edam-id="item.term.uri"
@@ -53,11 +51,11 @@
5351
</v-col>
5452
</v-row>
5553

56-
<v-divider v-if="tool.topics && tool.topics.length" />
54+
<v-divider v-if="topics.length" />
5755

5856
<!-- Operations -->
5957
<v-row
60-
v-if="tool.operations && tool.operations.length"
58+
v-if="operations.length"
6159
class="mt-0 pt-0 mb-0 section-row"
6260
align="center"
6361
>
@@ -66,7 +64,7 @@
6664
</v-col>
6765
<v-col cols="9" class="pt-3 pb-3 d-flex flex-wrap" style="gap: 14px">
6866
<ItemChipMenu
69-
v-for="item in tool.operations"
67+
v-for="item in operations"
7068
:key="item.id"
7169
:text="item.term.term"
7270
:edam-id="item.term.uri"
@@ -101,6 +99,19 @@ export default {
10199
tool: 'tool',
102100
loading: 'loading',
103101
}),
102+
// Documentation entries that carry a link; entries with only inline
103+
// `content` (no URL) render no chip, so they are excluded here.
104+
documents() {
105+
return (this.tool?.documentation || []).filter(
106+
(d) => d.term && d.term.url
107+
);
108+
},
109+
topics() {
110+
return (this.tool?.topics || []).filter((t) => t.term && t.term.term);
111+
},
112+
operations() {
113+
return (this.tool?.operations || []).filter((o) => o.term && o.term.term);
114+
},
104115
},
105116
};
106117
</script>

pages/index.spec.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ describe('Index.vue', () => {
1919
resourcesCount: () => {
2020
return 999;
2121
},
22-
toolsCount: () => {
23-
return 555;
24-
},
2522
communitiesCount: () => {
2623
return 10;
2724
},
@@ -32,7 +29,6 @@ describe('Index.vue', () => {
3229
actions: {
3330
getCommunitiesCount: jest.fn(),
3431
getResourcesCount: jest.fn(),
35-
getToolsCount: jest.fn(),
3632
},
3733
},
3834
};
@@ -47,6 +43,5 @@ describe('Index.vue', () => {
4743

4844
expect(mockStore.dashboard.actions.getCommunitiesCount).toHaveBeenCalled();
4945
expect(mockStore.dashboard.actions.getResourcesCount).toHaveBeenCalled();
50-
expect(mockStore.dashboard.actions.getToolsCount).toHaveBeenCalled();
5146
});
5247
});

pages/index.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
</section>
1616
<hero-numbers
1717
:community-count="communitiesCount"
18-
:tools-count="toolsCount"
19-
:resources-count="resourcesCount"
18+
:tools-count="resourcesCount"
2019
:projects-count="projectsCount"
2120
/>
2221
<logo-slider class="landing-mt landing-mb" />
@@ -47,13 +46,13 @@ export default {
4746
computed: {
4847
...mapGetters('dashboard', {
4948
communitiesCount: 'communitiesCount',
50-
toolsCount: 'toolsCount',
49+
// resourcesCount is the total tools count (/stats/tools/count_total)
50+
// and is displayed under the "Tools" label in the hero numbers.
5151
resourcesCount: 'resourcesCount',
5252
projectsCount: 'projectsCount',
5353
}),
5454
},
5555
mounted() {
56-
this.$store.dispatch('dashboard/getToolsCount');
5756
this.$store.dispatch('dashboard/getResourcesCount');
5857
this.$store.dispatch('dashboard/getCommunitiesCount');
5958
},

pages/tool/_id.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,22 @@ export default {
226226
hasSimilarSoftware() {
227227
return this.loadingSimilar || this.similarTools.length > 0;
228228
},
229-
// Whether the documentation section should be shown
229+
// Whether the documentation section should be shown. The card renders
230+
// Documents (documentation entries with a URL), Related topics and
231+
// Function (operations); a documentation entry that only carries inline
232+
// `content` (no URL) renders nothing, so it must not, on its own, show
233+
// the card.
230234
hasDocumentation() {
231-
return (this.tool?.documentation || []).length > 0;
235+
const hasDocuments = (this.tool?.documentation || []).some(
236+
(doc) => doc.term?.url
237+
);
238+
const hasTopics = (this.tool?.topics || []).some(
239+
(topic) => topic.term?.term
240+
);
241+
const hasOperations = (this.tool?.operations || []).some(
242+
(operation) => operation.term?.term
243+
);
244+
return hasDocuments || hasTopics || hasOperations;
232245
},
233246
// Sections to render, hiding cards that have no information
234247
items() {

store/dashboard.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export default {
55
state: () => {
66
return {
77
resourcesCount: 0,
8-
toolsCount: 0,
98
communitiesCount: 0,
109
projectsCount: 0,
1110
};
@@ -30,26 +29,12 @@ export default {
3029
const response = await this.$observatory.$get('/stats/tools/count_total');
3130
commit('setResourcesCount', response[0]);
3231
},
33-
async getToolsCount({ commit }) {
34-
const response = await this.$axios.head('/aggregate', {
35-
params: {
36-
limit: 1,
37-
},
38-
});
39-
commit('setToolsCount', response);
40-
},
4132
},
4233

4334
mutations: {
4435
setResourcesCount(state, payload) {
4536
state.resourcesCount = payload.data;
4637
},
47-
setToolsCount(state, payload) {
48-
const matches = payload.headers['content-range'].match(
49-
/(\d+)-(\d+|\*)\/(\d+|\*)/
50-
);
51-
state.toolsCount = parseInt(matches[3]);
52-
},
5338
setCommunitiesCount(state, payload) {
5439
const communities = payload.getCommunities.map((community) => {
5540
community._metadata = JSON.parse(community._metadata);
@@ -80,7 +65,6 @@ export default {
8065

8166
getters: {
8267
resourcesCount: (state) => state.resourcesCount,
83-
toolsCount: (state) => state.toolsCount,
8468
communitiesCount: (state) => state.communitiesCount,
8569
projectsCount: (state) => state.projectsCount,
8670
},

0 commit comments

Comments
 (0)