Skip to content

Commit fb03183

Browse files
authored
Filter selectable nodes and update selection logic
1 parent fd9ecf6 commit fb03183

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

apps/files/src/components/FilesListTableHeader.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,29 @@ export default defineComponent({
150150
}
151151
},
152152
153+
selectableNodes(): Node[] {
154+
return this.nodes.filter((node: Node) => {
155+
const enc = node?.attributes?.['is-encrypted']
156+
return enc != 1
157+
})
158+
},
159+
153160
selectedNodes() {
154161
return this.selectionStore.selected
155162
},
156163
157164
isAllSelected() {
158-
return this.selectedNodes.length === this.nodes.length
165+
const total = this.selectableNodes.length
166+
return total > 0 && this.selectedNodes.length === total
159167
},
160168
161169
isNoneSelected() {
162170
return this.selectedNodes.length === 0
163171
},
164172
165173
isSomeSelected() {
166-
return !this.isAllSelected && !this.isNoneSelected
174+
const total = this.selectableNodes.length
175+
return this.selectedNodes.length > 0 && this.selectedNodes.length < total
167176
},
168177
},
169178
@@ -201,8 +210,8 @@ export default defineComponent({
201210
202211
onToggleAll(selected = true) {
203212
if (selected) {
204-
const selection = this.nodes.map(node => node.source).filter(Boolean) as FileSource[]
205-
logger.debug('Added all nodes to selection', { selection })
213+
const selection = this.selectableNodes.map(node => node.source).filter(Boolean) as FileSource[]
214+
logger.debug('Added all selectable nodes to selection', { selection })
206215
this.selectionStore.setLastIndex(null)
207216
this.selectionStore.set(selection)
208217
} else {

0 commit comments

Comments
 (0)