forked from xbapps/xbvr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display current version number in UI, and check for latest
- Loading branch information
cld9x
committed
Aug 5, 2019
1 parent
03ede9e
commit d0c57ec
Showing
3 changed files
with
95 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,65 @@ | ||
<template> | ||
<nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation"> | ||
<div class="navbar-brand"> | ||
<a class="navbar-item"> | ||
<h1 class="title">XBVR</h1> | ||
</a> | ||
</div> | ||
|
||
<div id="navbarBasicExample" class="navbar-menu"> | ||
<div class="navbar-start"> | ||
<a class="navbar-item"> | ||
<router-link to="./">Scenes</router-link> | ||
</a> | ||
<a class="navbar-item"> | ||
<router-link to="./files">Files</router-link> | ||
</a> | ||
<a class="navbar-item"> | ||
<router-link to="./options">Options</router-link> | ||
</a> | ||
</div> | ||
</div> | ||
</nav> | ||
<b-navbar :fixed-top="true"> | ||
<template slot="brand"> | ||
<b-navbar-item> | ||
<h1 class="title">XBVR <small>{{currentVersion}}</small></h1> | ||
</b-navbar-item> | ||
</template> | ||
<template slot="start"> | ||
<b-navbar-item> | ||
<router-link to="./">Scenes</router-link> | ||
</b-navbar-item> | ||
<b-navbar-item> | ||
<router-link to="./files">Files</router-link> | ||
</b-navbar-item> | ||
<b-navbar-item> | ||
<router-link to="./options">Options</router-link> | ||
</b-navbar-item> | ||
</template> | ||
</b-navbar> | ||
</template> | ||
|
||
<script> | ||
let d = document.documentElement; | ||
d.className += " has-navbar-fixed-top"; | ||
</script> | ||
import ky from "ky"; | ||
export default { | ||
data() { | ||
return { | ||
currentVersion: "", | ||
latestVersion: "", | ||
} | ||
}, | ||
mounted() { | ||
ky.get(`/api/config/version-check`).json().then(data => { | ||
this.currentVersion = data.current_version; | ||
this.latestVersion = data.latest_version; | ||
if (this.currentVersion !== this.latestVersion && this.currentVersion !== "CURRENT") { | ||
this.$buefy.snackbar.open({ | ||
message: `Version ${this.latestVersion} available!`, | ||
type: 'is-warning', | ||
position: 'is-top', | ||
actionText: 'Download now', | ||
indefinite: true, | ||
onAction: () => { | ||
window.location = "https://github.com/cld9x/xbvr/releases"; | ||
} | ||
}) | ||
} | ||
}); | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
h1 { | ||
display: flex; | ||
align-items: center; | ||
} | ||
h1 small { | ||
font-size: 0.5em; | ||
margin-left: 0.5em; | ||
opacity: 0.5; | ||
} | ||
</style> |