Compare commits

..

No commits in common. "7aba27e5f960db78067bc6a0c0ad25ce7d874dd2" and "47df424138a2529fb228610d54633399e0b35090" have entirely different histories.

20 changed files with 76 additions and 185 deletions

View File

@ -1,6 +0,0 @@
package consts
const DEFAULT_FONT_SIZE = 14
const DEFAULT_ASIDE_WIDTH = 300
const DEFAULT_WINDOW_WIDTH = 1024
const DEFAULT_WINDOW_HEIGHT = 768

View File

@ -508,15 +508,12 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re
} }
var value any var value any
var size int64
var cursor uint64 var cursor uint64
switch strings.ToLower(keyType) { switch strings.ToLower(keyType) {
case "string": case "string":
value, err = rdb.Get(ctx, key).Result() value, err = rdb.Get(ctx, key).Result()
size, _ = rdb.StrLen(ctx, key).Result()
case "list": case "list":
value, err = rdb.LRange(ctx, key, 0, -1).Result() value, err = rdb.LRange(ctx, key, 0, -1).Result()
size, _ = rdb.LLen(ctx, key).Result()
case "hash": case "hash":
//value, err = rdb.HGetAll(ctx, key).Result() //value, err = rdb.HGetAll(ctx, key).Result()
items := map[string]string{} items := map[string]string{}
@ -535,7 +532,6 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re
} }
} }
value = items value = items
size, _ = rdb.HLen(ctx, key).Result()
case "set": case "set":
//value, err = rdb.SMembers(ctx, key).Result() //value, err = rdb.SMembers(ctx, key).Result()
items := []string{} items := []string{}
@ -552,7 +548,6 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re
} }
} }
value = items value = items
size, _ = rdb.SCard(ctx, key).Result()
case "zset": case "zset":
//value, err = rdb.ZRangeWithScores(ctx, key, 0, -1).Result() //value, err = rdb.ZRangeWithScores(ctx, key, 0, -1).Result()
var items []types.ZSetItem var items []types.ZSetItem
@ -577,7 +572,6 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re
} }
} }
value = items value = items
size, _ = rdb.ZCard(ctx, key).Result()
case "stream": case "stream":
var msgs []redis.XMessage var msgs []redis.XMessage
items := []types.StreamItem{} items := []types.StreamItem{}
@ -593,7 +587,6 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re
}) })
} }
value = items value = items
size, _ = rdb.XLen(ctx, key).Result()
} }
if err != nil { if err != nil {
resp.Msg = err.Error() resp.Msg = err.Error()
@ -604,7 +597,6 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re
"type": keyType, "type": keyType,
"ttl": ttl, "ttl": ttl,
"value": value, "value": value,
"size": size,
} }
return return
} }

View File

@ -7,7 +7,6 @@ import (
"sort" "sort"
"strings" "strings"
"sync" "sync"
"tinyrdm/backend/consts"
storage2 "tinyrdm/backend/storage" storage2 "tinyrdm/backend/storage"
"tinyrdm/backend/types" "tinyrdm/backend/types"
"tinyrdm/backend/utils/coll" "tinyrdm/backend/utils/coll"
@ -102,28 +101,6 @@ func (p *preferencesService) GetAppVersion() (resp types.JSResp) {
return return
} }
func (p *preferencesService) SaveWindowSize(width, height int) {
p.SetPreferences(map[string]any{
"behavior": map[string]any{
"window_width": width,
"window_height": height,
},
})
}
func (p *preferencesService) GetWindowSize() (width, height int) {
data := p.pref.GetPreferences()
w, h := data["behavior.window_width"], data["behavior.window_height"]
var ok bool
if width, ok = w.(int); !ok {
return consts.DEFAULT_WINDOW_WIDTH, consts.DEFAULT_WINDOW_HEIGHT
}
if height, ok = h.(int); !ok {
return consts.DEFAULT_WINDOW_WIDTH, consts.DEFAULT_WINDOW_HEIGHT
}
return
}
type latestRelease struct { type latestRelease struct {
Name string `json:"name"` Name string `json:"name"`
TagName string `json:"tag_name"` TagName string `json:"tag_name"`

View File

@ -5,7 +5,6 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"strings" "strings"
"sync" "sync"
"tinyrdm/backend/consts"
) )
type PreferencesStorage struct { type PreferencesStorage struct {
@ -21,19 +20,15 @@ func NewPreferences() *PreferencesStorage {
func (p *PreferencesStorage) DefaultPreferences() map[string]any { func (p *PreferencesStorage) DefaultPreferences() map[string]any {
return map[string]any{ return map[string]any{
"behavior": map[string]any{
"aside_width": consts.DEFAULT_ASIDE_WIDTH,
"window_width": consts.DEFAULT_WINDOW_WIDTH,
"window_height": consts.DEFAULT_WINDOW_HEIGHT,
},
"general": map[string]any{ "general": map[string]any{
"language": "auto", "language": "auto",
"font": "", "font": "",
"font_size": consts.DEFAULT_FONT_SIZE, "font_size": 14,
"use_sys_proxy": false, "use_sys_proxy": false,
"use_sys_proxy_http": false, "use_sys_proxy_http": false,
"check_update": true, "check_update": true,
"skip_version": "", "skip_version": "",
"aside_width": 300,
}, },
"editor": map[string]any{ "editor": map[string]any{
"font": "", "font": "",

View File

@ -59,7 +59,7 @@ const startResize = () => {
} }
const asideWidthVal = computed(() => { const asideWidthVal = computed(() => {
return prefStore.behavior.asideWidth + 'px' return prefStore.general.asideWidth + 'px'
}) })
const dragging = computed(() => { const dragging = computed(() => {
@ -115,7 +115,7 @@ const border = computed(() => {
<div <div
id="app-toolbar-title" id="app-toolbar-title"
:style="{ :style="{
width: `${data.navMenuWidth + prefStore.behavior.asideWidth - 4}px`, width: `${data.navMenuWidth + prefStore.general.asideWidth - 4}px`,
paddingLeft: isMacOS() ? '70px' : '10px', paddingLeft: isMacOS() ? '70px' : '10px',
}"> }">
<n-space align="center" :wrap-item="false" :wrap="false" :size="3"> <n-space align="center" :wrap-item="false" :wrap="false" :size="3">

View File

@ -97,7 +97,6 @@ const tabContent = computed(() => {
keyPath: tab.key, keyPath: tab.key,
ttl: tab.ttl, ttl: tab.ttl,
value: tab.value, value: tab.value,
size: tab.size || 0,
} }
}) })
@ -152,8 +151,7 @@ const onReloadKey = async () => {
:key-path="tabContent.keyPath" :key-path="tabContent.keyPath"
:name="tabContent.name" :name="tabContent.name"
:ttl="tabContent.ttl" :ttl="tabContent.ttl"
:value="tabContent.value" :value="tabContent.value" />
:size="tabContent.size" />
</div> </div>
</template> </template>

View File

@ -19,7 +19,6 @@ const props = defineProps({
default: -1, default: -1,
}, },
value: Object, value: Object,
size: Number,
}) })
const filterOption = [ const filterOption = [
@ -258,9 +257,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
@update:value="onFilterInput" /> @update:value="onFilterInput" />
</n-input-group> </n-input-group>
</div> </div>
<div class="tb2-extra-info flex-item-expand"> <div class="flex-item-expand"></div>
<n-tag size="large">{{ $t('interface.total', { size: props.size }) }}</n-tag>
</div>
<n-button plain :focusable="false" @click="onAddRow"> <n-button plain :focusable="false" @click="onAddRow">
<template #icon> <template #icon>
<n-icon :component="AddLink" size="18" /> <n-icon :component="AddLink" size="18" />

View File

@ -20,7 +20,6 @@ const props = defineProps({
default: -1, default: -1,
}, },
value: Object, value: Object,
size: Number,
}) })
const connectionStore = useConnectionStore() const connectionStore = useConnectionStore()
@ -182,9 +181,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
@clear="clearFilter" @clear="clearFilter"
@update:value="onFilterInput" /> @update:value="onFilterInput" />
</div> </div>
<div class="tb2-extra-info flex-item-expand"> <div class="flex-item-expand"></div>
<n-tag size="large">{{ $t('interface.total', { size: props.size }) }}</n-tag>
</div>
<n-button plain :focusable="false" @click="onAddValue"> <n-button plain :focusable="false" @click="onAddValue">
<template #icon> <template #icon>
<n-icon :component="AddLink" size="18" /> <n-icon :component="AddLink" size="18" />

View File

@ -20,7 +20,6 @@ const props = defineProps({
default: -1, default: -1,
}, },
value: Array, value: Array,
size: Number,
}) })
const connectionStore = useConnectionStore() const connectionStore = useConnectionStore()
@ -178,9 +177,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
@clear="clearFilter" @clear="clearFilter"
@update:value="onFilterInput" /> @update:value="onFilterInput" />
</div> </div>
<div class="tb2-extra-info flex-item-expand"> <div class="flex-item-expand"></div>
<n-tag size="large">{{ $t('interface.total', { size: props.size }) }}</n-tag>
</div>
<n-button plain :focusable="false" @click="onAddValue"> <n-button plain :focusable="false" @click="onAddValue">
<template #icon> <template #icon>
<n-icon :component="AddLink" size="18" /> <n-icon :component="AddLink" size="18" />

View File

@ -20,7 +20,6 @@ const props = defineProps({
default: -1, default: -1,
}, },
value: Object, value: Object,
size: Number,
}) })
const filterOption = [ const filterOption = [
@ -171,9 +170,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
@update:value="onFilterInput" /> @update:value="onFilterInput" />
</n-input-group> </n-input-group>
</div> </div>
<div class="tb2-extra-info flex-item-expand"> <div class="flex-item-expand"></div>
<n-tag size="large">{{ $t('interface.total', { size: props.size }) }}</n-tag>
</div>
<n-button plain :focusable="false" @click="onAddRow"> <n-button plain :focusable="false" @click="onAddRow">
<template #icon> <template #icon>
<n-icon :component="AddLink" size="18" /> <n-icon :component="AddLink" size="18" />

View File

@ -27,7 +27,6 @@ const props = defineProps({
default: -1, default: -1,
}, },
value: String, value: String,
size: Number,
}) })
const viewOption = computed(() => const viewOption = computed(() =>

View File

@ -20,7 +20,6 @@ const props = defineProps({
default: -1, default: -1,
}, },
value: Object, value: Object,
size: Number,
}) })
const filterOption = [ const filterOption = [
@ -289,9 +288,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
</n-tooltip> </n-tooltip>
</n-input-group> </n-input-group>
</div> </div>
<div class="tb2-extra-info flex-item-expand"> <div class="flex-item-expand"></div>
<n-tag size="large">{{ $t('interface.total', { size: props.size }) }}</n-tag>
</div>
<n-button plain :focusable="false" @click="onAddRow"> <n-button plain :focusable="false" @click="onAddRow">
<template #icon> <template #icon>
<n-icon :component="AddLink" size="18" /> <n-icon :component="AddLink" size="18" />

View File

@ -4,7 +4,7 @@ import { ConnectionType } from '@/consts/connection_type.js'
import { NIcon, NSpace, NTag } from 'naive-ui' import { NIcon, NSpace, NTag } from 'naive-ui'
import Key from '@/components/icons/Key.vue' import Key from '@/components/icons/Key.vue'
import ToggleDb from '@/components/icons/ToggleDb.vue' import ToggleDb from '@/components/icons/ToggleDb.vue'
import { find, get, includes, indexOf, isEmpty, pull, remove, size } from 'lodash' import { find, get, includes, indexOf, isEmpty, remove } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Refresh from '@/components/icons/Refresh.vue' import Refresh from '@/components/icons/Refresh.vue'
import CopyLink from '@/components/icons/CopyLink.vue' import CopyLink from '@/components/icons/CopyLink.vue'
@ -300,24 +300,14 @@ const onUpdateExpanded = (value, option, meta) => {
if (!meta.node) { if (!meta.node) {
return return
} }
// console.log(JSON.stringify(meta))
// keep expand or collapse children while they own more than 1 child switch (meta.action) {
let node = meta.node case 'expand':
while (node != null && size(node.children) === 1) { meta.node.expanded = true
const key = node.children[0].key break
switch (meta.action) { case 'collapse':
case 'expand': meta.node.expanded = false
node.expanded = true break
if (!includes(expandedKeys.value, key)) {
expandedKeys.value.push(key)
}
break
case 'collapse':
node.expanded = false
remove(expandedKeys.value, (v) => v === key)
break
}
node = node.children[0]
} }
} }

View File

@ -87,8 +87,7 @@
"empty_server_list": "No redis server", "empty_server_list": "No redis server",
"action": "Action", "action": "Action",
"type": "Type", "type": "Type",
"score": "Score", "score": "Score"
"total": "Length: {size}"
}, },
"ribbon": { "ribbon": {
"server": "Server", "server": "Server",

View File

@ -87,8 +87,7 @@
"empty_server_list": "还没添加Redis服务器", "empty_server_list": "还没添加Redis服务器",
"action": "操作", "action": "操作",
"type": "类型", "type": "类型",
"score": "分值", "score": "分值"
"total": "总数:{size}"
}, },
"ribbon": { "ribbon": {
"server": "服务器", "server": "服务器",

View File

@ -532,7 +532,7 @@ const useConnectionStore = defineStore('connections', {
if (!isEmpty(key)) { if (!isEmpty(key)) {
const { data, success, msg } = await GetKeyValue(server, db, key) const { data, success, msg } = await GetKeyValue(server, db, key)
if (success) { if (success) {
const { type, ttl, value, size } = data const { type, ttl, value } = data
tab.upsertTab({ tab.upsertTab({
server, server,
db, db,
@ -540,7 +540,6 @@ const useConnectionStore = defineStore('connections', {
ttl, ttl,
key, key,
value, value,
size,
}) })
return return
} else { } else {
@ -556,7 +555,6 @@ const useConnectionStore = defineStore('connections', {
ttl: -1, ttl: -1,
key: null, key: null,
value: null, value: null,
size: 0,
}) })
} finally { } finally {
} }
@ -749,10 +747,10 @@ const useConnectionStore = defineStore('connections', {
*/ */
_tidyNode(connName, db, key, skipResort) { _tidyNode(connName, db, key, skipResort) {
const nodeMap = this._getNodeMap(connName, db) const nodeMap = this._getNodeMap(connName, db)
const dbNode = get(this.databases, [connName, db], {})
const separator = this._getSeparator(connName) const separator = this._getSeparator(connName)
const keyParts = split(key, separator) const keyParts = split(key, separator)
const totalParts = size(keyParts) const totalParts = size(keyParts)
const dbNode = get(this.databases, [connName, db], {})
let node let node
// find last exists ancestor key // find last exists ancestor key
let i = totalParts - 1 let i = totalParts - 1
@ -1252,7 +1250,7 @@ const useConnectionStore = defineStore('connections', {
* *
* @param {string} connName * @param {string} connName
* @param {number} db * @param {number} db
* @param {string} [key] * @param {string} key
* @param {boolean} [isLayer] * @param {boolean} [isLayer]
* @private * @private
*/ */
@ -1265,52 +1263,46 @@ const useConnectionStore = defineStore('connections', {
} }
const nodeMap = this._getNodeMap(connName, db) const nodeMap = this._getNodeMap(connName, db)
const keyParts = split(key, separator)
const totalParts = size(keyParts)
if (isLayer === true) { if (isLayer === true) {
this._deleteChildrenKeyNodes(nodeMap, key) this._deleteChildrenKeyNodes(nodeMap, key)
} }
if (isEmpty(key)) { // remove from parent in tree node
// clear all key nodes const parentKey = slice(keyParts, 0, totalParts - 1)
dbRoot.children = [] let parentNode
dbRoot.keys = 0 if (isEmpty(parentKey)) {
parentNode = dbRoot
} else { } else {
const keyParts = split(key, separator) parentNode = nodeMap.get(`${ConnectionType.RedisKey}/${join(parentKey, separator)}`)
const totalParts = size(keyParts) }
// remove from parent in tree node
const parentKey = slice(keyParts, 0, totalParts - 1)
let parentNode
if (isEmpty(parentKey)) {
parentNode = dbRoot
} else {
parentNode = nodeMap.get(`${ConnectionType.RedisKey}/${join(parentKey, separator)}`)
}
// not found parent node // not found parent node
if (parentNode == null) { if (parentNode == null) {
return false return false
} }
remove(parentNode.children, { remove(parentNode.children, {
type: isLayer ? ConnectionType.RedisKey : ConnectionType.RedisValue, type: isLayer ? ConnectionType.RedisKey : ConnectionType.RedisValue,
redisKey: key, redisKey: key,
}) })
// check and remove empty layer node // check and remove empty layer node
let i = totalParts - 1 let i = totalParts - 1
for (; i >= 0; i--) { for (; i >= 0; i--) {
const anceKey = join(slice(keyParts, 0, i), separator) const anceKey = join(slice(keyParts, 0, i), separator)
if (i > 0) { if (i > 0) {
const anceNode = nodeMap.get(`${ConnectionType.RedisKey}/${anceKey}`) const anceNode = nodeMap.get(`${ConnectionType.RedisKey}/${anceKey}`)
const redisKey = join(slice(keyParts, 0, i + 1), separator) const redisKey = join(slice(keyParts, 0, i + 1), separator)
remove(anceNode.children, { type: ConnectionType.RedisKey, redisKey }) remove(anceNode.children, { type: ConnectionType.RedisKey, redisKey })
if (isEmpty(anceNode.children)) { if (isEmpty(anceNode.children)) {
nodeMap.delete(`${ConnectionType.RedisKey}/${anceKey}`) nodeMap.delete(`${ConnectionType.RedisKey}/${anceKey}`)
} else {
break
}
} else { } else {
// last one, remove from db node break
remove(dbRoot.children, { type: ConnectionType.RedisKey, redisKey: keyParts[0] })
} }
} else {
// last one, remove from db node
remove(dbRoot.children, { type: ConnectionType.RedisKey, redisKey: keyParts[0] })
} }
} }
@ -1319,28 +1311,24 @@ const useConnectionStore = defineStore('connections', {
/** /**
* delete node and all it's children from nodeMap * delete node and all it's children from nodeMap
* @param {Map<string, DatabaseItem>} nodeMap * @param nodeMap
* @param {string} [key] clean nodeMap if key is empty * @param key
* @private * @private
*/ */
_deleteChildrenKeyNodes(nodeMap, key) { _deleteChildrenKeyNodes(nodeMap, key) {
if (isEmpty(key)) { const mapKey = `${ConnectionType.RedisKey}/${key}`
nodeMap.clear() const node = nodeMap.get(mapKey)
} else { for (const child of node.children || []) {
const mapKey = `${ConnectionType.RedisKey}/${key}` if (child.type === ConnectionType.RedisValue) {
const node = nodeMap.get(mapKey) if (!nodeMap.delete(`${ConnectionType.RedisValue}/${child.redisKey}`)) {
for (const child of node.children || []) { console.warn('delete:', `${ConnectionType.RedisValue}/${child.redisKey}`)
if (child.type === ConnectionType.RedisValue) {
if (!nodeMap.delete(`${ConnectionType.RedisValue}/${child.redisKey}`)) {
console.warn('delete:', `${ConnectionType.RedisValue}/${child.redisKey}`)
}
} else if (child.type === ConnectionType.RedisKey) {
this._deleteChildrenKeyNodes(nodeMap, child.redisKey)
} }
} else if (child.type === ConnectionType.RedisKey) {
this._deleteChildrenKeyNodes(nodeMap, child.redisKey)
} }
if (!nodeMap.delete(mapKey)) { }
console.warn('delete map key', mapKey) if (!nodeMap.delete(mapKey)) {
} console.warn('delete map key', mapKey)
} }
}, },

View File

@ -31,11 +31,6 @@ const usePreferencesStore = defineStore('preferences', {
* @returns {Preferences} * @returns {Preferences}
*/ */
state: () => ({ state: () => ({
behavior: {
asideWidth: 300,
windowWidth: 0,
windowHeight: 0,
},
general: { general: {
theme: 'auto', theme: 'auto',
language: 'en', language: 'en',
@ -45,6 +40,7 @@ const usePreferencesStore = defineStore('preferences', {
useSysProxyHttp: false, useSysProxyHttp: false,
checkUpdate: false, checkUpdate: false,
skipVersion: '', skipVersion: '',
asideWidth: 300,
}, },
editor: { editor: {
font: '', font: '',
@ -215,12 +211,7 @@ const usePreferencesStore = defineStore('preferences', {
} }
return result return result
} }
const pf = Object.assign( const pf = Object.assign({}, obj2Map('general', this.general), obj2Map('editor', this.editor))
{},
obj2Map('behavior', this.behavior),
obj2Map('general', this.general),
obj2Map('editor', this.editor),
)
const { success, msg } = await SetPreferences(pf) const { success, msg } = await SetPreferences(pf)
return success === true return success === true
}, },
@ -250,7 +241,7 @@ const usePreferencesStore = defineStore('preferences', {
}, },
setAsideWidth(width) { setAsideWidth(width) {
this.behavior.asideWidth = width this.general.asideWidth = width
}, },
async checkForUpdate(manual = false) { async checkForUpdate(manual = false) {

View File

@ -83,10 +83,9 @@ const useTabStore = defineStore('tab', {
* @param {number} [type] * @param {number} [type]
* @param {number} [ttl] * @param {number} [ttl]
* @param {string} [key] * @param {string} [key]
* @param {number} [size]
* @param {*} [value] * @param {*} [value]
*/ */
upsertTab({ server, db, type, ttl, key, size, value }) { upsertTab({ server, db, type, ttl, key, value }) {
let tabIndex = findIndex(this.tabList, { name: server }) let tabIndex = findIndex(this.tabList, { name: server })
if (tabIndex === -1) { if (tabIndex === -1) {
this.tabList.push({ this.tabList.push({
@ -96,7 +95,6 @@ const useTabStore = defineStore('tab', {
type, type,
ttl, ttl,
key, key,
size,
value, value,
}) })
tabIndex = this.tabList.length - 1 tabIndex = this.tabList.length - 1
@ -110,7 +108,6 @@ const useTabStore = defineStore('tab', {
tab.type = type tab.type = type
tab.ttl = ttl tab.ttl = ttl
tab.key = key tab.key = key
tab.size = size
tab.value = value tab.value = value
this._setActivatedIndex(tabIndex, true) this._setActivatedIndex(tabIndex, true)
// this.activatedTab = tab.name // this.activatedTab = tab.name

View File

@ -86,10 +86,6 @@ body {
gap: 5px; gap: 5px;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
.tb2-extra-info {
padding: 0 5px;
}
} }
.value-wrapper { .value-wrapper {

17
main.go
View File

@ -10,9 +10,7 @@ import (
"github.com/wailsapp/wails/v2/pkg/options/linux" "github.com/wailsapp/wails/v2/pkg/options/linux"
"github.com/wailsapp/wails/v2/pkg/options/mac" "github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows" "github.com/wailsapp/wails/v2/pkg/options/windows"
runtime2 "github.com/wailsapp/wails/v2/pkg/runtime"
"runtime" "runtime"
"tinyrdm/backend/consts"
"tinyrdm/backend/services" "tinyrdm/backend/services"
) )
@ -30,7 +28,6 @@ func main() {
connSvc := services.Connection() connSvc := services.Connection()
prefSvc := services.Preferences() prefSvc := services.Preferences()
prefSvc.SetAppVersion(version) prefSvc.SetAppVersion(version)
windowWidth, windowHeight := prefSvc.GetWindowSize()
// menu // menu
appMenu := menu.NewMenu() appMenu := menu.NewMenu()
@ -43,10 +40,10 @@ func main() {
// Create application with options // Create application with options
err := wails.Run(&options.App{ err := wails.Run(&options.App{
Title: "Tiny RDM", Title: "Tiny RDM",
Width: windowWidth, Width: 1024,
Height: windowHeight, Height: 768,
MinWidth: consts.DEFAULT_WINDOW_WIDTH, MinWidth: 1024,
MinHeight: consts.DEFAULT_WINDOW_HEIGHT, MinHeight: 768,
Frameless: runtime.GOOS != "darwin", Frameless: runtime.GOOS != "darwin",
Menu: appMenu, Menu: appMenu,
AssetServer: &assetserver.Options{ AssetServer: &assetserver.Options{
@ -58,12 +55,6 @@ func main() {
connSvc.Start(ctx) connSvc.Start(ctx)
}, },
OnShutdown: func(ctx context.Context) { OnShutdown: func(ctx context.Context) {
// save current window size
width, height := runtime2.WindowGetSize(ctx)
if width > 0 && height > 0 {
prefSvc.SaveWindowSize(width, height)
}
connSvc.Stop(ctx) connSvc.Stop(ctx)
}, },
Bind: []interface{}{ Bind: []interface{}{