Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
</div>
</VFadeTransition>

<VToolbarItems>
<VToolbarItems v-if="!loadingAncestors">
<Menu class="pa-1">
<template #activator="{ on }">
<IconButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<span v-if="canManage && isRicecooker" class="font-weight-bold grey--text subheading">
{{ $tr('apiGenerated') }}
</span>
<VTooltip v-if="canManage" bottom attach="body" lazy>
<VTooltip v-if="!loading && canManage" bottom attach="body" lazy>
<template #activator="{ on }">
<!-- Need to wrap in div to enable tooltip when button is disabled -->
<div style="height: 100%;" v-on="on">
Expand All @@ -82,7 +82,7 @@
</template>
<span>{{ publishButtonTooltip }}</span>
</VTooltip>
<span v-else class="font-weight-bold grey--text subheading">
<span v-else-if="!loading" class="font-weight-bold grey--text subheading">
{{ $tr('viewOnly') }}
</span>
</template>
Expand Down Expand Up @@ -279,6 +279,12 @@
MessageDialog,
},
mixins: [titleMixin],
props: {
loading: {
type: Boolean,
default: false,
},
},
data() {
return {
drawer: false,
Expand Down Expand Up @@ -331,7 +337,9 @@
}
},
showChannelMenu() {
return this.$vuetify.breakpoint.xsOnly || this.canManage || this.isPublished;
return (
!this.loading && (this.$vuetify.breakpoint.xsOnly || this.canManage || this.isPublished)
);
},
viewChannelDetailsLink() {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<TreeViewBase @dropToClipboard="handleDropToClipboard">
<TreeViewBase :loading="loading" @dropToClipboard="handleDropToClipboard">
<template v-if="hasStagingTree && canManage" #extension>
<Banner
:value="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@ export function UPDATE_ASSESSMENTITEM_FROM_INDEXEDDB(state, { id, ...mods }) {
}

export function DELETE_ASSESSMENTITEM(state, assessmentItem) {
Vue.delete(state.assessmentItemsMap[assessmentItem.contentnode], assessmentItem.assessment_id);
if (state.assessmentItemsMap[assessmentItem.contentnode]) {
Vue.delete(state.assessmentItemsMap[assessmentItem.contentnode], assessmentItem.assessment_id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export default {
getPublishTaskForChannel(state) {
return function(channelId) {
return Object.values(state.asyncTasksMap).find(
t => t.channel_id.replace('-', '') === channelId && t.task_name === 'export-channel'
t =>
t.task_name === 'export-channel' &&
t.channel_id &&
t.channel_id.replace('-', '') === channelId
);
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
props: {
items: {
type: Array,
required: true,
default: () => [],
},
max: {
Expand Down
21 changes: 11 additions & 10 deletions contentcuration/contentcuration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,18 +1700,19 @@ def get_details(self, channel_id=None):
"resource_count": node.get("resource_count", 0),
"resource_size": node.get("resource_size", 0),
"includes": for_educators,
"kind_count": node.get("kind_count", []),
"languages": node.get("languages", ""),
"accessible_languages": node.get("accessible_languages", ""),
"licenses": node.get("licenses", ""),
"tags": node.get("tags_list", []),
"copyright_holders": node["copyright_holders"],
"authors": node["authors"],
"aggregators": node["aggregators"],
"providers": node["providers"],
"sample_pathway": pathway,
"kind_count": node.get("kind_count") or [],
"languages": node.get("languages") or [],
"accessible_languages": node.get("accessible_languages") or [],
"licenses": node.get("licenses") or [],
"tags": node.get("tags_list") or [],
"original_channels": original_channels,
"sample_pathway": pathway,
"sample_nodes": sample_nodes,
# source model fields for the below default to an empty string, but can also be null
"authors": list(filter(bool, node["authors"])),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah - I fixed this on the frontend, but better to just not return this data at all.

"aggregators": list(filter(bool, node["aggregators"])),
"providers": list(filter(bool, node["providers"])),
"copyright_holders": list(filter(bool, node["copyright_holders"])),
}

# Set cache with latest data
Expand Down
4 changes: 4 additions & 0 deletions contentcuration/contentcuration/tests/test_contentnodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ def test_get_node_details(self):
assert details["resource_count"] > 0
assert details["resource_size"] > 0
assert len(details["kind_count"]) > 0
assert len(details["authors"]) == len([author for author in details["authors"] if author])
assert len(details["aggregators"]) == len([aggregator for aggregator in details["aggregators"] if aggregator])
assert len(details["providers"]) == len([provider for provider in details["providers"] if provider])
assert len(details["copyright_holders"]) == len([holder for holder in details["copyright_holders"] if holder])


class NodeOperationsTestCase(StudioTestCase):
Expand Down