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> </div>
<div <div
v-if="this.$root.connectionError" v-if="this.$root.currentUserVisibleError"
id="connection-error" 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" /> <span id="upload-progressbar" />
<ChatInput <ChatInput
:network="network" :network="network"

View File

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

View File

@ -5,7 +5,7 @@
<div :class="['show-more', { show: channel.moreHistoryAvailable }]"> <div :class="['show-more', { show: channel.moreHistoryAvailable }]">
<button <button
ref="loadMoreButton" ref="loadMoreButton"
:disabled="channel.historyLoading || !$root.connected" :disabled="channel.historyLoading || !$root.isConnected"
class="btn" class="btn"
@click="onShowMoreClick"> @click="onShowMoreClick">
<span v-if="channel.historyLoading">Loading</span> <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 // And we will reload the page to grab the latest version
if (utils.serverHash > -1 && data.serverHash > -1 && data.serverHash !== utils.serverHash) { if (utils.serverHash > -1 && data.serverHash > -1 && data.serverHash !== utils.serverHash) {
socket.disconnect(); socket.disconnect();
vueApp.connected = false; vueApp.isConnected = false;
vueApp.connectionError = "Server restarted, reloading…"; vueApp.currentUserVisibleError = "Server restarted, reloading…";
location.reload(true); location.reload(true);
return; return;
} }
@ -53,8 +53,8 @@ socket.on("auth", function(data) {
if (!data.success) { if (!data.success) {
if (login.length === 0) { if (login.length === 0) {
socket.disconnect(); socket.disconnect();
vueApp.connected = false; vueApp.isConnected = false;
vueApp.connectionError = "Authentication failed, reloading…"; vueApp.currentUserVisibleError = "Authentication failed, reloading…";
location.reload(); location.reload();
return; return;
} }
@ -69,8 +69,8 @@ socket.on("auth", function(data) {
token = storage.get("token"); token = storage.get("token");
if (token) { if (token) {
vueApp.connectionError = "Authorizing…"; vueApp.currentUserVisibleError = "Authorizing…";
$("#loading-page-message").text(vueApp.connectionError); $("#loading-page-message").text(vueApp.currentUserVisibleError);
let lastMessage = -1; let lastMessage = -1;

View File

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

View File

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

View File

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

View File

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

View File

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