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

Gs fix filters #121

Merged
merged 2 commits into from
Jun 24, 2024
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
4 changes: 4 additions & 0 deletions Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ COPY . ./
# Log the contents of the working directory
RUN echo "Contents of /app after copying frontend files:" && ls -la /app

# Set environment variable via build argument
ARG VITE_APP_API_URL
ENV VITE_APP_API_URL=$VITE_APP_API_URL

# Build the application using the specified config
RUN npx vite build

Expand Down
19 changes: 13 additions & 6 deletions src/components/TableViewPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<i class="fas fa-sliders-h"></i> Filters
</button>
<div class="filter-panel"
:class="{'d-none': !isFilterPaneOpen, 'd-block': isFilterPaneOpen, 'col-12': true, 'col-md-6': true, 'col-lg-4': true}">
:class="{ 'd-none': !isFilterPaneOpen, 'd-block': isFilterPaneOpen, 'col-12': true, 'col-md-6': true, 'col-lg-4': true }">
<FilterComponent />
</div>
<div class="container mt-4">
Expand All @@ -20,16 +20,19 @@
<table class="table table-hover table-sm">
<thead class="table-light">
<tr>
<th scope="col" v-for="header in tableHeaders" :key="header.value" @click="toggleSort(header.value)">
<th scope="col" v-for="header in tableHeaders" :key="header.value"
@click="toggleSort(header.value)">
{{ header.text }}
<span v-if="sortBy === header.value">
<i class="fas" :class="{'fa-sort-up': sortOrder === 'asc', 'fa-sort-down': sortOrder === 'desc'}"></i>
<i class="fas"
:class="{ 'fa-sort-up': sortOrder === 'asc', 'fa-sort-down': sortOrder === 'desc' }"></i>
</span>
</th>
</tr>
</thead>
<tbody>
<tr v-for="observation in table_observations" :key="observation.id" @click="openObservationDetails(observation)">
<tr v-for="observation in table_observations" :key="observation.id"
@click="openObservationDetails(observation)">
<td>{{ observation.id }}</td>
<td>{{ observation.municipality_name }}</td>
<td>{{ formatDate(observation.created_datetime) }}</td>
Expand All @@ -41,7 +44,8 @@
</table>
</div>
<div v-if="totalObservations > 0" class="d-flex justify-content-start mt-3">
<button class="btn btn-outline-success mr-2" @click="fetchPage('prev')" :disabled="!previousPage">
<button class="btn btn-outline-success mr-2" @click="fetchPage('prev')"
:disabled="!previousPage">
<i class="fas fa-chevron-left"></i> Previous
</button>
<button class="btn btn-outline-success" @click="fetchPage('next')" :disabled="!nextPage">
Expand All @@ -64,7 +68,7 @@

<script>
import { useVespaStore } from '@/stores/vespaStore';
import { computed, ref, watch } from 'vue';
import { computed, ref, watch, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import FilterComponent from './FilterComponent.vue';
import NavbarComponent from './NavbarComponent.vue';
Expand Down Expand Up @@ -162,6 +166,9 @@ export default {
vespaStore.getObservations();
}, { deep: true });

onMounted(() => {
vespaStore.getObservations();
});

return {
table_observations,
Expand Down
Loading