mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
refactor(views/board): use bulk API for renaming columns
This commit is contained in:
parent
2b5029cc38
commit
b22e08b1eb
@ -55,18 +55,22 @@ export default class BoardApi {
|
||||
}
|
||||
|
||||
async renameColumn(oldValue: string, newValue: string, noteIds: string[]) {
|
||||
// Change the value in the notes.
|
||||
await executeBulkActions(noteIds, [
|
||||
{
|
||||
name: "updateLabelValue",
|
||||
labelName: "status",
|
||||
labelValue: newValue
|
||||
}
|
||||
]);
|
||||
|
||||
// Rename the column in the persisted data.
|
||||
for (const column of this.persistedData.columns || []) {
|
||||
if (column.value === oldValue) {
|
||||
column.value = newValue;
|
||||
}
|
||||
}
|
||||
this.viewStorage.store(this.persistedData);
|
||||
|
||||
// Update all notes that have the old status value to the new value
|
||||
for (const noteId of noteIds) {
|
||||
await attributes.setLabel(noteId, "status", newValue);
|
||||
}
|
||||
await this.viewStorage.store(this.persistedData);
|
||||
}
|
||||
|
||||
async removeColumn(column: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user