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

Update DLP UI for asynchronous assets summary #1452

Merged
merged 1 commit into from
Jan 31, 2023
Merged
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
46 changes: 43 additions & 3 deletions web/src/components/DLP/OverviewTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,20 @@
</MetadataCard>

<v-card
v-if="assetSummary && Object.keys(assetSummary) && Object.keys(assetSummary).length"
v-if="assetSummary"
outlined
>
<v-card-title class="font-weight-regular">
<v-icon class="mr-3 grey--text text--lighten-1">
<v-progress-circular
v-if="assetSummaryBeingComputed"
class="mr-3"
size="20"
indeterminate
/>
<v-icon
v-else
class="mr-3 grey--text text--lighten-1"
>
mdi-clipboard-list
</v-icon>
Assets Summary
Expand All @@ -122,8 +131,21 @@
:style="`column-count: ${assetSummaryColumnCount};`"
class="px-3 ml-2"
>
<div
v-if="assetSummaryBeingComputed"
class="text-subtitle-2"
>
The assets summary is being computed, please wait.
</div>
<div
v-else-if="!assetSummary || !Object.keys(assetSummary).length"
class="font-italic font-weight-bold"
>
This Dandiset does not contain any assets.
</div>
<div
v-for="([type, items], i) in Object.entries(assetSummary)"
v-else
:key="i"
>
<div
Expand Down Expand Up @@ -206,10 +228,11 @@ import { AssociatedProjects, DandisetMetadata, RelatedResource } from '@/types';
import {
computed,
ComputedRef,
defineComponent, getCurrentInstance, PropType,
defineComponent, getCurrentInstance, onMounted, PropType,
} from 'vue';

import MetadataCard from '@/components/DLP/MetadataCard.vue';
import { useDandisetStore } from '@/stores/dandiset';

// Asset summary fields to hide
const ASSET_SUMMARY_BLACKLIST = new Set([
Expand Down Expand Up @@ -248,6 +271,9 @@ export default defineComponent({
setup(props) {
const $vuetify = computed(() => getCurrentInstance()?.proxy.$vuetify);

const store = useDandisetStore();
const currentDandiset = computed(() => store.dandiset);

const contributors = computed(
() => props.meta.contributor?.filter(
(contributor) => !!(contributor.includeInCitation) && !!(contributor.schemaKey === 'Person'),
Expand Down Expand Up @@ -290,19 +316,33 @@ export default defineComponent({
: Math.min(Object.keys(assetSummary.value).length, 3)),
);

const assetSummaryBeingComputed = computed<boolean>(() => currentDandiset.value?.status === 'Pending');

const contactPeople = computed(
() => new Set(contributors.value
.filter((contributor) => contributor.roleName?.includes('dcite:ContactPerson'))
.map((contributor) => contributor.name)),
);

onMounted(() => {
setInterval(async () => {
if (!currentDandiset.value || !assetSummaryBeingComputed.value) {
return;
}
const { identifier } = currentDandiset.value.dandiset;
const { version } = currentDandiset.value;
await store.fetchDandiset({ identifier, version });
}, 5000);
});
jjnesbitt marked this conversation as resolved.
Show resolved Hide resolved

return {
contributors,
fundingInformation,
relatedResources,
associatedProjects,
assetSummary,
assetSummaryColumnCount,
assetSummaryBeingComputed,
contactPeople,
isURL,
};
Expand Down