Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Add keep-alive to vue router && populate version number from build ld…
Browse files Browse the repository at this point in the history
…flags (#26)

* add keep-alive to vue-router

* use ldflags to populate appver

* add ldflags to build
  • Loading branch information
charlie-haley authored May 9, 2021
1 parent dfa7fc9 commit a00db0a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: ${{ !env.ACT }}
run: |
cd ./src/flowcontrol
wails build -x windows/amd64 --verbose
wails build -x windows/amd64 --verbose -ldflags="-X 'main.appver=${{ github.ref }}'"
# If building locally, ensure we don't compile for a specific architecture due to docker in docker requirements
- name: Build project
if: ${{ env.ACT }}
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
if: ${{ !env.ACT }}
run: |
cd ./src/flowcontrol
wails build -x darwin/amd64 --verbose
wails build -x darwin/amd64 --verbose -ldflags="-X 'main.appver=${{ github.ref }}'"
#Zip assets
- name: Zip assets
run: |
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
if: ${{ !env.ACT }}
run: |
cd ./src/flowcontrol
wails build -x linux/amd64 --verbose
wails build -x linux/amd64 --verbose -ldflags="-X 'main.appver=${{ github.ref }}'"
#Zip assets
- name: Zip assets
run: |
Expand Down
4 changes: 3 additions & 1 deletion src/flowcontrol/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
</div>
</div>
<div class="fan-page">
<router-view/>
<keep-alive>
<router-view :key="$route.fullPath" />
</keep-alive>
</div>
</div>
</template>
Expand Down
13 changes: 12 additions & 1 deletion src/flowcontrol/frontend/src/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="settings-appinfo">
<FanIcon class="fan-icon"/>
<span class="settings-appinfo-title">Flowcontrol</span><br/>
<span class="settings-appinfo-version">v0.1.2</span><br/>
<span class="settings-appinfo-version">{{ version }}</span><br/>
<a href="https://github.com/charlie-haley/flowcontrol">GitHub</a>
</div>
</template>
Expand All @@ -14,6 +14,17 @@ export default {
name: "settings",
components: {
FanIcon
},
data() {
return {
version: " "
};
},
mounted: function() {
var self = this;
window.backend.version().then(result => {
self.version = result;
});
}
};
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/flowcontrol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.16

require (
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
github.com/wailsapp/wails v1.16.3
github.com/wailsapp/wails v1.16.4-pre3
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
)
4 changes: 2 additions & 2 deletions src/flowcontrol/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba h1:2DHfQOxcpWdGf5
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba/go.mod h1:iLnlXG2Pakcii2CU0cbY07DRCSvpWNa7nFxtevhOChk=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/wailsapp/wails v1.16.3 h1:wuJJU9PnnrrDvhh+DTr1MfqUSR1PDR5H+RilM5Wwd7c=
github.com/wailsapp/wails v1.16.3/go.mod h1:aADbAvTzZrKGd4Td7d1l4Dp5Hx7lLJEvVH7guIHoDf8=
github.com/wailsapp/wails v1.16.4-pre3 h1:ITalbeNsJ7dUACHcdczOzaDKVxZJBXUeUGEp3RoQieI=
github.com/wailsapp/wails v1.16.4-pre3/go.mod h1:aADbAvTzZrKGd4Td7d1l4Dp5Hx7lLJEvVH7guIHoDf8=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down
7 changes: 7 additions & 0 deletions src/flowcontrol/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var js string
//go:embed frontend/dist/app.css
var css string

var appver = "development"

func main() {

app := wails.CreateApp(&wails.AppConfig{
Expand All @@ -23,5 +25,10 @@ func main() {
Colour: "#131313",
})
app.Bind(&wailsstruct{})
app.Bind(version)
app.Run()
}

func version() string{
return appver;
}

0 comments on commit a00db0a

Please sign in to comment.