Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<Checkbox
ref="checkbox"
class="ma-0 pa-0"
:value="selected"
:inputValue="selected"
:indeterminate="indeterminate"
@click.stop.prevent="goNextSelectionState"
@input="goNextSelectionState"
/>
</VListTileAction>
<div class="mr-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
class="mt-0 pt-0"
:inputValue="selected"
:indeterminate="indeterminate"
@click.stop.prevent="goNextSelectionState"
@input="goNextSelectionState"
/>
</VListTileAction>
<div
Expand All @@ -55,7 +55,7 @@
</VListTileContent>
<VListTileAction style="min-width: unset;" class="pl-3 pr-1">
<div class="badge caption font-weight-bold">
{{ contentNode.resource_count }}
{{ contentNodeResourceCount }}
</div>
</VListTileAction>
<!-- Custom placement of dropdown indicator -->
Expand Down Expand Up @@ -117,7 +117,7 @@
</template>
<script>

import { mapActions, mapGetters } from 'vuex';
import { mapActions, mapGetters, mapState } from 'vuex';
import clipboardMixin, { parentMixin } from './mixins';
import ContentNodeOptions from './ContentNodeOptions';
import Checkbox from 'shared/views/form/Checkbox';
Expand Down Expand Up @@ -150,6 +150,7 @@
};
},
computed: {
...mapState('clipboard', ['clipboardNodesMap']),
...mapGetters('clipboard', ['isPreloading', 'isLoaded']),
thumbnailAttrs() {
if (this.contentNode) {
Expand Down Expand Up @@ -181,6 +182,10 @@
const contentNode = this.contentNode || {};
return { ...contentNode, clipboardNodeId: this.nodeId };
},
contentNodeResourceCount() {
return Object.values(this.clipboardNodesMap).filter(node => node.parent === this.nodeId)
.length;
},
},
watch: {
open(open) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
</VListTile>
<VListTile v-if="allowMove" @click.stop="calculateMoveNodes">
<VListTileTitle>{{ $tr('moveTo') }}</VListTileTitle>
<MoveModal v-if="moveModalOpen" ref="moveModal" v-model="moveModalOpen" @target="moveNodes" />
<MoveModal
v-if="moveModalOpen"
ref="moveModal"
v-model="moveModalOpen"
:clipboardTopicResourceCount="topicAndResourceCount"
@target="moveNodes"
/>
</VListTile>
<VListTile @click="removeNode()">
<VListTileTitle>{{ $tr('remove') }}</VListTileTitle>
Expand All @@ -20,7 +26,7 @@

<script>

import { mapActions, mapGetters } from 'vuex';
import { mapActions, mapGetters, mapState } from 'vuex';
import { RouteNames } from '../../constants';
import MoveModal from '../move/MoveModal';
import clipboardMixin from './mixins';
Expand All @@ -40,6 +46,7 @@
};
},
computed: {
...mapState('clipboard', ['clipboardNodesMap']),
...mapGetters('clipboard', ['getMoveTrees', 'isLegacyNode']),
isLegacy() {
return this.isLegacyNode(this.nodeId);
Expand All @@ -60,6 +67,19 @@
});
return `${channelURI}${sourceNode.href}`;
},
topicAndResourceCount() {
let topicCount = 0;
let resourceCount = 0;
if (this.contentNode.kind === 'topic') {
topicCount = 1;
resourceCount = Object.values(this.clipboardNodesMap).filter(
node => node.parent === this.nodeId
).length;
} else {
resourceCount = 1;
}
return { topicCount: topicCount, resourceCount: resourceCount };
},
},
methods: {
...mapActions(['showSnackbar']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
<Checkbox
ref="checkbox"
class="ma-0 pa-0"
:value="selected"
:inputValue="selected"
:label="selectionState ? '' : $tr('selectAll')"
:indeterminate="indeterminate"
@click.stop.prevent="goNextSelectionState"
@input="goNextSelectionState"
/>
</VListTileAction>
</VSlideXTransition>
Expand Down Expand Up @@ -71,6 +71,8 @@
v-if="allowMove && moveModalOpen"
ref="moveModal"
v-model="moveModalOpen"
:moveNodeIds="selectedNodeIds"
:clipboardTopicResourceCount="topicAndResourceCount"
@target="moveNodes"
/>
<IconButton
Expand Down Expand Up @@ -199,7 +201,7 @@
},
computed: {
...mapGetters(['clipboardRootId']),
...mapState('clipboard', ['initializing']),
...mapState('clipboard', ['initializing', 'clipboardNodesMap']),
...mapGetters('clipboard', [
'channels',
'selectedNodeIds',
Expand Down Expand Up @@ -243,6 +245,21 @@
? DropEffect.COPY
: DropEffect.NONE;
},
topicAndResourceCount() {
let topicCount = 0;
let resourceCount = 0;
this.selectedNodeIds.forEach(id => {
const kind = this.clipboardNodesMap[id]?.kind;
if (kind === 'topic' || !kind) {
// Increment topicCount if kind is "topic" or not set
topicCount++;
} else {
// Increment resourceCount for any other kind
resourceCount++;
}
});
return { topicCount: topicCount, resourceCount: resourceCount };
},
},
watch: {
open(open) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@
type: Boolean,
default: false,
},
clipboardTopicResourceCount: {
type: Object,
default: () => ({}),
},
},
data() {
return {
Expand Down Expand Up @@ -200,7 +204,10 @@
},
},
moveHeader() {
return this.$tr('moveItems', this.getTopicAndResourceCounts(this.moveNodeIds));
const resourceCounts = Object.keys(this.clipboardTopicResourceCount).length
? this.clipboardTopicResourceCount
: this.getTopicAndResourceCounts(this.moveNodeIds);
return this.$tr('moveItems', resourceCounts);
},
moveHereButtonDisabled() {
if (this.moveNodesInProgress) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
},
},
methods: {
handleChange(checked) {
handleChange(checked, e) {
e.stopPropagation();
this.isChecked = checked;
},
updateInputValue(newValue) {
Expand All @@ -146,4 +147,4 @@
color: var(--v-text);
}

</style>
</style>