mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
rename loadresults methods/properties for clarity that they don't contain entities, only rows
This commit is contained in:
parent
57702a07a2
commit
e6bf6424e8
@ -22,4 +22,4 @@ CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdite
|
|||||||
CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`);
|
CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`);
|
||||||
CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`);
|
CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`);
|
||||||
|
|
||||||
UPDATE entity_changes SET entity_name = 'revisions' WHERE entity_name = 'note_revisions';
|
UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions';
|
||||||
|
1
package-lock.json
generated
1
package-lock.json
generated
@ -5,7 +5,6 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "trilium",
|
|
||||||
"version": "0.60.1-beta",
|
"version": "0.60.1-beta",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
@ -241,7 +241,7 @@ class NoteContext extends Component {
|
|||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.isNoteReloaded(this.noteId)) {
|
if (loadResults.isNoteReloaded(this.noteId)) {
|
||||||
const note = loadResults.getEntity('notes', this.noteId);
|
const note = loadResults.getEntityRow('notes', this.noteId);
|
||||||
|
|
||||||
if (note.isDeleted) {
|
if (note.isDeleted) {
|
||||||
this.noteId = null;
|
this.noteId = null;
|
||||||
|
@ -27,7 +27,7 @@ export default class ShortcutComponent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
for (const attr of loadResults.getAttributes()) {
|
for (const attr of loadResults.getAttributeRows()) {
|
||||||
if (attr.type === 'label' && attr.name === 'keyboardShortcut') {
|
if (attr.type === 'label' && attr.name === 'keyboardShortcut') {
|
||||||
const note = await froca.getNote(attr.noteId);
|
const note = await froca.getNote(attr.noteId);
|
||||||
// launcher shortcuts are handled specifically
|
// launcher shortcuts are handled specifically
|
||||||
|
@ -262,7 +262,7 @@ function processAttachment(loadResults, ec) {
|
|||||||
note.attachments = note.attachments.filter(att => att.attachmentId !== attachment.attachmentId);
|
note.attachments = note.attachments.filter(att => att.attachmentId !== attachment.attachmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadResults.addAttachment(ec.entity);
|
loadResults.addAttachmentRow(ec.entity);
|
||||||
|
|
||||||
delete froca.attachments[ec.entityId];
|
delete froca.attachments[ec.entityId];
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ function processAttachment(loadResults, ec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadResults.addAttachment(ec.entity);
|
loadResults.addAttachmentRow(ec.entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -12,22 +12,22 @@ export default class LoadResults {
|
|||||||
this.noteIdToComponentId = {};
|
this.noteIdToComponentId = {};
|
||||||
this.componentIdToNoteIds = {};
|
this.componentIdToNoteIds = {};
|
||||||
|
|
||||||
this.branches = [];
|
this.branchRows = [];
|
||||||
|
|
||||||
this.attributes = [];
|
this.attributeRows = [];
|
||||||
|
|
||||||
this.noteReorderings = [];
|
this.noteReorderings = [];
|
||||||
|
|
||||||
this.revisions = [];
|
this.revisionRows = [];
|
||||||
|
|
||||||
this.contentNoteIdToComponentId = [];
|
this.contentNoteIdToComponentId = [];
|
||||||
|
|
||||||
this.options = [];
|
this.optionNames = [];
|
||||||
|
|
||||||
this.attachments = [];
|
this.attachmentRows = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
getEntity(entityName, entityId) {
|
getEntityRow(entityName, entityId) {
|
||||||
return this.entities[entityName]?.[entityId];
|
return this.entities[entityName]?.[entityId];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,12 +46,12 @@ export default class LoadResults {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addBranch(branchId, componentId) {
|
addBranch(branchId, componentId) {
|
||||||
this.branches.push({branchId, componentId});
|
this.branchRows.push({branchId, componentId});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBranches() {
|
getBranchRows() {
|
||||||
return this.branches
|
return this.branchRows
|
||||||
.map(row => this.getEntity("branches", row.branchId))
|
.map(row => this.getEntityRow("branches", row.branchId))
|
||||||
.filter(branch => !!branch);
|
.filter(branch => !!branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,23 +64,23 @@ export default class LoadResults {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addAttribute(attributeId, componentId) {
|
addAttribute(attributeId, componentId) {
|
||||||
this.attributes.push({attributeId, componentId});
|
this.attributeRows.push({attributeId, componentId});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {FAttribute[]} */
|
/** @returns {FAttribute[]} */
|
||||||
getAttributes(componentId = 'none') {
|
getAttributeRows(componentId = 'none') {
|
||||||
return this.attributes
|
return this.attributeRows
|
||||||
.filter(row => row.componentId !== componentId)
|
.filter(row => row.componentId !== componentId)
|
||||||
.map(row => this.getEntity("attributes", row.attributeId))
|
.map(row => this.getEntityRow("attributes", row.attributeId))
|
||||||
.filter(attr => !!attr);
|
.filter(attr => !!attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
addRevision(revisionId, noteId, componentId) {
|
addRevision(revisionId, noteId, componentId) {
|
||||||
this.revisions.push({revisionId, noteId, componentId});
|
this.revisionRows.push({revisionId, noteId, componentId});
|
||||||
}
|
}
|
||||||
|
|
||||||
hasRevisionForNote(noteId) {
|
hasRevisionForNote(noteId) {
|
||||||
return !!this.revisions.find(nr => nr.noteId === noteId);
|
return !!this.revisionRows.find(row => row.noteId === noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
getNoteIds() {
|
getNoteIds() {
|
||||||
@ -111,19 +111,19 @@ export default class LoadResults {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addOption(name) {
|
addOption(name) {
|
||||||
this.options.push(name);
|
this.optionNames.push(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
isOptionReloaded(name) {
|
isOptionReloaded(name) {
|
||||||
return this.options.includes(name);
|
return this.optionNames.includes(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
addAttachment(attachment) {
|
addAttachmentRow(attachment) {
|
||||||
this.attachments.push(attachment);
|
this.attachmentRows.push(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttachments() {
|
getAttachmentRows() {
|
||||||
return this.attachments;
|
return this.attachmentRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,25 +131,25 @@ export default class LoadResults {
|
|||||||
* notably changes in note itself should not have any effect on attributes
|
* notably changes in note itself should not have any effect on attributes
|
||||||
*/
|
*/
|
||||||
hasAttributeRelatedChanges() {
|
hasAttributeRelatedChanges() {
|
||||||
return this.branches.length > 0
|
return this.branchRows.length > 0
|
||||||
|| this.attributes.length > 0;
|
|| this.attributeRows.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty() {
|
isEmpty() {
|
||||||
return Object.keys(this.noteIdToComponentId).length === 0
|
return Object.keys(this.noteIdToComponentId).length === 0
|
||||||
&& this.branches.length === 0
|
&& this.branchRows.length === 0
|
||||||
&& this.attributes.length === 0
|
&& this.attributeRows.length === 0
|
||||||
&& this.noteReorderings.length === 0
|
&& this.noteReorderings.length === 0
|
||||||
&& this.revisions.length === 0
|
&& this.revisionRows.length === 0
|
||||||
&& this.contentNoteIdToComponentId.length === 0
|
&& this.contentNoteIdToComponentId.length === 0
|
||||||
&& this.options.length === 0
|
&& this.optionNames.length === 0
|
||||||
&& this.attachments.length === 0;
|
&& this.attachmentRows.length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmptyForTree() {
|
isEmptyForTree() {
|
||||||
return Object.keys(this.noteIdToComponentId).length === 0
|
return Object.keys(this.noteIdToComponentId).length === 0
|
||||||
&& this.branches.length === 0
|
&& this.branchRows.length === 0
|
||||||
&& this.attributes.length === 0
|
&& this.attributeRows.length === 0
|
||||||
&& this.noteReorderings.length === 0;
|
&& this.noteReorderings.length === 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
import AttachmentActionsWidget from "./buttons/attachments_actions.js";
|
import AttachmentActionsWidget from "./buttons/attachments_actions.js";
|
||||||
import BasicWidget from "./basic_widget.js";
|
import BasicWidget from "./basic_widget.js";
|
||||||
import server from "../services/server.js";
|
|
||||||
import options from "../services/options.js";
|
import options from "../services/options.js";
|
||||||
import imageService from "../services/image.js";
|
import imageService from "../services/image.js";
|
||||||
import linkService from "../services/link.js";
|
import linkService from "../services/link.js";
|
||||||
@ -192,7 +191,7 @@ export default class AttachmentDetailWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
const attachmentChange = loadResults.getAttachments().find(att => att.attachmentId === this.attachment.attachmentId);
|
const attachmentChange = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachment.attachmentId);
|
||||||
|
|
||||||
if (attachmentChange) {
|
if (attachmentChange) {
|
||||||
if (attachmentChange.isDeleted) {
|
if (attachmentChange.isDeleted) {
|
||||||
|
@ -520,7 +520,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,11 @@ export default class BookmarkButtons extends FlexContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getBranches().find(branch => branch.parentNoteId === '_lbBookmarks')) {
|
if (loadResults.getBranchRows().find(branch => branch.parentNoteId === '_lbBookmarks')) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadResults.getAttributes().find(attr => attr.type === 'label'
|
if (loadResults.getAttributeRows().find(attr => attr.type === 'label'
|
||||||
&& ['iconClass', 'workspaceIconClass', 'bookmarkFolder'].includes(attr.name)
|
&& ['iconClass', 'workspaceIconClass', 'bookmarkFolder'].includes(attr.name)
|
||||||
&& this.noteIds.includes(attr.noteId))
|
&& this.noteIds.includes(attr.noteId))
|
||||||
) {
|
) {
|
||||||
|
@ -35,7 +35,7 @@ export default class BookmarkSwitchWidget extends SwitchWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getBranches().find(b => b.noteId === this.noteId)) {
|
if (loadResults.getBranchRows().find(b => b.noteId === this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ export default class ButtonFromNoteWidget extends CommandButtonWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadResults.getAttributes(this.componentId).find(attr =>
|
if (loadResults.getAttributeRows(this.componentId).find(attr =>
|
||||||
attr.type === 'label'
|
attr.type === 'label'
|
||||||
&& attr.name === 'iconClass'
|
&& attr.name === 'iconClass'
|
||||||
&& attributeService.isAffecting(attr, buttonNote))) {
|
&& attributeService.isAffecting(attr, buttonNote))) {
|
||||||
|
@ -53,7 +53,7 @@ export default class EditButton extends OnClickButtonWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(
|
if (loadResults.getAttributeRows().find(
|
||||||
attr => attr.type === 'label'
|
attr => attr.type === 'label'
|
||||||
&& attr.name.toLowerCase().includes("readonly")
|
&& attr.name.toLowerCase().includes("readonly")
|
||||||
&& attributeService.isAffecting(attr, this.note)
|
&& attributeService.isAffecting(attr, this.note)
|
||||||
|
@ -31,7 +31,7 @@ export default class AbstractLauncher extends OnClickButtonWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
for (const attr of loadResults.getAttributes()) {
|
for (const attr of loadResults.getAttributeRows()) {
|
||||||
if (attr.noteId === this.launcherNote.noteId && attr.type === 'label' && attr.name === 'keyboardShortcut') {
|
if (attr.noteId === this.launcherNote.noteId && attr.type === 'label' && attr.name === 'keyboardShortcut') {
|
||||||
this.bindNoteShortcutHandler(attr);
|
this.bindNoteShortcutHandler(attr);
|
||||||
} else if (attr.type === 'label' && attr.name === 'iconClass' && attributesService.isAffecting(attr, this.launcherNote)) {
|
} else if (attr.type === 'label' && attr.name === 'iconClass' && attributesService.isAffecting(attr, this.launcherNote)) {
|
||||||
|
@ -66,7 +66,7 @@ export default class LauncherContainer extends FlexContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getBranches().find(branch => froca.getNoteFromCache(branch.parentNoteId)?.isLaunchBarConfig())) {
|
if (loadResults.getBranchRows().find(branch => froca.getNoteFromCache(branch.parentNoteId)?.isLaunchBarConfig())) {
|
||||||
// changes in note placement requires reload of all launchers, all other changes are handled by individual
|
// changes in note placement requires reload of all launchers, all other changes are handled by individual
|
||||||
// launchers
|
// launchers
|
||||||
this.load();
|
this.load();
|
||||||
|
@ -346,7 +346,7 @@ export default class RibbonContainer extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
else if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
else if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
||||||
this.refreshWithNote(this.note, true);
|
this.refreshWithNote(this.note, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ export default class BulkActionsDialog extends BasicWidget {
|
|||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
// only refreshing deleted attrs, otherwise components update themselves
|
// only refreshing deleted attrs, otherwise components update themselves
|
||||||
if (loadResults.getAttributes().find(attr =>
|
if (loadResults.getAttributeRows().find(attr =>
|
||||||
attr.type === 'label'
|
attr.type === 'label'
|
||||||
&& attr.name === 'action'
|
&& attr.name === 'action'
|
||||||
&& attr.noteId === '_bulkAction'
|
&& attr.noteId === '_bulkAction'
|
||||||
|
@ -85,7 +85,7 @@ export default class EditabilitySelectWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId)) {
|
if (loadResults.getAttributeRows().find(attr => attr.noteId === this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ export default class HighlightsListWidget extends RightPanelWidget {
|
|||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.isNoteContentReloaded(this.noteId)) {
|
if (loadResults.isNoteContentReloaded(this.noteId)) {
|
||||||
await this.refresh();
|
await this.refresh();
|
||||||
} else if (loadResults.getAttributes().find(attr => attr.type === 'label'
|
} else if (loadResults.getAttributeRows().find(attr => attr.type === 'label'
|
||||||
&& (attr.name.toLowerCase().includes('readonly') || attr.name === 'hideHighlightWidget')
|
&& (attr.name.toLowerCase().includes('readonly') || attr.name === 'hideHighlightWidget')
|
||||||
&& attributeService.isAffecting(attr, this.note))) {
|
&& attributeService.isAffecting(attr, this.note))) {
|
||||||
await this.refresh();
|
await this.refresh();
|
||||||
|
@ -312,7 +312,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
|
|||||||
this.triggerEvent('noteTypeMimeChanged', {noteId: this.noteId});
|
this.triggerEvent('noteTypeMimeChanged', {noteId: this.noteId});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const attrs = loadResults.getAttributes();
|
const attrs = loadResults.getAttributeRows();
|
||||||
|
|
||||||
const label = attrs.find(attr =>
|
const label = attrs.find(attr =>
|
||||||
attr.type === 'label'
|
attr.type === 'label'
|
||||||
|
@ -129,7 +129,7 @@ export default class NoteIconWidget extends NoteContextAwareWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const attr of loadResults.getAttributes()) {
|
for (const attr of loadResults.getAttributeRows()) {
|
||||||
if (attr.type === 'label'
|
if (attr.type === 'label'
|
||||||
&& ['iconClass', 'workspaceIconClass'].includes(attr.name)
|
&& ['iconClass', 'workspaceIconClass'].includes(attr.name)
|
||||||
&& attributeService.isAffecting(attr, this.note)) {
|
&& attributeService.isAffecting(attr, this.note)) {
|
||||||
|
@ -93,7 +93,7 @@ export default class NoteListWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId && ['viewType', 'expanded', 'pageSize'].includes(attr.name))) {
|
if (loadResults.getAttributeRows().find(attr => attr.noteId === this.noteId && ['viewType', 'expanded', 'pageSize'].includes(attr.name))) {
|
||||||
this.shownNoteId = null; // force render
|
this.shownNoteId = null; // force render
|
||||||
|
|
||||||
this.checkRenderStatus();
|
this.checkRenderStatus();
|
||||||
|
@ -429,7 +429,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes(this.componentId).find(
|
if (loadResults.getAttributeRows(this.componentId).find(
|
||||||
attr =>
|
attr =>
|
||||||
attr.type === 'label'
|
attr.type === 'label'
|
||||||
&& ['mapType', 'mapRootNoteId'].includes(attr.name)
|
&& ['mapType', 'mapRootNoteId'].includes(attr.name)
|
||||||
|
@ -1082,7 +1082,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
const noteIdsToUpdate = new Set();
|
const noteIdsToUpdate = new Set();
|
||||||
const noteIdsToReload = new Set();
|
const noteIdsToReload = new Set();
|
||||||
|
|
||||||
for (const ecAttr of loadResults.getAttributes()) {
|
for (const ecAttr of loadResults.getAttributeRows()) {
|
||||||
const dirtyingLabels = ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'color'];
|
const dirtyingLabels = ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'color'];
|
||||||
|
|
||||||
if (ecAttr.type === 'label' && dirtyingLabels.includes(ecAttr.name)) {
|
if (ecAttr.type === 'label' && dirtyingLabels.includes(ecAttr.name)) {
|
||||||
@ -1124,10 +1124,10 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
let movedActiveNode = null;
|
let movedActiveNode = null;
|
||||||
let parentsOfAddedNodes = [];
|
let parentsOfAddedNodes = [];
|
||||||
|
|
||||||
const allBranches = loadResults.getBranches();
|
const allBranchRows = loadResults.getBranchRows();
|
||||||
const allBranchesDeleted = allBranches.every(branch => !!branch.isDeleted);
|
const allBranchesDeleted = allBranchRows.every(branch => !!branch.isDeleted);
|
||||||
|
|
||||||
for (const ecBranch of allBranches) {
|
for (const ecBranch of allBranchRows) {
|
||||||
if (ecBranch.parentNoteId === '_share') {
|
if (ecBranch.parentNoteId === '_share') {
|
||||||
// all shared notes have a sign in the tree, even the descendants of shared notes
|
// all shared notes have a sign in the tree, even the descendants of shared notes
|
||||||
noteIdsToReload.add(ecBranch.noteId);
|
noteIdsToReload.add(ecBranch.noteId);
|
||||||
|
@ -60,7 +60,7 @@ export default class NoteWrapperWidget extends FlexContainer {
|
|||||||
|
|
||||||
const noteId = this.noteContext?.noteId;
|
const noteId = this.noteContext?.noteId;
|
||||||
if (loadResults.isNoteReloaded(noteId)
|
if (loadResults.isNoteReloaded(noteId)
|
||||||
|| loadResults.getAttributes().find(attr => attr.type === 'label' && attr.name === 'cssClass' && attributeService.isAffecting(attr, this.noteContext?.note))) {
|
|| loadResults.getAttributeRows().find(attr => attr.type === 'label' && attr.name === 'cssClass' && attributeService.isAffecting(attr, this.noteContext?.note))) {
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId && attr.name === 'viewType')) {
|
if (loadResults.getAttributeRows().find(attr => attr.noteId === this.noteId && attr.name === 'viewType')) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ export default class NotePathsWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getBranches().find(branch => branch.noteId === this.noteId)
|
if (loadResults.getBranchRows().find(branch => branch.noteId === this.noteId)
|
||||||
|| loadResults.isNoteReloaded(this.noteId)) {
|
|| loadResults.isNoteReloaded(this.noteId)) {
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
@ -318,7 +318,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
// only refreshing deleted attrs, otherwise components update themselves
|
// only refreshing deleted attrs, otherwise components update themselves
|
||||||
if (loadResults.getAttributes().find(attr => attr.type === 'label' && attr.name === 'action' && attr.isDeleted)) {
|
if (loadResults.getAttributeRows().find(attr => attr.type === 'label' && attr.name === 'action' && attr.isDeleted)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,10 @@ export default class SharedInfoWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.name.startsWith('_share') && attributeService.isAffecting(attr, this.note))) {
|
if (loadResults.getAttributeRows().find(attr => attr.name.startsWith('_share') && attributeService.isAffecting(attr, this.note))) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
else if (loadResults.getBranches().find(branch => branch.noteId === this.noteId)) {
|
else if (loadResults.getBranchRows().find(branch => branch.noteId === this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ export default class SharedSwitchWidget extends SwitchWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getBranches().find(b => b.noteId === this.noteId)) {
|
if (loadResults.getBranchRows().find(b => b.noteId === this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -681,7 +681,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (loadResults.isNoteReloaded(noteContext.noteId) ||
|
if (loadResults.isNoteReloaded(noteContext.noteId) ||
|
||||||
loadResults.getAttributes().find(attr =>
|
loadResults.getAttributeRows().find(attr =>
|
||||||
['workspace', 'workspaceIconClass', 'workspaceTabBackgroundColor'].includes(attr.name)
|
['workspace', 'workspaceIconClass', 'workspaceTabBackgroundColor'].includes(attr.name)
|
||||||
&& attributeService.isAffecting(attr, noteContext.note))
|
&& attributeService.isAffecting(attr, noteContext.note))
|
||||||
) {
|
) {
|
||||||
|
@ -226,7 +226,7 @@ export default class TocWidget extends RightPanelWidget {
|
|||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.isNoteContentReloaded(this.noteId)) {
|
if (loadResults.isNoteContentReloaded(this.noteId)) {
|
||||||
await this.refresh();
|
await this.refresh();
|
||||||
} else if (loadResults.getAttributes().find(attr => attr.type === 'label'
|
} else if (loadResults.getAttributeRows().find(attr => attr.type === 'label'
|
||||||
&& (attr.name.toLowerCase().includes('readonly') || attr.name === 'toc')
|
&& (attr.name.toLowerCase().includes('readonly') || attr.name === 'toc')
|
||||||
&& attributeService.isAffecting(attr, this.note))) {
|
&& attributeService.isAffecting(attr, this.note))) {
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ export default class AttachmentDetailTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
const attachmentChange = loadResults.getAttachments().find(att => att.attachmentId === this.attachmentId);
|
const attachmentChange = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachmentId);
|
||||||
|
|
||||||
if (attachmentChange?.isDeleted) {
|
if (attachmentChange?.isDeleted) {
|
||||||
this.refresh(); // all other updates are handled within AttachmentDetailWidget
|
this.refresh(); // all other updates are handled within AttachmentDetailWidget
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import TypeWidget from "./type_widget.js";
|
import TypeWidget from "./type_widget.js";
|
||||||
import server from "../../services/server.js";
|
|
||||||
import AttachmentDetailWidget from "../attachment_detail.js";
|
import AttachmentDetailWidget from "../attachment_detail.js";
|
||||||
import linkService from "../../services/link.js";
|
import linkService from "../../services/link.js";
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ export default class AttachmentListTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
// updates and deletions are handled by the detail, for new attachments the whole list has to be refreshed
|
// updates and deletions are handled by the detail, for new attachments the whole list has to be refreshed
|
||||||
const attachmentsAdded = loadResults.getAttachments()
|
const attachmentsAdded = loadResults.getAttachmentRows()
|
||||||
.some(att => !this.renderedAttachmentIds.has(att.attachmentId));
|
.some(att => !this.renderedAttachmentIds.has(att.attachmentId));
|
||||||
|
|
||||||
if (attachmentsAdded) {
|
if (attachmentsAdded) {
|
||||||
|
@ -66,7 +66,7 @@ export default class WebViewTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
if (loadResults.getAttributes().find(attr => attr.name === 'webViewSrc' && attributeService.isAffecting(attr, this.noteContext.note))) {
|
if (loadResults.getAttributeRows().find(attr => attr.name === 'webViewSrc' && attributeService.isAffecting(attr, this.noteContext.note))) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user