From ce9934faa71d25e191f8e2d609eac19d91f52c94 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Thu, 29 Jun 2023 09:50:18 +0200 Subject: [PATCH] Update shortcuts (fixes #51) --- INSTALL.md | 26 +-------------- docs/development/advanced-build.md | 33 +++++++++++++++++++ docs/development/build-directory.md | 2 +- docs/{user-guide => development}/logfiles.md | 4 +-- docs/user-guide/collections.md | 4 ++- docs/user-guide/databases.md | 7 +++- docs/user-guide/hosts.md | 7 +++- docs/user-guide/shortcuts.liquid | 12 +++++++ .../collection/dialogs/export.svelte | 2 +- .../src/organisms/connection/index.svelte | 2 +- internal/app/app_menu.go | 29 ++++++++-------- website/data/shortcuts.json | 26 ++++++++++----- website/includes/shortcut.liquid | 3 +- website/sass/styles.scss | 9 +++++ 14 files changed, 109 insertions(+), 57 deletions(-) create mode 100644 docs/development/advanced-build.md rename docs/{user-guide => development}/logfiles.md (94%) create mode 100644 docs/user-guide/shortcuts.liquid diff --git a/INSTALL.md b/INSTALL.md index b507366..30a24b0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -23,28 +23,4 @@ If you have Node.js installed, just download the source from GitHub, and run `./ ## Advanced build -### Prerequisites - -Rolens is written in Go, so you should download the Go compiler from [the download page](https://go.dev/dl/). The minimum version required is 1.18. You can confirm whether it's installed correctly by running `go version` and checking that it outputs something similar to `go1.18.2`. - -Furthermore, you need to have [Wails ^3.1](https://wails.io/docs/gettingstarted/installation) installed: `go install github.com/wailsapp/wails/v2/cmd/wails@latest`. Wails may have platform-specific dependencies; you can consult `wails doctor` to find out what dependencies Wails needs and how to install them. - -In order to compile the frontend, [Node.js](https://nodejs.org/en/download) ^16.0 and the [npm](https://npmjs.com) package manager ^8.0 (included in Node.js) are required. To confirm the installed versions of those tools, execute `node -v` and `npm -v`. - -### Download source - -To obtain a copy of the source code, do either of the following: - -* Download a tarball or zip archive from the [release page](https://github.com/garraflavatra/rolens/releases/latest). Make sure you download the source archive, and not a pre-compiled binary. -* Or clone [the Git repository](https://github.com/garraflavatra/rolens): `git clone https://github.com/garraflavatra/rolens.git`. - -### Compile - -`cd` into the root directory of the source code and run either: - -* `wails build` to generate an executable for your platform. -* `wails build -nsis` to generate an [NSIS installer](https://nsis.sourceforge.io/Main_Page) for Windows. This requires that you have NSIS installed on your machine. - -The generated binary will live in `build/bin`. You may want to run the installer (Windows) or move the app to the Applications folder (Mac). - -If Wails complains that there are too many open files, you can try to increase the maximum number of open files using [`ulimit -f 1024`](https://www.man7.org/linux/man-pages/man1/ulimit.1p.html) (or whichever value) on *nix systems. +Please see the [advanced build documentation](https://garraflavatra.github.io/rolens/development/advanced-build/) for a more profound insight in the build procedure. diff --git a/docs/development/advanced-build.md b/docs/development/advanced-build.md new file mode 100644 index 0000000..8640fb3 --- /dev/null +++ b/docs/development/advanced-build.md @@ -0,0 +1,33 @@ +--- +title: Advanced build process +parent: Development +order: 10 +--- + +If you just want to install Rolens, please refer to the [installation document](https://garraflavatra.github.io/rolens/installation/). You can read this guide to get a detailed overview of the build procedure. + +### Prerequisites + +Rolens is written in Go, so you should download the Go compiler from [the download page](https://go.dev/dl/). The minimum version required is 1.18. You can confirm whether it's installed correctly by running `go version` and checking that it outputs something similar to `go1.18.2`. + +Furthermore, you need to have [Wails ^3.1](https://wails.io/docs/gettingstarted/installation) installed: `go install github.com/wailsapp/wails/v2/cmd/wails@latest`. Wails may have platform-specific dependencies; you can consult `wails doctor` to find out what dependencies Wails needs and how to install them. + +In order to compile the frontend, [Node.js](https://nodejs.org/en/download) ^16.0 and the [npm](https://npmjs.com) package manager ^8.0 (included in Node.js) are required. To confirm the installed versions of those tools, execute `node -v` and `npm -v`. + +### Download source + +To obtain a copy of the source code, do either of the following: + +* Download a tarball or zip archive from the [release page](https://github.com/garraflavatra/rolens/releases/latest). Make sure you download the source archive, and not a pre-compiled binary. +* Or clone [the Git repository](https://github.com/garraflavatra/rolens): `git clone https://github.com/garraflavatra/rolens.git`. + +### Compile + +`cd` into the root directory of the source code and run either: + +* `wails build` to generate an executable for your platform. +* `wails build -nsis` to generate an [NSIS installer](https://nsis.sourceforge.io/Main_Page) for Windows. This requires that you have NSIS installed on your machine. + +The generated binary will live in `build/bin`. You may want to run the installer (Windows) or move the app to the Applications folder (Mac). + +If Wails complains that there are too many open files, you can try to increase the maximum number of open files using [`ulimit -f 1024`](https://www.man7.org/linux/man-pages/man1/ulimit.1p.html) (or whichever value) on *nix systems. diff --git a/docs/development/build-directory.md b/docs/development/build-directory.md index 87a5f19..5f3d787 100644 --- a/docs/development/build-directory.md +++ b/docs/development/build-directory.md @@ -1,7 +1,7 @@ --- title: Build directory parent: Development -order: 50 +order: 30 --- {% filecontent "../build/README.md", 2 %} diff --git a/docs/user-guide/logfiles.md b/docs/development/logfiles.md similarity index 94% rename from docs/user-guide/logfiles.md rename to docs/development/logfiles.md index fbc4c3b..35bc730 100644 --- a/docs/user-guide/logfiles.md +++ b/docs/development/logfiles.md @@ -1,7 +1,7 @@ --- title: Logfiles -parent: User guide -order: 120 +parent: Development +order: 40 --- Rolens keeps track of log-worthy events and logs them in its log directory. diff --git a/docs/user-guide/collections.md b/docs/user-guide/collections.md index 5683513..473e87e 100644 --- a/docs/user-guide/collections.md +++ b/docs/user-guide/collections.md @@ -4,6 +4,8 @@ parent: User guide order: 30 --- +## Shortcuts + You can use the following shortcuts when you have opened a collection. -{% render "shortcuts", shortcuts: shortcuts.collections %} +{% render "shortcuts", shortcuts: shortcuts["Managing collections"] %} diff --git a/docs/user-guide/databases.md b/docs/user-guide/databases.md index f2b658d..0ac7772 100644 --- a/docs/user-guide/databases.md +++ b/docs/user-guide/databases.md @@ -2,5 +2,10 @@ title: Databases parent: User guide order: 20 -stub: true --- + +## Shortcuts + +You can use the following shortcuts when you have opened a database. + +{% render "shortcuts", shortcuts: shortcuts["Managing databases"] %} diff --git a/docs/user-guide/hosts.md b/docs/user-guide/hosts.md index e82cb1c..b6a0f45 100644 --- a/docs/user-guide/hosts.md +++ b/docs/user-guide/hosts.md @@ -2,5 +2,10 @@ title: Managing hosts parent: User guide order: 10 -stub: true --- + +## Shortcuts + +You can use the following shortcuts to manage hosts and connections. + +{% render "shortcuts", shortcuts: shortcuts["Connecting to hosts"] %} diff --git a/docs/user-guide/shortcuts.liquid b/docs/user-guide/shortcuts.liquid new file mode 100644 index 0000000..2ead588 --- /dev/null +++ b/docs/user-guide/shortcuts.liquid @@ -0,0 +1,12 @@ +--- +title: Shortcut reference +parent: User guide +order: 900 +--- + +

You can use the following shortcuts to manage hosts and connections.

+ +{% for item in shortcuts %} +

{{ item[0] }}

+ {% render "shortcuts", shortcuts: item[1] %} +{% endfor %} diff --git a/frontend/src/organisms/connection/collection/dialogs/export.svelte b/frontend/src/organisms/connection/collection/dialogs/export.svelte index e3a5689..d680a47 100644 --- a/frontend/src/organisms/connection/collection/dialogs/export.svelte +++ b/frontend/src/organisms/connection/collection/dialogs/export.svelte @@ -5,7 +5,7 @@ import { createEventDispatcher } from 'svelte'; export let collection; - export let query = undefined; + export let query = {}; const dispatch = createEventDispatcher(); const exportInfo = { ...query, viewKey: collection.viewKey }; diff --git a/frontend/src/organisms/connection/index.svelte b/frontend/src/organisms/connection/index.svelte index 3a5a94a..a730686 100644 --- a/frontend/src/organisms/connection/index.svelte +++ b/frontend/src/organisms/connection/index.svelte @@ -38,10 +38,10 @@ }); EventsOn('ui.coll.new', () => $hostTree[activeHostKey]?.databases[activeDbKey]?.newCollection()); + EventsOn('ui.coll.export', () => $hostTree[activeHostKey]?.databases[activeDbKey]?.collections[activeCollKey]?.export()); EventsOn('ui.coll.truncate', () => $hostTree[activeHostKey]?.databases[activeDbKey]?.collections[activeCollKey]?.truncate()); EventsOn('ui.coll.drop', () => $hostTree[activeHostKey]?.databases[activeDbKey]?.collections[activeCollKey]?.drop()); EventsOn('ui.coll.tab', tab => collTab = tab); -
diff --git a/internal/app/app_menu.go b/internal/app/app_menu.go index 68477ec..365f03f 100644 --- a/internal/app/app_menu.go +++ b/internal/app/app_menu.go @@ -41,11 +41,11 @@ func (a *App) Menu() *menu.Menu { appMenu.Append(menu.EditMenu()) } - aboutMenu.AddText("Quit Rolens", keys.CmdOrCtrl("q"), func(cd *menu.CallbackData) { wailsRuntime.Quit(a.ctx) }) + aboutMenu.AddText("Quit Rolens", keys.CmdOrCtrl("Q"), func(cd *menu.CallbackData) { wailsRuntime.Quit(a.ctx) }) hostMenu := appMenu.AddSubmenu("Host") - hostMenu.AddText("New…", nil, menuCallbackEmit(a, "ui.host.new")) - hostMenu.AddText("Edit host…", nil, menuCallbackEmit(a, "ui.host.edit")) + hostMenu.AddText("New…", keys.OptionOrAlt("C"), menuCallbackEmit(a, "ui.host.new")) + hostMenu.AddText("Edit host…", keys.OptionOrAlt("H"), menuCallbackEmit(a, "ui.host.edit")) hostMenu.AddSeparator() hostMenu.AddText("Server status", nil, menuCallbackEmit(a, "ui.host.tab", "status")) hostMenu.AddText("System info", nil, menuCallbackEmit(a, "ui.host.tab", "systemInfo")) @@ -54,7 +54,7 @@ func (a *App) Menu() *menu.Menu { hostMenu.AddText("Remove host…", nil, menuCallbackEmit(a, "ui.host.remove")) dbMenu := appMenu.AddSubmenu("Database") - dbMenu.AddText("New…", nil, menuCallbackEmit(a, "ui.db.new")) + dbMenu.AddText("New…", keys.OptionOrAlt("D"), menuCallbackEmit(a, "ui.db.new")) dbMenu.AddSeparator() dbMenu.AddText("Database statistics", nil, menuCallbackEmit(a, "ui.db.tab", "stats")) dbMenu.AddText("Shell", nil, menuCallbackEmit(a, "ui.db.tab", "shell")) @@ -63,22 +63,23 @@ func (a *App) Menu() *menu.Menu { dbMenu.AddText("Drop…", nil, menuCallbackEmit(a, "ui.db.drop")) collMenu := appMenu.AddSubmenu("Collection") - collMenu.AddText("New…", nil, menuCallbackEmit(a, "ui.coll.new")) + collMenu.AddText("New…", keys.OptionOrAlt("T"), menuCallbackEmit(a, "ui.coll.new")) collMenu.AddSeparator() - collMenu.AddText("Collection statistics", nil, menuCallbackEmit(a, "ui.coll.tab", "stats")) - collMenu.AddText("Find", nil, menuCallbackEmit(a, "ui.coll.tab", "find")) - collMenu.AddText("Insert", nil, menuCallbackEmit(a, "ui.coll.tab", "insert")) - collMenu.AddText("Update", nil, menuCallbackEmit(a, "ui.coll.tab", "update")) - collMenu.AddText("Remove", nil, menuCallbackEmit(a, "ui.coll.tab", "remove")) - collMenu.AddText("Indexes", nil, menuCallbackEmit(a, "ui.coll.tab", "indexes")) - collMenu.AddText("Aggregate", nil, menuCallbackEmit(a, "ui.coll.tab", "aggregate")) - collMenu.AddText("Shell", nil, menuCallbackEmit(a, "ui.coll.tab", "shell")) + collMenu.AddText("Collection statistics", keys.Combo("S", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "stats")) + collMenu.AddText("Find", keys.Combo("F", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "find")) + collMenu.AddText("Insert", keys.Combo("I", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "insert")) + collMenu.AddText("Update", keys.Combo("P", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "update")) + collMenu.AddText("Remove", keys.Combo("R", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "remove")) + collMenu.AddText("Indexes", keys.Combo("X", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "indexes")) + collMenu.AddText("Aggregate", keys.Combo("A", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "aggregate")) + collMenu.AddText("Shell", keys.Combo("H", keys.CmdOrCtrlKey, keys.ShiftKey), menuCallbackEmit(a, "ui.coll.tab", "shell")) collMenu.AddSeparator() + collMenu.AddText("Export…", keys.OptionOrAlt("E"), menuCallbackEmit(a, "ui.coll.exort")) collMenu.AddText("Truncate…", nil, menuCallbackEmit(a, "ui.coll.truncate")) collMenu.AddText("Drop…", nil, menuCallbackEmit(a, "ui.coll.drop")) helpMenu := appMenu.AddSubmenu("Help") - helpMenu.AddText("User guide", nil, menuCallbackOpenURL(a, "https://garraflavatra.github.io/rolens/user-guide/")) + helpMenu.AddText("User guide", keys.CmdOrCtrl("/"), menuCallbackOpenURL(a, "https://garraflavatra.github.io/rolens/user-guide/")) helpMenu.AddText("Website", nil, menuCallbackOpenURL(a, "https://garraflavatra.github.io/rolens/")) helpMenu.AddText("Discussion board", nil, menuCallbackOpenURL(a, "https://github.com/garraflavatra/rolens/discussions")) helpMenu.AddSeparator() diff --git a/website/data/shortcuts.json b/website/data/shortcuts.json index ec536df..46b992d 100644 --- a/website/data/shortcuts.json +++ b/website/data/shortcuts.json @@ -1,14 +1,22 @@ { - "collections": [ - { "description": "Open Stats panel", "option": true, "ctrl": true, "symbol": "H", "link": "/user-guide/collections/stats/" }, - { "description": "Open Find panel", "option": true, "ctrl": true, "symbol": "F", "link": "/user-guide/collections/find/" }, - { "description": "Open Insert panel", "option": true, "ctrl": true, "symbol": "I", "link": "/user-guide/collections/insert/" }, - { "description": "Open Update panel", "option": true, "ctrl": true, "symbol": "U", "link": "/user-guide/collections/update/" }, - { "description": "Open Remove panel", "option": true, "ctrl": true, "symbol": "R", "link": "/user-guide/collections/remove/" }, - { "description": "Open Indexes panel", "option": true, "ctrl": true, "symbol": "X", "link": "/user-guide/collections/indexes/" }, - { "description": "Open Aggregate panel", "option": true, "ctrl": true, "symbol": "A", "link": "/user-guide/collections/aggregate/" } + "Connecting to hosts": [ + { "description": "Create a new host", "option": true, "symbol": "C", "link": "/user-guide/hosts/" }, + { "description": "Edit host", "option": true, "symbol": "H", "link": "/user-guide/hosts/" } ], - "preferences": [ + "Managing databases": [ + { "description": "Create a new database", "option": true, "symbol": "D", "link": "/user-guide/databases/" } + ], + "Managing collections": [ + { "description": "Open collection statistics", "shift": true, "ctrl": true, "symbol": "S", "link": "/user-guide/collections/stats/" }, + { "description": "Open find panel", "shift": true, "ctrl": true, "symbol": "F", "link": "/user-guide/collections/find/" }, + { "description": "Open insert panel", "shift": true, "ctrl": true, "symbol": "I", "link": "/user-guide/collections/insert/" }, + { "description": "Open update panel", "shift": true, "ctrl": true, "symbol": "P", "link": "/user-guide/collections/update/" }, + { "description": "Open remove panel", "shift": true, "ctrl": true, "symbol": "R", "link": "/user-guide/collections/remove/" }, + { "description": "Show indexes", "shift": true, "ctrl": true, "symbol": "X", "link": "/user-guide/collections/indexes/" }, + { "description": "Aggregate", "shift": true, "ctrl": true, "symbol": "A", "link": "/user-guide/collections/aggregate/" }, + { "description": "Open shell", "shift": true, "ctrl": true, "symbol": "H", "link": "/user-guide/collections/aggregate/" } + ], + "Preferences": [ { "description": "Open preferences", "ctrl": true, "symbol": ",", "link": "/user-guide/preferences/" } ] } diff --git a/website/includes/shortcut.liquid b/website/includes/shortcut.liquid index b93f257..1df7ba1 100644 --- a/website/includes/shortcut.liquid +++ b/website/includes/shortcut.liquid @@ -1,3 +1,4 @@ +{%- if shortcut.shift -%}{%- endif -%} {%- if shortcut.option -%}{%- endif -%} {%- if shortcut.ctrl -%}{%- endif -%} -{%- if shortcut.symbol -%}{{ shortcut.symbol }}{%- endif -%} +{%- if shortcut.symbol -%}{{ shortcut.symbol | upcase }}{%- endif -%} diff --git a/website/sass/styles.scss b/website/sass/styles.scss index ad48532..8ca23e2 100644 --- a/website/sass/styles.scss +++ b/website/sass/styles.scss @@ -294,3 +294,12 @@ article { stroke: none; } } + +// PRINT + +@media print { + main > aside, + article footer > p:not(:last-child) { + display: none; + } +}