renamed service variables to conform to new naming scheme

This commit is contained in:
azivner
2018-03-25 13:41:29 -04:00
parent d746d707b5
commit 297a2cd9da
31 changed files with 121 additions and 176 deletions

View File

@@ -1,9 +1,7 @@
"use strict";
import treeService from '../services/tree_service.js';
import cloning from '../services/cloning.js';
import link from '../services/link.js';
import noteDetail from '../services/note_detail.js';
import treeService from '../services/tree.js';
import cloningService from '../services/cloning.js';
import linkService from '../services/link.js';
import noteDetailService from '../services/note_detail.js';
import treeUtils from '../services/tree_utils.js';
const $dialog = $("#add-link-dialog");
@@ -27,7 +25,7 @@ function setLinkType(linkType) {
async function showDialog() {
glob.activeDialog = $dialog;
if (noteDetail.getCurrentNoteType() === 'text') {
if (noteDetailService.getCurrentNoteType() === 'text') {
$linkTypeHtml.prop('disabled', false);
setLinkType('html');
@@ -58,7 +56,7 @@ async function showDialog() {
minLength: 0,
change: () => {
const val = $autoComplete.val();
const notePath = link.getNodePathFromLabel(val);
const notePath = linkService.getNodePathFromLabel(val);
if (!notePath) {
return;
}
@@ -72,7 +70,7 @@ async function showDialog() {
// this is called when user goes through autocomplete list with keyboard
// at this point the item isn't selected yet so we use supplied ui.item to see WHERE the cursor is
focus: (event, ui) => {
const notePath = link.getNodePathFromLabel(ui.item.value);
const notePath = linkService.getNodePathFromLabel(ui.item.value);
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
setDefaultLinkTitle(noteId);
@@ -83,7 +81,7 @@ async function showDialog() {
$form.submit(() => {
const value = $autoComplete.val();
const notePath = link.getNodePathFromLabel(value);
const notePath = linkService.getNodePathFromLabel(value);
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
if (notePath) {
@@ -94,19 +92,19 @@ $form.submit(() => {
$dialog.dialog("close");
link.addLinkToEditor(linkTitle, '#' + notePath);
linkService.addLinkToEditor(linkTitle, '#' + notePath);
}
else if (linkType === 'selected-to-current') {
const prefix = $clonePrefix.val();
cloning.cloneNoteTo(noteId, noteDetail.getCurrentNoteId(), prefix);
cloningService.cloneNoteTo(noteId, noteDetailService.getCurrentNoteId(), prefix);
$dialog.dialog("close");
}
else if (linkType === 'current-to-selected') {
const prefix = $clonePrefix.val();
cloning.cloneNoteTo(noteDetail.getCurrentNoteId(), noteId, prefix);
cloningService.cloneNoteTo(noteDetailService.getCurrentNoteId(), noteId, prefix);
$dialog.dialog("close");
}

View File

@@ -1,6 +1,4 @@
"use strict";
import treeService from '../services/tree_service.js';
import treeService from '../services/tree.js';
const $dialog = $("#edit-tree-prefix-dialog");
const $form = $("#edit-tree-prefix-form");

View File

@@ -1,6 +1,4 @@
"use strict";
import link from '../services/link.js';
import linkService from '../services/link.js';
import utils from '../services/utils.js';
const $dialog = $("#event-log-dialog");
@@ -23,7 +21,7 @@ async function showDialog() {
const dateTime = utils.formatDateTime(utils.parseDate(event.dateAdded));
if (event.noteId) {
const noteLink = link.createNoteLink(event.noteId).prop('outerHTML');
const noteLink = linkService.createNoteLink(event.noteId).prop('outerHTML');
event.comment = event.comment.replace('<note>', noteLink);
}

View File

@@ -1,7 +1,5 @@
"use strict";
import treeService from '../services/tree_service.js';
import link from '../services/link.js';
import treeService from '../services/tree.js';
import linkService from '../services/link.js';
import utils from '../services/utils.js';
const $showDialogButton = $("#jump-to-note-button");
@@ -27,7 +25,7 @@ async function showDialog() {
function getSelectedNotePath() {
const val = $autoComplete.val();
return link.getNodePathFromLabel(val);
return linkService.getNodePathFromLabel(val);
}
function goToNote() {

View File

@@ -1,6 +1,4 @@
"use strict";
import noteDetail from '../services/note_detail.js';
import noteDetailService from '../services/note_detail.js';
import utils from '../services/utils.js';
const $showDialogButton = $(".show-labels-button");
@@ -17,7 +15,7 @@ function LabelsModel() {
this.labels = ko.observableArray();
this.loadLabels = async function() {
const noteId = noteDetail.getCurrentNoteId();
const noteId = noteDetailService.getCurrentNoteId();
const labels = await server.get('notes/' + noteId + '/labels');
@@ -81,7 +79,7 @@ function LabelsModel() {
return;
}
const noteId = noteDetail.getCurrentNoteId();
const noteId = noteDetailService.getCurrentNoteId();
const labelsToSave = self.labels()
.map(attr => attr())
@@ -95,7 +93,7 @@ function LabelsModel() {
utils.showMessage("Labels have been saved.");
noteDetail.loadLabelList();
noteDetailService.loadLabelList();
};
function addLastEmptyRow() {

View File

@@ -1,6 +1,4 @@
"use strict";
import noteDetail from '../services/note_detail.js';
import noteDetailService from '../services/note_detail.js';
import utils from '../services/utils.js';
const $showDialogButton = $("#show-history-button");
@@ -12,7 +10,7 @@ const $title = $("#note-history-title");
let historyItems = [];
async function showCurrentNoteHistory() {
await showNoteHistoryDialog(noteDetail.getCurrentNoteId());
await showNoteHistoryDialog(noteDetailService.getCurrentNoteId());
}
async function showNoteHistoryDialog(noteId, noteRevisionId) {

View File

@@ -1,6 +1,4 @@
"use strict";
import noteDetail from '../services/note_detail.js';
import noteDetailService from '../services/note_detail.js';
const $showDialogButton = $("#show-source-button");
const $dialog = $("#note-source-dialog");
@@ -15,7 +13,7 @@ function showDialog() {
height: 500
});
const noteText = noteDetail.getCurrentNote().detail.content;
const noteText = noteDetailService.getCurrentNote().detail.content;
$noteSource.text(formatHtml(noteText));
}

View File

@@ -1,6 +1,4 @@
"use strict";
import link from '../services/link.js';
import linkService from '../services/link.js';
import utils from '../services/utils.js';
const $showDialogButton = $("#recent-changes-button");
@@ -42,7 +40,7 @@ async function showDialog() {
noteLink = change.current_title;
}
else {
noteLink = link.createNoteLink(change.noteId, change.title);
noteLink = linkService.createNoteLink(change.noteId, change.title);
}
changesListEl.append($('<li>')

View File

@@ -1,8 +1,6 @@
"use strict";
import treeService from '../services/tree_service.js';
import treeService from '../services/tree.js';
import messagingService from '../services/messaging.js';
import server from '../services/server.js';
import messaging from '../services/messaging.js';
const $showDialogButton = $("#recent-notes-button");
const $dialog = $("#recent-notes-dialog");
@@ -53,7 +51,7 @@ function showDialog() {
catch (e) {
noteTitle = "[error - can't find note title]";
messaging.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
messagingService.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
}
return {

View File

@@ -1,6 +1,6 @@
"use strict";
import protected_session from '../services/protected_session.js';
import protectedSessionService from '../services/protected_session.js';
import utils from '../services/utils.js';
import server from '../services/server.js';
@@ -81,7 +81,7 @@ addModule((function() {
alert("Password has been changed. Trilium will be reloaded after you press OK.");
// password changed so current protected session is invalid and needs to be cleared
protected_session.resetProtectedSession();
protectedSessionService.resetProtectedSession();
}
else {
utils.showError(result.message);
@@ -109,7 +109,7 @@ addModule((function() {
const protectedSessionTimeout = $protectedSessionTimeout.val();
settings.saveSettings(settingName, protectedSessionTimeout).then(() => {
protected_session.setProtectedSessionTimeout(protectedSessionTimeout);
protectedSessionService.setProtectedSessionTimeout(protectedSessionTimeout);
});
return false;

View File

@@ -1,5 +1,3 @@
"use strict";
import utils from '../services/utils.js';
const $dialog = $("#sql-console-dialog");