1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 13:07:58 +00:00

Show version number in about dialog (#28)

This commit is contained in:
Romein van Buren 2023-06-06 21:52:02 +02:00 committed by GitHub
parent 775e4d98d8
commit b29b534b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
.DS_Store .DS_Store
/build/version.txt
/build/bin/ /build/bin/
/build/windows/installer/tmp/ /build/windows/installer/tmp/

View File

@ -1,3 +1,7 @@
## Unreleased
* Added version number of the running Rolens instance in the about dialog (#25, #28)
## [v0.2.0](https://github.com/garraflavatra/rolens/releases/tag/v0.2.0) ## [v0.2.0](https://github.com/garraflavatra/rolens/releases/tag/v0.2.0)
* Added some external links related to Rolens to the application menu. * Added some external links related to Rolens to the application menu.

13
build/version2file.js Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/node
// This script extracts the version number from wails.json in the project root
// and writes it to version.txt
const fs = require('fs');
fs.writeFileSync(
__dirname+'/version.txt',
JSON.parse(
fs.readFileSync(__dirname+'/../wails.json')
).info.productVersion
);

View File

@ -1 +1 @@
d933a4e16d5bb0132361eef3b5d3ba22 541b97f7203adc96312cfd007c0d8b97

View File

@ -1,6 +1,7 @@
<script> <script>
import Modal from '$components/modal.svelte'; import Modal from '$components/modal.svelte';
import alink from '$lib/actions/alink'; import alink from '$lib/actions/alink';
import environment from '$lib/stores/environment';
export let show = true; export let show = true;
</script> </script>
@ -9,7 +10,10 @@
<div class="brand"> <div class="brand">
<img src="/logo.png" alt="Rolens logo" /> <img src="/logo.png" alt="Rolens logo" />
<div> <div>
<div class="title">Rolens</div> <div class="title">
Rolens
<span class="version">{$environment.version}</span>
</div>
<div class="description">Intuitive MongoDB <br/> administration tool</div> <div class="description">Intuitive MongoDB <br/> administration tool</div>
</div> </div>
</div> </div>
@ -42,6 +46,11 @@
font-weight: 600; font-weight: 600;
line-height: 2.5rem; line-height: 2.5rem;
} }
.brand .title .version {
font-size: 80%;
font-weight: 300;
opacity: 0.65;
}
.brand .description { .brand .description {
font-size: 1.5rem; font-size: 1.5rem;
line-height: 1.6rem; line-height: 1.6rem;

View File

@ -4,6 +4,7 @@ export namespace app {
arch: string; arch: string;
buildType: string; buildType: string;
platform: string; platform: string;
version: string;
hasMongoExport: boolean; hasMongoExport: boolean;
hasMongoDump: boolean; hasMongoDump: boolean;
homeDirectory: string; homeDirectory: string;
@ -20,6 +21,7 @@ export namespace app {
this.arch = source["arch"]; this.arch = source["arch"];
this.buildType = source["buildType"]; this.buildType = source["buildType"];
this.platform = source["platform"]; this.platform = source["platform"];
this.version = source["version"];
this.hasMongoExport = source["hasMongoExport"]; this.hasMongoExport = source["hasMongoExport"];
this.hasMongoDump = source["hasMongoDump"]; this.hasMongoDump = source["hasMongoDump"];
this.homeDirectory = source["homeDirectory"]; this.homeDirectory = source["homeDirectory"];

3
go.mod
View File

@ -2,7 +2,7 @@ module github.com/garraflavatra/rolens
go 1.18 go 1.18
require github.com/wailsapp/wails/v2 v2.5.1 require github.com/wailsapp/wails/v2 v2.3.1
require ( require (
github.com/gen2brain/beeep v0.0.0-20220909211152-5a9ec94374f6 github.com/gen2brain/beeep v0.0.0-20220909211152-5a9ec94374f6
@ -13,6 +13,7 @@ require (
require ( require (
github.com/akavel/rsrc v0.10.2 // indirect github.com/akavel/rsrc v0.10.2 // indirect
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/josephspurrier/goversioninfo v1.4.0 // indirect github.com/josephspurrier/goversioninfo v1.4.0 // indirect
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
golang.org/x/image v0.7.0 // indirect golang.org/x/image v0.7.0 // indirect

10
go.sum
View File

@ -21,6 +21,8 @@ github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck= github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs= github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8= github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8=
@ -76,7 +78,7 @@ github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG0
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o=
github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8=
github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ= github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ=
github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4= github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
@ -85,8 +87,8 @@ github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wailsapp/wails/v2 v2.5.1 h1:mfG+2kWqQXYOwdgI43HEILjOZDXbk5woPYI3jP2b+js= github.com/wailsapp/wails/v2 v2.3.1 h1:ZJz+pyIBKyASkgO8JO31NuHO1gTTHmvwiHYHwei1CqM=
github.com/wailsapp/wails/v2 v2.5.1/go.mod h1:jbOZbcr/zm79PxXxAjP8UoVlDd9wLW3uDs+isIthDfs= github.com/wailsapp/wails/v2 v2.3.1/go.mod h1:zlNLI0E2c2qA6miiuAHtp0Bac8FaGH0tlhA19OssR/8=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E= github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
@ -159,6 +161,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -10,6 +10,7 @@ import (
"path" "path"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings"
"github.com/garraflavatra/rolens/internal/ui" "github.com/garraflavatra/rolens/internal/ui"
"github.com/ncruces/zenity" "github.com/ncruces/zenity"
@ -21,6 +22,7 @@ type EnvironmentInfo struct {
Arch string `json:"arch"` Arch string `json:"arch"`
BuildType string `json:"buildType"` BuildType string `json:"buildType"`
Platform string `json:"platform"` Platform string `json:"platform"`
Version string `json:"version"`
HasMongoExport bool `json:"hasMongoExport"` HasMongoExport bool `json:"hasMongoExport"`
HasMongoDump bool `json:"hasMongoDump"` HasMongoDump bool `json:"hasMongoDump"`
@ -38,8 +40,9 @@ type App struct {
ui *ui.UI ui *ui.UI
} }
func NewApp() *App { func NewApp(version string) *App {
a := &App{} a := &App{}
a.Env.Version = strings.TrimSpace(version)
_, err := exec.LookPath("mongodump") _, err := exec.LookPath("mongodump")
a.Env.HasMongoDump = err == nil a.Env.HasMongoDump = err == nil

View File

@ -22,10 +22,13 @@ var (
//go:embed build/appicon.png //go:embed build/appicon.png
appIcon []byte appIcon []byte
//go:embed build/version.txt
version string
) )
func main() { func main() {
app := app.NewApp() app := app.NewApp(version)
ui := uictrl.New() ui := uictrl.New()
err := wails.Run(&options.App{ err := wails.Run(&options.App{

View File

@ -16,5 +16,8 @@
"productVersion": "0.2.0", "productVersion": "0.2.0",
"comments": "The intuitive MongoDB administration tool", "comments": "The intuitive MongoDB administration tool",
"copyright": "© Romein van Buren 2023 (GNU GPL 3.0)." "copyright": "© Romein van Buren 2023 (GNU GPL 3.0)."
},
"preBuildHooks": {
"*/*": "node ../version2file.js"
} }
} }