Rename some vue variables

This commit is contained in:
Pavel Djundik 2018-09-09 16:09:19 +03:00
parent f526aa8b8b
commit 7b15c53ed4
9 changed files with 36 additions and 36 deletions

View File

@ -68,9 +68,9 @@
</div>
</div>
<div
v-if="this.$root.connectionError"
v-if="this.$root.currentUserVisibleError"
id="connection-error"
@click="this.$root.connectionError = null">{{ this.$root.connectionError }}</div>
@click="this.$root.currentUserVisibleError = null">{{ this.$root.currentUserVisibleError }}</div>
<span id="upload-progressbar" />
<ChatInput
:network="network"

View File

@ -15,7 +15,7 @@
@input="setPendingMessage"
@keypress.enter.exact.prevent="onSubmit" />
<span
v-if="this.$root.connected && this.$root.fileUploadEnabled"
v-if="this.$root.isConnected && this.$root.isFileUploadEnabled"
id="upload-tooltip"
class="tooltipped tooltipped-w tooltipped-no-touch"
aria-label="Upload File"
@ -138,7 +138,7 @@ export default {
return false;
});
if (this.$root.fileUploadEnabled) {
if (this.$root.isFileUploadEnabled) {
upload.initialize();
}
},
@ -179,7 +179,7 @@ export default {
this.$refs.input.click();
this.$refs.input.focus();
if (!this.$root.connected) {
if (!this.$root.isConnected) {
return false;
}

View File

@ -5,7 +5,7 @@
<div :class="['show-more', { show: channel.moreHistoryAvailable }]">
<button
ref="loadMoreButton"
:disabled="channel.historyLoading || !$root.connected"
:disabled="channel.historyLoading || !$root.isConnected"
class="btn"
@click="onShowMoreClick">
<span v-if="channel.historyLoading">Loading</span>

View File

@ -12,8 +12,8 @@ socket.on("auth", function(data) {
// And we will reload the page to grab the latest version
if (utils.serverHash > -1 && data.serverHash > -1 && data.serverHash !== utils.serverHash) {
socket.disconnect();
vueApp.connected = false;
vueApp.connectionError = "Server restarted, reloading…";
vueApp.isConnected = false;
vueApp.currentUserVisibleError = "Server restarted, reloading…";
location.reload(true);
return;
}
@ -53,8 +53,8 @@ socket.on("auth", function(data) {
if (!data.success) {
if (login.length === 0) {
socket.disconnect();
vueApp.connected = false;
vueApp.connectionError = "Authentication failed, reloading…";
vueApp.isConnected = false;
vueApp.currentUserVisibleError = "Authentication failed, reloading…";
location.reload();
return;
}
@ -69,8 +69,8 @@ socket.on("auth", function(data) {
token = storage.get("token");
if (token) {
vueApp.connectionError = "Authorizing…";
$("#loading-page-message").text(vueApp.connectionError);
vueApp.currentUserVisibleError = "Authorizing…";
$("#loading-page-message").text(vueApp.currentUserVisibleError);
let lastMessage = -1;

View File

@ -25,7 +25,7 @@ window.addEventListener("beforeinstallprompt", (installPromptEvent) => {
});
socket.on("configuration", function(data) {
vueApp.fileUploadEnabled = data.fileUpload;
vueApp.isFileUploadEnabled = data.fileUpload;
if (options.initialized) {
// Likely a reconnect, request sync for possibly missed settings.

View File

@ -11,8 +11,8 @@ const utils = require("../utils");
const {vueApp, initChannel} = require("../vue");
socket.on("init", function(data) {
vueApp.connectionError = "Rendering…";
$("#loading-page-message").text(vueApp.connectionError);
vueApp.currentUserVisibleError = "Rendering…";
$("#loading-page-message").text(vueApp.currentUserVisibleError);
const previousActive = vueApp.activeChannel && vueApp.activeChannel.channel.id;
@ -55,8 +55,8 @@ socket.on("init", function(data) {
}
vueApp.networks = data.networks;
vueApp.connected = true;
vueApp.connectionError = false;
vueApp.isConnected = true;
vueApp.currentUserVisibleError = null;
if (!vueApp.initialized) {
vueApp.initialized = true;

View File

@ -20,13 +20,13 @@ socket.on("connect_error", handleDisconnect);
socket.on("error", handleDisconnect);
socket.on("reconnecting", function(attempt) {
vueApp.connectionError = `Reconnecting… (attempt ${attempt})`;
$("#loading-page-message").text(vueApp.connectionError);
vueApp.currentUserVisibleError = `Reconnecting… (attempt ${attempt})`;
$("#loading-page-message").text(vueApp.currentUserVisibleError);
});
socket.on("connecting", function() {
vueApp.connectionError = "Connecting…";
$("#loading-page-message").text(vueApp.connectionError);
vueApp.currentUserVisibleError = "Connecting…";
$("#loading-page-message").text(vueApp.currentUserVisibleError);
});
socket.on("connect", function() {
@ -35,21 +35,21 @@ socket.on("connect", function() {
// nothing is sent to the server that might have happened.
socket.sendBuffer = [];
vueApp.connectionError = "Finalizing connection…";
$("#loading-page-message").text(vueApp.connectionError);
vueApp.currentUserVisibleError = "Finalizing connection…";
$("#loading-page-message").text(vueApp.currentUserVisibleError);
});
socket.on("authorized", function() {
vueApp.connectionError = "Loading messages…";
$("#loading-page-message").text(vueApp.connectionError);
vueApp.currentUserVisibleError = "Loading messages…";
$("#loading-page-message").text(vueApp.currentUserVisibleError);
});
function handleDisconnect(data) {
const message = data.message || data;
vueApp.connected = false;
vueApp.connectionError = `Waiting to reconnect… (${message})`;
$("#loading-page-message").text(vueApp.connectionError);
vueApp.isConnected = false;
vueApp.currentUserVisibleError = `Waiting to reconnect… (${message})`;
$("#loading-page-message").text(vueApp.currentUserVisibleError);
// If the server shuts down, socket.io skips reconnection
// and we have to manually call connect to start the process

View File

@ -23,7 +23,7 @@ function initialize() {
instance.addEventListener("error", (event) => {
// Reset progressbar
$("#upload-progressbar").width(0);
vueApp.connectionError = event.message;
vueApp.currentUserVisibleError = event.message;
});
const $form = $(document);

View File

@ -21,14 +21,14 @@ Vue.filter("roundBadgeNumber", roundBadgeNumber);
const vueApp = new Vue({
el: "#viewport",
data: {
initialized: false,
connected: false,
connectionError: false,
fileUploadEnabled: false,
isNotified: false,
isAutoCompleting: false,
appName: document.title,
activeChannel: null,
appName: document.title,
currentUserVisibleError: null,
initialized: false,
isAutoCompleting: false,
isConnected: false,
isFileUploadEnabled: false,
isNotified: false,
networks: [],
settings: {
syncSettings: false,