1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-06-28 05:25:11 +00:00

Added shell documentation

This commit is contained in:
2023-07-19 20:45:05 +02:00
parent 77747c10c2
commit 43fce1f27e
4 changed files with 41 additions and 2 deletions

View File

@ -29,12 +29,16 @@
height: 13px;
margin-right: 2px;
}
:global(.button) svg {
height: 13px;
width: auto;
vertical-align: bottom;
}
:global(.blankstate .button) svg {
height: 17px;
vertical-align: -3px;
margin-right: 4px;
}
</style>
<svg

View File

@ -2,7 +2,9 @@
import BlankState from '$components/blankstate.svelte';
import CodeEditor from '$components/codeeditor.svelte';
import Icon from '$components/icon.svelte';
import environment from '$lib/stores/environment';
import { OpenShellScript, SaveShellScript } from '$wails/go/app/App';
import { BrowserOpenURL } from '$wails/runtime/runtime';
import { javascript } from '@codemirror/lang-javascript';
import { onDestroy, onMount } from 'svelte';
@ -22,6 +24,10 @@
let editor;
async function runScript() {
if (!$environment.hasMongoDump) {
return;
}
busy = true;
if (collection) {
@ -77,6 +83,10 @@
horizontal = !horizontal;
}
function openMongoshInstallDocs() {
BrowserOpenURL('https://garraflavatra.github.io/rolens/user-guide/shell/');
}
$: visible && editor.focus();
onMount(() => {
@ -108,7 +118,17 @@
</div>
<div class="output">
{#if busy}
{#if !$environment.hasMongoShell}
<BlankState
title="mongosh is required to run shell scripts"
label="Please refer to the documentation for more information."
icon="!"
>
<button class="button" on:click={openMongoshInstallDocs}>
<Icon name="info" /> Read the documentation
</button>
</BlankState>
{:else if busy}
<BlankState icon="loading" label="Executing…" />
{:else if result.errorTitle || result.errorDescription}
<BlankState title={result.errorTitle} label={result.errorDescription} icon="!">