Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/improve layout #41

Merged
merged 4 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ onMounted(() => {
<template>
<Navbar />

<div id="content">
<div id="content" class="pb-5">
<RouterView />
</div>

Expand Down
16 changes: 11 additions & 5 deletions src/components/Pane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ const emits = defineEmits(["update:value"]);

<template>
<!-- Tabbed Navigation -->
<div class="shadow-sm p-4">
<div>
<ul class="nav nav-pills py-3">
<Panetab @click="$emit('update:value', item.id)" :tab="item" :active="activeItem == item.id" v-for="item in items" :key="item.id" />
<Panetab
@click="$emit('update:value', item.id)"
:tab="item"
:active="activeItem == item.id"
v-for="item in items"
:key="item.id"
/>
</ul>
<div class="tab-content">
<slot></slot>
</div>
</div>
<div class="tab-content mx-3">
<slot></slot>
</div>
</template>
57 changes: 26 additions & 31 deletions src/views/BrowseView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ function filter(offset = 0) {
.catch((err) => searchState.value.setError(err));
}


const ordering: Ref<SortOption[]> = ref([{ field: "id", ord: "asc" }]);

const positionInResults: Ref<PositionInResult> = computed(() =>
Expand All @@ -119,38 +118,34 @@ onMounted(filter);
<div class="row">
<h2>Browse BakRep Genomes</h2>
</div>
<div class="row">
<div class="col">
<div class="rounded bg-body-secondary p-4 mb-4">
<QueryFilter label="GC" v-model="gcTuple" />
<QueryFilter label="Contigs" v-model="contigTuple" />
<QueryFilter label="Genome Size" v-model="sizeTuple" />
<QueryFilter label="Completeness" v-model="qualityTuple" />
<QueryFilter label="Contamination" v-model="contaminationTuple" />
<button class="btn btn-light w-100" @click="filter()">
Apply Filter
</button>
</div>
<div class="row">
<div class="col">
<div class="rounded bg-body-secondary p-4 mb-4">
<QueryFilter label="GC" v-model="gcTuple" />
<QueryFilter label="Contigs" v-model="contigTuple" />
<QueryFilter label="Genome Size" v-model="sizeTuple" />
<QueryFilter label="Completeness" v-model="qualityTuple" />
<QueryFilter label="Contamination" v-model="contaminationTuple" />
<button class="btn btn-light w-100" @click="filter()">
Apply Filter
</button>
</div>
</div>
<Loading :state="searchState">
<div class="row py-3 my-5">
Showing results {{ positionInResults.firstElement }}-{{
positionInResults.lastElement
}}
of {{ pagination.total }} results
<ResultTable
:ordering="ordering"
:entries="entries"
@update:ordering="updateOrdering"
/>
<Pagination
class="mt-3"
:value="pagination"
@update:offset="filter"
/>
</div>
</Loading>
</div>
<Loading :state="searchState">
<div class="row px-3">
Showing results {{ positionInResults.firstElement }}-{{
positionInResults.lastElement
}}
of {{ pagination.total }} results
<ResultTable
:ordering="ordering"
:entries="entries"
@update:ordering="updateOrdering"
/>
<Pagination class="mt-3" :value="pagination" @update:offset="filter" />
</div>
</Loading>
</main>
</template>
<style></style>
206 changes: 101 additions & 105 deletions src/views/search/ResultTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ function contamination(entry: BakrepSearchResultEntry): string {
return entry.checkm2.quality.contamination + "";
}

let drag = false;

function passOrdering(sortkey: string, newdirection: SortDirection | null) {
emit("update:ordering", sortkey, newdirection);
}
Expand All @@ -63,111 +61,109 @@ const showFeatures = computed(() =>
</script>

<template>
<div class="rounded bg-light shadow-sm">
<table class="mt-3 table table-hover">
<thead>
<table class="mt-3 table table-hover table-striped">
<thead>
<tr>
<th scope="col">
Id
<SortSymbol
:ordering="ordering"
sortkey="id"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
GC
<SortSymbol
:ordering="ordering"
sortkey="bakta.stats.gc"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Contigs
<SortSymbol
:ordering="ordering"
sortkey="bakta.stats.no_sequences"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Genome Size
<SortSymbol
:ordering="ordering"
sortkey="bakta.stats.size"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Species
<SortSymbol
:ordering="ordering"
sortkey="gtdbtk.classification.species.keyword"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
ST Type
<SortSymbol
:ordering="ordering"
sortkey="mlst.sequence_type.keyword"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Completeness
<SortSymbol
:ordering="ordering"
sortkey="checkm2.quality.completeness"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Contamination
<SortSymbol
:ordering="ordering"
sortkey="checkm2.quality.contamination"
@update:ordering="passOrdering"
/>
</th>
<th v-if="showFeatures">Features</th>
</tr>
</thead>
<tbody>
<template v-for="entry in entries" :key="entry.id">
<tr>
<th scope="col">
Id
<SortSymbol
:ordering="ordering"
sortkey="id"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
GC
<SortSymbol
:ordering="ordering"
sortkey="bakta.stats.gc"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Contigs
<SortSymbol
:ordering="ordering"
sortkey="bakta.stats.no_sequences"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Genome Size
<SortSymbol
:ordering="ordering"
sortkey="bakta.stats.size"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Species
<SortSymbol
:ordering="ordering"
sortkey="gtdbtk.classification.species.keyword"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
ST Type
<SortSymbol
:ordering="ordering"
sortkey="mlst.sequence_type.keyword"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Completeness
<SortSymbol
:ordering="ordering"
sortkey="checkm2.quality.completeness"
@update:ordering="passOrdering"
/>
</th>
<th scope="col">
Contamination
<SortSymbol
:ordering="ordering"
sortkey="checkm2.quality.contamination"
@update:ordering="passOrdering"
/>
</th>
<th v-if="showFeatures">Features</th>
<td scope="row">
<router-link
:to="{
name: 'result',
params: { id: entry.id, title: entry.id },
}"
>
{{ entry.id }}
</router-link>
</td>
<td>{{ gc(entry) }}</td>
<td>{{ contigs(entry) }}</td>
<td>
{{ genomeSize(entry) }}
</td>
<td>{{ species(entry) }}</td>
<td class="text-nowrap">{{ sequenceType(entry) }}</td>
<td>{{ completeness(entry) }} %</td>
<td>{{ contamination(entry) }} %</td>
<td v-if="showFeatures">
<ul class="nostyle" v-if="entry.bakta && entry.bakta.features">
<li v-for="(f, idx) of entry.bakta.features" :key="idx">
{{ f.gene }} - {{ f.product }}
</li>
</ul>
</td>
</tr>
</thead>
<tbody>
<template v-for="entry in entries" :key="entry.id">
<tr>
<td scope="row">
<router-link
:to="{
name: 'result',
params: { id: entry.id, title: entry.id },
}"
>
{{ entry.id }}
</router-link>
</td>
<td>{{ gc(entry) }}</td>
<td>{{ contigs(entry) }}</td>
<td>
{{ genomeSize(entry) }}
</td>
<td>{{ species(entry) }}</td>
<td class="text-nowrap">{{ sequenceType(entry) }}</td>
<td>{{ completeness(entry) }} %</td>
<td>{{ contamination(entry) }} %</td>
<td v-if="showFeatures">
<ul class="nostyle" v-if="entry.bakta && entry.bakta.features">
<li v-for="(f, idx) of entry.bakta.features" :key="idx">
{{ f.gene }} - {{ f.product }}
</li>
</ul>
</td>
</tr>
</template>
</tbody>
</table>
</div>
</template>
</tbody>
</table>
</template>

<style>
Expand Down
27 changes: 11 additions & 16 deletions src/views/search/SearchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,20 @@ onMounted(init);
<template>
<main class="container pt-5">
<Loading :state="pageState">
<div class="row">
<div class="col">
<QueryBuilder v-model:query="query" :rules="rules" @submit="search" />
<QueryBuilder v-model:query="query" :rules="rules" @submit="search" />

<div class="d-flex mt-2 justify-content-end">
<button
@click="search(0)"
class="btn btn-secondary"
type="button"
id="button-search"
>
Search
</button>
</div>
</div>
<div class="d-flex mt-2 mb-5 justify-content-end">
<button
@click="search(0)"
class="btn btn-secondary"
type="button"
id="button-search"
>
Search
</button>
</div>

<Loading :state="searchState">
<div class="row py-3 my-5">
<div class="row px-3">
Showing search results {{ positionInResults.firstElement }}-{{
positionInResults.lastElement
}}
Expand Down