提交 b5211602 编写于 作者: J Johannes Rieken

sort by category only once, #91900

上级 9ce4ebbf
......@@ -260,6 +260,17 @@ export class BulkFileOperations {
}
}
// sort (once) categories atop which have unconfirmed edits
this.categories.sort((a, b) => {
if (a.metadata.needsConfirmation === b.metadata.needsConfirmation) {
return a.metadata.label.localeCompare(b.metadata.label);
} else if (a.metadata.needsConfirmation) {
return -1;
} else {
return 1;
}
});
return this;
}
......
......@@ -259,19 +259,6 @@ export class BulkEditDataSource implements IAsyncDataSource<BulkFileOperations,
export class BulkEditSorter implements ITreeSorter<BulkEditElement> {
compare(a: BulkEditElement, b: BulkEditElement): number {
if (a instanceof CategoryElement && b instanceof CategoryElement) {
//
const aConfirm = BulkEditSorter._needsConfirmation(a.category);
const bConfirm = BulkEditSorter._needsConfirmation(b.category);
if (aConfirm === bConfirm) {
return a.category.metadata.label.localeCompare(b.category.metadata.label);
} else if (aConfirm) {
return -1;
} else {
return 1;
}
}
if (a instanceof FileElement && b instanceof FileElement) {
return compare(a.edit.uri.toString(), b.edit.uri.toString());
}
......@@ -282,10 +269,6 @@ export class BulkEditSorter implements ITreeSorter<BulkEditElement> {
return 0;
}
private static _needsConfirmation(a: BulkCategory): boolean {
return Iterable.some(a.fileOperations, ops => ops.needsConfirmation());
}
}
// --- ACCESSI
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册