mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 23:59:02 +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[]) {
|
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.
|
// Rename the column in the persisted data.
|
||||||
for (const column of this.persistedData.columns || []) {
|
for (const column of this.persistedData.columns || []) {
|
||||||
if (column.value === oldValue) {
|
if (column.value === oldValue) {
|
||||||
column.value = newValue;
|
column.value = newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.viewStorage.store(this.persistedData);
|
await 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeColumn(column: string) {
|
async removeColumn(column: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user