Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6622878
Make syncing more frequent.
rtibbles Sep 3, 2020
83fd2ad
Prompt syncing from changes in the changes table and lock deletion.
rtibbles Sep 3, 2020
36d92a8
Update dev server sync forcing.
rtibbles Sep 3, 2020
d93d0e6
Automatically clear locks once they have expired.
rtibbles Sep 3, 2020
26dd8d0
Add logging messages in dev mode to better trace async calls.
rtibbles Sep 3, 2020
df3087a
Remove tree resource, replace with clipboard resource.
rtibbles Sep 3, 2020
8b2cdd7
Do caching based on specific requests, rather than indexedDB state.
rtibbles Sep 3, 2020
45c6e9e
Remove tree representation from vuex.
rtibbles Sep 3, 2020
5bd8638
Don't display additional traceback info in travis tests.
rtibbles Sep 3, 2020
4146cb0
Remove all references to tree state in components.
rtibbles Sep 4, 2020
aef42de
Update clipboard in the frontend to rely on a separate backend.
rtibbles Sep 4, 2020
b8721ee
Add channel_id to contentnode viewset.
rtibbles Sep 4, 2020
8b57135
Add clipboard endpoint, cleanup unused endpoint.
rtibbles Sep 4, 2020
9afc9f6
Fell the tree endpoint.
rtibbles Sep 4, 2020
31b4b5e
Fix tests and simplify required copy args for contentnode.
rtibbles Sep 4, 2020
205a320
Fix tests. Fix copying from current topic view to clipboard.
rtibbles Sep 4, 2020
2d953b7
JS linting.
rtibbles Sep 4, 2020
55e4461
Just one more thing...
rtibbles Sep 4, 2020
c0598a8
Couple clipboard node vuex state to indexeddb.
rtibbles Sep 4, 2020
ea56e68
Add clipboard nodes to the right place after copying.
rtibbles Sep 4, 2020
c7daf34
Properly delete clipboard nodes.
rtibbles Sep 4, 2020
17698ba
Code cleanup based on PR review.
rtibbles Sep 4, 2020
9cdf940
Fix basic bulk clipboard deletion.
rtibbles Sep 6, 2020
b40b0e0
Add level information to clipboard.
rtibbles Sep 8, 2020
7b19c06
Use ancestor id to differentiate duplicate clipboard entries.
rtibbles Sep 8, 2020
22d0bbe
Update duplicate clipboard node logic to handle shallow and deep copies.
rtibbles Sep 8, 2020
70c7657
Make updates for making full copies to content nodes from a shallow c…
rtibbles Sep 9, 2020
9fbe447
Use lodash get to handle extra_fields being null.
rtibbles Sep 9, 2020
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 @@ -38,18 +38,18 @@
</template>

<transition-group>
<template v-for="child in treeChildren">
<template v-for="child in children">
<TopicNode
v-if="hasChildren(child.id)"
v-if="hasClipboardChildren(child.id)"
:key="child.id"
:nodeId="child.id"
:sourceId="child.source_id"
:level="level + 1"
/>
<ContentNode
v-else
:key="child.id"
:nodeId="child.id"
:sourceId="child.source_id"
:level="level + 1"
/>
</template>
</transition-group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<VHover>
<ContextMenu slot-scope="{ hover }">
<VListTile
v-if="contentNode"
class="content-item py-2"
:class="{hover, selected}"
:style="{'padding-left': indentPadding}"
Expand Down Expand Up @@ -48,12 +49,12 @@
</VBtn>
</template>

<ContentNodeOptions :nodeId="nodeId" :sourceId="sourceId" />
<ContentNodeOptions :nodeId="nodeId" :ancestorId="ancestorId" />
</VMenu>
</VListTileAction>
</VListTile>
<template #menu>
<ContentNodeOptions :nodeId="nodeId" :sourceId="sourceId" />
<template v-if="contentNode" #menu>
<ContentNodeOptions :nodeId="nodeId" :ancestorId="ancestorId" />
</template>
</ContextMenu>
</VHover>
Expand All @@ -76,16 +77,18 @@
ContextMenu,
},
mixins: [clipboardMixin],
props: {
sourceId: {
type: String,
required: true,
},
},
computed: {
thumbnailAttrs() {
const { title, kind, thumbnail_src: src, thumbnail_encoding: encoding } = this.contentNode;
return { title, kind, src, encoding };
if (this.contentNode) {
const {
title,
kind,
thumbnail_src: src,
thumbnail_encoding: encoding,
} = this.contentNode;
return { title, kind, src, encoding };
}
return {};
},
},
$trs: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<VListTile @click="duplicateNode()">
<VListTileTitle>{{ $tr('makeACopy') }}</VListTileTitle>
</VListTile>
<VListTile v-if="canEdit" @click.stop="setMoveNodes([sourceId])">
<VListTile v-if="canEdit" @click.stop="moveNode">
<VListTileTitle>{{ $tr('moveTo') }}</VListTileTitle>
</VListTile>
<VListTile @click="removeNode()">
Expand All @@ -22,7 +22,6 @@
import { mapActions, mapGetters, mapMutations } from 'vuex';
import { RouterNames } from '../../constants';
import { withChangeTracker } from 'shared/data/changes';
import { ContentKindsNames } from 'shared/leUtils/ContentKinds';

export default {
name: 'ContentNodeOptions',
Expand All @@ -31,44 +30,41 @@
type: String,
required: true,
},
sourceId: {
ancestorId: {
type: String,
required: true,
default: null,
},
},
computed: {
...mapGetters('channel', ['getChannel']),
...mapGetters('contentNode', ['getContentNode', 'getTreeNode']),
treeNode() {
return this.getTreeNode(this.sourceId);
},
...mapGetters('clipboard', ['getClipboardNodeForRender', 'getCopyTrees']),
node() {
return this.getContentNode(this.sourceId);
return this.getClipboardNodeForRender(this.nodeId);
},
channelId() {
return this.treeNode.channel_id;
return this.node.channel_id;
},
viewLink() {
return {
name: RouterNames.TREE_VIEW,
params: {
nodeId: this.treeNode.parent,
detailNodeId: this.sourceId,
nodeId: this.node.parent,
detailNodeId: this.node.id,
},
};
},
canEdit() {
return this.getChannel(this.channelId) && this.getChannel(this.channelId).edit;
},
isTopic() {
return this.node.kind === ContentKindsNames.TOPIC;
},
},
methods: {
...mapActions(['showSnackbar']),
...mapActions('clipboard', ['copy']),
...mapActions('contentNode', ['deleteContentNodes']),
...mapMutations('contentNode', { setMoveNodes: 'SET_MOVE_NODES' }),
...mapActions('clipboard', ['copy', 'deleteClipboardNode']),
...mapMutations('clipboard', { setCopyNodes: 'SET_CLIPBOARD_MOVE_NODES' }),
moveNode() {
const copyTrees = this.getCopyTrees(this.nodeId, null, this.ancestorId, true);
this.setCopyNodes(copyTrees);
},
removeNode: withChangeTracker(function(changeTracker) {
this.showSnackbar({
duration: null,
Expand All @@ -77,7 +73,10 @@
actionCallback: () => changeTracker.revert(),
});

return this.deleteContentNodes([this.nodeId]).then(() => {
return this.deleteClipboardNode({
clipboardNodeId: this.nodeId,
ancestorId: this.ancestorId,
}).then(() => {
return this.showSnackbar({
text: this.$tr('removedFromClipboard'),
actionText: this.$tr('undo'),
Expand All @@ -94,8 +93,8 @@
});

return this.copy({
id: this.sourceId,
deep: this.isTopic,
node_id: this.node.node_id,
channel_id: this.node.channel_id,
}).then(() => {
return this.showSnackbar({
text: this.$tr('copiedItemsToClipboard'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<template v-slot:activator>
<ContentNode
:nodeId="nodeId"
:sourceId="sourceId"
:level="level"
>
<VListTileContent class="description-col py-2 pl-2 shrink">
<VBadge color="primary">
<template #badge>
<span class="caption font-weight-bold">{{ descendantCount }}</span>
<span class="caption font-weight-bold">{{ contentNode.resource_count }}</span>
</template>
<VListTileTitle class="text-truncate notranslate">
{{ contentNode.title }}
Expand All @@ -34,18 +34,20 @@
</template>

<transition-group>
<template v-for="child in treeChildren">
<template v-for="child in children">
<TopicNode
v-if="hasChildren(child.id)"
v-if="hasClipboardChildren(child.id)"
:key="child.id"
:nodeId="child.id"
:sourceId="child.source_id"
:level="level + 1"
:ancestorId="childAncestorId"
/>
<ContentNode
v-else
:key="child.id"
:nodeId="child.id"
:sourceId="child.source_id"
:level="level + 1"
:ancestorId="childAncestorId"
/>
</template>
</transition-group>
Expand All @@ -65,16 +67,28 @@
},
mixins: [clipboardMixin, parentMixin],
props: {
sourceId: {
ancestorId: {
type: String,
required: true,
default: null,
},
},
data() {
return {
open: false,
};
},
computed: {
childAncestorId() {
return this.isClipboardNode(this.nodeId) ? this.nodeId : this.ancestorId;
},
},
mounted() {
// Prefetch content node data. Since we're using `lazy` with the
// nested VListGroup, this prefetches one level at a time!
if (this.contentNode.total_count > 0) {
this.loadClipboardNodes({ parent: this.nodeId, ancestorId: this.childAncestorId });
}
},
};

</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
'getCopyTrees',
]),
selectedNodeIds() {
return this.selectedNodes.map(n => n.id);
return this.selectedNodes.map(([sid]) => sid);
},
canEdit() {
return !this.selectedChannels.find(channel => !channel.edit);
Expand All @@ -166,9 +166,8 @@
},
methods: {
...mapActions(['showSnackbar']),
...mapMutations('contentNode', { setMoveNodes: 'SET_MOVE_NODES' }),
...mapActions('clipboard', ['loadChannels', 'copy']),
...mapActions('contentNode', ['deleteContentNodes']),
...mapMutations('clipboard', { setCopyNodes: 'SET_CLIPBOARD_MOVE_NODES' }),
...mapActions('clipboard', ['loadChannels', 'copy', 'deleteClipboardNodes']),
refresh() {
if (this.refreshing) {
return;
Expand All @@ -181,14 +180,15 @@
this.elevated = this.$refs.nodeList.scrollTop > 0;
},
moveNodes() {
if (!this.selectedNodeIds.length) {
const trees = this.getCopyTrees(this.clipboardRootId);
if (!trees.length) {
return;
}

this.setMoveNodes(this.selectedNodes.map(n => n.source_id));
this.setCopyNodes(trees);
},
duplicateNodes: withChangeTracker(function(changeTracker) {
const trees = this.getCopyTrees(this.clipboardRootId);
const trees = this.getCopyTrees(this.clipboardRootId, this.clipboardRootId);

if (!trees.length) {
return Promise.resolve([]);
Expand All @@ -213,9 +213,9 @@
});
}),
removeNodes: withChangeTracker(function(changeTracker) {
const id__in = this.selectedNodeIds;
const selectionIds = this.selectedNodeIds;

if (!id__in.length) {
if (!selectionIds.length) {
return Promise.resolve([]);
}

Expand All @@ -226,7 +226,7 @@
actionCallback: () => changeTracker.revert(),
});

return this.deleteContentNodes(id__in).then(() => {
return this.deleteClipboardNodes(selectionIds).then(() => {
return this.showSnackbar({
text: this.$tr('removedFromClipboard'),
actionText: this.$tr('undo'),
Expand Down
Loading