1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-19 22:18:03 +00:00

Export refinements

This commit is contained in:
2023-02-16 20:19:04 +01:00
parent 38ef130684
commit 715519b06d
4 changed files with 58 additions and 67 deletions

View File

@ -36,8 +36,8 @@
<svelte:window on:keydown={keydown} />
{#if show}
<div class="modal outer" on:mousedown|self={() => show = false} transition:fade>
<div class="inner" style:max-width={width || '80vw'} transition:fly={{ y: 100 }}>
<div class="modal outer" transition:fade>
<div class="inner" style:max-width={width || '80vw'} transition:fly={{ y: -100 }}>
{#if title}
<header>
<div class="title">{title}</div>
@ -68,7 +68,6 @@
background-color: rgba(0, 0, 0, 0.5);
margin: 0;
padding-top: 50px;
cursor: pointer;
}
:global(#root.platform-darwin) .outer {
margin-top: var(--darwin-titlebar-height);

View File

@ -74,26 +74,36 @@
<Modal bind:show={info} title={actionLabel[info?.type]}>
<form on:submit|preventDefault={performExport}>
<div class="meta">
<!-- svelte-ignore a11y-label-has-associated-control - input is in DirectoryChooser -->
<label class="field">
<span class="label">Output directory</span>
<DirectoryChooser bind:value={info.outdir} />
</label>
<label class="field">
<span class="label">Filename</span>
<input type="text" bind:value={info.filename} />
<select bind:value={info.filetype} class="filetype">
<optgroup label="Dump (mongodump)">
<option value="bson">.bson</option>
</optgroup>
<optgroup label="Export (mongoexport)">
<option value="csv">.csv</option>
<option value="json">.json</option>
</optgroup>
</select>
</label>
<!-- svelte-ignore a11y-label-has-associated-control - input is in DirectoryChooser -->
<label class="field">
<span class="label">Output destination:</span>
<DirectoryChooser bind:value={info.outdir} />
<span class="label">/</span>
<input type="text" bind:value={info.filename} />
<span class="label">.</span>
<select bind:value={info.filetype} class="filetype">
<optgroup label="Dump (via mongodump)">
<option value="bson">bson</option>
</optgroup>
<optgroup label="Export">
<option value="csv">csv</option>
<option value="json">json</option>
</optgroup>
</select>
</label>
<div class="options">
{#if info.filetype === 'json'}
<label class="field">
<span class="label">Separate items using:</span>
<select bind:value={info.jsonType}>
<option value="newline">Newline</option>
<option value="array">JSON array</option>
</select>
</label>
{/if}
</div>
<div class="location">
<div class="grid">
<Grid
@ -154,7 +164,8 @@
<style>
form {
display: grid;
grid-template: auto / 1fr;
grid-template: auto auto 1fr auto / 1fr;
gap: 0.5rem;
}
.location {
display: grid;
@ -163,17 +174,9 @@
}
.location .grid {
border: 1px solid #ccc;
padding: 0.3rem;
overflow-y: auto;
}
.meta {
display: grid;
grid-template: 1fr / 1fr 1fr;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
select.filetype {
flex: 0 1;
}

View File

@ -102,8 +102,8 @@
name: collKey,
icon: 'list',
menu: [
{ label: 'Export collection (JSON/CSV, mongoexport)…', fn: () => dispatch('exportCollection', collKey) },
{ label: 'Dump collection (BSON, mongodump)…', fn: () => dispatch('dumpCollection', collKey) },
{ label: 'Export collection (JSON, CSV)…', fn: () => dispatch('exportCollection', collKey) },
{ label: 'Dump collection (BSON via mongodump)…', fn: () => dispatch('dumpCollection', collKey) },
{ separator: true },
{ label: 'Rename collection…', fn: () => dispatch('renameCollection', collKey) },
{ label: 'Truncate collection…', fn: () => truncateCollection(dbKey, collKey) },