Skip to content

Commit

Permalink
fix: add setting to disable changelog (opt-out)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Oct 3, 2023
1 parent 009779e commit 8aa42c6
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 14 deletions.
8 changes: 3 additions & 5 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,11 +1142,7 @@ app.post(
isAuthenticated,
async function (req, res) {
try {
if (restarting) {
throw Error(
'Gateway is restarting, wait a moment before doing another request'
)
}
const { disableChangelog } = req.body
const settings: Settings =
jsonStore.get(store.settings) || ({} as Settings)

Expand All @@ -1164,6 +1160,8 @@ app.post(
server: serverVersion,
}

settings.gateway.disableChangelog = disableChangelog

await jsonStore.put(store.settings, settings)

res.json({
Expand Down
1 change: 1 addition & 0 deletions lib/Gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export type GatewayConfig = {
app?: string
server?: string
}
disableChangelog?: boolean
}

interface ValueIdTopic {
Expand Down
32 changes: 25 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,10 @@ export default {
}
},
async checkChangelog() {
const versions = useBaseStore().gateway?.versions
const settings = useBaseStore().gateway
if (settings?.disableChangelog) return
const versions = settings?.versions
// get changelog from github latest release
try {
const latest = await this.getRelease('zwave-js-ui', 'latest')
Expand Down Expand Up @@ -1143,12 +1146,27 @@ export default {
}
// means we never saw the changelog for this version
await this.confirm(`Changelog`, changelog, 'info', {
width: 1000,
cancelText: '',
confirmText: 'Close',
})
await ConfigApis.updateVersions()
const result = await this.confirm(
`Changelog`,
changelog,
'info',
{
width: 1000,
cancelText: '',
confirmText: 'OK',
persistent: true,
inputs: [
{
type: 'checkbox',
label: "Don't show again",
key: 'dontShowAgain',
hint: 'Enable this to never show changelogs on next updates',
},
],
}
)
await ConfigApis.updateVersions(result?.dontShowAgain)
}
} catch (error) {
log.error(error)
Expand Down
4 changes: 2 additions & 2 deletions src/apis/ConfigApis.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export default {
const response = await request.put('/store-multi', { files })
return response.data
},
async updateVersions() {
const response = await request.post('/versions')
async updateVersions(disableChangelog = false) {
const response = await request.post('/versions', { disableChangelog })
return response.data
},
}
1 change: 1 addition & 0 deletions src/stores/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const useBaseStore = defineStore('base', {
logToFile: false,
values: [],
jobs: [],
disableChangelog: false,
},
appInfo: {
homeid: '',
Expand Down
9 changes: 9 additions & 0 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@
v-model="newGateway.logToFile"
></v-switch>
</v-col>

<v-col cols="12" sm="6" md="4">
<v-checkbox
persistent-hint
label="Disable changelogs"
hint="Check this to disable changelogs dialogs on new versions"
v-model="newZwave.disableChangelog"
></v-checkbox>
</v-col>
</v-row>
<v-subheader class="font-weight-bold">
Devices values configuration
Expand Down

0 comments on commit 8aa42c6

Please sign in to comment.