Skip to content

Commit

Permalink
fix review and update PR
Browse files Browse the repository at this point in the history
  • Loading branch information
hakermi committed Sep 19, 2024
1 parent e003b15 commit a4808de
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,18 @@ Page getNoteOfNoteBookByName(String noteType,
List<Page> getChildrenNoteOf(Page note, boolean withDrafts, boolean withChild) throws WikiException;

/**
* Check whether the page has children or not
* Check if the given page has children or not
*
* @param pageId target note id
* @return true if it has page and false if not
* @param pageId note page id
* @return true if the given page has children and false if not
*/
boolean hasChildren(long pageId);

/**
* Check if page has drafts
* Check if the given page has drafts or not
*
* @param pageId target note id
* @return true if page has drafts and false if not
* @param pageId note page id
* @return true if the given page has drafts and false if not
*/
boolean hasDrafts(long pageId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ public List<Page> getChildrenNoteOf(Page note, boolean withDrafts, boolean withC
if (withChild) {
for (Page page : pages) {
long pageId = Long.parseLong(page.getId());
page.setHasChild(dataStorage.hasChildren(pageId));
page.setHasChild(hasChildren(pageId));
}
}
return pages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public JsonNodeData(TreeNode treeNode,
this.isLastNode = isLastNode;
this.isSelectable = isSelectable;
this.excerpt = excerpt;
this.children = !this.hasChild ? null : TreeUtils.tranformToJson(treeNode, context);
this.children = TreeUtils.tranformToJson(treeNode, context);
this.isSelected = treeNode.isSelected();
this.isRestricted = treeNode.isRetricted;
if (this.children != null && !this.children.isEmpty()) {
Expand Down
10 changes: 10 additions & 0 deletions notes-webapp/src/main/webapp/skin/less/notes/notes.less
Original file line number Diff line number Diff line change
Expand Up @@ -1242,3 +1242,13 @@ ul.note-manual-child {
.remove-focus:focus::after {
opacity: 0 !important;
}

.notes-custom-treeview {
.v-treeview-node {
.v-treeview-node__root {
.v-treeview-node__toggle, .v-treeview-node__level:first-child {
display: none;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ export default {
}
}
};
</script>
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@
<template>
<v-list-item-action class="mr-3">
<v-icon
color="success"
size="18"
v-if="exportStatus.action.featuredImagesProcessed">
color="success"
size="18"
v-if="exportStatus.action.featuredImagesProcessed">
fa-check
</v-icon>
<v-progress-circular
v-if="!exportStatus.action.featuredImagesProcessed"
color="primary"
indeterminate
size="18" />
v-if="!exportStatus.action.featuredImagesProcessed"
color="primary"
indeterminate
size="18" />
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>{{ $t('notes.export.status.label.processingFeaturedImages') }}</v-list-item-title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,23 @@
<div v-else class="notes-application-content">
<v-treeview
v-if="noteChildren?.length"
:load-children="fetchChildren"
ref="noteTreeview"
:items="noteChildren"
dense
class="ps-1"
item-key="noteId">
class="ps-1 notes-custom-treeview"
item-key="noteId"
dense>
<template #prepend="{ item, open }">
<v-btn
@click="fetchChildren(item, $refs.noteTreeview)"
:loading="item.isLoading"
icon>
<v-icon
v-if="item.hasChild"
size="16">
{{ open ? 'fas fa-caret-down' : 'fas fa-caret-right' }}
</v-icon>
</v-btn>
</template>
<template #label="{ item }">
<note-content-table-item :note="item" />
</template>
Expand Down Expand Up @@ -418,11 +430,23 @@ export default {
vTreeComponent: {
template: `
<v-treeview
dense
ref="noteTreeview"
:items="noteChildItems"
:load-children="fetchChildren"
class="ps-1"
item-key="noteId">
class="ps-1 notes-custom-treeview"
item-key="noteId"
dense>
<template #prepend="{ item, open }">
<v-btn
@click="fetchChildren(item, $refs.noteTreeview)"
:loading="item.isLoading"
icon>
<v-icon
v-if="item.hasChild"
size="16">
{{ open ? 'fas fa-caret-down' : 'fas fa-caret-right' }}
</v-icon>
</v-btn>
</template>
<template #label="{ item }">
<note-content-table-item :note="item" />
</template>
Expand All @@ -446,8 +470,8 @@ export default {
});
},
methods: {
fetchChildren(note) {
return this.$root.$children[0].fetchChildren(note);
fetchChildren(item, treeview) {
return this.$root.$children[0].fetchChildren(item, treeview);
},
getNoteLanguages(noteId) {
return this.$root.$children[0].getNoteLanguages(noteId);
Expand Down Expand Up @@ -938,9 +962,18 @@ export default {
}
this.closeMobileActionMenu();
},
fetchChildren(note) {
return this.$notesService.getNoteTreeLevel(note.path, this.selectedTranslation?.value).then(data => {
note.children = data?.jsonList;
fetchChildren(item, treeview) {
if (item.isOpen) {
treeview.updateOpen(item.noteId, false);
item.isOpen = false;
return;
}
item.isLoading = true;
return this.$notesService.getNoteTreeLevel(item.path, this.selectedTranslation?.value).then(data => {
item.children = data?.jsonList;
item.isLoading = false;
treeview.updateOpen(item.noteId, true);
item.isOpen = true;
});
},
retrieveNoteTreeById() {
Expand Down

0 comments on commit a4808de

Please sign in to comment.