mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 21:17:59 +00:00
Added meaningful window titles
This commit is contained in:
parent
be4e3e778e
commit
abc9df0897
@ -3,6 +3,7 @@
|
|||||||
* Display host and database statistics generated by the corresponding diagnostic MongoDB commands in addition to collection stats (#15).
|
* Display host and database statistics generated by the corresponding diagnostic MongoDB commands in addition to collection stats (#15).
|
||||||
* Added version number of the running Rolens instance in the about dialog (#25, #28).
|
* Added version number of the running Rolens instance in the about dialog (#25, #28).
|
||||||
* Fixed host/database selection bug in grid.
|
* Fixed host/database selection bug in grid.
|
||||||
|
* Added meaningful window titles, and actually show these in the title bar (macOS).
|
||||||
|
|
||||||
## [v0.2.0]
|
## [v0.2.0]
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
import environment from '$lib/stores/environment';
|
import environment from '$lib/stores/environment';
|
||||||
import hosts from '$lib/stores/hosts';
|
import hosts from '$lib/stores/hosts';
|
||||||
import applicationInited from '$lib/stores/inited';
|
import applicationInited from '$lib/stores/inited';
|
||||||
|
import windowTitle from '$lib/stores/windowtitle';
|
||||||
import About from '$organisms/about.svelte';
|
import About from '$organisms/about.svelte';
|
||||||
import Connection from '$organisms/connection/index.svelte';
|
import Connection from '$organisms/connection/index.svelte';
|
||||||
import Settings from '$organisms/settings/index.svelte';
|
import Settings from '$organisms/settings/index.svelte';
|
||||||
@ -42,7 +43,7 @@
|
|||||||
<svelte:window on:contextmenu|preventDefault />
|
<svelte:window on:contextmenu|preventDefault />
|
||||||
|
|
||||||
<div id="root" class="platform-{$environment?.platform}">
|
<div id="root" class="platform-{$environment?.platform}">
|
||||||
<div class="titlebar"></div>
|
<div class="titlebar">{$windowTitle}</div>
|
||||||
|
|
||||||
{#if $applicationInited && $hosts && (showWelcomeScreen !== undefined)}
|
{#if $applicationInited && $hosts && (showWelcomeScreen !== undefined)}
|
||||||
<main class:empty={showWelcomeScreen}>
|
<main class:empty={showWelcomeScreen}>
|
||||||
@ -69,6 +70,10 @@
|
|||||||
height: 0;
|
height: 0;
|
||||||
background-color: #00002a;
|
background-color: #00002a;
|
||||||
--wails-draggable: drag;
|
--wails-draggable: drag;
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
#root.platform-darwin .titlebar {
|
#root.platform-darwin .titlebar {
|
||||||
height: var(--darwin-titlebar-height);
|
height: var(--darwin-titlebar-height);
|
||||||
|
14
frontend/src/lib/stores/windowtitle.js
Normal file
14
frontend/src/lib/stores/windowtitle.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { WindowSetTitle } from "$wails/runtime/runtime";
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
|
const { set, subscribe } = writable('Rolens');
|
||||||
|
|
||||||
|
subscribe(newTitle => WindowSetTitle(newTitle));
|
||||||
|
|
||||||
|
const windowTitle = {
|
||||||
|
set,
|
||||||
|
setSegments: (...segments) => set(segments.map(s => s.trim()).join(' — ')),
|
||||||
|
subscribe,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default windowTitle;
|
@ -2,11 +2,11 @@
|
|||||||
import Grid from '$components/grid.svelte';
|
import Grid from '$components/grid.svelte';
|
||||||
import { startProgress } from '$lib/progress';
|
import { startProgress } from '$lib/progress';
|
||||||
import connections from '$lib/stores/connections';
|
import connections from '$lib/stores/connections';
|
||||||
import { WindowSetTitle } from '$wails/runtime/runtime';
|
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import { DropCollection, DropDatabase, OpenCollection, OpenConnection, OpenDatabase, RemoveHost, TruncateCollection } from '../../../wailsjs/go/app/App';
|
import { DropCollection, DropDatabase, OpenCollection, OpenConnection, OpenDatabase, RemoveHost, TruncateCollection } from '../../../wailsjs/go/app/App';
|
||||||
import hosts from '$lib/stores/hosts';
|
import hosts from '$lib/stores/hosts';
|
||||||
import { tick } from 'svelte';
|
import { tick } from 'svelte';
|
||||||
|
import windowTitle from '$lib/stores/windowtitle';
|
||||||
|
|
||||||
export let activeHostKey = '';
|
export let activeHostKey = '';
|
||||||
export let activeDbKey = '';
|
export let activeDbKey = '';
|
||||||
@ -50,10 +50,13 @@
|
|||||||
|
|
||||||
activeHostKey = hostKey;
|
activeHostKey = hostKey;
|
||||||
dispatch('connected', hostKey);
|
dispatch('connected', hostKey);
|
||||||
WindowSetTitle(`${$hosts[activeHostKey].name} - Rolens`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progress.end();
|
progress.end();
|
||||||
|
|
||||||
|
if (databases) {
|
||||||
|
windowTitle.setSegments($hosts[activeHostKey].name, 'Rolens');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeHost(hostKey) {
|
async function removeHost(hostKey) {
|
||||||
@ -80,6 +83,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
progress.end();
|
progress.end();
|
||||||
|
windowTitle.setSegments(activeDbKey, $hosts[activeHostKey].name, 'Rolens');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function dropDatabase(dbKey) {
|
async function dropDatabase(dbKey) {
|
||||||
@ -100,6 +104,7 @@
|
|||||||
$connections[activeHostKey].databases[activeDbKey].collections[collKey] = $connections[activeHostKey].databases[activeDbKey].collections[collKey] || {};
|
$connections[activeHostKey].databases[activeDbKey].collections[collKey] = $connections[activeHostKey].databases[activeDbKey].collections[collKey] || {};
|
||||||
$connections[activeHostKey].databases[activeDbKey].collections[collKey].stats = stats;
|
$connections[activeHostKey].databases[activeDbKey].collections[collKey].stats = stats;
|
||||||
progress.end();
|
progress.end();
|
||||||
|
windowTitle.setSegments(activeDbKey + '.' + activeCollKey, $hosts[activeHostKey].name, 'Rolens');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function truncateCollection(dbKey, collKey) {
|
async function truncateCollection(dbKey, collKey) {
|
||||||
|
Loading…
Reference in New Issue
Block a user