merged tree utils into tree service

This commit is contained in:
zadam
2020-01-25 09:56:08 +01:00
parent 7a62d1636b
commit 3254b551d8
22 changed files with 168 additions and 188 deletions

View File

@@ -1,6 +1,6 @@
import linkService from '../services/link.js';
import noteDetailService from '../services/note_detail.js';
import treeUtils from '../services/tree_utils.js';
import treeService from '../services/tree.js';
import noteAutocompleteService from "../services/note_autocomplete.js";
import utils from "../services/utils.js";
@@ -23,7 +23,7 @@ export async function showDialog() {
$linkTitle.val('');
async function setDefaultLinkTitle(noteId) {
const noteTitle = await treeUtils.getNoteTitle(noteId);
const noteTitle = await treeService.getNoteTitle(noteId);
$linkTitle.val(noteTitle);
}
@@ -35,7 +35,7 @@ export async function showDialog() {
return false;
}
const noteId = treeUtils.getNoteIdFromNotePath(suggestion.path);
const noteId = treeService.getNoteIdFromNotePath(suggestion.path);
if (noteId) {
setDefaultLinkTitle(noteId);
@@ -43,7 +43,7 @@ export async function showDialog() {
});
$autoComplete.on('autocomplete:cursorchanged', function(event, suggestion, dataset) {
const noteId = treeUtils.getNoteIdFromNotePath(suggestion.path);
const noteId = treeService.getNoteIdFromNotePath(suggestion.path);
setDefaultLinkTitle(noteId);
});

View File

@@ -1,7 +1,7 @@
import noteDetailService from '../services/note_detail.js';
import server from '../services/server.js';
import toastService from "../services/toast.js";
import treeUtils from "../services/tree_utils.js";
import treeService from "../services/tree.js";
import attributeAutocompleteService from "../services/attribute_autocomplete.js";
import utils from "../services/utils.js";
import linkService from "../services/link.js";
@@ -66,7 +66,7 @@ function AttributesModel() {
for (const attr of ownedAttributes) {
attr.labelValue = attr.type === 'label' ? attr.value : '';
attr.relationValue = attr.type === 'relation' ? (await treeUtils.getNoteTitle(attr.value)) : '';
attr.relationValue = attr.type === 'relation' ? (await treeService.getNoteTitle(attr.value)) : '';
attr.selectedPath = attr.type === 'relation' ? attr.value : '';
attr.labelDefinition = (attr.type === 'label-definition' && attr.value) ? attr.value : {
labelType: "text",
@@ -151,7 +151,7 @@ function AttributesModel() {
attr.value = attr.labelValue;
}
else if (attr.type === 'relation') {
attr.value = treeUtils.getNoteIdFromNotePath(attr.selectedPath);
attr.value = treeService.getNoteIdFromNotePath(attr.selectedPath);
}
else if (attr.type === 'label-definition') {
attr.value = attr.labelDefinition;

View File

@@ -1,7 +1,7 @@
import treeService from '../services/tree.js';
import server from '../services/server.js';
import treeCache from "../services/tree_cache.js";
import treeUtils from "../services/tree_utils.js";
import treeService from "../services/tree.js";
import toastService from "../services/toast.js";
import utils from "../services/utils.js";
@@ -34,7 +34,7 @@ export async function showDialog(node) {
$treePrefixInput.val(branch.prefix);
const noteTitle = await treeUtils.getNoteTitle(node.data.noteId);
const noteTitle = await treeService.getNoteTitle(node.data.noteId);
$noteTitle.text(" - " + noteTitle);
}

View File

@@ -1,7 +1,7 @@
import noteAutocompleteService from "../services/note_autocomplete.js";
import utils from "../services/utils.js";
import cloningService from "../services/cloning.js";
import treeUtils from "../services/tree_utils.js";
import treeService from "../services/tree.js";
import toastService from "../services/toast.js";
import treeCache from "../services/tree_cache.js";
@@ -43,7 +43,7 @@ export async function showDialog(noteIds) {
}
async function cloneNotesTo(notePath) {
const targetNoteId = treeUtils.getNoteIdFromNotePath(notePath);
const targetNoteId = treeService.getNoteIdFromNotePath(notePath);
for (const cloneNoteId of clonedNoteIds) {
await cloningService.cloneNoteTo(cloneNoteId, targetNoteId, $clonePrefix.val());

View File

@@ -1,4 +1,4 @@
import treeUtils from "../services/tree_utils.js";
import treeService from "../services/tree.js";
import utils from "../services/utils.js";
import ws from "../services/ws.js";
import toastService from "../services/toast.js";
@@ -43,11 +43,11 @@ export async function showDialog(notePath, defaultType) {
$dialog.modal();
const {noteId, parentNoteId} = treeUtils.getNoteIdAndParentIdFromNotePath(notePath);
const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath);
branchId = await treeCache.getBranchId(parentNoteId, noteId);
const noteTitle = await treeUtils.getNoteTitle(noteId);
const noteTitle = await treeService.getNoteTitle(noteId);
$noteTitle.html(noteTitle);
}

View File

@@ -1,5 +1,5 @@
import utils from '../services/utils.js';
import treeUtils from "../services/tree_utils.js";
import treeService from "../services/tree.js";
import importService from "../services/import.js";
const $dialog = $("#import-dialog");
@@ -30,7 +30,7 @@ export async function showDialog(noteId) {
parentNoteId = noteId;
$noteTitle.text(await treeUtils.getNoteTitle(parentNoteId));
$noteTitle.text(await treeService.getNoteTitle(parentNoteId));
$dialog.modal();
}

View File

@@ -1,4 +1,4 @@
import treeUtils from '../services/tree_utils.js';
import treeService from '../services/tree.js';
import noteAutocompleteService from '../services/note_autocomplete.js';
import utils from "../services/utils.js";
@@ -29,7 +29,7 @@ $form.on('submit', () => {
$dialog.modal('hide');
if (callback) {
callback(treeUtils.getNoteIdFromNotePath(notePath));
callback(treeService.getNoteIdFromNotePath(notePath));
}
}
else {

View File

@@ -1,7 +1,7 @@
import noteAutocompleteService from "../services/note_autocomplete.js";
import utils from "../services/utils.js";
import cloningService from "../services/cloning.js";
import treeUtils from "../services/tree_utils.js";
import treeService from "../services/tree.js";
import toastService from "../services/toast.js";
import treeCache from "../services/tree_cache.js";
import treeChangesService from "../services/branches.js";