Skip to content

Commit

Permalink
Merge pull request #185 from nih-sparc/Address-sparc-downtime-recorded
Browse files Browse the repository at this point in the history
Address sparc downtime recorded
  • Loading branch information
egauzens authored Aug 19, 2024
2 parents 4f898b6 + 47912a3 commit d98732a
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 24 deletions.
2 changes: 1 addition & 1 deletion components/PortalFeatures/PortalFeatures.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="section-container container pt-32 pb-56">
<div class="section-container container py-32">
<div class="heading2 mb-32">{{ title }}</div>
<div v-if="maxSet" class="max-set-row" :style="`grid-template-columns: repeat(${maxPerRow}, 1fr)`">
<div
Expand Down
6 changes: 4 additions & 2 deletions components/ProjectsAndDatasets/ProjectsAndDatasets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<template v-if="isProject">
<div class="body2 mb-16">Here is a project you might be interested in:</div>
<projects-and-datasets-card
v-if="projectOrResource.fields"
:title="projectOrResource.fields.title"
:description="projectOrResource.fields.shortDescription"
:banner="projectOrResource.fields.banner"
Expand All @@ -20,7 +21,8 @@
<!--If not a project then we assume it is a tool/resource since it must be one or the other-->
<template v-else>
<div class="body2 mb-16">Here is a resource you might be interested in:</div>
<projects-and-datasets-card
<projects-and-datasets-card
v-if="projectOrResource.fields"
:title="projectOrResource.fields.name"
:description="projectOrResource.fields.description"
:banner="projectOrResource.fields.logo.fields.file.url"
Expand All @@ -32,7 +34,7 @@
</nuxt-link>
</template>
</div>
<div class="col p-16">
<div v-if="dataset.title" class="col p-16">
<div class="body2 mb-16">{{ datasetSectionTitle }}</div>
<projects-and-datasets-card
:title="dataset.title"
Expand Down
5 changes: 5 additions & 0 deletions pages/about/[aboutDetailsId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,9 @@ export default {
:deep(img) {
max-width: 100%;
}
:deep(img) {
display: block;
margin-left: auto;
margin-right: auto;
}
</style>
8 changes: 6 additions & 2 deletions pages/about/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="container">
<paper class="row mt-32" :text="parseMarkdown(sparcPortal)" button-text="View The Roadmap"
button-link-external="https://docs.sparc.science/docs/sparc-portal-roadmap" />
<div :v-if="whoWeSpport?.length > 0" class="who-we-support-container p-24 mt-32">
<div :v-if="whoWeSupport?.length > 0" class="who-we-support-container p-24 mt-32">
<div class="heading2">Who We Support</div>
<Consortias />
<nuxt-link to="/about/projects">
Expand Down Expand Up @@ -283,6 +283,11 @@ export default {
width: 100%;
display: flex;
}
:deep(img) {
display: block;
margin-left: auto;
margin-right: auto;
}
.who-we-support-item {
color: #000;
text-decoration: none;
Expand All @@ -298,7 +303,6 @@ export default {
img {
background: #fff;
border-radius: 50%;
display: block;
margin-bottom: 8px;
width: 128px;
border: solid 1px #c0c4cc;
Expand Down
2 changes: 1 addition & 1 deletion pages/apps/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</p>
</page-hero>
<portal-features :features="appEntries" :title="appsSectionTitle" :icon-is-top-element="false" :max-per-row="3" />
<div class="container" :style="'text-align: center; margin-top: 1rem;'" v-html="parseMarkdown(footer)" />
<div class="container" :style="'text-align: center; margin-top: 1rem; margin-bottom: 2rem;'" v-html="parseMarkdown(footer)" />
</div>
</template>

Expand Down
50 changes: 32 additions & 18 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import HomepageNews from '@/components/HomepageNews/HomepageNews.vue'
import PortalFeatures from '@/components/PortalFeatures/PortalFeatures.vue'
import ProjectsAndDatasets from '@/components/ProjectsAndDatasets/ProjectsAndDatasets.vue'
import StayConnected from '@/components/StayConnected/StayConnected.vue'
import { failMessage } from '@/utils/notification-messages'
import marked from '@/mixins/marked/index'
import getHomepageFields from '@/utils/homepageFields'
import { useMainStore } from '../store/index.js'
Expand Down Expand Up @@ -120,27 +120,41 @@ export default {
}
]
})
return Promise.all([
$contentfulClient.getEntry(config.public.ctf_home_page_id)
]).then(async ([homepage]) => {
try {
const homepage = await $contentfulClient.getEntry(config.public.ctf_home_page_id)
let fields = getHomepageFields(homepage.fields)
const datasetSectionTitle = homepage.fields.datasetSectionTitle
const url = `${config.public.portal_api}/get_featured_dataset`
await $axios.get(url).then(({data}) => {
const datasets = data?.datasets
fields = { ...fields, 'featuredDataset': { 'title': datasets[0].name, 'description': datasets[0].description, 'banner': datasets[0].banner, 'id': datasets[0].id }, 'datasetSectionTitle': datasetSectionTitle }
})
if (pathOr(undefined, ["featuredProject","fields","institution"], fields) != undefined) {
const institutionId = pathOr("", ["featuredProject","fields","institution","sys","id"], fields)
await $contentfulClient.getEntry(institutionId).then(( response ) => {
fields.featuredProject.fields = { ...fields.featuredProject.fields, 'banner': response.fields.logo.fields?.file.url }
})
const { data } = await $axios.get(`${config.public.portal_api}/get_featured_dataset`)
const datasets = data?.datasets
if (datasets != undefined && datasets.length > 0) {
const featuredDataset = {
title: datasets[0].name,
description: datasets[0].description,
banner: datasets[0].banner,
id: datasets[0].id,
}
fields = { ...fields, featuredDataset, datasetSectionTitle }
}
const institutionId = pathOr(undefined, ["featuredProject", "fields", "institution", "sys", "id"], fields)
if (institutionId) {
const institutionResponse = await $contentfulClient.getEntry(institutionId)
fields.featuredProject.fields.banner = institutionResponse.fields.logo.fields?.file.url
}
if (datasets == undefined || datasets.length <= 0 || homepage == undefined || fields == undefined) {
failMessage("Some services are temporarily unavailable, which may cause certain pages to load incompletely.")
}
return fields
}).catch(e => {
console.error(e);
return { contentfulError: true }
})
} catch (error) {
console.error(error)
failMessage("Some services are temporarily unavailable, which may cause certain pages to load incompletely.")
return
}
},
watch: {
Expand Down

0 comments on commit d98732a

Please sign in to comment.