Добавлена полоска уведомления о выходе новой версии (отключается в настройках веб-интерфейса). Проверка настраивается параметром checkReleaseLink в конфиге сревера (#15)

This commit is contained in:
Book Pauk
2023-03-02 18:05:46 +07:00
parent d87e2ce632
commit 12304c13a1
8 changed files with 87 additions and 9 deletions

View File

@@ -3,6 +3,19 @@
<div ref="scroller" class="col fit column no-wrap" style="overflow: auto; position: relative" @scroll="onScroll">
<!-- Tool Panel begin -->
<div ref="toolPanel" class="tool-panel column bg-cyan-2" style="position: sticky; top: 0; z-index: 10;">
<!-- Обновление -->
<div v-show="showNewReleaseAvailable && newReleaseAvailable" class="row q-py-sm bg-green-4 items-center">
<div class="q-ml-sm" style="font-size: 120%">
Доступна новая версия <b>{{ config.name }} v{{ config.latestVersion }}</b>
</div>
<DivBtn class="q-ml-sm q-px-sm bg-white" :size="20" @click.stop.prevent="openReleasePage">
Скачать
</DivBtn>
<DivBtn class="q-ml-sm q-px-sm bg-white" :size="20" @click.stop.prevent="settingsDialogVisible = true">
Отключить уведомление
</DivBtn>
</div>
<!-- 1 -->
<div class="row">
<!-- 1-1 -->
@@ -504,6 +517,7 @@ class Search {
limit = 20;
extendedParams = false;
showJson = false;
showNewReleaseAvailable = true;
//stuff
prevList = {};
@@ -555,6 +569,7 @@ class Search {
mounted() {
(async() => {
//для срабатывания watch.config
await this.api.updateConfig();
//устанавливаем uiDefaults от сервера, если это необходимо
@@ -604,6 +619,7 @@ class Search {
this.abCacheEnabled = settings.abCacheEnabled;
this.langDefault = settings.langDefault;
this.showJson = settings.showJson;
this.showNewReleaseAvailable = settings.showNewReleaseAvailable;
}
recvMessage(d) {
@@ -631,6 +647,10 @@ class Search {
return this.$store.state.config;
}
get newReleaseAvailable() {
return (this.config.latestVersion && this.config.version != this.config.latestVersion);
}
get recStruct() {
if (this.config.dbConfig && this.config.dbConfig.inpxInfo.recStruct)
return this.config.dbConfig.inpxInfo.recStruct;
@@ -728,14 +748,19 @@ class Search {
}
openReleasePage() {
window.open('https://github.com/bookpauk/inpx-web/releases', '_blank');
if (this.config.latestReleaseLink)
window.open(this.config.latestReleaseLink, '_blank');
}
makeProjectName() {
const collection = this.config.dbConfig.inpxInfo.collection.split('\n');
this.collection = collection[0].trim();
this.projectName = `${this.config.name} v${this.config.webAppVersion}`;
let projectName = `${this.config.name} v${this.config.webAppVersion}`;
if (this.newReleaseAvailable)
projectName += `, доступно обновление: v${this.config.latestVersion}`;
this.projectName = projectName;
this.makeTitle();
}

View File

@@ -19,6 +19,7 @@
/>
</div>
<q-checkbox v-show="config.latestVersion" v-model="showNewReleaseAvailable" size="36px" label="Уведомлять о выходе новой версии" />
<q-checkbox v-model="downloadAsZip" size="36px" label="Скачивать книги в виде zip-архива" />
<q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
<q-checkbox v-model="showRates" size="36px" label="Показывать оценки" />
@@ -85,6 +86,9 @@ const componentOptions = {
abCacheEnabled(newValue) {
this.commit('setSettings', {'abCacheEnabled': newValue});
},
showNewReleaseAvailable(newValue) {
this.commit('setSettings', {'showNewReleaseAvailable': newValue});
},
}
};
class SettingsDialog {
@@ -105,6 +109,7 @@ class SettingsDialog {
showDates = true;
showDeleted = false;
abCacheEnabled = true;
showNewReleaseAvailable = true;
limitOptions = [
{label: '10', value: 10},
@@ -125,6 +130,10 @@ class SettingsDialog {
mounted() {
}
get config() {
return this.$store.state.config;
}
get settings() {
return this.$store.state.settings;
}
@@ -142,6 +151,7 @@ class SettingsDialog {
this.showDates = settings.showDates;
this.showDeleted = settings.showDeleted;
this.abCacheEnabled = settings.abCacheEnabled;
this.showNewReleaseAvailable = settings.showNewReleaseAvailable;
}
okClick() {

View File

@@ -89,8 +89,10 @@ export default vueComponent(DivBtn);
}
.button-pressed {
margin-left: 2px;
margin-top: 2px;
margin-left: 1px;
margin-top: 1px;
margin-right: -1px;
margin-bottom: -1px;
}
.clickable {

View File

@@ -21,6 +21,7 @@ const state = {
abCacheEnabled: true,
langDefault: '',
showJson: false,
showNewReleaseAvailable: true,
},
};