Рефакторинг, улучшение отображения версии
This commit is contained in:
@@ -92,16 +92,8 @@ class Api {
|
|||||||
async updateConfig() {
|
async updateConfig() {
|
||||||
try {
|
try {
|
||||||
const config = await this.getConfig();
|
const config = await this.getConfig();
|
||||||
|
config.webAppVersion = packageJson.version;
|
||||||
this.commit('setConfig', config);
|
this.commit('setConfig', config);
|
||||||
|
|
||||||
//проверим на новую версию, обновимся при необходимости
|
|
||||||
if (this.config.version) {
|
|
||||||
if (this.config.version != packageJson.version && Date.now() - this.lastReloadTime > 15*1000) {
|
|
||||||
this.commit('setLastReloadTime', Date.now());//на всякий случай, чтобы исключить зацикливание в reload
|
|
||||||
|
|
||||||
document.location.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$root.stdDialog.alert(e.message, 'Ошибка');
|
this.$root.stdDialog.alert(e.message, 'Ошибка');
|
||||||
}
|
}
|
||||||
@@ -111,10 +103,6 @@ class Api {
|
|||||||
return this.$store.state.config;
|
return this.$store.state.config;
|
||||||
}
|
}
|
||||||
|
|
||||||
get lastReloadTime() {
|
|
||||||
return this.$store.state.lastReloadTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
get settings() {
|
get settings() {
|
||||||
return this.$store.state.settings;
|
return this.$store.state.settings;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ class Search {
|
|||||||
const collection = this.config.dbConfig.inpxInfo.collection.split('\n');
|
const collection = this.config.dbConfig.inpxInfo.collection.split('\n');
|
||||||
this.collection = collection[0].trim();
|
this.collection = collection[0].trim();
|
||||||
|
|
||||||
this.projectName = `${this.config.name} v${this.config.version}`;
|
this.projectName = `${this.config.name} v${this.config.webAppVersion}`;
|
||||||
this.$root.setAppTitle(`Коллекция ${this.collection}`);
|
this.$root.setAppTitle(`Коллекция ${this.collection}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// initial state
|
// initial state
|
||||||
const state = {
|
const state = {
|
||||||
config: {},
|
config: {},
|
||||||
lastReloadTime: 0,
|
|
||||||
settings: {
|
settings: {
|
||||||
accessToken: '',
|
accessToken: '',
|
||||||
limit: 20,
|
limit: 20,
|
||||||
@@ -27,9 +26,6 @@ const mutations = {
|
|||||||
setConfig(state, value) {
|
setConfig(state, value) {
|
||||||
state.config = value;
|
state.config = value;
|
||||||
},
|
},
|
||||||
setLastReloadTime(state, value) {
|
|
||||||
state.lastReloadTime = value;
|
|
||||||
},
|
|
||||||
setSettings(state, value) {
|
setSettings(state, value) {
|
||||||
state.settings = Object.assign({}, state.settings, value);
|
state.settings = Object.assign({}, state.settings, value);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user