mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 17:55:52 +01:00
chore(views/board): delete values when deleting column
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import appContext from "../../../components/app_context";
|
||||
import FNote from "../../../entities/fnote";
|
||||
import attributes from "../../../services/attributes";
|
||||
import bulk_action, { executeBulkActions } from "../../../services/bulk_action";
|
||||
import note_create from "../../../services/note_create";
|
||||
import ViewModeStorage from "../view_mode_storage";
|
||||
import { BoardData } from "./config";
|
||||
@@ -69,6 +70,15 @@ export default class BoardApi {
|
||||
}
|
||||
|
||||
async removeColumn(column: string) {
|
||||
// Remove the value from the notes.
|
||||
const noteIds = this.byColumn.get(column)?.map(item => item.note.noteId) || [];
|
||||
await executeBulkActions(noteIds, [
|
||||
{
|
||||
name: "deleteLabel",
|
||||
labelName: "status"
|
||||
}
|
||||
]);
|
||||
|
||||
this.persistedData.columns = (this.persistedData.columns ?? []).filter(col => col.value !== column);
|
||||
this.viewStorage.store(this.persistedData);
|
||||
}
|
||||
|
||||
@@ -2,30 +2,30 @@ import { executeBulkActions } from "../../../services/bulk_action.js";
|
||||
|
||||
export async function renameColumn(parentNoteId: string, type: "label" | "relation", originalName: string, newName: string) {
|
||||
if (type === "label") {
|
||||
return executeBulkActions(parentNoteId, [{
|
||||
return executeBulkActions([parentNoteId], [{
|
||||
name: "renameLabel",
|
||||
oldLabelName: originalName,
|
||||
newLabelName: newName
|
||||
}]);
|
||||
}], true);
|
||||
} else {
|
||||
return executeBulkActions(parentNoteId, [{
|
||||
return executeBulkActions([parentNoteId], [{
|
||||
name: "renameRelation",
|
||||
oldRelationName: originalName,
|
||||
newRelationName: newName
|
||||
}]);
|
||||
}], true);
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteColumn(parentNoteId: string, type: "label" | "relation", columnName: string) {
|
||||
if (type === "label") {
|
||||
return executeBulkActions(parentNoteId, [{
|
||||
return executeBulkActions([parentNoteId], [{
|
||||
name: "deleteLabel",
|
||||
labelName: columnName
|
||||
}]);
|
||||
}], true);
|
||||
} else {
|
||||
return executeBulkActions(parentNoteId, [{
|
||||
return executeBulkActions([parentNoteId], [{
|
||||
name: "deleteRelation",
|
||||
relationName: columnName
|
||||
}]);
|
||||
}], true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user