mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-17 21:44:05 +00:00
Started work on indexes
This commit is contained in:
@ -1,13 +1,43 @@
|
||||
<script>
|
||||
import CodeViewer from '../../../components/codeviewer.svelte';
|
||||
import ObjectGrid from '../../../components/objectgrid.svelte';
|
||||
import { GetIndexes } from '../../../../wailsjs/go/app/App';
|
||||
|
||||
export let collection;
|
||||
|
||||
const indexes = [];
|
||||
let indexes = [];
|
||||
let activeKey = '';
|
||||
let json = '';
|
||||
|
||||
function getIndexes() {}
|
||||
async function getIndexes() {
|
||||
const result = await GetIndexes(collection.hostKey, collection.dbKey, collection.key);
|
||||
if (result) {
|
||||
indexes = result;
|
||||
}
|
||||
}
|
||||
|
||||
function openJson(itemId) {
|
||||
const item = indexes?.filter(i => i.name == itemId);
|
||||
json = JSON.stringify(item, undefined, 2);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="buttons">
|
||||
<button class="btn" on:click={getIndexes}>Get indexes</button>
|
||||
<button class="btn danger" disabled={!indexes?.length}>Drop selected</button>
|
||||
<button class="btn">Create…</button>
|
||||
<div class="indexes">
|
||||
<div class="actions">
|
||||
<button class="btn" on:click={getIndexes}>Get indexes</button>
|
||||
<button class="btn danger" disabled={!indexes?.length || !activeKey}>Drop selected</button>
|
||||
<button class="btn">Create…</button>
|
||||
</div>
|
||||
|
||||
<ObjectGrid key="name" data={indexes} bind:activeKey on:trigger={e => openJson(e.detail)} />
|
||||
</div>
|
||||
|
||||
<CodeViewer bind:code={json} language="json" />
|
||||
|
||||
<style>
|
||||
.indexes {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
grid-template: auto 1fr / 1fr;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user